root / admin / admin.php @ 61b73b7b9ccca2605e3474a28695ad284a433569
Historique | Voir | Annoter | Télécharger (20,5 ko)
1 | <?php
|
---|---|
2 | /*
|
3 | * admin.php - Administration des compétitions |
4 | * Copyright (C) 2008 Romuald DELAVERGNE <delavergne@free.fr> |
5 | * |
6 | * This source code is licensed under the GNU General Public License, |
7 | * Version 2. See the file COPYING for more details. |
8 | */ |
9 | |
10 | require_once 'zip.lib.php'; |
11 | require_once 'unzip.lib.php'; |
12 | |
13 | if (basename(dirname($_SERVER['PHP_SELF'])) == "admin") |
14 | require_once '../functions.php'; |
15 | else
|
16 | require_once 'functions.php'; |
17 | |
18 | function hiddenVars() { ?> |
19 | <input type="hidden" name="typeCompetition" value="<?=$_POST['typeCompetition']?>" /> |
20 | <input type="hidden" name="saison" value="<?=$_POST['saison']?>" /> |
21 | <input type="hidden" name="div1" value="<?=$_POST['div1']?>" /> |
22 | <input type="hidden" name="div2" value="<?=$_POST['div2']?>" /> |
23 | <input type="hidden" name="poule" value="<?=$_POST['poule']?>" /> |
24 | <input type="hidden" name="phase" value="<?=$_POST['phase']?>" /> |
25 | <?php }
|
26 | |
27 | function retour($button, $message = "") { ?>
|
28 | <form method="post" action="index.php"> |
29 | <?php if ($message != "") echo "\t\t\t$message"; ?> |
30 | <?php hiddenVars() ?> |
31 | <input type="submit" value="<?=$button?>" /> |
32 | </form>
|
33 | <?php }
|
34 | |
35 | /* |
36 | echo "<pre>\n";
|
37 | print_r($_POST); |
38 | echo "</pre>\n";
|
39 | */ |
40 | |
41 | // Données reçues par l'index ou cette page |
42 | $championnat = $_POST['championnat']; |
43 | if ($_POST['validation_championnat'] == "ajouter") $championnat = "validation_ajouter"; |
44 | if ($_POST['validation_championnat'] == "modifier") $championnat = "validation_modifier"; |
45 | if ($_POST['validation_penalites'] == "valider") $championnat = "validation_penalites"; |
46 | if ($_POST['validation_ajustements'] == "valider") $championnat = "validation_ajustements"; |
47 | if ($_POST['validation_forfaits'] == "valider") $championnat = "validation_forfaits"; |
48 | if ($_POST['validation_commentaires'] == "valider") $championnat = "validation_commentaires"; |
49 | |
50 | if (isset($_POST['rencontre-ajouter'])) { |
51 | $rencontre = "ajouter"; |
52 | } else { |
53 | $vars = preg_grep("/^rencontre-/", array_keys($_POST)); |
54 | if ($vars) { |
55 | $rencontre = $_POST[current($vars)]; |
56 | $rencontreId = current($vars); |
57 | } |
58 | } |
59 | { |
60 | $vars = preg_grep("/^adjust-/", array_keys($_POST)); |
61 | if ($vars) { |
62 | $championnat = "validation_ajustement"; |
63 | switch ($_POST[current($vars)]) { |
64 | case '↑':
|
65 | $action = "up"; |
66 | break; |
67 | case '↓':
|
68 | $action = "down"; |
69 | break; |
70 | default: |
71 | $action = "unknown"; |
72 | break; |
73 | } |
74 | list($prefix, $equipe) = explode("-", current($vars)); |
75 | } |
76 | } |
77 | if ($_POST['validation_rencontre'] == "ajouter") $rencontre = "validation_ajouter"; |
78 | if ($_POST['validation_rencontre'] == "modifier") $rencontre = "validation_modifier"; |
79 | |
80 | $equipes = get_magic_quotes_gpc() ? stripslashes($_POST['equipes']) : $_POST['equipes']; |
81 | $journees = get_magic_quotes_gpc() ? stripslashes($_POST['journees']) : $_POST['journees']; |
82 | $journee = get_magic_quotes_gpc() ? stripslashes($_POST['journee']) : $_POST['journee']; |
83 | $domicile = get_magic_quotes_gpc() ? stripslashes($_POST['domicile']) : $_POST['domicile']; |
84 | $visiteur = get_magic_quotes_gpc() ? stripslashes($_POST['visiteur']) : $_POST['visiteur']; |
85 | $ptsDom = get_magic_quotes_gpc() ? stripslashes($_POST['ptsDom']) : $_POST['ptsDom']; |
86 | $ptsVis = get_magic_quotes_gpc() ? stripslashes($_POST['ptsVis']) : $_POST['ptsVis']; |
87 | $scoreDom = get_magic_quotes_gpc() ? stripslashes($_POST['scoreDom']) : $_POST['scoreDom']; |
88 | $scoreVis = get_magic_quotes_gpc() ? stripslashes($_POST['scoreVis']) : $_POST['scoreVis']; |
89 | $fftDom = get_magic_quotes_gpc() ? stripslashes($_POST['fftDom']) : $_POST['fftDom']; |
90 | $fftVis = get_magic_quotes_gpc() ? stripslashes($_POST['fftVis']) : $_POST['fftVis']; |
91 | |
92 | $message = ""; |
93 | |
94 | if ($_POST['saison'] && $_POST['div1']) { |
95 | $path = (authent()) ? "../datas" : "datas"; |
96 | $path .= "/".$_POST['saison']."/".$_POST['div1']; |
97 | if ($_POST['div2'] != "") $path .= $SEP_DIV.$_POST['div2']; |
98 | if ($_POST['poule'] != "" || $_POST['phase'] != "") $path .= "/"; |
99 | if ($_POST['poule'] != "") $path .= $_POST['poule']; |
100 | if ($_POST['phase'] != "") $path .= $SEP_DIV.$_POST['phase']; |
101 | } |
102 | |
103 | if ($_POST['exporter'] == "exporter") { |
104 | $zip = new zipfile(); |
105 | backup($zip, "../datas", "datas"); |
106 | $archive = $zip->file();
|
107 | header("Content-Type: application/x-zip"); |
108 | header("Content-Disposition: inline; filename=datas-".date("Y-m-d").".zip"); |
109 | echo $archive; |
110 | exit; |
111 | } elseif ($_POST['validation_importer'] == "importer") { |
112 | if ($_FILES['zipfile']['error'] == 0) { |
113 | $dest = ".."; |
114 | $zip = new SimpleUnzip($_FILES['zipfile']['tmp_name']); |
115 | if ($zip) { |
116 | $needToImport = array(); |
117 | $alreadyExist = array(); |
118 | foreach ($zip->Entries as $extr) {
|
119 | if (!file_exists($dest."/".$extr->Path)) {
|
120 | mkdirRecursive($dest."/".$extr->Path);
|
121 | $needToImport[] = $extr->Path;
|
122 | } else { |
123 | if (!in_array($extr->Path, $needToImport)) {
|
124 | if (!in_array($extr->Path, $alreadyExist)) {
|
125 | $message .= "<p>Le championnat ".$extr->Path." n'a pas été importé car il existe déjà !</p>"; |
126 | $alreadyExist[] = $extr->Path;
|
127 | } |
128 | } |
129 | } |
130 | if (in_array($extr->Path, $needToImport)) {
|
131 | $fh = fopen($dest."/".$extr->Path."/".$extr->Name, 'w'); |
132 | fwrite($fh, $extr->Data);
|
133 | fclose($fh); |
134 | } |
135 | } |
136 | $message .= "Données importées"; |
137 | } else { |
138 | $message = $_POST['zipfile'].": fichier invalide !"; |
139 | } |
140 | } else { |
141 | $message = "Erreur lors du chargement du fichier '".$_FILES['zipfile']['name']."' !"; |
142 | } |
143 | } elseif ($_POST['supprimer-tout'] == "tout supprimer") { |
144 | $message = "pas implémenté."; |
145 | } |
146 | |
147 | if ($path) { |
148 | //echo "<p>path=$path.</p>\n"; |
149 | switch ($championnat) { |
150 | case "pénalités": |
151 | $Pen = getPenalites($path); |
152 | $equipes = getEquipes($path); |
153 | break; |
154 | case "ajustements": |
155 | $Adjust = getAjustements($path); |
156 | $equipes = getEquipes($path); |
157 | break; |
158 | case "forfait général": |
159 | $ForfaitsG = getForfaitsG($path); |
160 | $equipes = getEquipes($path); |
161 | break; |
162 | case "commentaires": |
163 | $Comments = getCommentaires($path); |
164 | $equipes = getEquipes($path); |
165 | break; |
166 | case "modifier": |
167 | if (file_exists("$path/equipes")) { |
168 | $equipes = file_get_contents("$path/equipes"); |
169 | } |
170 | if (file_exists("$path/journees")) { |
171 | $journees = file_get_contents("$path/journees"); |
172 | } |
173 | break; |
174 | case "validation_ajouter": |
175 | if (!file_exists($path)) { |
176 | mkdirRecursive($path); |
177 | my_file_put_contents("$path/equipes", $equipes); |
178 | my_file_put_contents("$path/journees", $journees); |
179 | $message = "La compétition a été ajoutée."; |
180 | } else { |
181 | $message = "La compétition existe déjà !"; |
182 | } |
183 | break; |
184 | case "validation_modifier": |
185 | my_file_put_contents("$path/equipes", $equipes); |
186 | my_file_put_contents("$path/journees", $journees); |
187 | $message = "La compétition a été mise à jour."; |
188 | break; |
189 | case "validation_penalites": |
190 | $vars = preg_grep("/^pen_/", array_keys($_POST)); |
191 | if ($vars) { |
192 | $penalites = ""; |
193 | foreach ($vars as $var) { |
194 | if ($_POST[$var] > 0) {
|
195 | list($prefix, $equipe) = explode("_", $var); |
196 | $penalites .= $equipe.":".$_POST[$var]."\n"; |
197 | } |
198 | } |
199 | $file = "$path/penalites"; |
200 | if ($penalites) { |
201 | my_file_put_contents($file, $penalites); |
202 | } else { |
203 | if (file_exists($file)) unlink($file); |
204 | } |
205 | $message = "Les pénalités ont été mises à jour."; |
206 | } |
207 | break; |
208 | case "validation_ajustements": |
209 | $vars = preg_grep("/^adjust_/", array_keys($_POST)); |
210 | if ($vars) { |
211 | $ajustements = ""; |
212 | foreach ($vars as $var) { |
213 | if ($_POST[$var] != 0) { |
214 | if (abs($_POST[$var]) <= 9) {
|
215 | list($prefix, $equipe) = explode("_", $var); |
216 | $ajustements .= $equipe.":".$_POST[$var]."\n"; |
217 | } else { |
218 | $message = "Ajustement trop important (".$_POST[$var].")."; |
219 | break 2; |
220 | } |
221 | } |
222 | } |
223 | $file = "$path/ajustements"; |
224 | if ($ajustements) { |
225 | my_file_put_contents($file, $ajustements); |
226 | } else { |
227 | if (file_exists($file)) unlink($file); |
228 | } |
229 | $message = "Les ajustements ont été mis à jour."; |
230 | } |
231 | break; |
232 | case "validation_forfaits": |
233 | $file = "$path/forfaits"; |
234 | $message = "Les forfaits généraux ont été mis à jour."; |
235 | $vars = preg_grep("/^forfaitG_/", array_keys($_POST)); |
236 | if ($vars) { |
237 | $forfaits = ""; |
238 | foreach ($vars as $var) { |
239 | if ($_POST[$var] == "on") { |
240 | list($prefix, $equipe) = explode("_", $var); |
241 | $forfaits .= $equipe.":".$_POST[$var]."\n"; |
242 | } |
243 | } |
244 | my_file_put_contents($file, $forfaits); |
245 | } else { |
246 | if (file_exists($file)) unlink($file); |
247 | } |
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; |
268 | case "validation_ajustement": |
269 | $Adjust = getAjustements($path); |
270 | $equipes = getEquipes($path); |
271 | switch ($action) { |
272 | case "up": |
273 | $Adjust[$equipe]++; |
274 | $message = "L'équipe ".$equipes[$equipe]." a été remontée d'une position."; |
275 | break; |
276 | case "down": |
277 | $Adjust[$equipe] = $Adjust[$equipe] - 1; /* $var-- don't works with empty value */ |
278 | $message = "L'équipe ".$equipes[$equipe]." a été redescendue d'une position."; |
279 | break; |
280 | default: |
281 | break 2; |
282 | } |
283 | $ajustements = ""; |
284 | foreach ($Adjust as $n => $val) {
|
285 | if ($val != 0) { |
286 | if (abs($val) <= 9) {
|
287 | $ajustements .= "$n:$val\n"; |
288 | } else { |
289 | $message = "Ajustement trop important ($val)."; |
290 | break 2; |
291 | } |
292 | } |
293 | } |
294 | $file = "$path/ajustements"; |
295 | if ($ajustements) { |
296 | my_file_put_contents($file, $ajustements); |
297 | } else { |
298 | if (file_exists($file)) unlink($file); |
299 | } |
300 | break; |
301 | case "supprimer": |
302 | // Suppression de tous les fichiers du répertoire |
303 | if ($dir = opendir($path)) { |
304 | while (($file = readdir($dir)) !== FALSE) { |
305 | if (is_file("$path/$file")) unlink("$path/$file"); |
306 | } |
307 | closedir($dir); |
308 | } |
309 | // Suppression du maximum de répertoires |
310 | while (isEmptyDir($path) && basename($path) != "datas") { |
311 | monRmdir($path); |
312 | $path = dirname($path); |
313 | } |
314 | $message = "Le championnat a été supprimé."; |
315 | break; |
316 | } |
317 | switch ($rencontre) { |
318 | case "ajouter": |
319 | $equipes = getEquipes($path); |
320 | $journees = getJournees($path); |
321 | break; |
322 | case "modifier": |
323 | $equipes = getEquipes($path); |
324 | $journees = getJournees($path); |
325 | list($prefix, $journee, $domicile, $visiteur) = explode("-", $rencontreId); |
326 | $file = "$path/match-".$journee."-".$domicile."-".$visiteur; |
327 | if (file_exists($file)) { |
328 | $resu = file_get_contents($file); |
329 | list($ptsDom, $ptsVis, $scoreDom, $scoreVis, $fftDom, $fftVis) = explode(":", $resu); |
330 | } |
331 | break; |
332 | case "validation_ajouter": |
333 | if ($journee == "" || $domicile == "" || $visiteur == "") { |
334 | $message = "Vous devez saisir le numéro de la journée, l'équipe qui reçoit et qui se déplace !"; |
335 | } else { |
336 | $file = "$path/match-".$journee."-".$domicile."-".$visiteur; |
337 | if (!file_exists($file)) { |
338 | my_file_put_contents($file, $ptsDom.":".$ptsVis.":".$scoreDom.":".$scoreVis.":".$fftDom.":".$fftVis); |
339 | $message = "La nouvelle rencontre a été ajoutée."; |
340 | } else { |
341 | $message = "La rencontre existe déjà !"; |
342 | } |
343 | } |
344 | break; |
345 | case "validation_modifier": |
346 | $file = "$path/match-".$journee."-".$domicile."-".$visiteur; |
347 | my_file_put_contents($file, $ptsDom.":".$ptsVis.":".$scoreDom.":".$scoreVis.":".$fftDom.":".$fftVis); |
348 | $message = "La rencontre a été mise à jour."; |
349 | break; |
350 | case "supprimer": |
351 | list($prefix, $journee, $domicile, $visiteur) = explode("-", $rencontreId); |
352 | $file = "match-".$journee."-".$domicile."-".$visiteur; |
353 | if (file_exists("$path/$file")) { |
354 | unlink("$path/$file"); |
355 | $message = "La rencontre a été supprimée."; |
356 | } |
357 | break; |
358 | } |
359 | } |
360 | ?>
|
361 | <html>
|
362 | <head>
|
363 | <title>Administration</title> |
364 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> |
365 | <meta http-equiv="Content-language" content="fr" /> |
366 | <meta name="copyright" content="Tous droits réservés - All Rights Reserved" /> |
367 | <meta name="author" content="Romuald DELAVERGNE"> |
368 | </head>
|
369 | <html>
|
370 | <body>
|
371 | <?php if ($championnat == "ajouter" || $championnat == "modifier" ) { ?> |
372 | <form name="admin" method="post" action="<?=$_SERVER['PHP_SELF']?>"> |
373 | <table border="0"> |
374 | <tr>
|
375 | <td>Saison</td> |
376 | <td>
|
377 | : |
378 | <?php if ($championnat == "ajouter") { ?> |
379 | <input type="text" name="saison" size="5" value="" /> |
380 | <?php } else { ?> |
381 | <input type="hidden" name="saison" value="<?=$_POST['saison']?>" /> |
382 | <?=$_POST['saison']."/".($_POST['saison']+1)."\n"?> |
383 | <?php } ?> |
384 | </td>
|
385 | </tr>
|
386 | <?php if ($_POST['typeCompetition'] != "") { ?> |
387 | <input type="hidden" name="div1" value="<?=$_POST['typeCompetition']?>" /> |
388 | <tr>
|
389 | <td><?=$_POST['typeCompetition'] == "C" ? "Coupe" : "Tournoi"?></td> |
390 | <td>
|
391 | : |
392 | <?php if ($championnat == "ajouter") { ?> |
393 | <input type="text" name="div2" value="" /> |
394 | <?php } else { ?> |
395 | <input type="hidden" name="div2" value="<?=$_POST['div2']?>" /> |
396 | <?=$_POST['div2']."\n"?> |
397 | <?php } ?> |
398 | </td>
|
399 | </tr>
|
400 | <?php } else { ?> |
401 | <tr>
|
402 | <td>Division</td> |
403 | <td>
|
404 | : |
405 | <?php if ($championnat == "ajouter") { ?> |
406 | <select name="div1"> |
407 | <option value=""></option> |
408 | <?php
|
409 | foreach ($DIVISION as $n => $d) { |
410 | echo "\t\t\t\t\t\t<option value=\"$n\">$d</option>\n"; |
411 | } |
412 | ?>
|
413 | </select>
|
414 | <input type="text" name="div2" size="3" value="" /> |
415 | <?php } else { ?> |
416 | <input type="hidden" name="div1" value="<?=$_POST['div1']?>" /> |
417 | <input type="hidden" name="div2" value="<?=$_POST['div2']?>" /> |
418 | <?=$_POST['div1'].$_POST['div2']."\n"?> |
419 | <?php } ?> |
420 | </td>
|
421 | </tr>
|
422 | <?php } ?> |
423 | <?php if ($championnat == "ajouter" || $_POST['poule']) { ?> |
424 | <tr>
|
425 | <td><?=($_POST['typeCompetition'] != "") ? "Poule/Tableau" : "Poule"?></td> |
426 | <td>
|
427 | : |
428 | <?php if ($championnat == "ajouter") { ?> |
429 | <input type="text" name="poule" value="" /> |
430 | <?php } else { ?> |
431 | <input type="hidden" name="poule" value="<?=$_POST['poule']?>" /> |
432 | <?=$_POST['poule']."\n"?> |
433 | <?php } ?> |
434 | </td>
|
435 | </tr>
|
436 | <?php } ?> |
437 | <?php if (($championnat == "ajouter" || $_POST['phase']) && $_POST['typeCompetition'] == "") { ?> |
438 | <tr>
|
439 | <td>Phase</td> |
440 | <td>
|
441 | : |
442 | <?php if ($championnat == "ajouter") { ?> |
443 | <select name="phase"> |
444 | <option value=""></option> |
445 | <option value="1">1</option> |
446 | <option value="2">2</option> |
447 | </select>
|
448 | <?php } else { ?> |
449 | <input type="hidden" name="phase" value="<?=$_POST['phase']?>" /> |
450 | <?=$_POST['phase']."\n"?> |
451 | <?php } ?> |
452 | </td>
|
453 | </tr>
|
454 | <?php } ?> |
455 | <tr>
|
456 | <td colspan="2"> |
457 | <br /> |
458 | Liste des <?=$_POST['typeCompetition'] == "T" ? "joueurs" : "équipes"?> : |
459 | </td>
|
460 | </tr>
|
461 | <tr>
|
462 | <td colspan="2"> |
463 | <textarea name="equipes" cols="30" rows="10"><?=$equipes?></textarea> |
464 | </td>
|
465 | </tr>
|
466 | <tr>
|
467 | <td colspan="2"> |
468 | <br /> |
469 | Liste des <?=$_POST['typeCompetition'] == "T" ? "tours" : "journées"?> : |
470 | </td>
|
471 | </tr>
|
472 | <tr>
|
473 | <td colspan="2"> |
474 | <textarea name="journees" cols="30" rows="10"><?=$journees?></textarea> |
475 | </td>
|
476 | </tr>
|
477 | </table>
|
478 | <?php if ($championnat == "ajouter") { ?> |
479 | <input type="submit" name="validation_championnat" value="ajouter" /> |
480 | <?php } ?> |
481 | <?php if ($championnat == "modifier" ) { ?> |
482 | <input type="submit" name="validation_championnat" value="modifier" /> |
483 | <?php } ?> |
484 | </form>
|
485 | <?php retour("annuler"); ?> |
486 | <?php } else if ($championnat == "pénalités") { ?> |
487 | <form method="post" action="<?=$_SERVER['PHP_SELF']?>"> |
488 | <table>
|
489 | <?php foreach ($equipes as $n => $e) { ?> |
490 | <tr>
|
491 | <td><?=$e?></td> |
492 | <td>:<input type="text" name="pen_<?=$n?>" size="3" value="<?=($Pen[$n] ? $Pen[$n] : "0")?>" /></td> |
493 | </tr>
|
494 | <?php } ?> |
495 | </table>
|
496 | <?php hiddenVars() ?> |
497 | <input type="submit" name="validation_penalites" value="valider" /> |
498 | </form>
|
499 | <?php retour("annuler"); ?> |
500 | <?php } else if ($championnat == "ajustements") { ?> |
501 | <form method="post" action="<?=$_SERVER['PHP_SELF']?>"> |
502 | <table>
|
503 | <?php foreach ($equipes as $n => $e) { ?> |
504 | <tr>
|
505 | <td><?=$e?></td> |
506 | <td>:<input type="text" name="adjust_<?=$n?>" size="3" value="<?=($Adjust[$n] ? $Adjust[$n] : "0")?>" /></td> |
507 | </tr>
|
508 | <?php } ?> |
509 | </table>
|
510 | <?php hiddenVars() ?> |
511 | <input type="submit" name="validation_ajustements" value="valider" /> |
512 | </form>
|
513 | <?php retour("annuler"); ?> |
514 | <?php } else if ($championnat == "forfait général") { ?> |
515 | <form method="post" action="<?=$_SERVER['PHP_SELF']?>"> |
516 | <table>
|
517 | <?php foreach ($equipes as $n => $e) { ?> |
518 | <tr>
|
519 | <td><?=$e?></td> |
520 | <td>:<input type="checkbox" name="forfaitG_<?=$n?>"<?=($ForfaitsG[$n] == "on" ? " checked" : "")?> /></td> |
521 | </tr>
|
522 | <?php } ?> |
523 | </table>
|
524 | <?php hiddenVars() ?> |
525 | <input type="submit" name="validation_forfaits" value="valider" /> |
526 | </form>
|
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"); ?> |
542 | <?php } else if ($rencontre == "ajouter" || $rencontre == "modifier") { ?> |
543 | <form method="post" action="<?=$_SERVER['PHP_SELF']?>"> |
544 | <table border="0"> |
545 | <tr>
|
546 | <td colspan="4"> |
547 | <?php if ($rencontre == "ajouter") { ?> |
548 | <?=$_POST['typeCompetition'] == "" ? "Journée" : "Tour"?> : |
549 | <select name="journee"> |
550 | <option value=""></option> |
551 | <?php
|
552 | foreach ($journees as $n => $j) { |
553 | echo "\t\t\t\t\t\t<option value=\"$n\">$j</option>\n"; |
554 | } |
555 | ?>
|
556 | </select>
|
557 | <?php } else { ?> |
558 | <?=$journees[$journee]."\n"?> |
559 | <input type="hidden" name="journee" value="<?=$journee?>" /> |
560 | <?php } ?> |
561 | </td>
|
562 | </tr>
|
563 | <tr>
|
564 | <td>
|
565 | <?php if ($rencontre == "ajouter") { ?> |
566 | <?=$_POST['typeCompetition'] == "T" ? "Joueur 1" : "Équipe à domicile"?> : |
567 | <select name="domicile"> |
568 | <option value=""></option> |
569 | <?php
|
570 | foreach ($equipes as $n => $e) { |
571 | echo "\t\t\t\t\t\t<option value=\"$n\">$e</option>\n"; |
572 | } |
573 | ?>
|
574 | </select>
|
575 | <?php } else { ?> |
576 | <input type="hidden" name="domicile" value="<?=$domicile?>" /> |
577 | <?=$equipes[$domicile]."\n"?> |
578 | <?php } ?> |
579 | </td>
|
580 | <td> points : <input type="text" name="ptsDom" size="3" value="<?=$ptsDom?>" /></td> |
581 | <td> score : <input type="text" name="scoreDom" size="3" value="<?=$scoreDom?>" /></td> |
582 | <td>
|
583 | <label for="fftDom">forfait :</label> |
584 | <input type="checkbox" id="fftDom" name="fftDom"<?=$fftDom ? " checked" : ""?> /> |
585 | </td>
|
586 | </tr>
|
587 | <tr>
|
588 | <td>
|
589 | <?php if ($rencontre == "ajouter") { ?> |
590 | <?=$_POST['typeCompetition'] == "T" ? "Joueur 2" : "Équipe à l'extérieure"?> : |
591 | <select name="visiteur"> |
592 | <option value=""></option> |
593 | <?php
|
594 | foreach ($equipes as $n => $e) { |
595 | echo "\t\t\t\t\t\t<option value=\"$n\">$e</option>\n"; |
596 | } |
597 | ?>
|
598 | </select>
|
599 | <?php } else { ?> |
600 | <input type="hidden" name="visiteur" value="<?=$visiteur?>" /> |
601 | <?=$equipes[$visiteur]."\n"?> |
602 | <?php } ?> |
603 | </td>
|
604 | <td> points : <input type="text" name="ptsVis" size="3" value="<?=$ptsVis?>" /></td> |
605 | <td> score : <input type="text" name="scoreVis" size="3" value="<?=$scoreVis?>" /></td> |
606 | <td>
|
607 | <label for="fftVis">forfait :</label> |
608 | <input type="checkbox" id="fftVis" name="fftVis"<?=$fftVis ? " checked" : ""?> /> |
609 | </td>
|
610 | </tr>
|
611 | </table>
|
612 | <?php hiddenVars() ?> |
613 | <?php if ($rencontre == "ajouter") { ?> |
614 | <input type="submit" name="validation_rencontre" value="ajouter" /> |
615 | <?php } ?> |
616 | <?php if ($rencontre == "modifier") { ?> |
617 | <input type="submit" name="validation_rencontre" value="modifier" /> |
618 | <?php } ?> |
619 | </form>
|
620 | <?php retour("annuler"); ?> |
621 | <?php } else if ($_POST['importer'] == "importer") { ?> |
622 | <form method="post" enctype="multipart/form-data"> |
623 | <?php hiddenVars() ?> |
624 | <input type="file" name="zipfile" value="" /> |
625 | <input type="submit" name="validation_importer" value="importer" /> |
626 | </form>
|
627 | <?php retour("annuler"); ?> |
628 | <?php
|
629 | } else { |
630 | retour("continuer", $message); |
631 | } |
632 | ?>
|
633 | </body>
|
634 | </html>
|