Révision a92b1e97

b/index.php
39 39

  
40 40
	$str_date = $_POST['str_date'];
41 41
	$nom = $_POST['nom'];
42
	$demi_jour = $_POST['demi_jour'];
42 43
	getConges("datas", $employes, $conges);
43 44
	if ($_POST['action'] == 'add') {
44 45
		if (!$conges[$nom] || !in_array($str_date, $conges[$nom])) {
45
			$conges[$nom][] = $str_date;
46
			$conges[$nom][] = $str_date.($demi_jour ? " $demi_jour" : "");
46 47
			setConges('datas', $nom, $conges);
47 48
		}
48 49
	} elseif ($_POST['action'] == 'delete') {
......
115 116
		<input type="hidden" name="nom" value="" />
116 117
		<input type="hidden" name="str_date" value="" />
117 118
		<input type="hidden" name="action" value="" />
119
		<select name="demi_jour">
120
			<option value=""></option>
121
			<option value="AM">AM</option>
122
			<option value="PM">PM</option>
123
		</select>
118 124
	</form>
119 125
	<form method="get">
120 126
		<input type="hidden" name="date" value="<?=$date?>" />
......
140 146
	<table border="1" width="100%">
141 147
		<tr>
142 148
			<th rowspan="2">&nbsp;</th>
143
			<th colspan="<?=$nb_jours?>" align="center"><?=$nom_mois?> <?=$date_annee?></th>
149
			<th colspan="<?=2*$nb_jours?>" align="center"><?=$nom_mois?> <?=$date_annee?></th>
144 150
		</tr>
145 151
		<tr>
146 152
<?php for ($n = 1; $n <= $nb_jours; $n++) { ?>
147
			<th><?=sprintf("%02d", $n)?></th>
153
			<th colspan="2"><?=sprintf("%02d", $n)?></th>
148 154
<?php } ?>
149 155
		</tr>
150 156
<?php foreach ($employes as $nom) { ?>
......
160 166
				} else if (isset($conges[$nom]) && in_array($str_date, $conges[$nom])) {
161 167
					$color = "blue";
162 168
					$day = "congé";
169
				} else if (isset($conges[$nom]) && in_array("$str_date AM", $conges[$nom]) && in_array("$str_date PM", $conges[$nom])) {
170
					$color = "blue";
171
					$day = "congé AP";
172
				} else if (isset($conges[$nom]) && in_array("$str_date AM", $conges[$nom])) {
173
					$color = "blue";
174
					$day = "congé AM";
175
				} else if (isset($conges[$nom]) && in_array("$str_date PM", $conges[$nom])) {
176
					$color = "blue";
177
					$day = "congé PM";
163 178
				} else {
164 179
					$color = "white";
165
					$day = "travaillé";
180
					$day = "ouvré";
166 181
				}
167
			/*
168
			<td style="background-color: <?=$color?>"<?=($day == "we") ? "" : "onClick=\"updateConges(this)\""?>>&nbsp;</td>
169
			<td style="background-color: <?=$color?>">&nbsp;</td>
170
			*/
171 182
?>
172
			<td style="background-color: <?=$color?>"<?=($day == "we") ? "" : "onClick=\"updateConges(this, '$nom', '$str_date')\""?>>&nbsp;</td>
183
<?php
184
				if ($day == "congé AM") {
185
?>
186
		<td style="cursor: pointer; background-color: <?=$color?>" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> AM')">&nbsp;</td>
187
		<td style="cursor: pointer; background-color: white" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> PM')">&nbsp;</td>
188
<?php 	} elseif ($day == "congé PM") { ?>
189
		<td style="cursor: pointer; background-color: white" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> AM')">&nbsp;</td>
190
		<td style="cursor: pointer; background-color: <?=$color?>" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> PM')">&nbsp;</td>
191
<?php 	} elseif ($day == "congé AP") { ?>
192
		<td style="cursor: pointer; background-color: <?=$color?>" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> AM')">&nbsp;</td>
193
		<td style="cursor: pointer; background-color: <?=$color?>" onClick="updateConges(this, '<?=$nom?>', '<?=$str_date?> PM')">&nbsp;</td>
194
<?php 	} else {?>
195
		<td colspan="2" style="cursor: pointer; background-color: <?=$color?>"<?=($day == "we") ? "" : " onClick=\"updateConges(this, '$nom', '$str_date')\""?>>&nbsp;</td>
196
<?php 	} ?>
173 197
<?php } ?>
174 198
		</tr>
175 199
<?php

Formats disponibles : Unified diff