\n"; if($validation==0){ $validation=1; echo ""; echo ""; // choix scrutin $sql="select scrutin,libelle from ".DB_PREFIXE."scrutin where solde is false"; $res = $f -> db -> query($sql); $f->isDatabaseError($res); echo ""; echo ""; //echo "

"._("selection")." "._("scrutin")."
"; echo "
"; echo "   "._("lancez")." "._("traitement")." "." "._("avant de consulter la Composition des bureaux")." !

"; echo ""; echo "
"; echo ""._("Composition des bureaux").""; echo "
"; // choix scrutin $sql="select scrutin,libelle from ".DB_PREFIXE."scrutin where solde is false"; $res = $f -> db -> query($sql); $f->isDatabaseError($res); while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ echo "    "; echo " "._("Composition des bureaux")." - "._("Election")." ".$row['libelle']."
"; } echo ""; echo ""; }else{ // validation = 1 echo "
"; echo _("Retour"); echo "

"; // vider la table composition_bureau echo "
Traitement "; $sql = "delete from ".DB_PREFIXE."composition_bureau where scrutin ='".$scrutin."'"; $res = $f -> db -> query($sql); $f->isDatabaseError($res); echo _("enregistrement")." "._("table")."\"composition_bureau\" "._("efface")." "._("pour")." ".$scrutin."
"; $sql=" select canton from ".DB_PREFIXE."scrutin where scrutin ='".$scrutin."'"; $canton = $f -> db -> getOne($sql); if($canton == 'T') $sql="select bureau from ".DB_PREFIXE."bureau"; else $sql="select bureau from ".DB_PREFIXE."bureau where canton = '".$canton."'"; $res = $f -> db -> query($sql); $f->isDatabaseError($res); while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $sql="insert into ".DB_PREFIXE."composition_bureau (bureau, scrutin) values('".$row['bureau']."','".$scrutin."')"; $res1 = $f -> db -> query($sql); $f->isDatabaseError($res1); } echo $res->numrows()." "._("bureau")." "._("cree")." "._("pour")." ".$scrutin." "._("canton")." : ".$canton."
"; // secretaire $sql="select nom,prenom,bureau from ".DB_PREFIXE."candidature inner join ".DB_PREFIXE. "agent on candidature.agent = agent.agent where scrutin='".$scrutin. "' and decision is true and candidature.poste = 'SECRETAIRE' and periode !='matin'"; $res = $f -> db -> query($sql); $f->isDatabaseError($res); while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $sql="update ".DB_PREFIXE."composition_bureau set secretaire='".$row['nom']." ". $row['prenom']."' where bureau='".$row['bureau']."' and scrutin='". $scrutin."'"; $res1 = $f -> db -> query($sql); $f->isDatabaseError($res1); } echo $res->numrows()." secretaire pour ".$scrutin." canton : ".$canton."
"; // president $sql="select nom,prenom,bureau from ".DB_PREFIXE."affectation inner join ".DB_PREFIXE. "elu on affectation.elu = elu.elu where scrutin='".$scrutin. "' and decision is TRUE and affectation.poste = 'PRESIDENT' "; $res = $f -> db -> query($sql); $f->isDatabaseError($res); while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $sql="update ".DB_PREFIXE."composition_bureau set president='".$row['nom']." ".$row['prenom']."' where bureau='".$row['bureau']."' and scrutin='".$scrutin."'"; $res1 = $f -> db -> query($sql); $f->isDatabaseError($res1); } echo $res->numrows()." president pour ".$scrutin." canton : ".$canton."
"; // president suppleant $sql="select nom,prenom,bureau from ".DB_PREFIXE."affectation inner join ".DB_PREFIXE. "elu on affectation.elu = elu.elu where scrutin='".$scrutin. "' and decision is true and affectation.poste = 'PRESIDENT SUPPLEANT' "; $res = $f -> db -> query($sql); $f->isDatabaseError($res); while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $sql="update ".DB_PREFIXE."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 ".DB_PREFIXE."composition_bureau where scrutin='".$scrutin. "' order by bureau"; $res = $f -> db -> query($sql); $f->isDatabaseError($res); 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 ""; } ?>