#!/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/Generales.pm';
require $ENV{DOCUMENT_ROOT}.'_adm/incs/Destacados.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 $cantDiasMesActual=&Generales::DiasMes((localtime($hoy))[4]);
my $cantDiasMesSiguiente=&Generales::DiasMes((localtime($hoy))[4]+1);
my $mesPasado=(timelocal 0,0,0,1,((localtime($hoy))[4]),(localtime($hoy))[5] + 1900)+60*60*24*$cantDiasMesActual;
my $mesSguiente=(timelocal 0,0,0,1,((localtime($hoy))[4]),(localtime($hoy))[5] + 1900)+60*60*24*$cantDiasMesActual+$cantDiasMesSiguiente*60*60*24;
open (ARCHI, $ENV{DOCUMENT_ROOT}.'calendario/tpl/publicaciones.htm')||print $!."- publicaciones.pl
\n";
while ($linea = ){
$html .= $linea;
}
close ARCHI;
$html =Generales::sacaLineas($html);
my $unasemana=$hoy+60*60*24*7;
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 $contador=0;
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[1];
$html=~ s/.*//;
$html=~ s/.*//;
########################## IMPRIMISION ############################################
$html =Generales::procesarDinamico($html,1);
$html =Generales::poneLineas($html);
Generales::imprimir($html);
#############################################################################################