-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgestion_sizpat.php
754 lines (744 loc) · 21.7 KB
/
gestion_sizpat.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
<?php
/*
* 12/12/2005 - 22:40:00 - Scout Web Portail - v 1.1.1
*
* gestion_sizpat.php v 1.1 - Gestion (création, modification, suppression) des sizaines d'une section
* Copyright (C) 2005 ChMat
* http://www.scoutwebportail.org
*
* This file is part of Scout Web Portail.
*
* Scout Web Portail is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Scout Web Portail is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Scout Web Portail; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
/*
* Modifications v 1.1
* Correction bug modification sizaine par AnS (Merci à Tarpan pour l'info)
*/
include_once('connex.php');
include_once('fonc.php');
if ($user['niveau']['numniveau'] <= 2)
{
include('404.php');
}
else
{
$do = (isset($_GET['do'])) ? $_GET['do'] : $_POST['do'];
if (empty($do) or !$do)
{
if (!defined('IN_SITE'))
{
?>
<?php echo '<'.'?xml version="1.0" encoding="iso-8859-1"?'.'>'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>Gestion des <?php echo $t_sizaines; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="templates/default/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
}
?>
<h1>Gestion des <?php echo $t_sizaines; ?></h1>
<p align="center"><a href="index.php?page=gestion_unite">Retour à la page Gestion de l'Unité</a></p>
<?php
if ($user['niveau']['numniveau'] == 3)
{
?>
<div class="introduction">
<p>Cette page te permet de gérer les différentes <?php echo $t_sizaines; ?> qui existent
dans ta Section. Attention de ne pas faire tout et n'importe quoi, les <?php echo $t_sizaines; ?>
sont un élément pivot de la gestion des membres de l'Unité !</p>
</div>
<?php
}
else if ($user['niveau']['numniveau'] == 5)
{
?>
<div class="introduction">
<p>Cette page te permet de gérer les différentes <?php echo $t_sizaines; ?> qui existent
dans l'Unité. Attention de ne pas faire tout et n'importe quoi, les <?php echo $t_sizaines; ?>
sont un élément pivot de la gestion des membres de l'Unité !</p>
</div>
<?php
}
else
{
?>
<div class="introduction">
<p>Sur cette page, tu peux consulter les informations relatives aux <?php echo $t_sizaines; ?> des différentes
sections.</p>
</div>
<?php
}
$nbresizaines = 0;
if (is_array($sizaines))
{
foreach($sizaines as $sizaine)
{
if ($user['numsection'] == $sizaine['section_sizpat'] or $user['niveau']['numniveau'] > 3)
{
$nbresizaines++;
}
}
}
if ($nbresizaines > 0 and ($sections[$user['numsection']]['sizaines'] > 0 or $user['niveau']['numniveau'] > 3))
{
?>
<p class="rmqbleu">Voici les <?php echo $t_sizaines; ?> présentes dans la base de données</p>
<?php
if ($user['niveau']['numniveau'] == 3)
{
?>
<p>Section en cours : <span class="rmq"><?php echo $sections[$user['numsection']]['nomsection']; ?></span></p>
<?php
}
?>
<table width="80%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<?php
if ($user['niveau']['numniveau'] > 3)
{
?>
<th>Section</th>
<?php
}
?>
<th><?php echo $t_sizaine; ?></th>
<th>Cri</th>
</tr>
<?php
$i = 0;
foreach ($sizaines as $sizaine)
{
if ($user['numsection'] == $sizaine['section_sizpat'] or $user['niveau']['numniveau'] > 3)
{
$couleur = ($i % 2 == 0) ? 'td-1' : 'td-2';
?>
<tr class="<?php echo $couleur; ?>">
<?php
$i++;
if ($user['niveau']['numniveau'] > 3)
{
?>
<td><?php echo $sections[$sizaine['section_sizpat']]['nomsection']; ?></td>
<?php
}
?>
<td><?php echo $sizaine['nomsizaine']; ?></td>
<td><?php echo $sizaine['cri']; ?></td>
</tr>
<?php
}
}
?>
</table>
<?php
if ($msg == 1)
{
?>
<div class="msg">
<p class="rmq" align="center">Modification effectuée avec succès</p>
</div>
<?php
}
if ($msg == 2)
{
?>
<div class="msg">
<p class="rmq" align="center">Tu n'as pas les droits suffisants pour cette action.</p>
</div>
<?php
}
if ($msg == 3)
{
?>
<div class="msg">
<p class="rmq" align="center">Cette <?php echo $t_sizaine; ?> n'est pas vide. Suppression impossible !</p>
</div>
<?php
}
}
else
{
if ($user['niveau']['numniveau'] == 3)
{
if ($sections[$user['numsection']]['sizaines'] == 0)
{
?>
<div class="msg">
<p align="center" class="rmq">D'après les infos de ta section, tu n'utilises pas les <?php echo $t_sizaines; ?>.</p>
<p align="center"><a href="index.php?page=gestion_sections&do=modifiersection&step=2&numsection=<?php echo $masection; ?>">Modifier ces infos</a>.</p>
</div>
<?php
}
else
{
?>
<div class="msg">
<p align="center" class="rmq">Il n'y a encore aucune <?php echo $t_sizaine; ?> pour ta section dans la base de données.</p>
</div>
<?php
}
}
else
{
?>
<div class="msg">
<p align="center" class="rmq">Il n'y a encore aucune <?php echo $t_sizaine; ?> dans la base de données de l'Unité.</p>
</div>
<?php
}
}
?>
<?php
if (($user['niveau']['numniveau'] == 3 and $sections[$user['numsection']]['sizaines'] > 0) or $user['niveau']['numniveau'] == 5)
{
?>
<div class="menu_flottant">
<h2>Gérer les <?php echo $t_sizaines; ?></h2>
<p>
- <a href="index.php?page=gestion_sizpat&do=ajoutersizaine">Ajouter une <?php echo $t_sizaine; ?></a><?php
if ($nbresizaines > 0)
{
?><br />
- <a href="index.php?page=gestion_sizpat&do=supprimersizaine">Supprimer une <?php echo $t_sizaine; ?></a><br />
- <a href="index.php?page=gestion_sizpat&do=modifiersizaine">Modifier les infos d'une <?php echo $t_sizaine; ?></a>
<?php
}
?>
</p>
</div>
<?php
}
// juste ici au-dessus placer </body></html>
}
else if ($do == 'ajoutersizaine')
{
if ($_POST['step'] == 2)
{
if ((($user['niveau']['numniveau'] == 3 and $user['numsection'] == $_POST['section']) or $user['niveau']['numniveau'] == 5) and is_numeric($_POST['section']))
{
$nomsizaine = htmlentities($_POST['nomsizaine'], ENT_QUOTES);
$cri = htmlentities($_POST['cri'], ENT_QUOTES);
$sql = "INSERT INTO ".PREFIXE_TABLES."unite_sizaines (nomsizaine, section_sizpat, cri) values ('$nomsizaine', '$_POST[section]', '$cri')";
send_sql($db, $sql);
reset_config();
log_this("Ajout $nomsizaine", 'gestion_sizpat');
header('Location: index.php?page=gestion_sizpat&msg=1');
}
else
{
header('Location: index.php?page=gestion_sizpat&msg=2');
}
}
else
{
?>
<h1>Ajouter une <?php echo $t_sizaine; ?> dans la base de données</h1>
<p align="center"><a href="index.php?page=gestion_sizpat">Retour à la page Gestion des <?php echo $t_sizaines; ?></a></p>
<script language="JavaScript" type="text/JavaScript">
<!--
function clean(form)
{
if (form.nomsizaine.value == "<?php echo $t_sizaine; ?> des ...")
{
form.nomsizaine.value = "";
}
}
function sectionchoisie(form)
{
if (form.section.value != '' && form.section.value != 'erreur' && form.nomsizaine.value != '' && form.nomsizaine.value != '<?php echo $t_sizaine; ?> des ...')
{
return true;
}
else if (form.section.value == 'erreur')
{
alert("Tu ne peux choisir aucune section pour créer la <?php echo $t_sizaine; ?>.");
return false;
}
else if (form.nomsizaine.value == '' || form.nomsizaine.value == '<?php echo $t_sizaine; ?> des ...')
{
alert("N'oublie pas de donner un nom à la <?php echo $t_sizaine; ?> que tu crées.");
return false;
}
else
{
alert ("N'oublie pas de choisir une section.");
return false;
}
}
//-->
</script>
<form action="gestion_sizpat.php" method="post" name="form" class="form_config_site" id="form" onsubmit="return sectionchoisie(this)">
<input type="hidden" name="do" value="ajoutersizaine" />
<input type="hidden" name="step" value="2" />
<table width="80%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr class="td-gris">
<td width="50%">Nom de la <?php echo $t_sizaine; ?> *</td>
<td width="50%"><input name="nomsizaine" type="text" id="nomsizaine" size="40" value="<?php echo $t_sizaine; ?> des ..." onfocus="clean(this.form);" maxlength="100" /></td>
</tr>
<tr class="td-gris">
<td width="50%">Section *</td>
<td width="50%">
<?php
if ($user['niveau']['numniveau'] == 5)
{
?>
<select name="section" id="section">
<option value="" selected="selected"></option>
<?php
foreach ($sections as $ligne)
{
if (!is_unite($ligne['numsection']) and $ligne['sizaines'] > 0)
{
?>
<option value="<?php echo $ligne['numsection']; ?>"><?php echo $ligne['nomsection']; ?></option>
<?php
}
}
?>
</select>
<?php
}
else if ($user['niveau']['numniveau'] == 3)
{
echo $sections[$user['numsection']]['nomsection'];
?>
<input type="hidden" name="section" value="<?php echo $user['numsection']; ?>" />
<?php
}
?>
</td>
</tr>
<tr class="td-gris">
<td width="50%">Cri de <?php echo $t_sizaine; ?> :</td>
<td width="50%"><input name="cri" type="text" id="cri" size="40" maxlength="400" /></td>
</tr>
</table>
<p align="center">
<input type="submit" value="Ajouter cette <?php echo $t_sizaine; ?>" />
</p>
</form>
<?php
}
}
else if ($do == 'supprimersizaine')
{
if ($_POST['step'] == 2 and is_numeric($_POST['sizaine']))
{
if ($user['niveau']['numniveau'] == 5 or $user['numsection'] == $sizaines[$_POST['sizaine']]['section_sizpat'])
{
$sql = "SELECT nummb FROM ".PREFIXE_TABLES."mb_membres WHERE siz_pat = '$_POST[sizaine]'";
$res = send_sql($db, $sql);
if (mysql_num_rows($res) == 0)
{
log_this('Suppression '.$sizaines[$_POST['sizaine']]['nomsizaine'], 'gestion_sizpat');
$sql = "DELETE FROM ".PREFIXE_TABLES."unite_sizaines WHERE numsizaine = '$_POST[sizaine]'";
send_sql($db, $sql);
reset_config();
header('Location: index.php?page=gestion_sizpat&msg=1');
}
else
{
header('Location: index.php?page=gestion_sizpat&msg=3');
}
}
else
{
header('Location: index.php?page=gestion_sizpat&msg=2');
}
}
else
{
?>
<h1>Supprimer une <?php echo $t_sizaine; ?></h1>
<p align="center"><a href="index.php?page=gestion_sizpat">Retour à la page Gestion des <?php echo $t_sizaines; ?></a></p>
<script language="JavaScript" type="text/JavaScript">
<!--
function choix(section)
{
var v = getElement("sizaine"+section).value;
getElement("formsuppr").reset();
getElement("sizaine"+section).value = v;
getElement("sizaine").value = v;
}
function sizainechoisie(form)
{
if (getElement('sizaine').value != "")
{
return true;
}
else
{
alert ("N'oublie pas de choisir une <?php echo $t_sizaine; ?>.");
return false;
}
}
//-->
</script>
<noscript>
<div class="msg">
<p class="rmq">Javascript désactivé</p>
<p>Ce script utilise le javascript. Merci de l'activer pour utiliser cette page. </p>
</div>
</noscript>
<form action="gestion_sizpat.php" method="post" name="form" class="form_config_site" id="formsuppr" onsubmit="return sizainechoisie(this)">
<input type="hidden" name="do" value="supprimersizaine" />
<input type="hidden" name="step" value="2" />
<table width="80%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr class="td-gris">
<td colspan="2">Sélectionne la <?php echo $t_sizaine; ?> que tu souhaites
supprimer :</td>
</tr>
<?php
if ($user['niveau']['numniveau'] == 3)
{
?>
<tr class="td-gris">
<td><?php echo $sections[$user['numsection']]['nomsection']; ?></td>
<td>
<select name="sizaine">
<option value=""></option>
<?php
foreach ($sizaines as $ligne)
{
if ($ligne['section_sizpat'] == $user['numsection'])
{
?>
<option value="<?php echo $ligne['numsizaine']; ?>"><?php echo $ligne['nomsizaine']; ?></option>
<?php
}
}
?>
</select>
</td>
</tr>
<?php
}
if ($user['niveau']['numniveau'] == 5)
{
?>
<input type="hidden" name="sizaine" id="sizaine" />
<?php
foreach ($sections as $section)
{
if ($section['sizaines'] > 0)
{
echo "\n";
?>
<tr class="td-gris">
<td><?php echo $section['nomsection']; ?></td>
<td>
<select name="sizaine<?php echo $section['numsection']; ?>" onchange="choix(<?php echo $section['numsection']; ?>)" id="sizaine<?php echo $section['numsection']; ?>">
<option value=""></option>
<?php
foreach ($sizaines as $sizaine)
{
if ($sizaine['section_sizpat'] == $section['numsection'])
{
?>
<option value="<?php echo $sizaine['numsizaine']; ?>"><?php echo $sizaine['nomsizaine']; ?></option>
<?php
}
}
?>
</select>
</td>
</tr>
<?php
} // fin if sizaines > 0
} // fin foreach $sections
} // fin else if
?>
<tr class="td-1">
<td class="petitbleu" colspan="2">Pour pouvoir supprimer une <?php echo $t_sizaine; ?>, aucun membre ne doit
y appartenir dans la base de données. Si c'est le cas, la suppression
sera refusée.</td>
</tr>
</table>
<p align="center">
<input type="submit" id="envoi_form" value="Supprimer la <?php echo $t_sizaine; ?>" disabled="disabled" />
</p>
</form>
<script type="text/javascript">
<!--
getElement('envoi_form').disabled = false;
//-->
</script>
<?php
}
}
else if ($do == 'modifiersizaine')
{
if ($_POST['step'] == 3 and is_numeric($_POST['numsizaine']))
{
if ($user['niveau']['numniveau'] == 3 and $user['numsection'] == $sizaines[$_POST['numsizaine']]['section_sizpat'])
{
$nomsizaine = htmlentities($_POST['nomsizaine'], ENT_QUOTES);
$cri = htmlentities($_POST['cri'], ENT_QUOTES);
$sql = "UPDATE ".PREFIXE_TABLES."unite_sizaines SET nomsizaine = '$nomsizaine', cri = '$cri' WHERE numsizaine = '$_POST[numsizaine]'";
send_sql($db, $sql);
reset_config();
log_this('Modification '.$_POST['numsizaine'].' '.$nomsizaine, 'gestion_sizpat');
header('Location: index.php?page=gestion_sizpat&msg=1');
}
else if ($user['niveau']['numniveau'] == 5)
{
$nomsizaine = htmlentities($_POST['nomsizaine'], ENT_QUOTES);
$cri = htmlentities($_POST['cri'], ENT_QUOTES);
$sql = "UPDATE ".PREFIXE_TABLES."unite_sizaines SET nomsizaine = '$nomsizaine', cri = '$cri', section_sizpat = '$_POST[section]' WHERE numsizaine = '$_POST[numsizaine]'";
send_sql($db, $sql);
if ($_POST['section'] != $_POST['oldsection'])
{
$sql = "UPDATE ".PREFIXE_TABLES."mb_membres SET siz_pat = '0' WHERE siz_pat = '$_POST[numsizaine]'";
send_sql($db, $sql);
}
reset_config();
log_this('Modification '.$_POST['numsizaine'].' '.$nomsizaine, 'gestion_sizpat');
header('Location: index.php?page=gestion_sizpat&msg=1');
}
else
{
header('Location: index.php?page=gestion_sizpat&msg=2');
}
}
else if ($_POST['step'] == 2 and is_numeric($_POST['sizaine']))
{
foreach($sizaines as $ligne)
{
if ($ligne['numsizaine'] == $_POST['sizaine'])
{
?>
<h1>Modifier les infos d'une <?php echo $t_sizaine; ?></h1>
<p align="center"><a href="index.php?page=gestion_sizpat">Retour à la page Gestion des <?php echo $t_sizaines; ?></a></p>
<script type="text/javascript" language="JavaScript">
<!--
function check_form(form)
{
if (form.nomsizaine.value != '')
{
return confirm("Es-tu certain de vouloir modifier les infos de cette <?php echo $t_sizaine; ?> ?");
}
else
{
alert("N'oublie pas de donner un nom à la <?php echo $t_sizaine; ?> !");
return false;
}
}
//-->
</script>
<form action="gestion_sizpat.php" method="post" name="form1" class="form_config_site" id="form1" onsubmit="return check_form(this)">
<input type="hidden" name="do" value="modifiersizaine" />
<input type="hidden" name="step" value="3" />
<input type="hidden" name="numsizaine" value="<?php echo $_POST['sizaine']; ?>" />
<table width="75%" border="0" align="center" cellpadding="2" cellspacing="0">
<?php
if ($user['niveau']['numniveau'] == 5)
{
?>
<tr class="td-gris">
<td width="30%">Section de la <?php echo $t_sizaine; ?> *
<input type="hidden" name="oldsection" value="<?php echo $_POST['section']; ?>" /></td>
<td width="70%">
<script type="text/javascript" language="JavaScript">
<!--
function note(form)
{
if (form.section.value != form.oldsection.value)
{
alert("Rappel !\n\nLes membres appartenant à cette <?php echo $t_sizaine; ?> seront détachés de celle-ci.");
}
else
{
alert("En sélectionnant la section d'origine de cette <?php echo $t_sizaine; ?>, les membres ne seront pas détachés de celle-ci.");
}
}
//-->
</script>
<select name="section" id="section" onchange="note(this.form)">
<?php
foreach ($sections as $section)
{
if (!is_unite($section['numsection']) and $section['sizaines'] > 0)
{
?>
<option value="<?php echo $section['numsection']; ?>"<?php echo ($section['numsection'] == $ligne['section_sizpat']) ? ' selected' : ''; ?>><?php echo $section['nomsection']; ?></option>
<?php
}
}
?>
</select> </td>
</tr>
<?php
}
?>
<tr class="td-gris">
<td width="30%">Nom de la <?php echo $t_sizaine; ?> *</td>
<td width="70%"><input name="nomsizaine" type="text" id="nomsizaine" size="40" value="<?php echo $ligne['nomsizaine']; ?>" maxlength="100" /></td>
</tr>
<tr class="td-gris">
<td width="30%">Cri de <?php echo $t_sizaine; ?></td>
<td width="70%"><input name="cri" type="text" id="cri" size="30" value="<?php echo $ligne['cri']; ?>" /></td>
</tr>
<?php
if ($user['niveau']['numniveau'] == 5)
{
?>
<tr>
<td> </td>
<td> </td>
</tr>
<tr class="td-gris">
<td colspan="2" class="petitbleu"><span class="rmq">Attention !</span><br />
Si tu changes la Section à laquelle appartient cette <?php echo $t_sizaine; ?>,
des erreurs risquent de se produire dans la gestion des membres qui s'y
trouvent. Afin d'empêcher ce problème, les membres concernés
seront détachés de leur <?php echo $t_sizaine; ?>. A toi ensuite,
d'effectuer les modifications nécessaires.</td>
</tr>
<?php
}
?>
</table>
<p align="center">
<input type="submit" name="Submit" value="Modifier les infos de cette <?php echo $t_sizaine; ?>" />
</p>
</form>
<?php
}
}
}
else
{
?>
<h1>Modifier les infos d'une <?php echo $t_sizaine; ?></h1>
<p align="center"><a href="index.php?page=gestion_sizpat">Retour à la page Gestion des <?php echo $t_sizaines; ?></a></p>
<script language="JavaScript" type="text/JavaScript">
<!--
function choix(section)
{
var v = getElement("sizaine"+section).value;
getElement("formmodif").reset();
getElement("sizaine"+section).value = v;
getElement("sizaine").value = v;
}
function sizainechoisie(form)
{
if (form.sizaine.value != "")
{
return true;
}
else
{
alert ("N'oublie pas de choisir une <?php echo $t_sizaine; ?>.");
return false;
}
}
//-->
</script>
<noscript>
<div class="msg">
<p class="rmq">Javascript désactivé</p>
<p>Ce script utilise le javascript. Merci de l'activer pour utiliser cette page. </p>
</div>
</noscript><form action="index.php" method="post" name="form" class="form_config_site" id="formmodif" onsubmit="return sizainechoisie(this)">
<input type="hidden" name="page" value="gestion_sizpat" />
<input type="hidden" name="do" value="modifiersizaine" />
<input type="hidden" name="step" value="2" />
<table width="80%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr class="td-gris">
<td width="50%" height="25" colspan="2" class="rmqbleu">Sélectionne la <?php echo $t_sizaine; ?> à modifier :</td>
</tr>
<?php
if ($user['niveau']['numniveau'] == 3)
{
?>
<tr class="td-gris">
<td><?php echo $sections[$user['numsection']]['nomsection']; ?></td>
<td>
<select name="sizaine">
<option value="" selected="selected"></option>
<?php
foreach ($sizaines as $ligne)
{
if ($ligne['section_sizpat'] == $user['numsection'])
{
?>
<option value="<?php echo $ligne['numsizaine']; ?>"><?php echo $ligne['nomsizaine']; ?></option>
<?php
}
}
?>
</select>
</td>
</tr>
<?php
}
else if ($user['niveau']['numniveau'] == 5)
{
?>
<input type="hidden" name="sizaine" id="sizaine" />
<?php
foreach ($sections as $section)
{
if ($section['sizaines'] > 0)
{
echo "\n";
?>
<tr class="td-gris">
<td><?php echo $section['nomsection']; ?></td>
<td>
<select name="sizaine<?php echo $section['numsection']; ?>" onchange="choix(<?php echo $section['numsection']; ?>)" id="sizaine<?php echo $section['numsection']; ?>">
<option value=""></option>
<?php
foreach ($sizaines as $sizaine)
{
if ($sizaine['section_sizpat'] == $section['numsection'])
{
?>
<option value="<?php echo $sizaine['numsizaine']; ?>"><?php echo $sizaine['nomsizaine']; ?></option>
<?php
}
}
?>
</select>
</td>
</tr>
<?php
} // fin if sizaines > 0
} // fin foreach $sections
} // fin else if
?>
</table>
<p align="center">
<input type="submit" value="Sélectionner cette <?php echo $t_sizaine; ?>" />
</p>
</form>
<?php
}
}
}
?>
<?php
if (!defined('IN_SITE'))
{
?>
</body>
</html>
<?php
}
?>