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
| <?php
// Année et mois courant
$currYearID = (isset($_GET["a"]))?$_GET["a"]:date("Y");
$currMonthID = (isset($_GET["m"]))?$_GET["m"]:date("n");
// Timestamp des mois précédent et suivant
$prevMonth = mktime(0,0,0,$currMonthID-1,1,$currYearID);
$nextMonth = mktime(0,0,0,$currMonthID+1,1,$currYearID);
// Détermination des URLs
$prevYearURL = "a=".($currYearID-1)."&"."m=".$currMonthID;
$nextYearURL = "a=".($currYearID+1)."&"."m=".$currMonthID;
$prevMonthURL = "a=".date("Y",$prevMonth)."&"."m=".date("n",$prevMonth);
$nextMonthURL = "a=".date("Y",$nextMonth)."&"."m=".date("n",$nextMonth);
?>
<table>
<tr>
<td><a href="miniCalendrier.php?<?php echo $prevYearURL;?>">Prec</a></td>
<td><?php echo $currYearID;?></td>
<td><a href="miniCalendrier.php?<?php echo $nextYearURL;?>">Suiv</a></td>
</tr>
<tr>
<td><a href="miniCalendrier.php?<?php echo $prevMonthURL;?>">Prec</a></td>
<td><?php echo date("F",mktime(0,0,0,$currMonthID,1,$currYearID));?></td>
<td><a href="miniCalendrier.php?<?php echo $nextMonthURL;?>">Suiv</a></td>
</tr>
</table> |
Partager