headerhtml (); $f -> collectivite (); $f -> droit ($obj); $f -> header (1, $ent); $f->isAuthorized($obj); echo "\n
\n"; if($validation==0){ $validation=1; echo ""; echo ""; echo ""; // choix scrutin $sql="select scrutin,libelle from scrutin where solde !='Oui'"; $res = $f -> db -> query($sql); if (DB :: isError($res)) die($res->getMessage()."erreur SELECT ".$sql); echo ""; If ($_SESSION['profil'] >= $f -> droit){ echo ""; //echo "
".$f -> lang("traitement")." ".$f -> lang("de")." ".$f -> lang("creation")." ".$f -> lang("de")." ".$f -> lang("composition_des_bureaux")."

".$f -> lang("selectionnez")." ".$f -> lang("un")." ".$f -> lang("scrutin")." :

"; echo ""; echo "
".$f -> lang("lancez")." ".$f -> lang("ce")." ".$f -> lang("traitement")." "." ".$f -> lang("avant")." ".$f -> lang("les")." ".$f -> lang("edition").$f -> lang("pluriel")." ".$f -> lang("çi_dessous")." !

"; }else echo "
".$f->lang("attention")." ".$f->lang("droit").$f->lang("pluriel")." ".$f->lang("insuffisant").$f->lang("pluriel"); echo ""; echo "
"; echo "".$f -> lang("edition")." ".$f -> lang("composition_des_bureaux").""; echo "
"; // choix scrutin $sql="select scrutin,libelle from scrutin where solde !='Oui'"; $res = $f -> db -> query($sql); if (DB :: isError($res)) die($res->getMessage()."erreur SELECT ".$sql); while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ echo "
  "; echo $f -> lang("edition")." ".$f -> lang("par")." ".$f -> lang("bureau")."
".$f -> lang("election")." ".$row['libelle']."
"; } echo ""; echo "
"; }else{ // validation = 1 // vider la table composition_bureau echo "
Traitement "; $sql = "delete from composition_bureau where scrutin ='".$scrutin."'"; $res = $f -> db -> query($sql); if (DB :: isError($res)) die($res->getMessage()."erreur effacer table ".$sql); echo $f -> lang("enregistrement")." ".$f -> lang("table")."\"composition_bureau\" ".$f -> lang("efface")." ".$f -> lang("pour")." ".$scrutin."
"; $sql=" select canton from scrutin where scrutin ='".$scrutin."'"; $canton = $f -> db -> getOne($sql); if($canton == 'T') $sql="select bureau from bureau"; else $sql="select bureau from bureau where canton = '".$canton."'"; $res = $f -> db -> query($sql); if (DB :: isError($res)) die($res->getMessage()."erreur SELECT ".$sql); while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $sql="insert into composition_bureau (bureau, scrutin) values('".$row['bureau']."','".$scrutin."')"; $res1 = $f -> db -> query($sql); if (DB :: isError($res1)) die($res1->getMessage()."erreur maj ".$sql); } echo $res->numrows()." ".$f -> lang("bureau")." ".$f -> lang("cree")." ".$f -> lang("pour")." ".$scrutin." ".$f -> lang("canton")." : ".$canton."
"; // secretaire $sql="select nom,prenom,bureau from candidature inner join agent on candidature.agent = agent.agent where scrutin='". $scrutin. "' and decision ='Oui' and candidature.poste = 'secretaire' and periode !='matin'"; $res = $f -> db -> query($sql); if (DB :: isError($res)) die($res->getMessage()."erreur SELECT ".$sql); while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $sql="update composition_bureau set secretaire='".$row['nom']." ". $row['prenom']."' where bureau='".$row['bureau']."' and scrutin='". $scrutin."'"; $res1 = $f -> db -> query($sql); if (DB :: isError($res1)) die($res1->getMessage()."erreur maj ".$sql); } echo $res->numrows()." secretaire pour ".$scrutin." canton : ".$canton."
"; // president $sql="select nom,prenom,bureau from affectation inner join elu on affectation.elu = elu.elu where scrutin='". $scrutin. "' and decision ='Oui' and affectation.poste = 'president' "; $res = $f -> db -> query($sql); if (DB :: isError($res)) die($res->getMessage()."erreur SELECT ".$sql); while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $sql="update composition_bureau set president='".$row['nom']." ". $row['prenom']."' where bureau='".$row['bureau']."' and scrutin='". $scrutin."'"; $res1 = $f -> db -> query($sql); if (DB :: isError($res1)) die($res1->getMessage()."erreur maj ".$sql); } echo $res->numrows()." president pour ".$scrutin." canton : ".$canton."
"; // president suppleant $sql="select nom,prenom,bureau from affectation inner join elu on affectation.elu = elu.elu where scrutin='". $scrutin. "' and decision ='Oui' and affectation.poste = 'president suppleant' "; $res = $f -> db -> query($sql); if (DB :: isError($res)) die($res->getMessage()."erreur SELECT ".$sql); while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $sql="update composition_bureau set president_suppleant='".$row['nom']." ". $row['prenom']."' where bureau='".$row['bureau']."' and scrutin='". $scrutin."'"; $res1 = $f -> db -> query($sql); if (DB :: isError($res1)) die($res1->getMessage()."erreur maj ".$sql); } echo $res->numrows()." president suppleant pour ".$scrutin." canton : ".$canton."
"; echo "
"; echo "
Composition du bureau "; $sql="select bureau,president,president_suppleant,secretaire from composition_bureau where scrutin='". $scrutin."' order by bureau"; $res = $f -> db -> query($sql); if (DB :: isError($res)) die($res->getMessage()."erreur SELECT ".$sql); echo ""; echo ""; while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ echo ""; } echo "
BureauPresident". "President suppleantsecretaire
No ".$row['bureau']."".$row['president']."". $row['president_suppleant']."".$row['secretaire']."
"; echo "
"; echo ""; } // $f -> footer (); $f -> deconnexion (); $f -> footerhtml (); ?>