Commit 16bb11c16591721c87c68b620dd4fd91304b46a5
1 parent
356d05b1
Exists in
master
Refactoring para coding standards
Showing
4 changed files
with
1120 additions
and
1002 deletions
Show diff stats
ieducar/intranet/clsCalendario.inc.php
1 | 1 | <?php |
2 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
3 | - * * | |
4 | - * @author Prefeitura Municipal de Itajaí * | |
5 | - * @updated 29/03/2007 * | |
6 | - * Pacote: i-PLB Software Público Livre e Brasileiro * | |
7 | - * * | |
8 | - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí * | |
9 | - * ctima@itajai.sc.gov.br * | |
10 | - * * | |
11 | - * Este programa é software livre, você pode redistribuí-lo e/ou * | |
12 | - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme * | |
13 | - * publicada pela Free Software Foundation, tanto a versão 2 da * | |
14 | - * Licença como (a seu critério) qualquer versão mais nova. * | |
15 | - * * | |
16 | - * Este programa é distribuído na expectativa de ser útil, mas SEM * | |
17 | - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- * | |
18 | - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- * | |
19 | - * sulte a Licença Pública Geral GNU para obter mais detalhes. * | |
20 | - * * | |
21 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU * | |
22 | - * junto com este programa. Se não, escreva para a Free Software * | |
23 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * | |
24 | - * 02111-1307, USA. * | |
25 | - * * | |
26 | - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
27 | - | |
28 | -class clsCalendario{ | |
29 | - | |
30 | - | |
31 | - var $permite_trocar_ano = 0; | |
32 | - | |
33 | - var $largura_externa = 400; | |
34 | - | |
35 | - var $largura_interna = 250; | |
36 | - | |
37 | - var $padding = 5; | |
38 | - | |
39 | - var $COR = array( 0 => "#FADEAF", | |
40 | - "LARANJA_CLARO" => "#FADEAF", | |
41 | - | |
42 | - 1 => "#93BDC9", | |
43 | - "AZUL_ESCURO" => "#93BDC9", | |
44 | - | |
45 | - 2 => "#BCD39D", | |
46 | - "VERDE_ESCURO" => "#BCD39D", | |
47 | - | |
48 | - 3 => "#C7D5E0", | |
49 | - "AZUL_CLARO" => "#C7D5E0", | |
50 | - | |
51 | - 4 => "#E5D6DD", | |
52 | - "ROSA" => "#E5D6DD", | |
53 | - | |
54 | - 5 => "#E9D1AF", | |
55 | - "LARANJA_ESCURO" => "#E9D1AF", | |
56 | - | |
57 | - 6 => "#E9E6BB", | |
58 | - "AMARELO" => "#E9E6BB", | |
59 | - | |
60 | - 7 => "#C9D9CF", | |
61 | - "VERDE_CLARO" => "#C9D9CF", | |
62 | - | |
63 | - 8 => "#DDE3D9", | |
64 | - "CINZA" => "#DDE3D9", | |
65 | - ); | |
66 | - | |
67 | - | |
68 | - /** | |
69 | - * | |
70 | - * | |
71 | - * @var array | |
72 | - */ | |
73 | - var $array_icone= array('A' => array('nome' => 'Anotações', 'link' => '/intranet/imagens/i-educar/letra_a.gif') | |
74 | - | |
75 | - ,'' | |
76 | 2 | |
77 | - ); | |
78 | - | |
79 | - | |
80 | - var $array_icone_dias = array(); | |
81 | - | |
82 | - | |
83 | - /** | |
84 | - * Array das cores da legenda | |
85 | - * | |
86 | - * @var array | |
87 | - */ | |
88 | - var $array_cor = array('#F7F7F7'); | |
89 | - | |
90 | - /** | |
91 | - * Array das legendas | |
92 | - * | |
93 | - * @var array | |
94 | - */ | |
95 | - var $array_legenda = array('Padrao'); | |
96 | - | |
97 | - /** | |
98 | - * Array da cor para os dias da semana | |
99 | - * | |
100 | - * @var array | |
101 | - */ | |
102 | - var $array_cor_dia_padrao = array(); | |
103 | - | |
104 | - /** | |
105 | - * Dias do mes | |
106 | - * | |
107 | - * @var array | |
108 | - */ | |
109 | - var $array_dias = array(); | |
110 | - | |
111 | - /** | |
112 | - * acao quando for clicado em cima do dia | |
113 | - * | |
114 | - * @var array | |
115 | - */ | |
116 | - var $all_days_onclick; | |
117 | - | |
118 | - /** | |
119 | - * acao quando for clicado em cima do dia | |
120 | - * | |
121 | - * @var array | |
122 | - */ | |
123 | - var $all_days_url; | |
124 | - | |
125 | - | |
126 | - /** | |
127 | - * acao quando for clicado em cima do dia | |
128 | - * | |
129 | - * @var array | |
130 | - */ | |
131 | - var $array_onclick_dias = array(); | |
132 | - | |
133 | - /** | |
134 | - * Adicioar um div flutuante quando posicionar o mouse sobre o dia | |
135 | - * | |
136 | - * @var unknown_type | |
137 | - */ | |
138 | - var $array_div_flutuante_dias = array(); | |
139 | - | |
140 | - function resetAll(){ | |
141 | - $this->array_div_flutuante_dias = array(); | |
142 | - $this->array_onclick_dias = array(); | |
143 | - $this->array_dias = array(); | |
144 | - $this->array_cor_dia_padrao = array(); | |
145 | - $this->array_legenda = array('Padrao'); | |
146 | - $this->array_cor = array('#F7F7F7'); | |
147 | - $this->largura_externa = 400; | |
148 | - | |
149 | - $this->largura_interna = 250; | |
150 | - | |
151 | - $this->padding = 5; | |
152 | - } | |
153 | - | |
154 | - function setLargura($int_largura){ | |
155 | - | |
156 | - $this->largura_externa = $int_largura; | |
157 | - | |
158 | - if($int_largura > 250) | |
159 | - $this->largura_interna = $this->largura_externa - 121; | |
160 | - else | |
161 | - $this->largura_interna = '40%'; | |
162 | - | |
163 | - $this->padding = (floor((($int_largura - 30) / 7 ) / 10) * 2); | |
164 | - | |
165 | - } | |
166 | - | |
167 | - function diaDescricao($arr_dias,$array_mensagem_dias){ | |
168 | - | |
169 | - if(is_array($arr_dias)){ | |
170 | - foreach ($arr_dias as $key => $dia) { | |
171 | - $this->array_div_flutuante_dias[$key] = $array_mensagem_dias[$key]; | |
172 | - } | |
173 | - | |
174 | - } | |
175 | - } | |
176 | - | |
177 | - function diaOnClick($arr_dias,$array_onclick_dias){ | |
178 | - | |
179 | - if(is_array($arr_dias)){ | |
180 | - foreach ($arr_dias as $key => $dia) { | |
181 | - $this->array_onclick_dias[$dia][] = $array_onclick_dias[$key]; | |
182 | - } | |
183 | - | |
184 | - } | |
185 | - | |
186 | - } | |
187 | - | |
188 | - function adicionarIconeDias($arr_dias,$id_icone){ | |
189 | - | |
190 | - if(is_array($arr_dias)){ | |
191 | - | |
192 | - foreach ($arr_dias as $key => $dia) { | |
193 | - if(key_exists($id_icone,$this->array_icone)) | |
194 | - $this->array_icone_dias[$dia] = $id_icone; | |
195 | - $this->array_icone[$id_icone]['utilizado'] = true; | |
196 | - } | |
197 | - | |
198 | - } | |
199 | - | |
200 | - } | |
201 | - | |
202 | - /** | |
203 | - | |
204 | - * * | |
205 | - * @param STRING $str_legenda | |
206 | - * @param STRING $str_cor | |
207 | - * #FADEAF - 0 - LARANJA_CLARO | |
208 | - * | |
209 | - * #93BDC9 - 1 - AZUL_ESCURO | |
210 | - * | |
211 | - * #BCD39D - 2 - VERDE_ESCURO | |
212 | - * | |
213 | - * #C7D5E0 - 3 - AZUL_CLARO | |
214 | - * | |
215 | - * #E5D6DD - 4 - ROSA | |
216 | - * | |
217 | - * #E9D1AF - 5 - LARANJA_ESCURO | |
218 | - * | |
219 | - * #E9E6BB - 6 - AMARELO | |
220 | - * | |
221 | - * #C9D9CF - 7 - VERDE_CLARO | |
222 | - * | |
223 | - * #DDE3D9 - 8 - CINZA | |
224 | - */ | |
225 | - | |
226 | - function adicionarLegenda($str_legenda, $str_cor){ | |
227 | - | |
228 | - //$this->array_cod_legenda[] = $str_cod_legenda; | |
229 | - $key = array_search($str_legenda,$this->array_legenda); | |
230 | - if(!empty($key)) | |
231 | - if($this->array_legenda[$key] == $str_legenda) | |
232 | - return; | |
233 | - $this->array_legenda[] = $str_legenda; | |
234 | - $str_cor = strtoupper($str_cor); | |
235 | - $this->array_cor[] = $this->COR["{$str_cor}"]; | |
236 | - | |
237 | - | |
238 | - } | |
239 | - /** | |
240 | - * *Legenda padrao | |
241 | - * @param STRING $str_legenda | |
242 | - * @param STRING $str_cor | |
243 | - * #FADEAF - 0 - LARANJA_CLARO | |
244 | - * | |
245 | - * #93BDC9 - 1 - AZUL_ESCURO | |
246 | - * | |
247 | - * #BCD39D - 2 - VERDE_ESCURO | |
248 | - * | |
249 | - * #C7D5E0 - 3 - AZUL_CLARO | |
250 | - * | |
251 | - * #E5D6DD - 4 - ROSA | |
252 | - * | |
253 | - * #E9D1AF - 5 - LARANJA_ESCURO | |
254 | - * | |
255 | - * #E9E6BB - 6 - AMARELO | |
256 | - * | |
257 | - * #C9D9CF - 7 - VERDE_CLARO | |
258 | - * | |
259 | - * #DDE3D9 - 8 - CINZA | |
260 | - */ | |
261 | - function setLegendaPadrao($str_legenda, $str_cor = "#F7F7F7"){ | |
262 | - | |
263 | - $this->array_legenda[0] = $str_legenda; | |
264 | - $this->array_cor[0] = $this->COR["{$str_cor}"]; | |
265 | - | |
266 | - } | |
267 | - | |
268 | - /** | |
269 | - | |
270 | - * *Atribui uma cor padrao para os dias(0 Dom - 6 Sab) da semana ex - todas as segundas 1 | |
271 | - * @param ARRAY $arr_dia_semana | |
272 | - * @param STRING $str_cor | |
273 | - * #FADEAF - 0 - LARANJA_CLARO | |
274 | - * | |
275 | - * #93BDC9 - 1 - AZUL_ESCURO | |
276 | - * | |
277 | - * #BCD39D - 2 - VERDE_ESCURO | |
278 | - * | |
279 | - * #C7D5E0 - 3 - AZUL_CLARO | |
280 | - * | |
281 | - * #E5D6DD - 4 - ROSA | |
282 | - * | |
283 | - * #E9D1AF - 5 - LARANJA_ESCURO | |
284 | - * | |
285 | - * #E9E6BB - 6 - AMARELO | |
286 | - * | |
287 | - * #C9D9CF - 7 - VERDE_CLARO | |
288 | - * | |
289 | - * #DDE3D9 - 8 - CINZA | |
290 | - */ | |
291 | - function setCorDiaSemana($arr_dia_semana, $str_cor){ | |
292 | - $str_cor = strtoupper($str_cor); | |
293 | - if(is_array($arr_dia_semana)) | |
294 | - foreach ($arr_dia_semana as $dia) | |
295 | - $this->array_cor_dia_padrao["{$dia}"] = $this->COR["{$str_cor}"]; | |
296 | - else | |
297 | - $this->array_cor_dia_padrao["{$arr_dia_semana}"] = $str_cor; | |
298 | - } | |
299 | - /** | |
300 | - * Adiciona os dias do mes com a sua legenda | |
301 | - * | |
302 | - * @param unknown_type $str_cod_legenda | |
303 | - * @param unknown_type $dias | |
304 | - */ | |
305 | - function adicionarArrayDias($str_cod_legenda,$dias){ | |
306 | - | |
307 | - $key = array_shift(array_keys($this->array_legenda, $str_cod_legenda)); | |
308 | - foreach ($dias as $dia) | |
309 | - { | |
310 | - $dia = (int)$dia; | |
311 | - $this->array_dias["{$dia}"] = $key; | |
312 | - } | |
313 | - | |
314 | - ksort($this->array_dias); | |
315 | - | |
316 | - } | |
317 | - | |
318 | - /** | |
319 | - * retorna o calendario | |
320 | - * | |
321 | - * @param unknown_type $mes | |
322 | - * @param unknown_type $ano | |
323 | - * @return unknown | |
324 | - */ | |
325 | - function getCalendario($mes,$ano,$nome,$mixVariaveisMantidas) { | |
326 | - | |
327 | - $array_color = $array_color; | |
328 | - $array_legenda = $array_legenda; | |
329 | - | |
330 | - if(isset($mixVariaveisMantidas["{$nome}_mes"]) && is_numeric($mixVariaveisMantidas["{$nome}_mes"])) | |
331 | - $mes = $mixVariaveisMantidas["{$nome}_mes"]; | |
332 | - | |
333 | - if(isset($mixVariaveisMantidas["{$nome}_ano"]) && is_numeric($mixVariaveisMantidas["{$nome}_ano"]) && $this->permite_trocar_ano == true) | |
334 | - $ano = $mixVariaveisMantidas["{$nome}_ano"]; | |
335 | - | |
336 | - // Array com todos os dias da semana | |
337 | - $diasDaSemana = array('DOM','SEG','TER','QUA','QUI','SEX','SAB'); | |
338 | - $diasDaSemana = array('DOM','SEG','TER','QUA','QUI','SEX','SAB'); | |
339 | - | |
340 | - $mesesDoAno = array( | |
341 | - "1" => "JANEIRO" | |
342 | - ,"2" => "FEVEREIRO" | |
343 | - ,"3" => "MARÇO" | |
344 | - ,"4" => "ABRIL" | |
345 | - ,"5" => "MAIO" | |
346 | - ,"6" => "JUNHO" | |
347 | - ,"7" => "JULHO" | |
348 | - ,"8" => "AGOSTO" | |
349 | - ,"9" => "SETEMBRO" | |
350 | - ,"10" => "OUTUBRO" | |
351 | - ,"11" => "NOVEMBRO" | |
352 | - ,"12" => "DEZEMBRO" | |
353 | - ); | |
354 | - | |
355 | - // Qual o primeiro dia do mes | |
356 | - $primeiroDiaDoMes = mktime(0,0,0,$mes,1,$ano); | |
357 | - | |
358 | - // Quantos dias tem o mes | |
359 | - $NumeroDiasMes = date('t',$primeiroDiaDoMes); | |
360 | - | |
361 | - // Retrieve some information about the first day of the | |
362 | - // month in question. | |
363 | - $dateComponents = getdate($primeiroDiaDoMes); | |
364 | - | |
365 | - // What is the name of the month in question? | |
366 | - $NomeMes = $mesesDoAno[$dateComponents['mon']]; | |
367 | - | |
368 | - // What is the index value (0-6) of the first day of the | |
369 | - // month in question. | |
370 | - $DiaSemana = $dateComponents['wday']; | |
371 | - | |
372 | - // Create the table tag opener and day headers | |
373 | - //GET | |
374 | - $linkFixo = $strUrl . "?"; | |
375 | - if( is_array( $mixVariaveisMantidas ) ) | |
376 | - { | |
377 | - foreach ( $mixVariaveisMantidas as $key => $value ) | |
378 | - { | |
379 | - if( $key != "{$nome}_mes" && $key != "{$nome}_ano") | |
380 | - { | |
381 | - $linkFixo .= "$key=$value&"; | |
382 | - } | |
383 | - } | |
384 | - } | |
385 | - else | |
386 | - { | |
387 | - if( is_string( $mixVariaveisMantidas ) ) | |
388 | - { | |
389 | - $linkFixo .= "$mixVariaveisMantidas&"; | |
390 | - } | |
391 | - } | |
392 | - // | |
393 | - $linkFixo = $linkFixo == "?" ? "" : $linkFixo; | |
394 | - | |
395 | - if($mes == 12) | |
396 | - { | |
397 | - if($this->permite_trocar_ano) | |
398 | - { | |
399 | - $mes_posterior_mes = 1; | |
400 | - $mes_anterior_mes = 11; | |
401 | - $ano_posterior_mes = $ano + 1; | |
402 | - $ano_anterior_mes = $ano; | |
403 | - | |
404 | - $mes_ano = $mes; | |
405 | - $ano_posterior_ano = $ano + 1; | |
406 | - $ano_anterior_ano = $ano - 1; | |
407 | - | |
408 | - //$ano++; | |
409 | - }else{ | |
410 | - $mes_posterior_mes = 1; | |
411 | - $mes_anterior_mes = 11; | |
412 | - $ano_posterior_mes = $ano; | |
413 | - $ano_anterior_mes = $ano; | |
414 | - } | |
415 | - }elseif ($mes == 1){ | |
416 | - if($this->permite_trocar_ano) | |
417 | - { | |
418 | - $mes_posterior_mes = 2; | |
419 | - $mes_anterior_mes = 12; | |
420 | - $ano_posterior_mes = $ano; | |
421 | - $ano_anterior_mes = $ano - 1; | |
422 | - | |
423 | - $mes_ano = $mes; | |
424 | - $ano_posterior_ano = $ano + 1; | |
425 | - $ano_anterior_ano = $ano - 1; | |
426 | - }else{ | |
427 | - $mes_posterior_mes = 2; | |
428 | - $mes_anterior_mes = 12; | |
429 | - $ano_posterior_mes = $ano; | |
430 | - $ano_anterior_mes = $ano; | |
431 | - } | |
432 | - } | |
433 | - else{ | |
434 | - if($this->permite_trocar_ano) | |
435 | - { | |
436 | - $mes_posterior_mes = $mes + 1; | |
437 | - $mes_anterior_mes = $mes - 1; | |
438 | - $ano_posterior_mes = $ano; | |
439 | - $ano_anterior_mes = $ano; | |
440 | - | |
441 | - $mes_ano = $mes; | |
442 | - $ano_posterior_ano = $ano + 1; | |
443 | - $ano_anterior_ano = $ano - 1; | |
444 | - }else{ | |
445 | - $mes_posterior_mes = $mes + 1; | |
446 | - $mes_anterior_mes = $mes - 1; | |
447 | - $ano_posterior_mes = $ano; | |
448 | - $ano_anterior_mes = $ano; | |
449 | - } | |
450 | - } | |
451 | - | |
452 | - | |
453 | - | |
454 | - $form = "<form id=\"form_calendario\" name=\"form_calendario\" method=\"post\" action=\"{$linkFixo}\"> | |
455 | - <input type=\"hidden\" id=\"nome\" name=\"nome\" value=\"\"> | |
456 | - <input type=\"hidden\" id=\"dia\" name=\"dia\" value=\"\"> | |
457 | - <input type=\"hidden\" id=\"mes\" name=\"mes\" value=\"\"> | |
458 | - <input type=\"hidden\" id=\"ano\" name=\"ano\" value=\"\"> | |
459 | - </form>"; | |
460 | - | |
461 | - if($this->permite_trocar_ano == true) | |
462 | - { | |
463 | - $select = "<select name=\"mes\" id=\"smes\" onchange=\"acaoCalendario('{$nome}','',this.value,'{$ano}');\">\">"; | |
464 | - foreach ($mesesDoAno as $key => $mes_) | |
465 | - { | |
466 | - $selected = ($dateComponents['mon'] == $key) ? "selected='selected'" : ""; | |
467 | - $select .="<option value='{$key}' $selected>{$mes_}</option>"; | |
468 | - | |
469 | - } | |
470 | - | |
471 | - $select .= "</select>"; | |
472 | - | |
473 | - $cab = "<a href='#' onclick='acaoCalendario(\"{$nome}\",\"\",\"{$mes_anterior_mes}\",\"{$ano_anterior_mes}\")'><img src='/intranet/imagens/i-educar/seta_esq.gif' border='0' style='margin-right:5px;' alt='Mês Anterior'></a>{$select}<a href='#' onclick='acaoCalendario(\"{$nome}\",\"\",\"{$mes_posterior_mes}\",\"{$ano_posterior_mes}\")'><img src='/intranet/imagens/i-educar/seta_dir.gif' border='0' style='margin-left:5px;' alt='Mês Posterior'></a> | |
474 | - <a href='#' onclick='acaoCalendario(\"{$nome}\",\"\",\"{$mes_ano}\",\"{$ano_anterior_ano}\")'><img src='/intranet/imagens/i-educar/seta_esq.gif' border='0' style='margin-right:5px;' alt='Mês Anterior'></a>{$ano}<a href='#' onclick='acaoCalendario(\"{$nome}\",\"\",\"{$mes_ano}\",\"{$ano_posterior_ano}\")'><img src='/intranet/imagens/i-educar/seta_dir.gif' border='0' style='margin-left:5px;' alt='Mês Posterior'></a>"; | |
475 | - }else | |
476 | - { | |
477 | - $cab = "<a href='javascript:void(1);' onclick='acaoCalendario(\"{$nome}\",\"\",\"{$mes_anterior_mes}\",\"{$ano_anterior_mes}\")'><img src='/intranet/imagens/i-educar/seta_esq.gif' border='0' style='margin-right:5px;' alt='Mês Anterior'></a>{$NomeMes} {$ano}href='#' onclick='acaoCalendario(\"{$nome}\",\"\",\"{$mes_posterior_mes}\",\"{$ano_anterior_mes}\")'><img src='/intranet/imagens/i-educar/seta_dir.gif' border='0' style='margin-left:5px;' alt='Mês Posterior'>"; | |
478 | - } | |
479 | - | |
480 | - | |
481 | - | |
482 | - $calendario = "<div id='d_calendario' ><table class='calendar' cellspacing='0' cellpadding='0' width='{$this->largura_externa}' border='0'>"; | |
483 | - $calendario .= "<tr><td class='cal_esq' > </td><td background='/intranet/imagens/i-educar/cal_bg.gif' width='100%' class='mes'>$cab</td><td align='right' class='cal_dir'> </td></tr>"; | |
484 | - $calendario .= "<tr><td colspan='3' class='bordaM' >$form"; | |
485 | - $calendario .= "<table cellspacing='0' cellpadding='0' width='100%' border=0 class='header'><tr>"; | |
486 | - | |
487 | - // Create the calendar headers | |
488 | - foreach($diasDaSemana as $day) { | |
489 | - if(end($diasDaSemana) == $day) | |
490 | - $calendario .= "<td style='width: 45px;'>$day</td>"; | |
491 | - else | |
492 | - $calendario .= "<td style='border-right: 1px dotted #FFFFFF;width: 45px;'>$day</td>"; | |
493 | - } | |
494 | - | |
495 | - $calendario .= "</tr>"; | |
496 | - $calendario .= "</table>"; | |
497 | - $calendario .= "</td></tr>"; | |
498 | - | |
499 | - $calendario .= "<tr><td colspan='3' style='padding: 3px' valign='top' class='bordaF'>"; | |
500 | - $calendario .= "<table cellspacing='5' cellpadding='0' width='100%' >"; | |
501 | - // Create the rest of the calendar | |
502 | - | |
503 | - // Initiate the day counter, starting with the 1st. | |
504 | - | |
505 | - $diaCorrente = 1; | |
506 | - | |
507 | - $calendario .= "<tr>"; | |
508 | - | |
509 | - // The variable $DiaSemana is used to | |
510 | - // ensure that the calendar | |
511 | - // display consists of exactly 7 columns. | |
512 | - | |
513 | - if ($DiaSemana > 0) { | |
514 | - $completar_dias = $DiaSemana; | |
515 | - $day = date ("d", mktime (0,0,0,$dateComponents["mon"],-$completar_dias+1,$dateComponents["year"])); | |
516 | - for($a = 0 ; $a < $completar_dias ; $a++) | |
517 | - { | |
518 | - $calendario .= "<td class='dayLastMonth' style='padding-left:{$this->padding}px;'>{$day}</td>"; | |
519 | - $day++; | |
520 | - } | |
521 | - | |
522 | - } | |
523 | - while ($diaCorrente <= $NumeroDiasMes) { | |
524 | - | |
525 | - // Seventh column (Saturday) reached. Start a new row. | |
526 | - | |
527 | - if ($DiaSemana == 7) { | |
528 | - | |
529 | - $DiaSemana = 0; | |
530 | - $calendario .= "</tr><tr>"; | |
531 | - | |
532 | - } | |
533 | - | |
534 | - $style_dia ="background-color:{$this->array_cor[0]};"; | |
535 | - | |
536 | - if($this->array_cor_dia_padrao[$DiaSemana]) | |
537 | - $style_dia ="background-color:{$this->array_cor_dia_padrao[$DiaSemana]};"; | |
538 | - | |
539 | - | |
540 | - if (key_exists($diaCorrente,$this->array_dias) /*&& $DiaSemana != 0 && $DiaSemana != 6*/) { | |
541 | - $key = $this->array_dias[$diaCorrente]; | |
542 | - $cor = $this->array_cor[$key]; | |
543 | - $style_dia ="background-color:{$cor};"; | |
544 | - } | |
545 | - | |
546 | - | |
547 | - $onclick = ""; | |
548 | - | |
549 | - if($this->all_days_onclick) | |
550 | - { | |
551 | - $onclick = "onclick=\"{$this->all_days_onclick}\""; | |
552 | - }elseif($this->all_days_url) | |
553 | - { | |
554 | - $onclick = "onclick=\"document.location='{$this->all_days_url}&dia={$diaCorrente}&mes={$mes}&ano={$ano}';\""; | |
555 | - } | |
556 | - | |
557 | - if (key_exists($diaCorrente,$this->array_onclick_dias)) | |
558 | - { | |
559 | - $onclick = "onclick=\"{$this->array_onclick_dias[$diaCorrente]};\""; | |
560 | - //break; | |
561 | - } | |
562 | - | |
563 | - $icone = ""; | |
564 | - if(key_exists($diaCorrente,$this->array_icone_dias)){ | |
565 | - $icone = "<img src='{$this->array_icone[$this->array_icone_dias[$diaCorrente]]["link"]}' border='0' align='right' style='padding-right:5px;'>"; | |
566 | - } | |
567 | - | |
568 | - $message = ""; | |
569 | - $diaCorrente_ = strlen($diaCorrente) == 1 ? "0".$diaCorrente : $diaCorrente; | |
570 | - $NomeMes = strtolower($NomeMes); | |
571 | - | |
572 | - if (key_exists($diaCorrente,$this->array_div_flutuante_dias)) { | |
573 | - $message = "onmouseover=\"ShowContent('{$diaCorrente}','{$mes}','{$ano}','{$nome}'); return true;\""; | |
574 | - $mouseout = "onmouseout=\"HideContent(event,'{$diaCorrente}','{$mes}','{$ano}','{$nome}')\" "; | |
575 | - $mensagens .= "<div $mouseout class='div_info' style='display:none; z-index: 10;' id=\"{$nome}_div_dia_{$diaCorrente}{$mes}{$ano}\"> | |
576 | - <div style='margin:0px 15px 0px 0px;font-size: 14px; z-index: 0; border-bottom: 1px solid #000000;'>{$diaCorrente_} de {$NomeMes} de $ano | |
577 | - </div> | |
578 | - <div style='align:left;padding-top:5px;z-index: 0;' class='dia'> | |
579 | - {$this->array_div_flutuante_dias[$diaCorrente]} | |
580 | - </div> | |
581 | - </div>"; | |
582 | - | |
583 | - } | |
584 | - | |
585 | - $calendario .= "<td style='{$style_dia}padding-left:{$this->padding}px;' id='{$nome}_td_dia_{$diaCorrente}{$mes}{$ano}' class='day' $onclick $message>{$icone} $diaCorrente_</td>"; | |
586 | - | |
587 | - // Increment counters | |
588 | - | |
589 | - $diaCorrente++; | |
590 | - $DiaSemana++; | |
591 | - | |
592 | - } | |
593 | - | |
594 | - // Complete the row of the last week in month, if necessary | |
595 | - | |
596 | - if ($DiaSemana != 7) { | |
597 | - | |
598 | - $remainingDays = 7 - $DiaSemana; | |
599 | - | |
600 | - for($a = 1 ; $a <= $remainingDays ; $a++) | |
601 | - { | |
602 | - //dayLastMonth | |
603 | - $calendario .= "<td class='dayLastMonth' style='padding-left:{$this->padding}px;'>{$a}</td>"; | |
604 | - | |
605 | - } | |
606 | - | |
607 | - } | |
608 | - | |
609 | - if($this->array_legenda) | |
610 | - { | |
611 | - | |
612 | - $calendario .= "<tr><td colspan='7'>"; | |
613 | - $calendario .= "<table cellspacing=2 cellpadding=0 class='legenda' width=100%> | |
614 | - <tr>"; | |
615 | - $cont = 0; | |
616 | - foreach ($this->array_legenda as $key => $legenda){ | |
617 | - $style = "style='background-color:{$this->array_cor["{$key}"]};'"; | |
618 | - $calendario .= "<td {$style} class='cor'> </td><td>{$legenda}</td>"; | |
619 | - $cont++; | |
620 | - if($cont == 3){ | |
621 | - $calendario .= "</tr><tr>"; | |
622 | - $cont = 0; | |
623 | - } | |
624 | - } | |
625 | - $calendario .= "</tr></table>"; | |
626 | - $calendario .="</td></tr>"; | |
627 | - } | |
628 | - | |
629 | - if($this->array_icone_dias) | |
630 | - { | |
631 | - | |
632 | - $calendario .= "<tr><td colspan='7'>"; | |
633 | - $calendario .= "<table cellspacing=2 cellpadding=0 class='legenda' width=100%> | |
634 | - <tr align='left'>"; | |
635 | - $cont = 0; | |
636 | - | |
637 | - foreach ($this->array_icone as $key => $legenda){ | |
638 | - if($legenda['utilizado']) | |
639 | - { | |
640 | - $style = "style='background-color:{$this->array_cor["{$key}"]};'"; | |
641 | - $icone = ""; | |
642 | - $icone = "<img src='{$this->array_icone[$key]["link"]}' border='0' align='right' style='padding-right:5px;'>"; | |
643 | - $calendario .= "<td {$style} align='left'>$icone</td><td width='100%'>{$legenda['nome']}</td>"; | |
644 | - $cont++; | |
645 | - if($cont == 3){ | |
646 | - $calendario .= "</tr><tr>"; | |
647 | - $cont = 0; | |
648 | - } | |
649 | - } | |
650 | - } | |
651 | - $calendario .= "</tr></table>"; | |
652 | - $calendario .="</td></tr>"; | |
653 | - } | |
654 | - $calendario .= "</table>"; | |
655 | - $calendario .= "</td></tr>"; | |
656 | - $calendario .= "</table></div>"; | |
657 | - $calendario .= $mensagens; | |
658 | - return $calendario; | |
659 | - | |
660 | - } | |
661 | - | |
662 | -}; | |
663 | -?> | |
3 | +/** | |
4 | + * i-Educar - Sistema de gestão escolar | |
5 | + * | |
6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
7 | + * <ctima@itajai.sc.gov.br> | |
8 | + * | |
9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
12 | + * qualquer versão posterior. | |
13 | + * | |
14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
17 | + * do GNU para mais detalhes. | |
18 | + * | |
19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
22 | + * | |
23 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
24 | + * @category i-Educar | |
25 | + * @license @@license@@ | |
26 | + * @package iEd_Include | |
27 | + * @since Arquivo disponível desde a versão 1.0.0 | |
28 | + * @version $Id$ | |
29 | + */ | |
30 | + | |
31 | +/** | |
32 | + * clsCalendario class. | |
33 | + * | |
34 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
35 | + * @category i-Educar | |
36 | + * @license @@license@@ | |
37 | + * @package iEd_Include | |
38 | + * @since Classe disponível desde a versão 1.0.0 | |
39 | + * @version @@package_version@@ | |
40 | + */ | |
41 | +class clsCalendario | |
42 | +{ | |
43 | + /** | |
44 | + * @var int | |
45 | + */ | |
46 | + var $permite_trocar_ano = 0; | |
47 | + | |
48 | + /** | |
49 | + * @var int | |
50 | + */ | |
51 | + var $largura_externa = 400; | |
52 | + | |
53 | + /** | |
54 | + * @var int | |
55 | + */ | |
56 | + var $largura_interna = 250; | |
57 | + | |
58 | + /** | |
59 | + * @var int | |
60 | + */ | |
61 | + var $padding = 5; | |
62 | + | |
63 | + /** | |
64 | + * @var array | |
65 | + */ | |
66 | + var $COR = array( | |
67 | + 0 => '#FADEAF', | |
68 | + 'LARANJA_CLARO' => '#FADEAF', | |
69 | + 1 => '#93BDC9', | |
70 | + 'AZUL_ESCURO' => '#93BDC9', | |
71 | + 2 => '#BCD39D', | |
72 | + 'VERDE_ESCURO' => '#BCD39D', | |
73 | + 3 => '#C7D5E0', | |
74 | + 'AZUL_CLARO' => '#C7D5E0', | |
75 | + 4 => '#E5D6DD', | |
76 | + 'ROSA' => '#E5D6DD', | |
77 | + 5 => '#E9D1AF', | |
78 | + 'LARANJA_ESCURO' => '#E9D1AF', | |
79 | + 6 => '#E9E6BB', | |
80 | + 'AMARELO' => '#E9E6BB', | |
81 | + 7 => '#C9D9CF', | |
82 | + 'VERDE_CLARO' => '#C9D9CF', | |
83 | + 8 => '#DDE3D9', | |
84 | + 'CINZA' => '#DDE3D9', | |
85 | + ); | |
86 | + | |
87 | + /** | |
88 | + * @var array | |
89 | + */ | |
90 | + var $array_icone = array( | |
91 | + 'A' => array( | |
92 | + 'nome' => 'Anotações', | |
93 | + 'link' => '/intranet/imagens/i-educar/letra_a.gif' | |
94 | + ), | |
95 | + '' | |
96 | + ); | |
97 | + | |
98 | + /** | |
99 | + * @var array | |
100 | + */ | |
101 | + var $array_icone_dias = array(); | |
102 | + | |
103 | + /** | |
104 | + * Cores da legenda. | |
105 | + * @var array | |
106 | + */ | |
107 | + var $array_cor = array('#F7F7F7'); | |
108 | + | |
109 | + /** | |
110 | + * Legendas. | |
111 | + * @var array | |
112 | + */ | |
113 | + var $array_legenda = array('Padrão'); | |
114 | + | |
115 | + /** | |
116 | + * Cor para os dias da semana. | |
117 | + * @var array | |
118 | + */ | |
119 | + var $array_cor_dia_padrao = array(); | |
120 | + | |
121 | + /** | |
122 | + * Dias do mês. | |
123 | + * @var array | |
124 | + */ | |
125 | + var $array_dias = array(); | |
126 | + | |
127 | + /** | |
128 | + * Javascript de um "dia". | |
129 | + * @var array | |
130 | + */ | |
131 | + var $all_days_onclick; | |
132 | + | |
133 | + /** | |
134 | + * URL de um "dia". | |
135 | + * @var array | |
136 | + */ | |
137 | + var $all_days_url; | |
138 | + | |
139 | + /** | |
140 | + * @var array | |
141 | + */ | |
142 | + var $array_onclick_dias = array(); | |
143 | + | |
144 | + /** | |
145 | + * Div flutuante para dias. | |
146 | + * @var array | |
147 | + */ | |
148 | + var $array_div_flutuante_dias = array(); | |
149 | + | |
150 | + function resetAll() | |
151 | + { | |
152 | + $this->array_div_flutuante_dias = array(); | |
153 | + $this->array_onclick_dias = array(); | |
154 | + $this->array_dias = array(); | |
155 | + $this->array_cor_dia_padrao = array(); | |
156 | + $this->array_legenda = array('Padrão'); | |
157 | + $this->array_cor = array('#F7F7F7'); | |
158 | + $this->largura_externa = 400; | |
159 | + $this->largura_interna = 250; | |
160 | + $this->padding = 5; | |
161 | + } | |
162 | + | |
163 | + /** | |
164 | + * @param int $int_largura | |
165 | + */ | |
166 | + function setLargura($int_largura) | |
167 | + { | |
168 | + $this->largura_externa = $int_largura; | |
169 | + | |
170 | + if ($int_largura > 250) { | |
171 | + $this->largura_interna = $this->largura_externa - 121; | |
172 | + } | |
173 | + else { | |
174 | + $this->largura_interna = '40%'; | |
175 | + } | |
176 | + | |
177 | + $this->padding = floor((($int_largura - 30) / 7 ) / 10) * 2; | |
178 | + } | |
179 | + | |
180 | + /** | |
181 | + * @param array $arr_dias | |
182 | + * @param array $array_mensagem_dias | |
183 | + */ | |
184 | + function diaDescricao($arr_dias, $array_mensagem_dias) | |
185 | + { | |
186 | + if (is_array($arr_dias)) { | |
187 | + foreach ($arr_dias as $key => $dia) { | |
188 | + $this->array_div_flutuante_dias[$key] = $array_mensagem_dias[$key]; | |
189 | + } | |
190 | + } | |
191 | + } | |
192 | + | |
193 | + /** | |
194 | + * @param array $arr_dias | |
195 | + * @param array $array_onclick_dias | |
196 | + */ | |
197 | + function diaOnClick($arr_dias, $array_onclick_dias) | |
198 | + { | |
199 | + if (is_array($arr_dias)) { | |
200 | + foreach ($arr_dias as $key => $dia) { | |
201 | + $this->array_onclick_dias[$dia][] = $array_onclick_dias[$key]; | |
202 | + } | |
203 | + } | |
204 | + } | |
205 | + | |
206 | + /** | |
207 | + * @param array $arr_dias | |
208 | + * @param string $id_icone | |
209 | + */ | |
210 | + function adicionarIconeDias($arr_dias, $id_icone) | |
211 | + { | |
212 | + if (is_array($arr_dias)) { | |
213 | + foreach ($arr_dias as $key => $dia) { | |
214 | + if (key_exists($id_icone,$this->array_icone)) { | |
215 | + $this->array_icone_dias[$dia] = $id_icone; | |
216 | + $this->array_icone[$id_icone]['utilizado'] = TRUE; | |
217 | + } | |
218 | + } | |
219 | + } | |
220 | + } | |
221 | + | |
222 | + /** | |
223 | + * @param string $str_legenda | |
224 | + * @param string $str_cor | |
225 | + */ | |
226 | + function adicionarLegenda($str_legenda, $str_cor) | |
227 | + { | |
228 | + $key = array_search($str_legenda, $this->array_legenda); | |
229 | + | |
230 | + if (!empty($key)) | |
231 | + if($this->array_legenda[$key] == $str_legenda) | |
232 | + return; | |
233 | + | |
234 | + $this->array_legenda[] = $str_legenda; | |
235 | + $str_cor = strtoupper($str_cor); | |
236 | + $this->array_cor[] = $this->COR[$str_cor]; | |
237 | + } | |
238 | + | |
239 | + /** | |
240 | + * @param string $str_legenda | |
241 | + * @param string $str_cor | |
242 | + */ | |
243 | + function setLegendaPadrao($str_legenda, $str_cor = '#F7F7F7') | |
244 | + { | |
245 | + $this->array_legenda[0] = $str_legenda; | |
246 | + $this->array_cor[0] = $this->COR[$str_cor]; | |
247 | + } | |
248 | + | |
249 | + /** | |
250 | + * @param array $arr_dia_semana | |
251 | + * @param string $str_cor | |
252 | + */ | |
253 | + function setCorDiaSemana($arr_dia_semana, $str_cor) | |
254 | + { | |
255 | + $str_cor = strtoupper($str_cor); | |
256 | + | |
257 | + if (is_array($arr_dia_semana)) | |
258 | + foreach ($arr_dia_semana as $dia) { | |
259 | + $this->array_cor_dia_padrao[$dia] = $this->COR[$str_cor]; | |
260 | + } | |
261 | + else { | |
262 | + $this->array_cor_dia_padrao["{$arr_dia_semana}"] = $str_cor; | |
263 | + } | |
264 | + } | |
265 | + | |
266 | + /** | |
267 | + * Adiciona os dias do mês com a sua legenda. | |
268 | + * @param string $str_cod_legenda | |
269 | + * @param int $dias | |
270 | + */ | |
271 | + function adicionarArrayDias($str_cod_legenda, $dias) | |
272 | + { | |
273 | + $key = array_shift(array_keys($this->array_legenda, $str_cod_legenda)); | |
274 | + | |
275 | + foreach ($dias as $dia) { | |
276 | + $dia = (int) $dia; | |
277 | + $this->array_dias[$dia] = $key; | |
278 | + } | |
279 | + | |
280 | + ksort($this->array_dias); | |
281 | + } | |
282 | + | |
283 | + /** | |
284 | + * Retorna o código HTML do calendário. | |
285 | + * | |
286 | + * Parte do código foi baseada em um tutorial antigo disponível | |
287 | + * no site da Zend. A URL original não existe mais mas, parte do | |
288 | + * código foi preservado por um blogueiro no endereço <http://miud.in/7NM>. | |
289 | + * Não existe informação de licenciamento relevante. | |
290 | + * | |
291 | + * @link http://miud.in/7NM Código fonte da geração de calendário | |
292 | + * @param int $mes | |
293 | + * @param int $ano | |
294 | + * @param string $nome | |
295 | + * @param mixed mixVariaveisMantidas | |
296 | + * @return string | |
297 | + * @todo Substituir código de geração de calendário por uma biblioteca | |
298 | + * com licença compatível com GPL2 | |
299 | + */ | |
300 | + function getCalendario($mes, $ano, $nome, $mixVariaveisMantidas) | |
301 | + { | |
302 | + $array_color = $array_color; | |
303 | + $array_legenda = $array_legenda; | |
304 | + | |
305 | + if ( | |
306 | + isset($mixVariaveisMantidas["{$nome}_mes"]) && | |
307 | + is_numeric($mixVariaveisMantidas["{$nome}_mes"]) | |
308 | + ) { | |
309 | + $mes = $mixVariaveisMantidas["{$nome}_mes"]; | |
310 | + } | |
311 | + | |
312 | + if( | |
313 | + isset($mixVariaveisMantidas["{$nome}_ano"]) && | |
314 | + is_numeric($mixVariaveisMantidas["{$nome}_ano"]) && | |
315 | + $this->permite_trocar_ano == true | |
316 | + ) { | |
317 | + $ano = $mixVariaveisMantidas["{$nome}_ano"]; | |
318 | + } | |
319 | + | |
320 | + // Array com todos os dias da semana | |
321 | + $diasDaSemana = array('DOM', 'SEG', 'TER', 'QUA', 'QUI', 'SEX', 'SAB'); | |
322 | + | |
323 | + $mesesDoAno = array( | |
324 | + '1' => 'JANEIRO', | |
325 | + '2' => 'FEVEREIRO', | |
326 | + '3' => 'MARÇO', | |
327 | + '4' => 'ABRIL', | |
328 | + '5' => 'MAIO', | |
329 | + '6' => 'JUNHO', | |
330 | + '7' => 'JULHO', | |
331 | + '8' => 'AGOSTO', | |
332 | + '9' => 'SETEMBRO', | |
333 | + '10' => 'OUTUBRO', | |
334 | + '11' => 'NOVEMBRO', | |
335 | + '12' => 'DEZEMBRO' | |
336 | + ); | |
337 | + | |
338 | + // Qual o primeiro dia do mes | |
339 | + $primeiroDiaDoMes = mktime(0, 0, 0, $mes, 1, $ano); | |
340 | + | |
341 | + // Quantos dias tem o mes | |
342 | + $NumeroDiasMes = date('t', $primeiroDiaDoMes); | |
343 | + | |
344 | + // Retrieve some information about the first day of the | |
345 | + // month in question. | |
346 | + $dateComponents = getdate($primeiroDiaDoMes); | |
347 | + | |
348 | + // What is the name of the month in question? | |
349 | + $NomeMes = $mesesDoAno[$dateComponents['mon']]; | |
350 | + | |
351 | + // What is the index value (0-6) of the first day of the | |
352 | + // month in question. | |
353 | + $DiaSemana = $dateComponents['wday']; | |
354 | + | |
355 | + // Create the table tag opener and day headers | |
356 | + // GET | |
357 | + $linkFixo = $strUrl . "?"; | |
358 | + if (is_array($mixVariaveisMantidas)) { | |
359 | + foreach ($mixVariaveisMantidas as $key => $value) { | |
360 | + if ($key != "{$nome}_mes" && $key != "{$nome}_ano") { | |
361 | + $linkFixo .= $key=$value . '&'; | |
362 | + } | |
363 | + } | |
364 | + } | |
365 | + else { | |
366 | + if (is_string($mixVariaveisMantidas)) { | |
367 | + $linkFixo .= "$mixVariaveisMantidas&"; | |
368 | + } | |
369 | + } | |
370 | + | |
371 | + $linkFixo = $linkFixo == '?' ? '' : $linkFixo; | |
372 | + | |
373 | + if ($mes == 12) { | |
374 | + if ($this->permite_trocar_ano) { | |
375 | + $mes_posterior_mes = 1; | |
376 | + $mes_anterior_mes = 11; | |
377 | + $ano_posterior_mes = $ano + 1; | |
378 | + $ano_anterior_mes = $ano; | |
379 | + | |
380 | + $mes_ano = $mes; | |
381 | + $ano_posterior_ano = $ano + 1; | |
382 | + $ano_anterior_ano = $ano - 1; | |
383 | + } | |
384 | + else { | |
385 | + $mes_posterior_mes = 1; | |
386 | + $mes_anterior_mes = 11; | |
387 | + $ano_posterior_mes = $ano; | |
388 | + $ano_anterior_mes = $ano; | |
389 | + } | |
390 | + } | |
391 | + elseif ($mes == 1) { | |
392 | + if ($this->permite_trocar_ano) { | |
393 | + $mes_posterior_mes = 2; | |
394 | + $mes_anterior_mes = 12; | |
395 | + $ano_posterior_mes = $ano; | |
396 | + $ano_anterior_mes = $ano - 1; | |
397 | + | |
398 | + $mes_ano = $mes; | |
399 | + $ano_posterior_ano = $ano + 1; | |
400 | + $ano_anterior_ano = $ano - 1; | |
401 | + } | |
402 | + else { | |
403 | + $mes_posterior_mes = 2; | |
404 | + $mes_anterior_mes = 12; | |
405 | + $ano_posterior_mes = $ano; | |
406 | + $ano_anterior_mes = $ano; | |
407 | + } | |
408 | + } | |
409 | + else { | |
410 | + if ($this->permite_trocar_ano) { | |
411 | + $mes_posterior_mes = $mes + 1; | |
412 | + $mes_anterior_mes = $mes - 1; | |
413 | + $ano_posterior_mes = $ano; | |
414 | + $ano_anterior_mes = $ano; | |
415 | + | |
416 | + $mes_ano = $mes; | |
417 | + $ano_posterior_ano = $ano + 1; | |
418 | + $ano_anterior_ano = $ano - 1; | |
419 | + } | |
420 | + else { | |
421 | + $mes_posterior_mes = $mes + 1; | |
422 | + $mes_anterior_mes = $mes - 1; | |
423 | + $ano_posterior_mes = $ano; | |
424 | + $ano_anterior_mes = $ano; | |
425 | + } | |
426 | + } | |
427 | + | |
428 | + $form = sprintf(' | |
429 | + <form id="form_calendario" name="form_calendario" method="post" action="%s"> | |
430 | + <input type="hidden" id="nome" name="nome" value=""> | |
431 | + <input type="hidden" id="dia" name="dia" value=""> | |
432 | + <input type="hidden" id="mes" name="mes" value=""> | |
433 | + <input type="hidden" id="ano" name="ano" value=""> | |
434 | + </form>', $linkFixo); | |
435 | + | |
436 | + if ($this->permite_trocar_ano == TRUE) { | |
437 | + $select = sprintf( | |
438 | + '<select name="mes" id="smes" onchange="acaoCalendario(\'%s\', \'\', this.value, \'%s\');">', | |
439 | + $nome, $ano | |
440 | + ); | |
441 | + | |
442 | + foreach ($mesesDoAno as $key => $mes_) { | |
443 | + $selected = ($dateComponents['mon'] == $key) ? 'selected="selected"' : ''; | |
444 | + $select .= sprintf( | |
445 | + '<option value="%s" %s>%s</option>', | |
446 | + $key, $selected, $mes_ | |
447 | + ); | |
448 | + } | |
449 | + | |
450 | + $select .= '</select>'; | |
451 | + | |
452 | + $cab = array(); | |
453 | + $cab[] = sprintf(' | |
454 | + <a href="#" onclick="acaoCalendario(\'%s\', \'\', \'%s\', \'%s\')"> | |
455 | + <img src="/intranet/imagens/i-educar/seta_esq.gif" border="0" style="margin-right: 5px;" alt="Mês Anterior"> | |
456 | + </a> | |
457 | + %s', | |
458 | + $nome, $mes_anterior_mes, $ano_anterior_mes, $select); | |
459 | + | |
460 | + $cab[] = sprintf(' | |
461 | + <a href="#" onclick="acaoCalendario(\'%s\', \'\', \'%s\', \'%s\')"> | |
462 | + <img src="/intranet/imagens/i-educar/seta_dir.gif" border="0" style="margin-left: 5px;" alt="Mês Posterior"> | |
463 | + </a>', | |
464 | + $nome, $mes_posterior_mes, $ano_posterior_mes); | |
465 | + | |
466 | + $cab[] = sprintf(' | |
467 | + <a href="#" onclick="acaoCalendario(\'%s\', \'\', \'%s\', \'%s\')"> | |
468 | + <img src="/intranet/imagens/i-educar/seta_esq.gif" border="0" style="margin-right: 5px;" alt="Mês Anterior"> | |
469 | + </a> | |
470 | + %s | |
471 | + ', $nome, $mes_ano, $ano_anterior_ano, $ano); | |
472 | + | |
473 | + $cab[] = sprintf(' | |
474 | + <a href="#" onclick="acaoCalendario(\'%s\', \'\', \'%s\', \'%s\')"> | |
475 | + <img src="/intranet/imagens/i-educar/seta_dir.gif" border="0" style="margin-left: 5px;" alt="Mês Posterior"> | |
476 | + </a>', | |
477 | + $nome, $mes_ano, $ano_posterior_ano); | |
478 | + | |
479 | + $cab = implode("\n", $cab); | |
480 | + } | |
481 | + else { | |
482 | + $cab = array(); | |
483 | + | |
484 | + $cab[] = sprintf(' | |
485 | + <a href="javascript:void(1);" onclick="acaoCalendario(\'%s\',\'\',\'%s\',\'%s\')"> | |
486 | + <img src="/intranet/imagens/i-educar/seta_esq.gif" border="0" style="margin-right: 5px;" alt="Mês Anterior"> | |
487 | + </a> | |
488 | + %s | |
489 | + %s', | |
490 | + $nome, $mes_anterior_mes, $ano_anterior_mes, $NomeMes, $ano | |
491 | + ); | |
492 | + | |
493 | + $cab[] = sprintf(' | |
494 | + <a href="#" onclick="acaoCalendario(\'%s\', \'\', \'%s\', \'%s\')"> | |
495 | + <img src="/intranet/imagens/i-educar/seta_dir.gif" border="0" style="margin-left: 5px;" alt="Mês Posterior"> | |
496 | + </a>', | |
497 | + $nome, $mes_posterior_mes, $ano_anterior_mes); | |
498 | + | |
499 | + $cab = implode("\n", $cab); | |
500 | + } | |
501 | + | |
502 | + $calendario = sprintf(' | |
503 | + <div id="d_calendario"> | |
504 | + <table class="calendar" cellspacing="0" cellpadding="0" width="%s" border="0">', | |
505 | + $this->largura_externa | |
506 | + ); | |
507 | + | |
508 | + $calendario .= sprintf(' | |
509 | + <tr> | |
510 | + <td class="cal_esq"> </td> | |
511 | + <td background="/intranet/imagens/i-educar/cal_bg.gif" width="100%%" class="mes">%s</td> | |
512 | + <td align="right" class="cal_dir"> </td> | |
513 | + </tr>', | |
514 | + $cab | |
515 | + ); | |
516 | + | |
517 | + $calendario .= sprintf('<tr><td colspan="3" class="bordaM">%s', $form); | |
518 | + $calendario .= '<table cellspacing="0" cellpadding="0" width="100%%" border="0" class="header"><tr>'; | |
519 | + | |
520 | + // Create the calendar headers | |
521 | + foreach($diasDaSemana as $day) { | |
522 | + if (end($diasDaSemana) == $day) { | |
523 | + $calendario .= sprintf('<td style="width: 45px;">%s</td>', $day); | |
524 | + } | |
525 | + else { | |
526 | + $calendario .= sprintf( | |
527 | + '<td style="border-right: 1px dotted #FFFFFF; width: 45px;">%s</td>', $day | |
528 | + ); | |
529 | + } | |
530 | + } | |
531 | + | |
532 | + $calendario .= '</tr>'; | |
533 | + $calendario .= '</table>'; | |
534 | + $calendario .= '</td></tr>'; | |
535 | + | |
536 | + $calendario .= '<tr><td colspan="3" style="padding: 3px" valign="top" class="bordaF">'; | |
537 | + $calendario .= '<table cellspacing="5" cellpadding="0" width="100%">'; | |
538 | + | |
539 | + // Create the rest of the calendar | |
540 | + // Initiate the day counter, starting with the 1st. | |
541 | + $diaCorrente = 1; | |
542 | + $calendario .= '<tr>'; | |
543 | + | |
544 | + // The variable $DiaSemana is used to | |
545 | + // ensure that the calendar | |
546 | + // display consists of exactly 7 columns. | |
547 | + if ($DiaSemana > 0) { | |
548 | + $completar_dias = $DiaSemana; | |
549 | + $ts = mktime(0, 0, 0, $dateComponents['mon'], -$completar_dias + 1, $dateComponents['year']); | |
550 | + $day = date('d', $ts); | |
551 | + | |
552 | + for ($a = 0; $a < $completar_dias; $a++) { | |
553 | + $calendario .= sprintf( | |
554 | + '<td class="dayLastMonth" style="padding-left:%spx;">%s</td>', | |
555 | + $this->padding, $day | |
556 | + ); | |
557 | + | |
558 | + $day++; | |
559 | + } | |
560 | + } | |
561 | + | |
562 | + while ($diaCorrente <= $NumeroDiasMes) { | |
563 | + // Seventh column (Saturday) reached. Start a new row. | |
564 | + if ($DiaSemana == 7) { | |
565 | + $DiaSemana = 0; | |
566 | + $calendario .= '</tr><tr>'; | |
567 | + } | |
568 | + | |
569 | + $style_dia = sprintf('background-color: %s;', $this->array_cor[0]); | |
570 | + | |
571 | + if ($this->array_cor_dia_padrao[$DiaSemana]) | |
572 | + $style_dia = sprintf('background-color: %s;', $this->array_cor_dia_padrao[$DiaSemana]); | |
573 | + | |
574 | + if (key_exists($diaCorrente,$this->array_dias)) { | |
575 | + $key = $this->array_dias[$diaCorrente]; | |
576 | + $cor = $this->array_cor[$key]; | |
577 | + $style_dia = sprintf('background-color: %s;', $cor); | |
578 | + } | |
579 | + | |
580 | + $onclick = ''; | |
581 | + | |
582 | + if ($this->all_days_onclick) { | |
583 | + $onclick = sprintf('onclick="%s"', $this->all_days_onclick); | |
584 | + } | |
585 | + elseif ($this->all_days_url) { | |
586 | + $onclick = sprintf( | |
587 | + 'onclick="document.location=\'%s&dia=%s&mes=%s&ano=%s\';"', | |
588 | + $this->all_days_url, $diaCorrente, $mes, $ano | |
589 | + ); | |
590 | + } | |
591 | + | |
592 | + if (key_exists($diaCorrente,$this->array_onclick_dias)) { | |
593 | + $onclick = sprintf('onclick="%s;"', $this->array_onclick_dias[$diaCorrente]); | |
594 | + } | |
595 | + | |
596 | + $icone = ''; | |
597 | + | |
598 | + if (key_exists($diaCorrente, $this->array_icone_dias)) { | |
599 | + $icone = sprintf( | |
600 | + '<img src="%s" border="0" align="right" alt="%s" style="padding-right: 5px;">', | |
601 | + $this->array_icone[$this->array_icone_dias[$diaCorrente]]['link'], | |
602 | + $this->array_icone[$this->array_icone_dias[$diaCorrente]]['nome'] | |
603 | + ); | |
604 | + } | |
605 | + | |
606 | + $message = ''; | |
607 | + $diaCorrente_ = strlen($diaCorrente) == 1 ? '0' . $diaCorrente : $diaCorrente; | |
608 | + $NomeMes = strtolower($NomeMes); | |
609 | + | |
610 | + if (key_exists($diaCorrente,$this->array_div_flutuante_dias)) { | |
611 | + $message = "onmouseover=\"ShowContent('{$diaCorrente}','{$mes}','{$ano}','{$nome}'); return true;\""; | |
612 | + $mouseout = "onmouseout=\"HideContent(event,'{$diaCorrente}','{$mes}','{$ano}','{$nome}')\" "; | |
613 | + $mensagens .= " | |
614 | + <div $mouseout class='div_info' style='display:none; z-index: 10;' id=\"{$nome}_div_dia_{$diaCorrente}{$mes}{$ano}\"> | |
615 | + <div style='margin:0px 15px 0px 0px;font-size: 14px; z-index: 0; border-bottom: 1px solid #000000;'>{$diaCorrente_} de {$NomeMes} de $ano | |
616 | + </div> | |
617 | + <div style='align:left;padding-top:5px;z-index: 0;' class='dia'> | |
618 | + {$this->array_div_flutuante_dias[$diaCorrente]} | |
619 | + </div> | |
620 | + </div>"; | |
621 | + } | |
622 | + | |
623 | + $calendario .= sprintf(" | |
624 | + <td style='%s padding-left: %spx;' id='%s_td_dia_%s%s%s' class='day' %s %s> | |
625 | + %s %s | |
626 | + </td>", | |
627 | + $style_dia, $this->padding, $nome, $diaCorrente, $mes, $ano, $onclick, $message, | |
628 | + $icone, $diaCorrente_); | |
629 | + | |
630 | + // Increment counters | |
631 | + $diaCorrente++; | |
632 | + $DiaSemana++; | |
633 | + } | |
634 | + | |
635 | + // Complete the row of the last week in month, if necessary | |
636 | + if ($DiaSemana != 7) { | |
637 | + $remainingDays = 7 - $DiaSemana; | |
638 | + | |
639 | + for ($a = 1 ; $a <= $remainingDays ; $a++) { | |
640 | + //dayLastMonth | |
641 | + $calendario .= sprintf(' | |
642 | + <td class="dayLastMonth" style="padding-left:%spx;">%s</td>', | |
643 | + $this->padding, $a | |
644 | + ); | |
645 | + } | |
646 | + } | |
647 | + | |
648 | + if ($this->array_legenda) { | |
649 | + $calendario .= '<tr><td colspan="7">'; | |
650 | + $calendario .= ' | |
651 | + <table cellspacing="2" cellpadding="0" class="legenda" width="100%"> | |
652 | + <tr>'; | |
653 | + | |
654 | + $cont = 0; | |
655 | + | |
656 | + foreach ($this->array_legenda as $key => $legenda) { | |
657 | + $style = sprintf( | |
658 | + 'style="background-color: %s;"', $this->array_cor[$key] | |
659 | + ); | |
660 | + | |
661 | + $calendario .= sprintf( | |
662 | + '<td %s class="cor"> </td><td>%s</td>', $style, $legenda | |
663 | + ); | |
664 | + | |
665 | + $cont++; | |
666 | + | |
667 | + if ($cont == 3) { | |
668 | + $calendario .= '</tr><tr>'; | |
669 | + $cont = 0; | |
670 | + } | |
671 | + } | |
672 | + | |
673 | + $calendario .= '</tr></table>'; | |
674 | + $calendario .= '</td></tr>'; | |
675 | + } | |
676 | + | |
677 | + if ($this->array_icone_dias) { | |
678 | + $calendario .= '<tr><td colspan="7">'; | |
679 | + $calendario .= '<table cellspacing="2" cellpadding="0" class="legenda" width="100%"> | |
680 | + <tr align="left">'; | |
681 | + | |
682 | + $cont = 0; | |
683 | + | |
684 | + foreach ($this->array_icone as $key => $legenda) { | |
685 | + if ($legenda['utilizado']) { | |
686 | + $style = sprintf('style="background-color: %s;"', $this->array_cor[$key]); | |
687 | + $icone = ''; | |
688 | + | |
689 | + $icone = sprintf( | |
690 | + '<img src="%s" border="0" align="left" alt="%s" style="padding-right: 5px;">', | |
691 | + $this->array_icone[$key]['link'], $this->array_icone[$key]['nome'] | |
692 | + ); | |
693 | + | |
694 | + $calendario .= sprintf( | |
695 | + '<td %s align="left"></td><td width="100%%">%s %s</td>', | |
696 | + $style, $icone, $legenda['nome'] | |
697 | + ); | |
698 | + | |
699 | + $cont++; | |
700 | + | |
701 | + if ($cont == 3) { | |
702 | + $calendario .= '</tr><tr>'; | |
703 | + $cont = 0; | |
704 | + } | |
705 | + } | |
706 | + } | |
707 | + | |
708 | + $calendario .= '</tr></table>'; | |
709 | + $calendario .= '</td></tr>'; | |
710 | + } | |
711 | + | |
712 | + $calendario .= '</table>'; | |
713 | + $calendario .= '</td></tr>'; | |
714 | + $calendario .= '</table></div>'; | |
715 | + | |
716 | + $calendario .= $mensagens; | |
717 | + | |
718 | + return $calendario; | |
719 | + } | |
720 | +} | |
664 | 721 | \ No newline at end of file | ... | ... |
ieducar/intranet/educar_calendario_ano_letivo_lst.php
... | ... | @@ -270,6 +270,7 @@ class indice extends clsConfig |
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
273 | + | |
273 | 274 | // Monta a lista |
274 | 275 | if (is_array($lista) && count($lista)) { |
275 | 276 | foreach ($lista as $key => $registro) { |
... | ... | @@ -300,6 +301,7 @@ class indice extends clsConfig |
300 | 301 | |
301 | 302 | $inicio_ano = explode('/', dataFromPgToBr($inicio_ano)); |
302 | 303 | $fim_ano = explode('/', dataFromPgToBr($fim_ano)); |
304 | + | |
303 | 305 | $obj_calendario = new clsCalendario(); |
304 | 306 | $obj_calendario->setLargura(600); |
305 | 307 | $obj_calendario->permite_trocar_ano = TRUE; | ... | ... |
ieducar/intranet/scripts/calendario.js
1 | - | |
2 | -var isIE = (navigator.appName.indexOf("Microsoft")!= -1) ? 1:0 | |
3 | -if(!isIE) | |
4 | - window.addEventListener("resize", updateMessagePosition, false); | |
5 | -else | |
6 | - window.onresize = updateMessagePosition; | |
7 | -//body.onresize = updateMessagePosit//ion; | |
8 | - | |
9 | -function updateMessagePosition(){ | |
10 | - | |
11 | - if(!last_td) | |
12 | - return; | |
13 | - tamanhoTela(); | |
14 | - var subtract; | |
15 | - | |
16 | - if(findPosX(last_td) > winW/2){ | |
17 | - if(navigator.appName.indexOf("Microsoft") == 0 ){ | |
18 | - subtract = -317 + 45 +20; | |
19 | - }else{ | |
20 | - subtract = -317 + 45; | |
21 | - } | |
22 | - | |
23 | - }else{ | |
24 | - | |
25 | - subtract = 2; | |
26 | - | |
27 | - } | |
28 | - | |
29 | - last.style.left = (findPosX(last_td)+subtract) + "px"; | |
30 | - | |
31 | - last.style.top = (findPosY(last_td)+2) + "px"; | |
32 | - | |
1 | +/** | |
2 | + * i-Educar - Sistema de gestão escolar | |
3 | + * | |
4 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
5 | + * <ctima@itajai.sc.gov.br> | |
6 | + * | |
7 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
8 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
9 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
10 | + * qualquer versão posterior. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
13 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
14 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
15 | + * do GNU para mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
18 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
19 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
20 | + * | |
21 | + * Parte do código foi baseada em um tutorial antigo disponível | |
22 | + * no site da Zend. A URL original não existe mais mas, parte do | |
23 | + * código foi preservado por um blogueiro no endereço <http://miud.in/7NM>. | |
24 | + * Não existe informação de licenciamento relevante. Veja o arquivo | |
25 | + * intranet/clsCalendario.inc.php para mais informações. | |
26 | + * | |
27 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
28 | + * @category i-Educar | |
29 | + * @license @@license@@ | |
30 | + * @since Arquivo disponível desde a versão 1.0.0 | |
31 | + * @version $Id$ | |
32 | + */ | |
33 | + | |
34 | +var isIE = (navigator.appName.indexOf('Microsoft')!= -1) ? 1 : 0 | |
35 | + | |
36 | +if (! isIE) { | |
37 | + window.addEventListener('resize', updateMessagePosition, false); | |
38 | +} | |
39 | +else { | |
40 | + window.onresize = updateMessagePosition; | |
33 | 41 | } |
34 | 42 | |
35 | -if(document.createStyleSheet){ | |
36 | - document.createStyleSheet('styles/calendario.css'); | |
43 | +function updateMessagePosition() | |
44 | +{ | |
45 | + if (! last_td) { | |
46 | + return; | |
47 | + } | |
37 | 48 | |
38 | - }else{ | |
39 | - var objHead = document.getElementsByTagName('head'); | |
40 | - var objCSS = objHead[0].appendChild(document.createElement('link')); | |
41 | - //objCSS = document.createElement('link'); | |
42 | - objCSS.rel = 'stylesheet'; | |
43 | - objCSS.href = 'styles/calendario.css'; | |
44 | - objCSS.type = 'text/css'; | |
49 | + tamanhoTela(); | |
50 | + var subtract; | |
45 | 51 | |
52 | + if (findPosX(last_td) > winW / 2) { | |
53 | + if (navigator.appName.indexOf('Microsoft') == 0) { | |
54 | + subtract = -317 + 45 +20; | |
55 | + } | |
56 | + else { | |
57 | + subtract = -317 + 45; | |
58 | + } | |
59 | + } | |
60 | + else { | |
61 | + subtract = 2; | |
62 | + } | |
46 | 63 | |
47 | - } | |
64 | + last.style.left = (findPosX(last_td) + subtract) + 'px'; | |
65 | + last.style.top = (findPosY(last_td) + 2) + 'px'; | |
66 | +} | |
48 | 67 | |
49 | -function init(){ | |
68 | +if (document.createStyleSheet) { | |
69 | + document.createStyleSheet('styles/calendario.css'); | |
70 | +} | |
71 | +else { | |
72 | + var objHead = document.getElementsByTagName('head'); | |
73 | + var objCSS = objHead[0].appendChild(document.createElement('link')); | |
50 | 74 | |
51 | - var div_calendario = document.getElementById('d_calendario'); | |
75 | + objCSS.rel = 'stylesheet'; | |
76 | + objCSS.href = 'styles/calendario.css'; | |
77 | + objCSS.type = 'text/css'; | |
78 | +} | |
52 | 79 | |
53 | - if(!div_calendario) | |
54 | - return; | |
55 | - // Internet Explorer: | |
56 | - if (document.all) | |
57 | - div_calendario.onselectstart = function () {return false; }; | |
80 | +function init() | |
81 | +{ | |
82 | + var div_calendario = document.getElementById('d_calendario'); | |
58 | 83 | |
59 | - // Netscape 4: | |
60 | - if (document.layers) { | |
61 | - document.captureEvents(Event.MOUSEDOWN); | |
62 | - div_calendario.onmousedown =function (evt) { return false; }; | |
63 | - } | |
84 | + if (! div_calendario) { | |
85 | + return; | |
86 | + } | |
64 | 87 | |
65 | - // Netscape 6: | |
66 | - div_calendario.onmousedown = function () { return false; }; | |
88 | + // Internet Explorer: | |
89 | + if (document.all) { | |
90 | + div_calendario.onselectstart = function () { return false; }; | |
91 | + } | |
67 | 92 | |
93 | + // Netscape 4: | |
94 | + if (document.layers) { | |
95 | + document.captureEvents(Event.MOUSEDOWN); | |
96 | + div_calendario.onmousedown = function (evt) { | |
97 | + return false; | |
98 | + }; | |
99 | + } | |
68 | 100 | |
101 | + // Netscape 6: | |
102 | + div_calendario.onmousedown = function () { | |
103 | + return false; | |
104 | + }; | |
69 | 105 | } |
106 | + | |
70 | 107 | window.onload = init; |
71 | 108 | |
109 | +var cX = 0; | |
110 | +var cY = 0; | |
72 | 111 | |
73 | -var cX = 0; var cY = 0; | |
74 | 112 | var last; |
75 | 113 | var last_td; |
76 | 114 | var fechou = false; |
77 | -//function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;} | |
78 | -//function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;} | |
79 | -//if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; } | |
80 | -//else { document.onmousemove = UpdateCursorPosition; } | |
81 | - //var screen_width = screen.availWidth; | |
82 | -//alert(parent.innerWidth); | |
83 | - | |
84 | -function AssignPosition(d,m,y,nome) { | |
85 | - | |
86 | - var dd = document.getElementById(nome + '_td_dia_' + d + '' + m + '' + y); | |
87 | - var d = document.getElementById(nome + '_div_dia_' + d + '' + m + '' + y); | |
88 | - last_td = dd; | |
89 | - tamanhoTela(); | |
90 | - var subtract; | |
91 | 115 | |
92 | - if(findPosX(dd) > winW/2){ | |
93 | - | |
94 | - if(navigator.appName.indexOf("Microsoft") == 0 ){ | |
95 | - subtract = -317 + 72 + 20; | |
96 | - }else{ | |
97 | - subtract = -317 + 72; | |
98 | - //45 | |
99 | - } | |
116 | +function AssignPosition(d,m,y,nome) | |
117 | +{ | |
118 | + var dd = document.getElementById(nome + '_td_dia_' + d + '' + m + '' + y); | |
119 | + var d = document.getElementById(nome + '_div_dia_' + d + '' + m + '' + y); | |
100 | 120 | |
101 | - }else{ | |
121 | + last_td = dd; | |
122 | + tamanhoTela(); | |
102 | 123 | |
103 | - subtract = 2; | |
124 | + var subtract; | |
104 | 125 | |
105 | - } | |
126 | + if (findPosX(dd) > winW/2) { | |
127 | + if (navigator.appName.indexOf('Microsoft') == 0) { | |
128 | + subtract = -317 + 72 + 20; | |
129 | + } | |
130 | + else { | |
131 | + subtract = -317 + 72; | |
132 | + } | |
133 | + } | |
134 | + else { | |
135 | + subtract = 2; | |
136 | + } | |
106 | 137 | |
107 | - d.style.left = (findPosX(dd)+subtract) + "px"; | |
138 | + d.style.left = (findPosX(dd) + subtract) + 'px'; | |
108 | 139 | |
109 | - d.style.top = (findPosY(dd)+2) + "px"; | |
140 | + d.style.top = (findPosY(dd) + 2) + 'px'; | |
110 | 141 | } |
111 | 142 | |
112 | -function HideContent(event,d,m,y,nome) { | |
113 | - | |
114 | - | |
115 | - if(d.length < 1) { | |
116 | - | |
117 | - return; | |
118 | - } | |
143 | +function HideContent(event, d, m, y, nome) | |
144 | +{ | |
145 | + if (d.length < 1) { | |
146 | + return; | |
147 | + } | |
119 | 148 | |
120 | 149 | if (window.event) { |
121 | 150 | current = this; |
... | ... | @@ -124,133 +153,135 @@ function HideContent(event,d,m,y,nome) { |
124 | 153 | else { |
125 | 154 | current = event.currentTarget; |
126 | 155 | related = event.relatedTarget; |
127 | - //alert(current + ' - ' + related ); | |
128 | 156 | } |
129 | - var dv = document.getElementById(nome + '_div_dia_'+ d + '' + m + '' + y); | |
130 | - b = related; | |
131 | - while (b.parentNode){ | |
132 | - if ((b = b.parentNode) == dv && (b.tagName == 'DIV' || b.tagName == 'TD')) | |
133 | - return true; | |
134 | - } | |
135 | - | |
136 | 157 | |
137 | - // document.getElementById(nome + '_div_dia_'+ d + '' + m + '' + y).style.display = "none"; | |
138 | - var nome_div = nome + '_div_dia_'+ d + '' + m + '' + y; | |
158 | + var dv = document.getElementById(nome + '_div_dia_'+ d + '' + m + '' + y); | |
139 | 159 | |
140 | - //alert("esconder(document.getElementById("+nome+" + '_div_dia_'+" + d + "+ '' +" + m + "+ '' +" + y + "))"); | |
141 | - //return; | |
142 | - setTimeout("esconder("+ nome_div + ");",500); | |
160 | + b = related; | |
143 | 161 | |
144 | - setInterval('fechou=false;',1000); | |
145 | -} | |
162 | + while (b.parentNode) { | |
163 | + if ((b = b.parentNode) == dv && (b.tagName == 'DIV' || b.tagName == 'TD')) { | |
164 | + return true; | |
165 | + } | |
166 | + } | |
146 | 167 | |
147 | -function esconder(el){ | |
148 | - fechou = true; | |
149 | - el.style.display = "none"; | |
168 | + var nome_div = nome + '_div_dia_'+ d + '' + m + '' + y; | |
150 | 169 | |
170 | + setTimeout('esconder(' + nome_div + ');', 500); | |
171 | + setInterval('fechou=false;', 1000); | |
151 | 172 | } |
152 | 173 | |
153 | -function ShowContent(d,m,y,nome) { | |
154 | - if(fechou) | |
155 | - return; | |
156 | - var dd = document.getElementById(nome + '_div_dia_' + d + '' + m + '' + y); | |
157 | - if(dd != last && last != null) | |
158 | - last.style.display = "none"; | |
174 | +function esconder(el) | |
175 | +{ | |
176 | + fechou = true; | |
177 | + el.style.display = 'none'; | |
178 | +} | |
159 | 179 | |
160 | - if(d.length < 1) { | |
161 | - return; | |
162 | - } | |
180 | +function ShowContent(d, m, y, nome) | |
181 | +{ | |
182 | + if (fechou) { | |
183 | + return; | |
184 | + } | |
163 | 185 | |
164 | - var dd = document.getElementById(nome + '_div_dia_' + d + '' + m + '' + y); | |
186 | + var dd = document.getElementById(nome + '_div_dia_' + d + '' + m + '' + y); | |
165 | 187 | |
166 | - AssignPosition(d,m,y,nome); | |
188 | + if (dd != last && last != null) { | |
189 | + last.style.display = 'none'; | |
190 | + } | |
167 | 191 | |
168 | - dd.style.display = ""; | |
192 | + if (d.length < 1) { | |
193 | + return; | |
194 | + } | |
169 | 195 | |
170 | - last = dd; | |
196 | + var dd = document.getElementById(nome + '_div_dia_' + d + '' + m + '' + y); | |
171 | 197 | |
198 | + AssignPosition(d, m, y, nome); | |
199 | + dd.style.display = ''; | |
200 | + last = dd; | |
172 | 201 | } |
173 | 202 | |
174 | -function ReverseContentDisplay(d,m,y,nome) { | |
175 | - | |
176 | - if(d.length < 1) { | |
177 | - return; | |
178 | - } | |
203 | +function ReverseContentDisplay(d, m, y, nome) | |
204 | +{ | |
205 | + if (d.length < 1) { | |
206 | + return; | |
207 | + } | |
179 | 208 | |
180 | - var dd = document.getElementById(nome + '_div_dia_' + d + '' + m + '' + y); | |
209 | + var dd = document.getElementById(nome + '_div_dia_' + d + '' + m + '' + y); | |
181 | 210 | |
182 | - AssignPosition(dd); | |
211 | + AssignPosition(dd); | |
183 | 212 | |
184 | - if(dd.style.display == "none") { | |
185 | - dd.style.display = ""; | |
186 | - } | |
187 | - else { | |
188 | - dd.style.display = "none"; | |
189 | - } | |
213 | + if (dd.style.display == 'none') { | |
214 | + dd.style.display = ''; | |
215 | + } | |
216 | + else { | |
217 | + dd.style.display = 'none'; | |
218 | + } | |
190 | 219 | } |
191 | 220 | |
192 | - | |
193 | 221 | function findPosX(obj) |
194 | 222 | { |
195 | - var curleft = 0; | |
196 | - if (obj.offsetParent) | |
197 | - { | |
198 | - while (obj.offsetParent) | |
199 | - { | |
200 | - curleft += obj.offsetLeft | |
201 | - obj = obj.offsetParent; | |
202 | - } | |
203 | - } | |
204 | - else if (obj.x) | |
205 | - curleft += obj.x; | |
206 | - return curleft; | |
223 | + var curleft = 0; | |
224 | + | |
225 | + if (obj.offsetParent) { | |
226 | + while (obj.offsetParent) { | |
227 | + curleft += obj.offsetLeft | |
228 | + obj = obj.offsetParent; | |
229 | + } | |
230 | + } | |
231 | + else if (obj.x) { | |
232 | + curleft += obj.x; | |
233 | + } | |
234 | + | |
235 | + return curleft; | |
207 | 236 | } |
208 | 237 | |
209 | 238 | function findPosY(obj) |
210 | 239 | { |
211 | - var curtop = 0; | |
212 | - if (obj.offsetParent) | |
213 | - { | |
214 | - while (obj.offsetParent) | |
215 | - { | |
216 | - curtop += obj.offsetTop | |
217 | - obj = obj.offsetParent; | |
218 | - } | |
219 | - } | |
220 | - else if (obj.y) | |
221 | - curtop += obj.y; | |
222 | - return curtop; | |
240 | + var curtop = 0; | |
241 | + | |
242 | + if (obj.offsetParent) { | |
243 | + while (obj.offsetParent) { | |
244 | + curtop += obj.offsetTop | |
245 | + obj = obj.offsetParent; | |
246 | + } | |
247 | + } | |
248 | + else if (obj.y) { | |
249 | + curtop += obj.y; | |
250 | + } | |
251 | + | |
252 | + return curtop; | |
223 | 253 | } |
254 | + | |
224 | 255 | var winW; |
225 | 256 | var winH; |
257 | + | |
226 | 258 | function tamanhoTela() |
227 | 259 | { |
228 | - if( typeof( window.innerWidth ) == 'number' ) | |
229 | - { | |
230 | - winW = window.innerWidth; | |
231 | - winH = window.innerHeight; | |
232 | - } | |
233 | - else if( document.documentElement && | |
234 | - ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) | |
235 | - { | |
236 | - /* IE 6+ in 'standards compliant mode' */ | |
237 | - winW = document.documentElement.clientWidth; | |
238 | - winH = document.documentElement.clientHeight; | |
239 | - } | |
240 | - else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) | |
241 | - { | |
242 | - /*IE 4 compatible*/ | |
243 | - winW = document.body.clientWidth; | |
244 | - winH = document.body.clientHeight; | |
245 | - } | |
246 | - | |
260 | + if (typeof(window.innerWidth ) == 'number') { | |
261 | + winW = window.innerWidth; | |
262 | + winH = window.innerHeight; | |
263 | + } | |
264 | + else if ( | |
265 | + document.documentElement && | |
266 | + (document.documentElement.clientWidth || document.documentElement.clientHeight) | |
267 | + ) { | |
268 | + /* IE 6+ in 'standards compliant mode' */ | |
269 | + winW = document.documentElement.clientWidth; | |
270 | + winH = document.documentElement.clientHeight; | |
271 | + } | |
272 | + else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { | |
273 | + /*IE 4 compatible*/ | |
274 | + winW = document.body.clientWidth; | |
275 | + winH = document.body.clientHeight; | |
276 | + } | |
247 | 277 | } |
248 | 278 | |
249 | -function acaoCalendario(nome,dia,mes,ano){ | |
279 | +function acaoCalendario(nome, dia, mes, ano) | |
280 | +{ | |
281 | + document.getElementById('nome').value = nome; | |
282 | + document.getElementById('dia').value = dia; | |
283 | + document.getElementById('mes').value = mes; | |
284 | + document.form_calendario.ano.value = ano; | |
250 | 285 | |
251 | - document.getElementById('nome').value = nome; | |
252 | - document.getElementById('dia').value = dia; | |
253 | - document.getElementById('mes').value = mes; | |
254 | - document.form_calendario.ano.value = ano; | |
255 | - document.form_calendario.submit(); | |
286 | + document.form_calendario.submit(); | |
256 | 287 | } |
257 | 288 | \ No newline at end of file | ... | ... |
ieducar/intranet/styles/calendario.css
1 | - .calendar | |
2 | - { | |
3 | - /* font-family:arial,helvetica;*/ | |
4 | - font-family: sans-serif, verdana, arial, "Times New Roman"; | |
5 | - font-size:11px; | |
6 | - color: white; | |
7 | - } | |
8 | - | |
9 | - .cal_esq | |
10 | - { | |
11 | - height: 38px; | |
12 | - background-image: url(/intranet/imagens/i-educar/cal_topo.gif); | |
13 | - background-repeat: no-repeat; | |
14 | - padding-left: 94px; | |
15 | - } | |
16 | - | |
17 | - .header | |
18 | - { | |
19 | - background-color: #A0AAB3; | |
20 | - border-color: #8A959B; | |
21 | - border-style: solid; | |
22 | - border-width: 1px; | |
23 | - color: #ffffff; | |
24 | - font-weight: bold; | |
25 | - font-family: sans-serif, verdana, arial, "Times New Roman"; | |
26 | - font-size: 12px; | |
27 | - height: 24px; | |
28 | - text-align:center; | |
29 | - } | |
30 | - | |
31 | - .day | |
32 | - { | |
33 | - font-size: 12px; | |
34 | - font-family: sans-serif, verdana, arial, "Times New Roman"; | |
35 | - font-weight: bold; | |
36 | - color: #5F5F5F; | |
37 | - border: 1px solid #8A959B; | |
38 | - text-align: left; | |
39 | - height: 25px; | |
40 | - width:50px; | |
41 | - cursor:hand; | |
42 | - cursor:pointer; | |
43 | - | |
44 | - } | |
45 | - | |
46 | - .linkedday | |
47 | - { | |
48 | - font-size: 12px; | |
49 | - font-weight: bold; | |
50 | - color: #5F5F5F; | |
51 | - border: 1px solid #8A959B; | |
52 | - text-align: left; | |
53 | - padding-left:5px; | |
54 | - height: 25px; | |
55 | - | |
56 | - } | |
57 | - | |
58 | - .mes | |
59 | - { | |
60 | - font-size: 14px; | |
61 | - font-family: sans-serif, verdana, arial, "Times New Roman"; | |
62 | - color: #8A959B; | |
63 | - text-align: left; | |
64 | - vertical-align: middle; | |
65 | - font-weight: bold; | |
66 | - padding: 7px 20px 0px 30px; | |
67 | - margin-top: 12px; | |
68 | - } | |
69 | - | |
70 | - .bordaM | |
71 | - { | |
72 | - | |
73 | - border-right: 1px solid #8A959B; | |
74 | - border-left: 1px solid #8A959B; | |
75 | - padding: 8px 8px 0px 8px; | |
76 | - } | |
77 | - | |
78 | - .bordaF | |
79 | - { | |
80 | - border-color: #8A959B; | |
81 | - border-style: solid; | |
82 | - border-width: 0px 1px 1px 1px; | |
83 | - } | |
84 | - | |
85 | - .cal_dir | |
86 | - { | |
87 | - background-image: url(/intranet/imagens/i-educar/cal_dir.gif); | |
88 | - background-repeat: no-repeat; | |
89 | - padding-right: 20px; | |
90 | - background-position: 0px 0px; | |
91 | - } | |
92 | - | |
93 | - .legenda{ | |
94 | - color:black; | |
95 | - font-size: 10px; | |
96 | - font-family: sans-serif, verdana, arial, "Times New Roman"; | |
97 | - border-width: 1px 0px 0px 0px; | |
98 | - border-color: #8A959B; | |
99 | - border-style: solid; | |
100 | - margin-top:3px; | |
101 | - padding-top:3px; | |
102 | - } | |
103 | - | |
104 | - .cor { | |
105 | - border-color: #000000; | |
106 | - border-style: dotted; | |
107 | - border-width: 1px 1px 1px 1px; | |
108 | - width:30px; | |
109 | - } | |
110 | - | |
111 | - .dayLastMonth | |
112 | - { | |
113 | - font-size: 12px; | |
114 | - font-weight: bold; | |
115 | - color: #5F5F5F; | |
116 | - border: 1px solid #8A959B; | |
117 | - text-align: left; | |
118 | - padding-left:5px; | |
119 | - height: 25px; | |
120 | - width:50px; | |
121 | - filter: alpha(opacity=20); | |
122 | - opacity: .2; | |
123 | - font-family: sans-serif, verdana, arial, "Times New Roman"; | |
124 | - } | |
125 | - | |
126 | - .div_info { | |
127 | - | |
128 | - position:absolute; | |
129 | - font-size: 12px; | |
130 | - border: 2px outset #8A959B; | |
131 | - background-color: white; | |
132 | - color:#000000; | |
133 | - font-weight:bold; | |
134 | - padding: 8px; | |
135 | - min-width: 100px; | |
136 | - min-height: 50px; | |
137 | - width: 300px; | |
138 | - overflow:block; | |
139 | - font-family: sans-serif, verdana, arial, "Times New Roman"; | |
140 | - | |
141 | -background-color: #FFFFFF; | |
142 | - filter:alpha(opacity=80); | |
143 | - -moz-opacity: 0.8; | |
144 | - opacity: 0.8; | |
145 | - | |
146 | - | |
147 | - } | |
148 | - | |
149 | - .div_info a { | |
150 | - color:#0000aa; | |
151 | - text-decoration: none; | |
152 | - } | |
153 | - .div_info a:hover { | |
154 | - color:#000055; | |
155 | - text-decoration: underline; | |
156 | - } | |
1 | +/** | |
2 | + * i-Educar - Sistema de gestão escolar | |
3 | + * | |
4 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
5 | + * <ctima@itajai.sc.gov.br> | |
6 | + * | |
7 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
8 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
9 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
10 | + * qualquer versão posterior. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
13 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
14 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
15 | + * do GNU para mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
18 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
19 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
20 | + * | |
21 | + * Parte do código foi baseada em um tutorial antigo disponível | |
22 | + * no site da Zend. A URL original não existe mais mas, parte do | |
23 | + * código foi preservado por um blogueiro no endereço <http://miud.in/7NM>. | |
24 | + * Não existe informação de licenciamento relevante. Veja o arquivo | |
25 | + * intranet/clsCalendario.inc.php para mais informações. | |
26 | + * | |
27 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
28 | + * @category i-Educar | |
29 | + * @license @@license@@ | |
30 | + * @since Arquivo disponível desde a versão 1.0.0 | |
31 | + * @version $Id$ | |
32 | + */ | |
33 | + | |
34 | +.calendar | |
35 | +{ | |
36 | + font-family: sans-serif, verdana, arial, "Times New Roman"; | |
37 | + font-size: 11px; | |
38 | + color: white; | |
39 | +} | |
40 | + | |
41 | +.cal_esq | |
42 | +{ | |
43 | + height: 38px; | |
44 | + background-image: url('/intranet/imagens/i-educar/cal_topo.gif'); | |
45 | + background-repeat: no-repeat; | |
46 | + padding-left: 94px; | |
47 | +} | |
48 | + | |
49 | +.header | |
50 | +{ | |
51 | + background-color: #A0AAB3; | |
52 | + border-color: #8A959B; | |
53 | + border-style: solid; | |
54 | + border-width: 1px; | |
55 | + color: #FFF; | |
56 | + font-weight: bold; | |
57 | + font-family: sans-serif, verdana, arial, "Times New Roman"; | |
58 | + font-size: 12px; | |
59 | + height: 24px; | |
60 | + text-align:center; | |
61 | +} | |
62 | + | |
63 | +.day | |
64 | +{ | |
65 | + font-size: 12px; | |
66 | + font-family: sans-serif, verdana, arial, "Times New Roman"; | |
67 | + font-weight: bold; | |
68 | + color: #5F5F5F; | |
69 | + border: 1px solid #8A959B; | |
70 | + text-align: left; | |
71 | + height: 25px; | |
72 | + width:50px; | |
73 | + cursor: hand; | |
74 | + cursor: pointer; | |
75 | +} | |
76 | + | |
77 | +.linkedday | |
78 | +{ | |
79 | + font-size: 12px; | |
80 | + font-weight: bold; | |
81 | + color: #5F5F5F; | |
82 | + border: 1px solid #8A959B; | |
83 | + text-align: left; | |
84 | + padding-left: 5px; | |
85 | + height: 25px; | |
86 | +} | |
87 | + | |
88 | +.mes | |
89 | +{ | |
90 | + font-size: 14px; | |
91 | + font-family: sans-serif, verdana, arial, "Times New Roman"; | |
92 | + color: #8A959B; | |
93 | + text-align: left; | |
94 | + vertical-align: middle; | |
95 | + font-weight: bold; | |
96 | + padding: 7px 20px 0px 30px; | |
97 | + margin-top: 12px; | |
98 | +} | |
99 | + | |
100 | +.bordaM | |
101 | +{ | |
102 | + border-right: 1px solid #8A959B; | |
103 | + border-left: 1px solid #8A959B; | |
104 | + padding: 8px 8px 0px 8px; | |
105 | +} | |
106 | + | |
107 | +.bordaF | |
108 | +{ | |
109 | + border-color: #8A959B; | |
110 | + border-style: solid; | |
111 | + border-width: 0px 1px 1px 1px; | |
112 | +} | |
113 | + | |
114 | +.cal_dir | |
115 | +{ | |
116 | + background-image: url('/intranet/imagens/i-educar/cal_dir.gif'); | |
117 | + background-repeat: no-repeat; | |
118 | + padding-right: 20px; | |
119 | + background-position: 0px 0px; | |
120 | +} | |
121 | + | |
122 | +.legenda | |
123 | +{ | |
124 | + color: black; | |
125 | + font-size: 10px; | |
126 | + font-family: sans-serif, verdana, arial, "Times New Roman"; | |
127 | + border-width: 1px 0px 0px 0px; | |
128 | + border-color: #8A959B; | |
129 | + border-style: solid; | |
130 | + margin-top: 3px; | |
131 | + padding-top: 3px; | |
132 | +} | |
133 | + | |
134 | +.cor { | |
135 | + border-color: #000000; | |
136 | + border-style: dotted; | |
137 | + border-width: 1px 1px 1px 1px; | |
138 | + width:30px; | |
139 | +} | |
140 | + | |
141 | +.dayLastMonth | |
142 | +{ | |
143 | + font-size: 12px; | |
144 | + font-weight: bold; | |
145 | + color: #5F5F5F; | |
146 | + border: 1px solid #8A959B; | |
147 | + text-align: left; | |
148 | + padding-left: 5px; | |
149 | + height: 25px; | |
150 | + width:50px; | |
151 | + filter: alpha(opacity=20); | |
152 | + opacity: .2; | |
153 | + font-family: sans-serif, verdana, arial, "Times New Roman"; | |
154 | +} | |
155 | + | |
156 | +.div_info | |
157 | +{ | |
158 | + position: absolute; | |
159 | + font-size: 12px; | |
160 | + border: 2px outset #8A959B; | |
161 | + background-color: white; | |
162 | + color: #000000; | |
163 | + font-weight: bold; | |
164 | + padding: 8px; | |
165 | + min-width: 100px; | |
166 | + min-height: 50px; | |
167 | + width: 300px; | |
168 | + overflow: block; | |
169 | + font-family: sans-serif, verdana, arial, "Times New Roman"; | |
170 | + background-color: #FFFFFF; | |
171 | + filter:alpha(opacity=80); | |
172 | + -moz-opacity: 0.8; | |
173 | + opacity: 0.8; | |
174 | +} | |
175 | + | |
176 | +.div_info a { | |
177 | + color: #0000aa; | |
178 | + text-decoration: none; | |
179 | +} | |
180 | + | |
181 | +.div_info a:hover { | |
182 | + color: #000055; | |
183 | + text-decoration: underline; | |
184 | +} | |
157 | 185 | \ No newline at end of file | ... | ... |