Révision 0acd1792

b/index.php
94 94
	$dateNow = date("Y/m/d", $tsNow);
95 95

  
96 96
	$vue = $_GET['vue'];
97
	$date = $_GET['date'];
98
	if (!$date) {
99
		$ts = strtotime(date("Y/m/01", $tsNow));
97
	if (!$vue) $vue = "mois";
98

  
99
	$dateCurrent = $_GET['date'];
100
	if (!$dateCurrent) {
101
		$tsCurrent = strtotime(date("Y/m/01", $tsNow));
100 102
	} else {
101
		$ts = strtotime($date);
103
		$tsCurrent = strtotime(date("Y/m/01", strtotime($dateCurrent)));
102 104
	}
103 105

  
104 106
	switch ($_GET['action']) {
105 107
		case '<<':
106
			$ts = strtotime("-1 month", $ts);
108
			$tsCurrent = strtotime("-1 month", $tsCurrent);
107 109
			break;
108 110
		case '>>':
109
			$ts = strtotime("+1 month", $ts);
111
			$tsCurrent = strtotime("+1 month", $tsCurrent);
110 112
			break;
111 113
	}
112 114

  
113
	if (!$vue) $vue = "mois";
114
	$date = date("Y/m/d", $ts);
115
	switch ($vue) {
116
		case "trimestre":
117
			$dateDeb = date("Y/m/01", strtotime("-1 month", $tsCurrent));
118
			break;
119
		case "année":
120
			$dateDeb = date("Y/01/01", $tsCurrent);
121
			break;
122
		case "mois":
123
		default:
124
			$dateDeb = date("Y/m/01", $tsCurrent);
125
			break;
126
	}
127
	$dateCurrent = date("Y/m/d", $tsCurrent);
115 128

  
116 129
	/*
117 130
	echo "<pre>\n";
......
217 230
		<input type="hidden" name="action" value="" />
218 231
	</form>
219 232
	<form method="get">
220
		<input type="hidden" name="date" value="<?=$date?>" />
233
		<input type="hidden" name="date" value="<?=$dateCurrent?>" />
221 234
		<input type="hidden" name="vue" value="<?=$vue?>" />
222 235
	<table>
223 236
	<tr>
224 237
		<td align="left"><input type="submit" name="action" value="<<" /></td>
225 238
		<td align="center">
226
			<a href="?date=<?=$date?>&vue=mois">mois</a> |
227
			<a href="?date=<?=$date?>&vue=trimestre">trimestre</a> |
228
			<a href="?date=<?=$date?>&vue=ann&eacute;e">ann&eacute;e</a>
239
			<a href="?date=<?=$dateCurrent?>&vue=mois">mois</a> |
240
			<a href="?date=<?=$dateCurrent?>&vue=trimestre">trimestre</a> |
241
			<a href="?date=<?=$dateCurrent?>&vue=ann&eacute;e">ann&eacute;e</a>
229 242
		<td align="right"><input type="submit" name="action" value=">>" /></td>
230 243
	</tr>
231 244
<?php
232 245
	for ($v = 0; $v == 0 || ($vue == "trimestre" && $v < 3) || ($vue == "année" && $v < 12); $v++) {
233
		$ts2 = strtotime("+$v month", $ts);
234
		$date_annee = date("Y", $ts2);
235
		$date_mois = date("m", $ts2);
236
		$nom_mois = date("F", $ts2);
237
		$nb_jours = date("t", $ts2);
246
		$ts = strtotime("+$v month", strtotime($dateDeb));
247
		$date_annee = date("Y", $ts);
248
		$date_mois = date("m", $ts);
249
		$nom_mois = date("F", $ts);
250
		$nb_jours = date("t", $ts);
238 251
?>
239 252
	<tr><td colspan="3">
240 253
	<table border="1" width="100%">

Formats disponibles : Unified diff