#!/usr/bin/perl
use strict;
$ENV{DOCUMENT_ROOT}.='/' if $ENV{DOCUMENT_ROOT};
use Time::Local 'timelocal';
my $html;
my $linea;
my $check;
require $ENV{DOCUMENT_ROOT}.'_adm/incs/clBase.pm';
require $ENV{DOCUMENT_ROOT}.'_adm/incs/Destacados.pm';
require $ENV{DOCUMENT_ROOT}.'_adm/incs/Generales.pm';
my $ref=Generales::Entrada();
my %para=%$ref;
my $idTapa_sec;
my $nombreTapa_sec;
my @Notas;
my $hoy = time;
my $oEvento;
my $Puntero;
my $oBase = clBase->new();
######################################################################
my @Row ;
my $mesPasado;
my $mesSguiente;
if (!$para{dia}) {
$mesPasado=(timelocal 0,0,0,1,((localtime($hoy))[4]),(localtime($hoy))[5] + 1900);
my $cantDiasMes=&Generales::DiasMes((localtime($hoy))[4]);
$mesSguiente=(timelocal 0,0,0,1,((localtime($hoy))[4]),(localtime($hoy))[5] + 1900)+60*60*24*$cantDiasMes;
}else{
$mesPasado=(timelocal 0,0,0,$para{dia},((localtime($hoy))[4]),(localtime($hoy))[5] + 1900);
$mesSguiente=$mesPasado+24*60*60;
}
open (ARCHI, $ENV{DOCUMENT_ROOT}.'calendario/tpl/calendario.htm')||print $!."- calendario.pl
\n";
while ($linea = ){
$html .= $linea;
}
close ARCHI;
$html =Generales::sacaLineas($html);
my @Actividades = $oBase->Seleccionar(qq~SELECT tnota.idNota from
((((tnota INNER JOIN tnotahorario on tnotahorario.idNota = tnota.idNota)
INNER JOIN thorario on thorario.idHorario = tnotahorario.idHorario)
LEFT JOIN tnotasala on tnotasala.idNota = tnota.idNota)
LEFT JOIN tsala on tsala.idSala = tnotasala.idSala)
WHERE thorario.cFechaOut>$mesPasado AND thorario.cFechaIn<$mesSguiente
AND tnota.isPub=2
GROUP BY tnota.idNota
ORDER BY thorario.cFechaIn ASC, tsala.cOrden ASC
~);
my @TipoEvento;
foreach $Puntero (@Actividades){
my $nota=$$Puntero[0];
my $tipo;
($html, $tipo) = Destacados::New($html, $nota);
$TipoEvento[$tipo]=1;
}
$html=~ s/.*//gi if !$TipoEvento[2];
$html=~ s/.*//gi if !$TipoEvento[2];
$html=~ s/.*//gi if !$TipoEvento[3];
$html=~ s/.*//gi if !$TipoEvento[1];
$html=~ s/.*//gi if !$TipoEvento[1];
$html=~ s/.*//;
$html=~ s/.*//;
$html=~ s/.*//;
########################## IMPRIMISION ############################################
$html =Generales::procesarDinamico($html);
$html =Generales::poneLineas($html);
Generales::imprimir($html);
#############################################################################################