Révision 66e79b0b

b/admin/admin.php
45 45
	if ($_POST['validation_penalites'] == "valider") $championnat = "validation_penalites";
46 46
	if ($_POST['validation_ajustements'] == "valider") $championnat = "validation_ajustements";
47 47
	if ($_POST['validation_forfaits'] == "valider") $championnat = "validation_forfaits";
48
	if ($_POST['validation_commentaires'] == "valider") $championnat = "validation_commentaires";
48 49

  
49 50
	if (isset($_POST['rencontre-ajouter'])) {
50 51
		$rencontre = "ajouter";
......
158 159
				$ForfaitsG = getForfaitsG($path);
159 160
				$equipes = getEquipes($path);
160 161
				break;
162
			case "commentaires":
163
				$Comments = getCommentaires($path);
164
				$equipes = getEquipes($path);
165
				break;
161 166
			case "modifier":
162 167
				if (file_exists("$path/equipes")) {
163 168
					$equipes = file_get_contents("$path/equipes");
......
241 246
					if (file_exists($file)) unlink($file);
242 247
				}
243 248
				break;
249
			case "validation_commentaires":
250
				$vars = preg_grep("/^comment_/", array_keys($_POST));
251
				if ($vars) {
252
					$commentaires = "";
253
					foreach ($vars as $var) {
254
						if ($_POST[$var] != "") {
255
							list($prefix, $equipe) = explode("_", $var);
256
							$commentaires .= $equipe.":".$_POST[$var]."\n";
257
						}
258
					}
259
					$file = "$path/commentaires";
260
					if ($commentaires) {
261
						my_file_put_contents($file, $commentaires);
262
					} else {
263
						if (file_exists($file)) unlink($file);
264
					}
265
					$message = "Les commentaires ont été mis à jour.";
266
				}
267
				break;
244 268
			case "validation_ajustement":
245 269
				$Adjust = getAjustements($path);
246 270
				$equipes = getEquipes($path);
......
501 525
		<input type="submit" name="validation_forfaits" value="valider" />
502 526
	</form>
503 527
<?php retour("annuler"); ?>
528
<?php } else if ($championnat == "commentaires") { ?>
529
	<form method="post" action="<?=$_SERVER['PHP_SELF']?>">
530
		<table>
531
<?php foreach ($equipes as $n => $e) { ?>
532
			<tr>
533
				<td><?=$e?></td>
534
				<td>:<input type="text" name="comment_<?=$n?>" value="<?=($Comments[$n] ? $Comments[$n] : "")?>" /></td>
535
			</tr>
536
<?php	} ?>
537
		</table>
538
<?php hiddenVars() ?>
539
		<input type="submit" name="validation_commentaires" value="valider" />
540
	</form>
541
<?php retour("annuler"); ?>
504 542
<?php } else if ($rencontre == "ajouter" || $rencontre == "modifier") { ?>
505 543
	<form method="post" action="<?=$_SERVER['PHP_SELF']?>">
506 544
		<table border="0">
b/functions.php
132 132
	return $ForfaitsG;
133 133
}
134 134

  
135
function getCommentaires($path) {
136
	$Comments = array();
137
	$file = "$path/commentaires";
138
	if (file_exists($file) && $commentaires = file($file)) {
139
		foreach ($commentaires as $c) {
140
			list($equipe, $commentaire) = explode(":", rtrim($c));
141
			$Comments[$equipe] = $commentaire;
142
		}
143
	}
144
	return $Comments;
145
}
146

  
135 147
function backup(&$zip, $dir, $zipdir) {
136 148
	if ($dh = opendir($dir)) {
137 149
		while (($file = readdir($dh)) !== false) {
b/index.php
113 113

  
114 114
	// Récupération des pénalités
115 115
	$Pen = getPenalites($path);
116

  
117 116
	// Récupération des ajustements
118 117
	$Adjust = getAjustements($path);
119

  
120 118
	// Récupération des forfaits généraux
121 119
	$ForfaitsG = getForfaitsG($path);
120
	// Récupération des commentaires
121
	$Comments = getCommentaires($path);
122 122
?>
123 123
<html>
124 124
<head>
......
230 230
<?php } ?>
231 231
<?php 	} ?>
232 232
		</div>
233
		<br />
233 234
<?php 	if ($saisons) { ?>
234 235
		<div id="boutons-championnat">
235 236
			<input type="submit" name="championnat" value="modifier" />
......
250 251
			<input type="submit" name="championnat" value="p&eacute;nalit&eacute;s" />
251 252
			<input type="submit" name="championnat" value="ajustements" />
252 253
			<input type="submit" name="championnat" value="forfait g&eacute;n&eacute;ral" />
254
			<input type="submit" name="championnat" value="commentaires" />
253 255
		</div>
254 256
<?php 	} ?>
255 257
<?php }
......
319 321
		$prev = ($i > 0) ? $sortKeys[$i-1] : -1;
320 322
		$next = ($i < count($sortKeys)-1) ? $sortKeys[$i+1] : -1;
321 323
?>
322
			<tr>
324
			<tr<?=$Comments[$equipe] ? " title=\"$Comments[$equipe]\"" : ""?>>
323 325
				<td class="colClt"><?=($prev != -1 && $Pts[$prev] == $Pts[$equipe]) ? "-" : $i+1?></td>
324 326
<?php if (IamAdmin()) { ?>
325 327
				<td class="colAdjust">
......
331 333
<?php } ?>
332 334
				</td>
333 335
<?php } ?>
334
				<td class="colEquipe"><?=$equipes[$equipe]?><?=$ForfaitsG[$equipe] == "on" ? " (forfait g&eacute;n&eacute;ral)" : ""?></td>
336
				<td class="colEquipe"><?=$equipes[$equipe]?></td>
335 337
				<td class="colPts"><?=$Pts[$equipe]?></td>
336 338
				<td class="colJoue"><?=$Joue[$equipe]?></td>
337 339
				<td class="colVic"><?=($Vic[$equipe]) ? $Vic[$equipe] : "0"?></td>

Formats disponibles : Unified diff