source: admin/WebConsole/idiomas/php/eng/clases/Almanaque_eng.php @ 7dc04cc1

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since 7dc04cc1 was beebc19, checked in by Irina Gomez <irinagomez@…>, 7 years ago

#842 Consola: se revisan todos los ficheros de idioma en inglés.

  • Property mode set to 100644
File size: 18.5 KB
Line 
1<?php
2/*============================================================================
3        This class generates HTML tables for selecting dates (English version)
4
5        Class attributes:
6
7                class: Class [CSS] of HTML table that will be generated.
8                onmouseover: The Javascript function that will be run when generating the event.
9                onmouseout: Javascript function that will be run when generating the event.
10                onclick: Javascript function that will be run when clicking over the object.
11
12============================================================================*/
13class Almanaque{
14
15        var $clase ;
16        var $onmouseover;
17        var $onmouseout;
18        var $onclick;
19
20        var $desplazamiento_dias=6; // Fine tunning depending on the algorithm start year
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 ("January",0x0001);
36                $this->nombre_mes[2]=array ("February",0x0002);
37                $this->nombre_mes[3]=array ("March",0x0004);
38                $this->nombre_mes[4]=array ("April",0x0008);
39                $this->nombre_mes[5]=array ("May",0x0010);
40                $this->nombre_mes[6]=array ("June",0x0020);
41                $this->nombre_mes[7]=array ("July",0x0040);
42                $this->nombre_mes[8]=array ("August",0x0080);
43                $this->nombre_mes[9]=array ("September",0x0100);
44                $this->nombre_mes[10]=array ("October",0x0200);
45                $this->nombre_mes[11]=array ("November",0x0400);
46                $this->nombre_mes[12]=array ("December",0x0800);
47
48                $this->nombre_dia[1]=array ("Mo",0x01); // size 1 bytes
49                $this->nombre_dia[2]=array ("Tu",0x02);
50                $this->nombre_dia[3]=array ("We",0x04);
51                $this->nombre_dia[4]=array ("Th",0x08);
52                $this->nombre_dia[5]=array ("Fr",0x10);
53                $this->nombre_dia[6]=array ("Sa",0x20);
54                $this->nombre_dia[7]=array ("Su",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); // size 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 ("Last",0x20);
76
77                $this->numero_annos[2010]=0x0001; // size 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; // size 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);  // size 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                $this->numero_horas[1]=array ("8:00",0x00000001);  // size 4 bytes
150                $this->numero_horas[2]=array ("8:30",0x00000002);
151                $this->numero_horas[3]=array ("9:00",0x00000004);
152                $this->numero_horas[4]=array ("9:30",0x00000008);
153                $this->numero_horas[5]=array ("10:00",0x00000010);
154                $this->numero_horas[6]=array ("10:30",0x00000020);
155                $this->numero_horas[7]=array ("11:00",0x00000040);
156                $this->numero_horas[8]=array ("11:30",0x00000080);
157                $this->numero_horas[9]=array ("12:00",0x00000100);
158                $this->numero_horas[10]=array ("12:30",0x00000200);
159                $this->numero_horas[11]=array ("13:00",0x00000400);
160                $this->numero_horas[12]=array ("13:30",0x00000800);
161                $this->numero_horas[13]=array ("14:00",0x00001000);
162                $this->numero_horas[14]=array ("14:30",0x00002000);
163                $this->numero_horas[15]=array ("15:00",0x00004000);
164                $this->numero_horas[16]=array ("15:30",0x00008000);
165                $this->numero_horas[17]=array ("16:00",0x00010000);
166                $this->numero_horas[18]=array ("16:30",0x00020000);
167                $this->numero_horas[19]=array ("17:00",0x00040000);
168                $this->numero_horas[20]=array ("17:30",0x00080000);
169                $this->numero_horas[21]=array ("18:00",0x00100000);
170                $this->numero_horas[22]=array ("18:30",0x00200000);
171                $this->numero_horas[23]=array ("19:00",0x00400000);
172                $this->numero_horas[24]=array ("19:30",0x00800000);
173                $this->numero_horas[25]=array ("20:00",0x01000000);
174                $this->numero_horas[26]=array ("20:30",0x02000000);
175                $this->numero_horas[27]=array ("21:00",0x04000000);
176                $this->numero_horas[28]=array ("21:30",0x08000000);
177        */
178
179        }
180
181        /*-------------------------------------------------------------------------------------------
182                This function returns day of the week number:
183                        0=sunday 1=monday, 2=tuesday ... 6=saturday
184
185                Input parameter:
186                        A string with date format dd/mm/yyyy.
187        ----------------------------------------------------------------------------------------------*/
188        function _DiaSemana($fecha){
189                list($dia,$mes,$anno)=explode('[/.-]',$fecha);
190                $cont=0;
191                for ($i=1900;$i<$anno;$i++){
192                        if ($this->bisiesto($i)) $dias_anuales=366; else        $dias_anuales=365;
193                        $cont+=$dias_anuales;
194                }
195                for ($i=1;$i<$mes;$i++){
196                        if ($i!=2)
197                                $cont+=$this->dias_meses[$i];
198                        else{
199                                if ($this->bisiesto($anno))
200                                        $cont+=29;
201                                else
202                                        $cont+=28;
203                        }
204                }
205                $cont+=$dia+$this->desplazamiento_dias;
206                return($cont%7);
207        }
208        /* -------------------------------------------------------------------------------------------
209                These function returns true if last year was a leap-year or false if it was not
210
211                Input parameter:
212                        A number representing 1 year
213        ----------------------------------------------------------------------------------------------*/
214        function bisiesto($anob){
215                if ($anob%4==0) return(true); else return(false);
216        }
217        /* -------------------------------------------------------------------------------------------
218                This function returns a string with  the HTML code of a years range
219        ----------------------------------------------------------------------------------------------*/
220        function Annos($ano_desde,$ano_hasta){
221                $HTML_calendario='<TABLE id="tabla_annos" class="'.$this->clase.'">'.chr(13);
222                $HTML_calendario.='<TR>'.chr(13);
223                $HTML_calendario.='<TH style="cursor:hand" onclick="TH_'.$this->onclick.'">Years</TH></TR>'.chr(13); // Literal years
224                for ($i=$ano_desde; $i<=ano_hasta; ){
225                        $HTML_calendario.='<TR><TD id="'.$this->numero_annos[$i][0].'" value="'.$this->numero_annos[$i][1].'" style="cursor:hand" onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$this->numero_annos[$i][0].'</TD></TR>'.chr(13);
226                }
227                $HTML_calendario.='</TABLE>'.chr(13);
228                return($HTML_calendario);
229        }
230        /* -------------------------------------------------------------------------------------------
231                This function returns a string with the HTML code of year and month schedule chosen
232                and they are class properties.
233        ----------------------------------------------------------------------------------------------*/
234        function MesAnno($mes,$anno){
235                $fecha="1/".$mes."/".$anno;
236                $ds=$this->_DiaSemana($fecha);
237                if ($ds==0) $ds=7;
238
239                $swbi=0; // Suma para bisiesto
240                if ($this->bisiesto($anno) && $mes==2)  $swbi=1;
241
242                $HTML_calendario='<TABLE id="tabla_mesanno" class="'.$this->clase.'">'.chr(13);
243                $HTML_calendario.='<TR>'.chr(13);
244                $HTML_calendario.='<TH colspan=7 style="cursor:hand" onclick="TH_'.$this->onclick.'">'.$this->nombre_mes[$mes][0].'</TH></TR>'.chr(13); // Month name
245                $HTML_calendario.='<TR>'.chr(13);
246                for ($i=1;$i<8;$i++)
247                        $HTML_calendario.='<TH>'.$this->nombre_dia[$i][0].'</TH>'.chr(13); // Day of the week
248                $HTML_calendario.='</TR><TR>'.chr(13);
249                for ($i=1;$i<$ds;$i++)
250                        $HTML_calendario.='<TD></TD>'.chr(13); // Filling firsts days of the week
251                $sm=$ds; // Control leap of week
252                for ($i=1;$i<=$this->dias_meses[$mes]+$swbi;$i++){
253                        $HTML_calendario.='<TD id="'.$i.'/'.$mes.'/'.$anno.'" value="'.$this->numero_dias[$i].'" style="cursor:hand" onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$i.'</TD>'.chr(13);
254                        if ($sm%7==0){
255                                $HTML_calendario.='</TR><TR>'.chr(13);
256                                $sm=0;
257                        }
258                        $sm++;
259                }
260                $HTML_calendario.='</TR></TABLE>'.chr(13);
261                return($HTML_calendario);
262        }
263        /* -------------------------------------------------------------------------------------------
264                This function returns a string with the HTML code of months of the year in two columns.
265        ----------------------------------------------------------------------------------------------*/
266        function Meses(){
267                $HTML_calendario='<TABLE id="tabla_meses" class="'.$this->clase.'">'.chr(13);
268                $HTML_calendario.='<TR>'.chr(13);
269                $HTML_calendario.='<TH colspan=2 style="cursor:hand" onclick="TH_'.$this->onclick.'">Months</TH></TR>'.chr(13); // Literal meses
270                for ($i=1;$i<13;$i++){
271                        $HTML_calendario.='<TR><TD id="'.$i.'" value="'.$this->nombre_mes[$i][1].'" style="cursor:hand" onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$this->nombre_mes[$i++][0].'</TD>'.chr(13);
272                        $HTML_calendario.='<TD id="'.$i.'" value="'.$this->nombre_mes[$i][1].'"style="cursor:hand" onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$this->nombre_mes[$i][0].'</TD></TR>'.chr(13);
273                }
274                $HTML_calendario.='</TABLE>'.chr(13);
275                return($HTML_calendario);
276        }
277        /* -------------------------------------------------------------------------------------------
278                This function returns a string with HTML code of days of the week in a row.
279        ----------------------------------------------------------------------------------------------*/
280        function Dias(){
281                $HTML_calendario='<TABLE id="tabla_dias" class="'.$this->clase.'">'.chr(13);
282                $HTML_calendario.='<TR>'.chr(13);
283                $HTML_calendario.='<TH  colspan=7 style="cursor:hand" onclick="TH_'.$this->onclick.'">Day</TH><TR>'.chr(13); // Literal Días
284                for ($i=1;$i<8;$i++){
285                        $HTML_calendario.='<TD id="'.$i.'" value="'.$this->nombre_dia[$i][1].'" style="cursor:hand" onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$this->nombre_dia[$i][0].'</TD>'.chr(13);
286                }
287                $HTML_calendario.='</TR></TABLE>'.chr(13);
288                return($HTML_calendario);
289        }
290        /* -------------------------------------------------------------------------------------------
291                This function returns a string with HTML code of the weeks sequence in a row.
292        ----------------------------------------------------------------------------------------------*/
293        function Semanas(){
294                $HTML_calendario='<TABLE id="tabla_semanas" class="'.$this->clase.'">'.chr(13);
295                $HTML_calendario.='<TR>'.chr(13);
296                $HTML_calendario.='<TH  colspan=7 style="cursor:hand" onclick="TH_'.$this->onclick.'">Week</TH><TR>'.chr(13); // Literal Semenas
297                for ($i=1;$i<7;$i++){
298                        $HTML_calendario.='<TD id="'.$i.'" value="'.$this->semanas[$i][1].'" style="cursor:hand" onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$this->semanas[$i][0].'&nbsp;</TD>'.chr(13);
299                }
300                $HTML_calendario.='</TR></TABLE>'.chr(13);
301                return($HTML_calendario);
302        }
303        /* -------------------------------------------------------------------------------------------
304                This function returns a string with HTML code of the 31 days of a month in 3 rows.
305        ----------------------------------------------------------------------------------------------*/
306        function DiasMes(){
307                $HTML_calendario='<TABLE id="tabla_diasmes" class="'.$this->clase.'">'.chr(13);
308                $HTML_calendario.='<TR>'.chr(13);
309                $HTML_calendario.='<TH colspan=8 style="cursor:hand" onclick="TH_'.$this->onclick.'">Day of month</TH><TR>'.chr(13); // Literal Día
310                $HTML_calendario.='<TR>'.chr(13);
311                $sd=1; // Control salto de fila
312                for ($i=1;$i<32;$i++){
313                                $HTML_calendario.='<TD id="'.$i.'" value="'.$this->numero_dias[$i].'" style="cursor:hand" onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$i.'</TD>'.chr(13);
314                                if ($sd%8==0){
315                                        $HTML_calendario.='</TR><TR>'.chr(13);
316                                        $sd=0;
317                                }
318                                $sd++;
319                }
320                $HTML_calendario.='</TR></TABLE>'.chr(13);
321                return($HTML_calendario);
322        }
323        /* -------------------------------------------------------------------------------------------
324                This function returns a string with HTML code of labs open-time.
325        ----------------------------------------------------------------------------------------------*/
326        function Horas(){
327                $HTML_calendario='<TABLE  id="tabla_horas" class="'.$this->clase.'">'.chr(13);
328                $HTML_calendario.='<TR>'.chr(13);
329                $HTML_calendario.='<TH colspan=12 style="cursor:hand" onclick="TH_'.$this->onclick.'">Time for action performance</TH>';
330                $HTML_calendario.='<TH>Mod</TH>';
331                $HTML_calendario.='<TH>Min.</TH>';
332                //$HTML_calendario.='<TH>Seg.</TH></TR>';
333                $HTML_calendario.='<TR>'.chr(13);
334                for ($i=1;$i<13;$i++)
335                        $HTML_calendario.='<TD align=center id="'.$this->numero_horas[$i][0].'"  value="'.$this->numero_horas[$i][1].'" style="cursor:hand" onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$this->numero_horas[$i][0].'</TD>'.chr(13);
336
337                $HTML_calendario.='<TD align=center>';
338                $HTML_calendario.= '<SELECT class="estilodesple" id="ampm">'.chr(13);
339                $HTML_calendario.= '<OPTION  value=0>A.M.</OPTION>'.chr(13);
340                $HTML_calendario.= '<OPTION selected value=1 >P.M.</OPTION>'.chr(13);
341                $HTML_calendario.='</SELECT>'.chr(13);
342                $HTML_calendario.='</TD>        '.chr(13);
343
344                $HTML_calendario.='<TD align=center>';
345                $HTML_calendario.='<INPUT   type=text class=cajatexto id=minutos size=1>'.chr(13);
346                $HTML_calendario.='</TD>        '.chr(13);
347
348                $HTML_calendario.='</TR>'.chr(13);
349                $HTML_calendario.='</TABLE>'.chr(13);
350
351                return($HTML_calendario);
352        }
353/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
354                This function returns a string with the HTML code of the lab reservations times.
355________________________________________________________________________________________________________*/
356        function HorasReserva($literal,$nombretabla,$nombreampm,$nombreminuto){
357                if($literal=="1")
358                        $literal="Start of the reserve";
359                else
360                        $literal="End of the reserve";
361                $HTML_calendario='<TABLE  id="'.$nombretabla.'" class="'.$this->clase.'">'.chr(13);
362                $HTML_calendario.='<TR>'.chr(13);
363                $HTML_calendario.='<TH colspan=12 style="cursor:hand" onclick="TH_'.$this->onclick.'">'.$literal.' </TH>';
364                $HTML_calendario.='<TH>Mod</TH>';
365                $HTML_calendario.='<TH>Min.</TH>';
366                $HTML_calendario.='<TR>'.chr(13);
367                for ($i=1;$i<13;$i++)
368                        $HTML_calendario.='<TD align=center id="'.$this->numero_horas[$i][0].'"  value="'.$this->numero_horas[$i][1].'" style="cursor:hand" onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$this->numero_horas[$i][0].'</TD>'.chr(13);
369
370                $HTML_calendario.='<TD align=center>';
371                $HTML_calendario.= '<SELECT class="estilodesple" id="'.$nombreampm.'">'.chr(13);
372                $HTML_calendario.= '<OPTION value=0>A.M.</OPTION>'.chr(13);
373                $HTML_calendario.= '<OPTION selected value=1  >P.M.</OPTION>'.chr(13);
374                $HTML_calendario.='</SELECT>'.chr(13);
375                $HTML_calendario.='</TD>        '.chr(13);
376
377                $HTML_calendario.='<TD align=center>';
378                $HTML_calendario.='<INPUT   type=text class=cajatexto id="'.$nombreminuto.'" size=1>'.chr(13);
379                $HTML_calendario.='</TD>        '.chr(13);
380
381                $HTML_calendario.='</TR>'.chr(13);
382                $HTML_calendario.='</TABLE>'.chr(13);
383
384                return($HTML_calendario);
385        }
386        /* -------------------------------------------------------------------------------------------
387                This function returns a string with HTML code of labs open-time.
388        ----------------------------------------------------------------------------------------------*/
389        function Horas_Completas(){
390                $maxcolumnas=16;
391
392                $HTML_calendario='<TABLE id="tabla_horas" class="'.$this->clase.'">'.chr(13);
393                $HTML_calendario.='<TR>'.chr(13);
394                $HTML_calendario.='<TH colspan='.$maxcolumnas.'>Horas</TH><TR>'.chr(13); // Literal Horas
395                $HTML_calendario.='<TR>'.chr(13);
396                $currenthora=0;
397                $currentminutos=0;
398                $currenthorario=$currenthora.":".$currentminutos;
399                for ($i=1;$i<97;$i++){
400                        if($currentminutos==0) $currenthorario.="0";
401
402                        $HTML_calendario.='<TD align=center id="'.$currenthorario.'"  style="cursor:hand" onmouseover="'.$this->onmouseover.'" onmouseout="'.$this->onmouseout.'" onclick="'.$this->onclick.'">'.$currenthorario.'</TD>'.chr(13);
403                        $currentminutos+=15;
404                        if($currentminutos==60) {
405                                $currenthora++;
406                                if($currenthora==24)    $currenthora=0;
407                                $currentminutos=0;
408                        }
409                        $currenthorario=$currenthora.":".$currentminutos;
410                        if ($i%$maxcolumnas==0) $HTML_calendario.='</TR><TR>'.chr(13);
411                }
412        $HTML_calendario.='</TR></TABLE>'.chr(13);
413        return($HTML_calendario);
414        }
415} // End of Almanaque class
Note: See TracBrowser for help on using the repository browser.