1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
| <?
$output = '';
if(@$_GET[month] == '' && @$_GET[year] == '') {
$time = time();
$month = date('n',$time);
$year = date('Y',$time);
}
$date = getdate(mktime(0,0,0,$month,1,$year));
$today = getdate();
$hours = $today[hours];
$mins = $today[minutes];
$secs = $today[seconds];
if(strlen($hours)<2) $hours="0".$hours;
if(strlen($mins)<2) $mins="0".$mins;
if(strlen($secs)<2) $secs="0".$secs;
$days=date("t",mktime(0,0,0,$month,1,$year));
$start = $date[wday]+1;
$name = $date[month];
$year2 = $date[year];
$offset = $days + $start - 1;
if($month==12) {
$next=1;
$nexty=$year + 1;
} else {
$next=$month + 1;
$nexty=$year;
}
if($month==1) {
$prev=12;
$prevy=$year - 1;
} else {
$prev=$month - 1;
$prevy=$year;
}
if($offset <= 28) $weeks=28;
elseif($offset > 35) $weeks = 42;
else $weeks = 35;
$output = "<table class='daytable' cellpadding='3' cellspacing='1' align='center'>
<tr>
<td colspan='7'>
<table border='0' width='100%'>
<tr>
<td valign='middle'>
<a href='javascript:navigate($month,$year-1)'><img src='images/left.gif' border='0'></a><a href='javascript:navigate(\"\",\"\")'><img src='images/center.gif' hspace='3' border='0'></a><a href='javascript:navigate($month,$year+1)'><img src='images/right.gif' border='0'></a>
</td>
<td align='right'>
<div id='heading'>$year2</div>
</td>
</tr>
<tr>
<td valign='middle'>
<a href='javascript:navigate($prev,$prevy)'><img src='images/left.gif' border='0'></a><a href='javascript:navigate(\"\",\"\")'><img src='images/center.gif' hspace='3' border='0'></a><a href='javascript:navigate($next,$nexty)'><img src='images/right.gif' border='0'></a>
</td>
<td align='right'>
<div id='heading'>$name</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class='dayhead'>Dim</td>
<td class='dayhead'>Lun</td>
<td class='dayhead'>Mar</td>
<td class='dayhead'>Mer</td>
<td class='dayhead'>Jeu</td>
<td class='dayhead'>Ven</td>
<td class='dayhead'>Sam</td>
</tr>";
$col=1;
$cur=1;
$next=0;
for($i=1;$i<=$weeks;$i++) {
if($next==3) $next=0;
if($col==1) $output.="<tr class='dayrow'>";
$output.="<td valign='top' class='days' onMouseOver=\"this.style.backgroundColor='#EEEEEE'\" onMouseOut=\"this.style.backgroundColor='#FFFFFF'\">";
if($i <= ($days+($start-1)) && $i >= $start) {
$output.="<div";
if(($cur==$today[mday]) && ($name==$today[month])) $output.=" style='color:#FF0000'";
$output.="> <a href='grille.php'> <b>$cur</b> </a> ";
$output.="</div></td>";
$cur++;
$col++;
} else {
$output.=" </td>";
$col++;
}
if($col==8) {
$output.="</tr>";
$col=1;
}
}
$output.="</table>";
// champs cachés
$output.="\n <input name='pMois' type='text' value='$month' />";
$output.="\n <input name='pAnnee' type='text' value='$year' />";
echo $output;
?> |
Partager