| 1 | <?php | 
|---|
| 2 | /*============================================================================ | 
|---|
| 3 |         Esta clase genera tablas HTML para selección de fechas (Versión inglesa) | 
|---|
| 4 |          | 
|---|
| 5 |         Atributos de la clase: | 
|---|
| 6 |  | 
|---|
| 7 |                 clase: Clase [CSS] de la tabla HTML que se generará. | 
|---|
| 8 |                 onmouseover: Función Javascript que se ejuctará al generarse el evento | 
|---|
| 9 |                 onmouseout: Función Javascript que se ejuctará al generarse el evento | 
|---|
| 10 |                 onclick: Función Javascript que se ejuctará al hacer click sobre el objeto | 
|---|
| 11 |  | 
|---|
| 12 | ============================================================================*/ | 
|---|
| 13 | class Almanaque{ | 
|---|
| 14 |  | 
|---|
| 15 |         var $clase ; | 
|---|
| 16 |         var $onmouseover; | 
|---|
| 17 |         var $onmouseout; | 
|---|
| 18 |         var $onclick; | 
|---|
| 19 |  | 
|---|
| 20 |         var $desplazamiento_dias=6; // Ajuste fino dependiendo del año de comienzo del algoritmo | 
|---|
| 21 |         var $nombre_mes=array(); | 
|---|
| 22 |         var $nombre_dia=array(); | 
|---|
| 23 |         var $dias_meses=array(); | 
|---|
| 24 |         var $semanas=array(); | 
|---|
| 25 |         var $numero_annos=array(); | 
|---|
| 26 |         var $numero_dias=array(); | 
|---|
| 27 |         var $numero_horas=array(); | 
|---|
| 28 |  | 
|---|
| 29 |     function __construct($pclase="", $ponmouseover="sobre(this)", $ponmouseout="fuera(this)", $ponclick="clic(this)"){ //Constructor | 
|---|
| 30 |                 $this->clase=$pclase; | 
|---|
| 31 |                 $this->onmouseover=$ponmouseover; | 
|---|
| 32 |                 $this->onmouseout=$ponmouseout; | 
|---|
| 33 |                 $this->onclick=$ponclick; | 
|---|
| 34 |                  | 
|---|
| 35 |                 $this->nombre_mes[1]=array ("Enero",0x0001);  | 
|---|
| 36 |                 $this->nombre_mes[2]=array ("Febrero",0x0002); | 
|---|
| 37 |                 $this->nombre_mes[3]=array ("Marzo",0x0004); | 
|---|
| 38 |                 $this->nombre_mes[4]=array ("Abril",0x0008); | 
|---|
| 39 |                 $this->nombre_mes[5]=array ("Mayo",0x0010); | 
|---|
| 40 |                 $this->nombre_mes[6]=array ("Junio",0x0020); | 
|---|
| 41 |                 $this->nombre_mes[7]=array ("Julio",0x0040); | 
|---|
| 42 |                 $this->nombre_mes[8]=array ("Agosto",0x0080); | 
|---|
| 43 |                 $this->nombre_mes[9]=array ("Septiembre",0x0100); | 
|---|
| 44 |                 $this->nombre_mes[10]=array ("Octubre",0x0200); | 
|---|
| 45 |                 $this->nombre_mes[11]=array ("Noviembre",0x0400); | 
|---|
| 46 |                 $this->nombre_mes[12]=array ("Diciembre",0x0800); | 
|---|
| 47 |  | 
|---|
| 48 |                 $this->nombre_dia[1]=array ("L",0x01); // tamaño 1 bytes | 
|---|
| 49 |                 $this->nombre_dia[2]=array ("M",0x02);  | 
|---|
| 50 |                 $this->nombre_dia[3]=array ("X",0x04);  | 
|---|
| 51 |                 $this->nombre_dia[4]=array ("J",0x08);  | 
|---|
| 52 |                 $this->nombre_dia[5]=array ("V",0x10);  | 
|---|
| 53 |                 $this->nombre_dia[6]=array ("S",0x20);  | 
|---|
| 54 |                 $this->nombre_dia[7]=array ("D",0x40);  | 
|---|
| 55 |  | 
|---|
| 56 |          | 
|---|
| 57 |                 $this->dias_meses[1]=31; | 
|---|
| 58 |                 $this->dias_meses[2]=28; | 
|---|
| 59 |                 $this->dias_meses[3]=31; | 
|---|
| 60 |                 $this->dias_meses[4]=30; | 
|---|
| 61 |                 $this->dias_meses[5]=31; | 
|---|
| 62 |                 $this->dias_meses[6]=30; | 
|---|
| 63 |                 $this->dias_meses[7]=31; | 
|---|
| 64 |                 $this->dias_meses[8]=31; | 
|---|
| 65 |                 $this->dias_meses[9]=30; | 
|---|
| 66 |                 $this->dias_meses[10]=31; | 
|---|
| 67 |                 $this->dias_meses[11]=30; | 
|---|
| 68 |                 $this->dias_meses[12]=31; | 
|---|
| 69 |  | 
|---|
| 70 |                 $this->semanas[1]=array ("1ª",0x01); // tamaño 1 bytes | 
|---|
| 71 |                 $this->semanas[2]=array ("2ª",0x02); | 
|---|
| 72 |                 $this->semanas[3]=array ("3ª",0x04); | 
|---|
| 73 |                 $this->semanas[4]=array ("4ª",0x08); | 
|---|
| 74 |                 $this->semanas[5]=array ("5ª",0x10); | 
|---|
| 75 |                 $this->semanas[6]=array ("Última",0x20); | 
|---|
| 76 |  | 
|---|
| 77 |                 $this->numero_annos[2010]=0x0001; // tamaño 2 bytes | 
|---|
| 78 |                 $this->numero_annos[2011]=0x0002; | 
|---|
| 79 |                 $this->numero_annos[2012]=0x0004; | 
|---|
| 80 |                 $this->numero_annos[2013]=0x0008; | 
|---|
| 81 |                 $this->numero_annos[2014]=0x0010; | 
|---|
| 82 |                 $this->numero_annos[2015]=0x0020; | 
|---|
| 83 |                 $this->numero_annos[2016]=0x0040; | 
|---|
| 84 |                 $this->numero_annos[2017]=0x0080; | 
|---|
| 85 |                 $this->numero_annos[2018]=0x0100; | 
|---|
| 86 |                 $this->numero_annos[2019]=0x0200; | 
|---|
| 87 |                 $this->numero_annos[2020]=0x0400; | 
|---|
| 88 |                 $this->numero_annos[2021]=0x0800; | 
|---|
| 89 |                 $this->numero_annos[2022]=0x1000; | 
|---|
| 90 |                 $this->numero_annos[2023]=0x2000; | 
|---|
| 91 |                 $this->numero_annos[2024]=0x4000; | 
|---|
| 92 |                 $this->numero_annos[2025]=0x8000; | 
|---|
| 93 |  | 
|---|
| 94 |                 $this->numero_dias[1]=0x00000001; // tamaño 4 bytes | 
|---|
| 95 |                 $this->numero_dias[2]=0x00000002;  | 
|---|
| 96 |                 $this->numero_dias[3]=0x00000004;  | 
|---|
| 97 |                 $this->numero_dias[4]=0x00000008;  | 
|---|
| 98 |  | 
|---|
| 99 |                 $this->numero_dias[5]=0x00000010;  | 
|---|
| 100 |                 $this->numero_dias[6]=0x00000020;  | 
|---|
| 101 |                 $this->numero_dias[7]=0x00000040;  | 
|---|
| 102 |                 $this->numero_dias[8]=0x00000080; | 
|---|
| 103 |  | 
|---|
| 104 |                 $this->numero_dias[9]=0x00000100;  | 
|---|
| 105 |                 $this->numero_dias[10]=0x00000200;  | 
|---|
| 106 |                 $this->numero_dias[11]=0x00000400;  | 
|---|
| 107 |                 $this->numero_dias[12]=0x00000800;  | 
|---|
| 108 |  | 
|---|
| 109 |                 $this->numero_dias[13]=0x00001000; | 
|---|
| 110 |                 $this->numero_dias[14]=0x00002000; | 
|---|
| 111 |                 $this->numero_dias[15]=0x00004000; | 
|---|
| 112 |                 $this->numero_dias[16]=0x00008000; | 
|---|
| 113 |  | 
|---|
| 114 |                 $this->numero_dias[17]=0x00010000; | 
|---|
| 115 |                 $this->numero_dias[18]=0x00020000; | 
|---|
| 116 |                 $this->numero_dias[19]=0x00040000; | 
|---|
| 117 |                 $this->numero_dias[20]=0x00080000; | 
|---|
| 118 |  | 
|---|
| 119 |                 $this->numero_dias[21]=0x00100000; | 
|---|
| 120 |                 $this->numero_dias[22]=0x00200000; | 
|---|
| 121 |                 $this->numero_dias[23]=0x00400000; | 
|---|
| 122 |                 $this->numero_dias[24]=0x00800000; | 
|---|
| 123 |          | 
|---|
| 124 |                 $this->numero_dias[25]=0x01000000; | 
|---|
| 125 |                 $this->numero_dias[26]=0x02000000; | 
|---|
| 126 |                 $this->numero_dias[27]=0x04000000; | 
|---|
| 127 |                 $this->numero_dias[28]=0x08000000; | 
|---|
| 128 |  | 
|---|
| 129 |                 $this->numero_dias[29]=0x10000000; | 
|---|
| 130 |                 $this->numero_dias[30]=0x20000000; | 
|---|
| 131 |                 $this->numero_dias[31]=0x40000000; | 
|---|
| 132 |                 $this->numero_dias[32]=0x80000000; | 
|---|
| 133 |  | 
|---|
| 134 |  | 
|---|
| 135 |                 $this->numero_horas[1]=array("0:00",0x0001);  // tamaño 2 bytes | 
|---|
| 136 |                 $this->numero_horas[2]=array("1:00",0x0002);   | 
|---|
| 137 |                 $this->numero_horas[3]=array("2:00",0x0004);   | 
|---|
| 138 |                 $this->numero_horas[4]=array("3:00",0x0008);   | 
|---|
| 139 |                 $this->numero_horas[5]=array("4:00",0x0010);   | 
|---|
| 140 |                 $this->numero_horas[6]=array("5:00",0x0020);   | 
|---|
| 141 |                 $this->numero_horas[7]=array("6:00",0x0040);   | 
|---|
| 142 |                 $this->numero_horas[8]=array("7:00",0x0080);   | 
|---|
| 143 |                 $this->numero_horas[9]=array("8:00",0x0100);   | 
|---|
| 144 |                 $this->numero_horas[10]=array("9:00",0x0200);   | 
|---|
| 145 |                 $this->numero_horas[11]=array("10:00",0x0400);   | 
|---|
| 146 |                 $this->numero_horas[12]=array("11:00",0x0800);   | 
|---|
| 147 |         } | 
|---|
| 148 |          | 
|---|
| 149 |         /* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 
|---|
| 150 |                 Esta función devuelve el número del día de la semana: | 
|---|
| 151 |                         0=domingo 1=Lunes, 2=mártes ... 6=sábado | 
|---|
| 152 |                  | 
|---|
| 153 |                 Parámetro de entrada: | 
|---|
| 154 |                         Una cadena con formato de fecha dd/mm/aaaa. | 
|---|
| 155 |         ________________________________________________________________________________________________________*/ | 
|---|
| 156 |         function _DiaSemana($fecha){ | 
|---|
| 157 |                 list($dia,$mes,$anno)=explode('[/.-]',$fecha); | 
|---|
| 158 |                 $cont=0; | 
|---|
| 159 |                 for ($i=1900;$i<$anno;$i++){ | 
|---|
| 160 |                         if ($this->bisiesto($i)) $dias_anuales=366; else        $dias_anuales=365; | 
|---|
| 161 |                         $cont+=$dias_anuales; | 
|---|
| 162 |                 } | 
|---|
| 163 |                 for ($i=1;$i<$mes;$i++){ | 
|---|
| 164 |                         if ($i!=2) | 
|---|
| 165 |                                 $cont+=$this->dias_meses[$i]; | 
|---|
| 166 |                         else{ | 
|---|
| 167 |                                 if ($this->bisiesto($anno)) | 
|---|
| 168 |                                         $cont+=29; | 
|---|
| 169 |                                 else | 
|---|
| 170 |                                         $cont+=28; | 
|---|
| 171 |                         } | 
|---|
| 172 |                 } | 
|---|
| 173 |                 $cont+=$dia+$this->desplazamiento_dias; | 
|---|
| 174 |                 return($cont%7); | 
|---|
| 175 |         } | 
|---|
| 176 |         /* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 
|---|
| 177 |                 Esta función devuelve true si el año pasado como parámetro es bisiesto y false si no lo es | 
|---|
| 178 |  | 
|---|
| 179 |                 Parámetro de entrada: | 
|---|
| 180 |                         Una número que representa el año | 
|---|
| 181 |         ________________________________________________________________________________________________________*/ | 
|---|
| 182 |         function bisiesto($anob){ | 
|---|
| 183 |                 if ($anob%4==0) return(true); else return(false); | 
|---|
| 184 |         } | 
|---|
| 185 |         /* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 
|---|
| 186 |                 Esta función devuelve una cadena con el código HTML con un rango de años  | 
|---|
| 187 |         ________________________________________________________________________________________________________*/ | 
|---|
| 188 |         function Annos($ano_desde,$ano_hasta){ | 
|---|
| 189 |                 $HTML_calendario='<TABLE id="tabla_annos" class="'.$this->clase.'">'.chr(13); | 
|---|
| 190 |                 $HTML_calendario.='<TR>'.chr(13); | 
|---|
| 191 |                 $HTML_calendario.='<TH style="cursor:pointer" onclick="TH_'.$this->onclick.'">Años</TH></TR>'.chr(13); // Literal años | 
|---|
| 192 |                 for ($i=$ano_desde; $i<=$ano_hasta; $i++){ | 
|---|
| 193 |                         $HTML_calendario.='<TR><TD align="center" id="'.$i.'" | 
|---|
| 194 |                         value="'.$this->numero_annos[$i].'" style="cursor:pointer"  | 
|---|
| 195 |                         onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'"  | 
|---|
| 196 |                         onclick="'.$this->onclick.'">'.$i.'</TD></TR>'.chr(13); | 
|---|
| 197 |                 } | 
|---|
| 198 |                 $HTML_calendario.='</TABLE>'.chr(13); | 
|---|
| 199 |                 return($HTML_calendario); | 
|---|
| 200 |         }        | 
|---|
| 201 |         /* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 
|---|
| 202 |                 Esta función devuelve una cadena con el código HTML del calendario del mes y año elegidos | 
|---|
| 203 |                 y que son propiedades de la clase. | 
|---|
| 204 |         ________________________________________________________________________________________________________*/ | 
|---|
| 205 |         function MesAnno($mes,$anno){ | 
|---|
| 206 |          | 
|---|
| 207 |                 $fecha="1/".$mes."/".$anno; | 
|---|
| 208 |                 $ds=$this->_DiaSemana($fecha); | 
|---|
| 209 |                 if ($ds==0) $ds=7; | 
|---|
| 210 |                  | 
|---|
| 211 |                 $swbi=0; // Suma para bisiesto | 
|---|
| 212 |                 if ($this->bisiesto($anno) && $mes==2)  $swbi=1;  | 
|---|
| 213 |  | 
|---|
| 214 |                 $HTML_calendario='<TABLE id="tabla_mesanno" class="'.$this->clase.'">'.chr(13); | 
|---|
| 215 |                 $HTML_calendario.='<TR>'.chr(13); | 
|---|
| 216 |                 $HTML_calendario.='<TH colspan=7 style="cursor:pointer" onclick="TH_'.$this->onclick.'">'.$this->nombre_mes[$mes][0].'</TH></TR>'.chr(13); // Nombre del mes | 
|---|
| 217 |                 $HTML_calendario.='<TR>'.chr(13); | 
|---|
| 218 |                 for ($i=1;$i<8;$i++) | 
|---|
| 219 |                         $HTML_calendario.='<TH>'.$this->nombre_dia[$i][0].'</TH>'.chr(13); // Días de la semana | 
|---|
| 220 |                 $HTML_calendario.='</TR><TR>'.chr(13); | 
|---|
| 221 |                 for ($i=1;$i<$ds;$i++) | 
|---|
| 222 |                         $HTML_calendario.='<TD></TD>'.chr(13); // Relleno primeros dias de la semana | 
|---|
| 223 |                 $sm=$ds; // Control salto de semana | 
|---|
| 224 |                 for ($i=1;$i<=$this->dias_meses[$mes]+$swbi;$i++){ | 
|---|
| 225 |                         $HTML_calendario.='<TD align="center" id="'.$i.'/'.$mes.'/'.$anno.'" value="'.$this->numero_dias[$i].'" style="cursor:pointer" onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$i.'</TD>'.chr(13); | 
|---|
| 226 |                         if ($sm%7==0){ | 
|---|
| 227 |                                 $HTML_calendario.='</TR><TR>'.chr(13); | 
|---|
| 228 |                                 $sm=0; | 
|---|
| 229 |                         } | 
|---|
| 230 |                         $sm++; | 
|---|
| 231 |                 } | 
|---|
| 232 |                 $HTML_calendario.='</TR></TABLE>'.chr(13); | 
|---|
| 233 |                 return($HTML_calendario); | 
|---|
| 234 |         } | 
|---|
| 235 |         /* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 
|---|
| 236 |                 Esta función devuelve una cadena con el código HTML con los meses del año en dos columnas. | 
|---|
| 237 |         ________________________________________________________________________________________________________*/ | 
|---|
| 238 |         function Meses(){ | 
|---|
| 239 |                 $HTML_calendario='<TABLE id="tabla_meses" class="'.$this->clase.'">'.chr(13); | 
|---|
| 240 |                 $HTML_calendario.='<TR>'.chr(13); | 
|---|
| 241 |                 $HTML_calendario.='<TH colspan=2 style="cursor:pointer" onclick="TH_'.$this->onclick.'">Meses</TH></TR>'.chr(13); // Literal meses | 
|---|
| 242 |                 for ($i=1;$i<13;$i++){ | 
|---|
| 243 |                         $HTML_calendario.='<TR><TD align="center" id="'.$i.'" value="'.$this->nombre_mes[$i][1].'"  | 
|---|
| 244 |                         style="cursor:pointer" onmouseover="'.$this->onmouseover.'"  | 
|---|
| 245 |                         onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'"> | 
|---|
| 246 |                          '.$this->nombre_mes[$i++][0].' </TD>'.chr(13); | 
|---|
| 247 |                         $HTML_calendario.='<TD align="center" id="'.$i.'" value="'.$this->nombre_mes[$i][1].'"  | 
|---|
| 248 |                         style="cursor:pointer" onmouseover="'.$this->onmouseover.'"  | 
|---|
| 249 |                         onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'"> | 
|---|
| 250 |                          '.$this->nombre_mes[$i][0].' </TD></TR>'.chr(13); | 
|---|
| 251 |                 } | 
|---|
| 252 |                 $HTML_calendario.='</TABLE>'.chr(13); | 
|---|
| 253 |                 return($HTML_calendario); | 
|---|
| 254 |         } | 
|---|
| 255 |         /* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 
|---|
| 256 |                 Esta función devuelve una cadena con el código HTML con los días de la semana en una fila. | 
|---|
| 257 |         ________________________________________________________________________________________________________*/ | 
|---|
| 258 |         function Dias(){ | 
|---|
| 259 |                 $HTML_calendario='<TABLE id="tabla_dias" class="'.$this->clase.'">'.chr(13); | 
|---|
| 260 |                 $HTML_calendario.='<TR>'.chr(13); | 
|---|
| 261 |                 $HTML_calendario.='<TH  colspan=7 style="cursor:pointer" onclick="TH_'.$this->onclick.'">Día</TH><TR>'.chr(13); // Literal Días | 
|---|
| 262 |                 for ($i=1;$i<8;$i++){ | 
|---|
| 263 |                         $HTML_calendario.='<TD align="center" id="'.$i.'" value="'.$this->nombre_dia[$i][1].'"  | 
|---|
| 264 |                         style="cursor:pointer" onmouseover="'.$this->onmouseover.'" | 
|---|
| 265 |                         onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$this->nombre_dia[$i][0].'</TD>'.chr(13); | 
|---|
| 266 |                 } | 
|---|
| 267 |                 $HTML_calendario.='</TR></TABLE>'.chr(13); | 
|---|
| 268 |                 return($HTML_calendario); | 
|---|
| 269 |         }                | 
|---|
| 270 |         /* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 
|---|
| 271 |                 Esta función devuelve una cadena con el código HTML con el orden de las semana en una fila. | 
|---|
| 272 |         ________________________________________________________________________________________________________*/ | 
|---|
| 273 |         function Semanas(){ | 
|---|
| 274 |                 $HTML_calendario='<TABLE id="tabla_semanas" class="'.$this->clase.'">'.chr(13); | 
|---|
| 275 |                 $HTML_calendario.='<TR>'.chr(13); | 
|---|
| 276 |                 $HTML_calendario.='<TH  colspan=7 style="cursor:pointer" onclick="TH_'.$this->onclick.'">Semana</TH><TR>'.chr(13); // Literal Semenas | 
|---|
| 277 |                 for ($i=1;$i<7;$i++){ | 
|---|
| 278 |                         $HTML_calendario.='<TD align="center" id="'.$i.'" value="'.$this->semanas[$i][1].'"  | 
|---|
| 279 |                         style="cursor:pointer" onmouseover="'.$this->onmouseover.'"  | 
|---|
| 280 |                         onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$this->semanas[$i][0].' </TD>'.chr(13); | 
|---|
| 281 |                 } | 
|---|
| 282 |                 $HTML_calendario.='</TR></TABLE>'.chr(13); | 
|---|
| 283 |                 return($HTML_calendario); | 
|---|
| 284 |         }        | 
|---|
| 285 |         /* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 
|---|
| 286 |                 Esta función devuelve una cadena con el código HTML con los 31 días de un mes en 3 filas | 
|---|
| 287 |         ________________________________________________________________________________________________________*/ | 
|---|
| 288 |         function DiasMes(){ | 
|---|
| 289 |                 $HTML_calendario='<TABLE id="tabla_diasmes" class="'.$this->clase.'">'.chr(13); | 
|---|
| 290 |                 $HTML_calendario.='<TR>'.chr(13); | 
|---|
| 291 |                 $HTML_calendario.='<TH colspan=8 style="cursor:pointer" onclick="TH_'.$this->onclick.'">Día de mes</TH><TR>'.chr(13); // Literal Día | 
|---|
| 292 |                 $HTML_calendario.='<TR>'.chr(13); | 
|---|
| 293 |                 $sd=1; // Control salto de fila | 
|---|
| 294 |                 for ($i=1;$i<32;$i++){ | 
|---|
| 295 |                                 $HTML_calendario.='<TD align="center" id="'.$i.'" value="'.$this->numero_dias[$i].'"  | 
|---|
| 296 |                                 style="cursor:pointer" onmouseover="'.$this->onmouseover.'"  | 
|---|
| 297 |                                 onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$i.'</TD>'.chr(13); | 
|---|
| 298 |                                 if ($sd%8==0){ | 
|---|
| 299 |                                         $HTML_calendario.='</TR><TR>'.chr(13); | 
|---|
| 300 |                                         $sd=0; | 
|---|
| 301 |                                 } | 
|---|
| 302 |                                 $sd++; | 
|---|
| 303 |                 } | 
|---|
| 304 |                 $HTML_calendario.='</TR></TABLE>'.chr(13); | 
|---|
| 305 |                 return($HTML_calendario); | 
|---|
| 306 |         } | 
|---|
| 307 |         /* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 
|---|
| 308 |                 Esta función devuelve una cadena con el código HTML con las horas de apertura de las aulas | 
|---|
| 309 |         ________________________________________________________________________________________________________*/ | 
|---|
| 310 |         function Horas(){ | 
|---|
| 311 |  | 
|---|
| 312 |                 $HTML_calendario='<TABLE  id="tabla_horas" class="'.$this->clase.'">'.chr(13); | 
|---|
| 313 |                 $HTML_calendario.='<TR>'.chr(13); | 
|---|
| 314 |                 $HTML_calendario.='<TH colspan=12 style="cursor:pointer" onclick="TH_'.$this->onclick.'">Hora ejecución de la acción </TH>'; | 
|---|
| 315 |                 $HTML_calendario.='<TH>Mod</TH>'; | 
|---|
| 316 |                 $HTML_calendario.='<TH>Min.</TH>'; | 
|---|
| 317 |                 //$HTML_calendario.='<TH>Seg.</TH></TR>'; | 
|---|
| 318 |                 $HTML_calendario.='<TR>'.chr(13); | 
|---|
| 319 |                 for ($i=1;$i<13;$i++) | 
|---|
| 320 |                         $HTML_calendario.='<TD align=center id="'.$this->numero_horas[$i][0].'"  value="'.$this->numero_horas[$i][1].'" style="cursor:pointer" onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$this->numero_horas[$i][0].'</TD>'.chr(13); | 
|---|
| 321 |  | 
|---|
| 322 |                 $HTML_calendario.='<TD align=center>'; | 
|---|
| 323 |                 $HTML_calendario.= '<SELECT class="estilodesple" id="ampm">'.chr(13); | 
|---|
| 324 |                 $HTML_calendario.= '<OPTION  value=0>A.M.</OPTION>'.chr(13); | 
|---|
| 325 |                 $HTML_calendario.= '<OPTION selected value=1 >P.M.</OPTION>'.chr(13); | 
|---|
| 326 |                 $HTML_calendario.='</SELECT>'.chr(13); | 
|---|
| 327 |                 $HTML_calendario.='</TD>        '.chr(13); | 
|---|
| 328 |  | 
|---|
| 329 |                 $HTML_calendario.='<TD align=center>'; | 
|---|
| 330 |                 $HTML_calendario.='<INPUT   type=text class=cajatexto id=minutos size=1>'.chr(13); | 
|---|
| 331 |                 $HTML_calendario.='</TD>        '.chr(13); | 
|---|
| 332 |  | 
|---|
| 333 |                 $HTML_calendario.='</TR>'.chr(13); | 
|---|
| 334 |                 $HTML_calendario.='</TABLE>'.chr(13); | 
|---|
| 335 |  | 
|---|
| 336 |                 return($HTML_calendario); | 
|---|
| 337 |         } | 
|---|
| 338 | /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 
|---|
| 339 |                 Esta función devuelve una cadena con el código HTML con las horas hasta de reserva de las aulas | 
|---|
| 340 | ________________________________________________________________________________________________________*/ | 
|---|
| 341 |         function HorasReserva($literal,$nombretabla,$nombreampm,$nombreminuto){ | 
|---|
| 342 |                 if($literal=="1")  | 
|---|
| 343 |                         $literal="Comienzo de la reserva"; | 
|---|
| 344 |                 else | 
|---|
| 345 |                         $literal="Fin de la reserva"; | 
|---|
| 346 |                  | 
|---|
| 347 |                 $HTML_calendario='<TABLE  id="'.$nombretabla.'" class="'.$this->clase.'">'.chr(13); | 
|---|
| 348 |                 $HTML_calendario.='<TR>'.chr(13); | 
|---|
| 349 |                 $HTML_calendario.='<TH colspan=12 style="cursor:pointer" onclick="TH_'.$this->onclick.'">'.$literal.' </TH>'; | 
|---|
| 350 |                 $HTML_calendario.='<TH>Mod</TH>'; | 
|---|
| 351 |                 $HTML_calendario.='<TH>Min.</TH>'; | 
|---|
| 352 |                 $HTML_calendario.='<TR>'.chr(13); | 
|---|
| 353 |                 for ($i=1;$i<13;$i++) | 
|---|
| 354 |                         $HTML_calendario.='<TD align=center id="'.$this->numero_horas[$i][0].'"  value="'.$this->numero_horas[$i][1].'" style="cursor:pointer" onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$this->numero_horas[$i][0].'</TD>'.chr(13); | 
|---|
| 355 |  | 
|---|
| 356 |                 $HTML_calendario.='<TD align=center>'; | 
|---|
| 357 |                 $HTML_calendario.= '<SELECT class="estilodesple" id="'.$nombreampm.'">'.chr(13); | 
|---|
| 358 |                 $HTML_calendario.= '<OPTION value=0>A.M.</OPTION>'.chr(13); | 
|---|
| 359 |                 $HTML_calendario.= '<OPTION selected value=1  >P.M.</OPTION>'.chr(13); | 
|---|
| 360 |                 $HTML_calendario.='</SELECT>'.chr(13); | 
|---|
| 361 |                 $HTML_calendario.='</TD>        '.chr(13); | 
|---|
| 362 |  | 
|---|
| 363 |                 $HTML_calendario.='<TD align=center>'; | 
|---|
| 364 |                 $HTML_calendario.='<INPUT   type=text class=cajatexto id="'.$nombreminuto.'" size=1>'.chr(13); | 
|---|
| 365 |                 $HTML_calendario.='</TD>        '.chr(13); | 
|---|
| 366 |  | 
|---|
| 367 |                 $HTML_calendario.='</TR>'.chr(13); | 
|---|
| 368 |                 $HTML_calendario.='</TABLE>'.chr(13); | 
|---|
| 369 |  | 
|---|
| 370 |                 return($HTML_calendario); | 
|---|
| 371 |         } | 
|---|
| 372 |         /* ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 
|---|
| 373 |                 Esta función devuelve una cadena con el código HTML con las horas de apertura de las aulas | 
|---|
| 374 |         ________________________________________________________________________________________________________*/ | 
|---|
| 375 |         function Horas_Completas(){ | 
|---|
| 376 |                 $maxcolumnas=16; | 
|---|
| 377 |  | 
|---|
| 378 |                 $HTML_calendario='<TABLE id="tabla_horas" class="'.$this->clase.'">'.chr(13); | 
|---|
| 379 |                 $HTML_calendario.='<TR>'.chr(13); | 
|---|
| 380 |                 $HTML_calendario.='<TH colspan='.$maxcolumnas.'>Horas</TH><TR>'.chr(13); // Literal Horas | 
|---|
| 381 |                 $HTML_calendario.='<TR>'.chr(13); | 
|---|
| 382 |                 $currenthora=0; | 
|---|
| 383 |                 $currentminutos=0; | 
|---|
| 384 |                 $currenthorario=$currenthora.":".$currentminutos; | 
|---|
| 385 |                 for ($i=1;$i<97;$i++){ | 
|---|
| 386 |                         if($currentminutos==0) $currenthorario.="0"; | 
|---|
| 387 |  | 
|---|
| 388 |                         $HTML_calendario.='<TD align=center id="'.$currenthorario.'"  style="cursor:pointer" onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$currenthorario.'</TD>'.chr(13); | 
|---|
| 389 |                         $currentminutos+=15; | 
|---|
| 390 |                         if($currentminutos==60) { | 
|---|
| 391 |                                 $currenthora++; | 
|---|
| 392 |                                 if($currenthora==24)    $currenthora=0; | 
|---|
| 393 |                                 $currentminutos=0; | 
|---|
| 394 |                         } | 
|---|
| 395 |                         $currenthorario=$currenthora.":".$currentminutos; | 
|---|
| 396 |                         if ($i%$maxcolumnas==0) $HTML_calendario.='</TR><TR>'.chr(13); | 
|---|
| 397 |                 } | 
|---|
| 398 |         $HTML_calendario.='</TR></TABLE>'.chr(13); | 
|---|
| 399 |         return($HTML_calendario); | 
|---|
| 400 |         } | 
|---|
| 401 | } // Fin de la clase Almanaque | 
|---|