42 |
42 |
if ($championnat == "ajouter un championnat") $championnat = "ajouter";
|
43 |
43 |
if ($_POST['validation_championnat'] == "ajouter") $championnat = "validation_ajouter";
|
44 |
44 |
if ($_POST['validation_championnat'] == "modifier") $championnat = "validation_modifier";
|
|
45 |
if ($_POST['validation_penalites'] == "valider") $championnat = "validation_penalites";
|
45 |
46 |
|
46 |
47 |
if (isset($_POST['rencontre-ajouter'])) {
|
47 |
48 |
$rencontre = "ajouter";
|
... | ... | |
122 |
123 |
if ($path) {
|
123 |
124 |
//echo "<p>path=$path.</p>\n";
|
124 |
125 |
switch ($championnat) {
|
|
126 |
case "pénalités":
|
|
127 |
$Pen = getPenalites($path);
|
|
128 |
$equipes = getEquipes($path);
|
|
129 |
break;
|
125 |
130 |
case "modifier":
|
126 |
131 |
if (file_exists("$path/equipes")) {
|
127 |
132 |
$equipes = file_get_contents("$path/equipes");
|
... | ... | |
140 |
145 |
my_file_put_contents("$path/equipes", $equipes);
|
141 |
146 |
$message = "Le championnat a été mis à jour.";
|
142 |
147 |
break;
|
|
148 |
case "validation_penalites":
|
|
149 |
$vars = preg_grep("/^pen_/", array_keys($_POST));
|
|
150 |
if ($vars) {
|
|
151 |
$penalites = "";
|
|
152 |
foreach ($vars as $var) {
|
|
153 |
if ($_POST[$var] > 0) {
|
|
154 |
list($prefix, $equipe) = explode("_", $var);
|
|
155 |
$penalites .= $equipe.":".$_POST[$var]."\n";
|
|
156 |
}
|
|
157 |
}
|
|
158 |
$file = "$path/penalites";
|
|
159 |
if ($penalites) {
|
|
160 |
my_file_put_contents($file, $penalites);
|
|
161 |
} else {
|
|
162 |
if (file_exists($file)) unlink($file);
|
|
163 |
}
|
|
164 |
$message = "Les pénalités ont été mises à jour.";
|
|
165 |
}
|
|
166 |
break;
|
143 |
167 |
case "supprimer":
|
144 |
168 |
// Suppression de tous les fichiers du répertoire
|
145 |
169 |
if ($dir = opendir($path)) {
|
... | ... | |
295 |
319 |
<?php } ?>
|
296 |
320 |
</form>
|
297 |
321 |
<?php retour("annuler"); ?>
|
|
322 |
<?php } else if ($championnat == "pénalités") { ?>
|
|
323 |
<form method="post" action="<?=$_SERVER['PHP_SELF']?>">
|
|
324 |
<table>
|
|
325 |
<?php foreach ($equipes as $n => $e) { ?>
|
|
326 |
<tr>
|
|
327 |
<td><?=$e?></td>
|
|
328 |
<td>:<input type="text" name="pen_<?=$n?>" size="3" value="<?=($Pen[$n] ? $Pen[$n] : "0")?>" /></td>
|
|
329 |
</tr>
|
|
330 |
<?php } ?>
|
|
331 |
</table>
|
|
332 |
<?php hiddenVars() ?>
|
|
333 |
<input type="submit" name="validation_penalites" value="valider" />
|
|
334 |
</form>
|
|
335 |
<?php retour("annuler"); ?>
|
298 |
336 |
<?php } else if ($rencontre == "ajouter" || $rencontre == "modifier") { ?>
|
299 |
337 |
<form method="post" action="<?=$_SERVER['PHP_SELF']?>">
|
300 |
338 |
<table border="0">
|