Révision 1057b016
| b/admin/admin.php | ||
|---|---|---|
| 44 | 44 |
if ($_POST['validation_championnat'] == "modifier") $championnat = "validation_modifier"; |
| 45 | 45 |
if ($_POST['validation_penalites'] == "valider") $championnat = "validation_penalites"; |
| 46 | 46 |
if ($_POST['validation_ajustements'] == "valider") $championnat = "validation_ajustements"; |
| 47 |
if ($_POST['validation_forfaits'] == "valider") $championnat = "validation_forfaits"; |
|
| 47 | 48 |
|
| 48 | 49 |
if (isset($_POST['rencontre-ajouter'])) {
|
| 49 | 50 |
$rencontre = "ajouter"; |
| ... | ... | |
| 153 | 154 |
$Adjust = getAjustements($path); |
| 154 | 155 |
$equipes = getEquipes($path); |
| 155 | 156 |
break; |
| 157 |
case "forfait général": |
|
| 158 |
$ForfaitsG = getForfaitsG($path); |
|
| 159 |
$equipes = getEquipes($path); |
|
| 160 |
break; |
|
| 156 | 161 |
case "modifier": |
| 157 | 162 |
if (file_exists("$path/equipes")) {
|
| 158 | 163 |
$equipes = file_get_contents("$path/equipes");
|
| ... | ... | |
| 219 | 224 |
$message = "Les ajustements ont été mis à jour."; |
| 220 | 225 |
} |
| 221 | 226 |
break; |
| 227 |
case "validation_forfaits": |
|
| 228 |
$file = "$path/forfaits"; |
|
| 229 |
$message = "Les forfaits généraux ont été mis à jour."; |
|
| 230 |
$vars = preg_grep("/^forfaitG_/", array_keys($_POST));
|
|
| 231 |
if ($vars) {
|
|
| 232 |
$forfaits = ""; |
|
| 233 |
foreach ($vars as $var) {
|
|
| 234 |
if ($_POST[$var] == "on") {
|
|
| 235 |
list($prefix, $equipe) = explode("_", $var);
|
|
| 236 |
$forfaits .= $equipe.":".$_POST[$var]."\n"; |
|
| 237 |
} |
|
| 238 |
} |
|
| 239 |
my_file_put_contents($file, $forfaits); |
|
| 240 |
} else {
|
|
| 241 |
if (file_exists($file)) unlink($file); |
|
| 242 |
} |
|
| 243 |
break; |
|
| 222 | 244 |
case "validation_ajustement": |
| 223 | 245 |
$Adjust = getAjustements($path); |
| 224 | 246 |
$equipes = getEquipes($path); |
| ... | ... | |
| 465 | 487 |
<input type="submit" name="validation_ajustements" value="valider" /> |
| 466 | 488 |
</form> |
| 467 | 489 |
<?php retour("annuler"); ?>
|
| 490 |
<?php } else if ($championnat == "forfait général") { ?>
|
|
| 491 |
<form method="post" action="<?=$_SERVER['PHP_SELF']?>"> |
|
| 492 |
<table> |
|
| 493 |
<?php foreach ($equipes as $n => $e) { ?>
|
|
| 494 |
<tr> |
|
| 495 |
<td><?=$e?></td> |
|
| 496 |
<td>:<input type="checkbox" name="forfaitG_<?=$n?>"<?=($ForfaitsG[$n] == "on" ? " checked" : "")?> /></td> |
|
| 497 |
</tr> |
|
| 498 |
<?php } ?> |
|
| 499 |
</table> |
|
| 500 |
<?php hiddenVars() ?> |
|
| 501 |
<input type="submit" name="validation_forfaits" value="valider" /> |
|
| 502 |
</form> |
|
| 503 |
<?php retour("annuler"); ?>
|
|
| 468 | 504 |
<?php } else if ($rencontre == "ajouter" || $rencontre == "modifier") { ?>
|
| 469 | 505 |
<form method="post" action="<?=$_SERVER['PHP_SELF']?>"> |
| 470 | 506 |
<table border="0"> |
| b/functions.php | ||
|---|---|---|
| 120 | 120 |
return $Adjust; |
| 121 | 121 |
} |
| 122 | 122 |
|
| 123 |
function getForfaitsG($path) {
|
|
| 124 |
$ForfaitsG = array(); |
|
| 125 |
$file = "$path/forfaits"; |
|
| 126 |
if (file_exists($file) && $forfaits = file($file)) {
|
|
| 127 |
foreach ($forfaits as $f) {
|
|
| 128 |
list($equipe, $forfait) = explode(":", rtrim($f));
|
|
| 129 |
$ForfaitsG[$equipe] = $forfait; |
|
| 130 |
} |
|
| 131 |
} |
|
| 132 |
return $ForfaitsG; |
|
| 133 |
} |
|
| 134 |
|
|
| 123 | 135 |
function backup(&$zip, $dir, $zipdir) {
|
| 124 | 136 |
if ($dh = opendir($dir)) {
|
| 125 | 137 |
while (($file = readdir($dh)) !== false) {
|
| b/index.php | ||
|---|---|---|
| 116 | 116 |
|
| 117 | 117 |
// Récupération des ajustements |
| 118 | 118 |
$Adjust = getAjustements($path); |
| 119 |
|
|
| 120 |
// Récupération des forfaits généraux |
|
| 121 |
$ForfaitsG = getForfaitsG($path); |
|
| 119 | 122 |
?> |
| 120 | 123 |
<html> |
| 121 | 124 |
<head> |
| ... | ... | |
| 246 | 249 |
<input type="submit" name="championnat" value="supprimer" onClick='return confirm("Voulez-vous vraiment effacer <?=$compet?> ?")' />
|
| 247 | 250 |
<input type="submit" name="championnat" value="pénalités" /> |
| 248 | 251 |
<input type="submit" name="championnat" value="ajustements" /> |
| 252 |
<input type="submit" name="championnat" value="forfait général" /> |
|
| 249 | 253 |
</div> |
| 250 | 254 |
<?php } ?> |
| 251 | 255 |
<?php } |
| ... | ... | |
| 286 | 290 |
$Pts[$n] -= $Pen[$n]; |
| 287 | 291 |
$Diff[$n] = $PG[$n] - $PP[$n]; |
| 288 | 292 |
$Rang[$n] = $Pts[$n] + $Adjust[$n]/100 + $Diff[$n]/100000; |
| 293 |
if ($ForfaitsG[$n]) $Pts[$n] = $Rang[$n] = 0; |
|
| 289 | 294 |
} |
| 290 | 295 |
arsort($Rang); |
| 291 | 296 |
$sortKeys = array_keys($Rang); |
| ... | ... | |
| 326 | 331 |
<?php } ?> |
| 327 | 332 |
</td> |
| 328 | 333 |
<?php } ?> |
| 329 |
<td class="colEquipe"><?=$equipes[$equipe]?></td> |
|
| 334 |
<td class="colEquipe"><?=$equipes[$equipe]?><?=$ForfaitsG[$equipe] == "on" ? " (forfait général)" : ""?></td> |
|
| 330 | 335 |
<td class="colPts"><?=$Pts[$equipe]?></td> |
| 331 | 336 |
<td class="colJoue"><?=$Joue[$equipe]?></td> |
| 332 | 337 |
<td class="colVic"><?=($Vic[$equipe]) ? $Vic[$equipe] : "0"?></td> |
Formats disponibles : Unified diff