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
| <? require "Includes/fonctions.php"; ?>
<div class="titre">Ajouter une personne de l'encadrement :</div>
<hr width="100%"><br>
<?
$longeur_max=60;
//-------- premier formulaire, liste des personnes ------------
if (isset($_POST['valeur']))
{
if ($_POST['valeur']!=NULL)
{
$table=$_POST['valeur'];
echo "Liste du personnel d'encadrement<br><br>";
$sql="select NUM_ENCADREMENT from ".$table;
$sqll=mysql_query($sql);
echo "<form name='formclub' method='post' action='index.php?i=2&pg=affectation_encadrement1&table=".$table."'>";
echo "<select name='encadrement' size='20'>";
while ($row=mysql_fetch_array($sqll))
{
$sqlll="select NOM_ENCADREMENT, PRENOM_ENCADREMENT from encadrement where NUM_ENCADREMENT =".$row["NUM_ENCADREMENT"];
$query=mysql_query($sqlll);
$rown=mysql_fetch_array($query);
$nom=strtoupper($rown["NOM_ENCADREMENT"]);
$prenom=strtolower($rown["PRENOM_ENCADREMENT"]);
$prenom=ucfirst($prenom);
echo "<option value='".$row["NUM_ENCADREMENT"]."'>".$nom." ".$prenom."</option>";
}
echo "</select><br><br>";
echo "<div align='center'><input type='submit' name='etape_2' value='Etape Suivante >>'></div></form>";
}
else
{
echo "<font color='#990000'><b>Aucun Champs selectionné, veuillez recommencer</b></font>";
}
}
else
{
//-------- second formulaire, structure et fédérations ajout ------------
if (isset($_POST['encadrement']))
{
$table=$_GET['table'];
if ($_POST['encadrement']!=NULL)
{
$ecadrement=$_POST['encadrement'];
$sql="select NOM_ENCADREMENT, PRENOM_ENCADREMENT from encadrement where NUM_ENCADREMENT=".$_POST['encadrement'];
$sqll=mysql_query($sql);
$rowm=mysql_fetch_array($sqll);
$nom=strtoupper($rowm["NOM_ENCADREMENT"]);
$prenom=strtolower($rowm["PRENOM_ENCADREMENT"]);
$prenom=ucfirst($prenom);
echo "Votre selection : <b>".$nom." ".$prenom."</b><br><br><br><div class='titre'>Selectionnez votre structure: </div><br>";
//affichage des listes déroulante en fonction du nombre de fédérations choisies
if (isset($_POST['nb_struc']))
{
if ($_POST['nb_struc']!=NULL)
{
echo "<form name='formtoto3' method='post' action=''>";
$nbstruc=$_POST['nb_struc'];
echo "<input type='hidden' name='nb_struc' value='".$nbstruc."'>";
echo "<input type='hidden' name='testo' value='".$ecadrement."'>";
$i=0;
echo "<input type='submit' name='submit' value='Valider Resultat' class='bouton'>";
echo "</form>";
}
else
{
echo "<font color='#990000'><b>Aucun Champs selectionné</b></font>";
}
}
}
$table=$_GET['table'];
?>
<br><hr width="100%"><br><div class="titre">Selectionnez la fédération de l'encadrement</div><br><br>
<?
$fede="select NOM_FEDERATION from federation f, occuper_federation fe where f.NUM_FEDERATION=fe.NUM_FEDERATION and NUM_ENCADREMENT=".$ecadrement;
$fedee=mysql_query($fede);
$nb=mysql_num_rows($fedee);
if($nb!=NULL)
{
echo "<b>/!\ Cette personne est déjà dans une/plusieurs fédération(s)</b><br>";
}
while($row=mysql_fetch_array($fedee))
{
echo "Fédération :".$row['NOM_FEDERATION']."<br>";
}
echo "<br>_____________________<br><br>";
echo "<form name='formclub' method='post' action='index.php?i=2&pg=affectation_encadrement1&table=".$table."'>";
echo "<input type='hidden' name='encadrement' value='".$ecadrement."'>";
echo "Combien de fédérations souhaitez-vous rattacher cette personne?<br>";
echo "<input type='text' name='nb_fede' size=7> <input type='submit' name='submit' value='Envoyer'><br><br></form>";
//affichage des listes déroulante en fonction du nombre de fédérations choisies
if (isset($_POST['nb_fede']))
{
if ($_POST['nb_fede']!=NULL)
{
echo "<form name='formtoto2' method='post' action=''>";
$nbfed=$_POST['nb_fede'];
echo "<input type='hidden' name='nb_federation' value='".$nbfed."'>";
echo "<input type='hidden' name='testo' value='".$ecadrement."'>";
$i=0;
while ($i<$_POST['nb_fede'])
{
$reqmvt="select NUM_FEDERATION, NOM_FEDERATION from federation order by NOM_FEDERATION";
$mvt=mysql_query($reqmvt);
echo "<select name='fede".$i."'><option value=''>-- Selectionnez --</option>";
while ($row=mysql_fetch_array($mvt))
{
$txt=Tronquer_Texte($row["NOM_FEDERATION"], $longeur_max);
echo "<option value='".$row["NUM_FEDERATION"]."'>".$txt."</option>";
}
$i++;
echo "</select><br><br>";
echo '<select name="fonction"><br><br>';
$SQL = "SELECT LIB_FONCTION, NUM_FONCTION FROM fonction";
$res = mysql_query($SQL) or die ($SQL.' : '.mysql_error());
while($val=mysql_fetch_array($res))
{
echo '<option value="'.$val['NUM_FONCTION'].'">'.$val['LIB_FONCTION'].'</option>';
}
echo '</select>';
}
echo "<input type='submit' name='submit' value='Valider Resultat' class='bouton'>";
echo "</form>";
}
else
{
echo "<font color='#990000'><b>Aucun Champs selectionné</b></font>";
}
}
}
else
{
if (isset($_POST['fede0']))
{
if ($_POST['fede0']!=NULL)
{
$nb=$_POST['nb_federation'];
$enca=$_POST['testo'];
$i=0;
while ($i<$nb)
{
if ($_POST["fede$i"]!=NULL)
{
$sql="select NUM_FEDERATION, NUM_ENCADREMENT from OCCUPER_FEDERATION where NUM_FEDERATION=".$_POST["fede$i"]." AND NUM_ENCADREMENT= ".$enca;
$query=mysql_query($sql);
$nbnum=mysql_num_rows($query);
$fed="select NOM_FEDERATION from federation where NUM_FEDERATION=".$_POST["fede$i"];
$fede=mysql_query($fed);
$row=mysql_fetch_array($fede);
if ($nbnum!=NULL)
{
echo "Fédération <b>".$row['NOM_FEDERATION']."</b> déjà selectionnée pour cette personne<br><br>";
}
else
{
$insert="insert into ENCADRER_FEDERATION values('".$enca."','".$_POST["fonction"]."','".$_POST["fede$i"]."')";
$query=mysql_query($insert);
echo "Insertion Réussie pour la fédération <b>".$row['NOM_FEDERATION']."</b><br><br>";
}
$i++;
}
else
{
echo "<b>ERREUR REQUETE</b>";
}
}
}
else
{
echo "<b>ERREUR REQUETE, veuillez selectionner une fédération</b>";
}
}
else
{
if ((isset($_POST["centredeformation0"]))||(isset($_POST["poleespoir0"]))||(isset($_POST["polefrance0"])))
{
if(($_POST["centredeformation0"]!=NULL)||($_POST["poleespoir0"]!=NULL)||($_POST["polefrance0"]!=NULL))
{
echo $_POST["centredeformation0"];
$nb=$_POST['nb_struc'];
echo $nb;
$enca=$_POST['testo'];
$i=0;
while ($i<$nb)
{
if (($_POST["centredeformation$i"])!=NULL)
{
$table="centredeformation";
$valeur=$_POST["centredeformation$i"];
}
else
{
if (($_POST["poleespoir$i"])!=Null)
{
$table="poleespoir";
$valeur=$_POST["poleespoir$i"];
}
else
{
if (($_POST["polefrance$i"])!=Null)
{
$table="polefrance";
$valeur=$_POST["polefrance$i"];
}
}
}
$sql="select NUM_ENCADREMENT, NUM_STRUCTURE from travailler_dans_".$table." where NUM_STRUCTURE=".$valeur." AND NUM_ENCADREMENT= ".$enca;
$query=mysql_query($sql);
$nbnum=mysql_num_rows($query);
$fed="select NOM_STRUCTURE from ".$table." where NUM_STRUCTURE=".$valeur;
$fede=mysql_query($fed);
$row=mysql_fetch_array($fede);
if ($nbnum!=NULL)
{
echo "Structure <b>".$row['NOM_STRUCTURE']."</b> déjà selectionnée pour cette personne<br><br>";
}
else
{
$insert="insert into travailler_dans_".$table." values('".$valeur."','".$enca."')";
$query=mysql_query($insert);
echo "Insertion Réussie pour la fédération <b>".$row['NOM_FEDERATION']."</b><br><br>";
}
$i++;
}
}
}
else
{
//------------------------ formulaire 1 ------------------
?>
<form name="formclub" method="post" action="index.php?i=2&pg=affectation_encadrement1">
Choix encadrement :<br><br>
<select name="valeur"><option value="">Selectionnez</option><option value="elu">Elu</option><option value="sal_enc">Non Elu</option></select>
<br><div align="center"><input type="submit" name="submit" value="Enregistrer"></div>
</form><br><br>
<?
}
}
}
}
?> |
Partager