pour_une_election_et_un_poste"; // GET - POST if (isset ($_GET['validation'])){ $validation=$_GET['validation']; }else{ $validation=0; } if (isset ($_POST['scrutin'])){ $scrutin=$_POST['scrutin']; }else{ $scrutin=0; } if (isset ($_POST['scrutinsolde'])){ $scrutinsolde=$_POST['scrutinsolde']; }else{ $scrutinsolde=0; } if (isset ($_POST['poste'])){ $poste=$_POST['poste']; }else{ $poste=0; } echo "\n
\n"; if($validation==0){ $validation=1; echo ""; echo ""; echo ""; // choix scrutin $sql="select scrutin,libelle from ".DB_PREFIXE."scrutin where solde is true"; $res = $f -> db -> query($sql); $f->isDatabaseError($res); echo ""; // choix scrutin $sql="select scrutin,libelle from ".DB_PREFIXE."scrutin where solde is false"; $res = $f -> db -> query($sql); $f->isDatabaseError($res); echo ""; // choix poste $sql="select poste,poste from ".DB_PREFIXE."poste where nature ='candidature'"; $res = $f -> db -> query($sql); $f->isDatabaseError($res); echo ""; echo ""; echo "
"._("transfert")." "._("de")." "._("candidature")."
"._("selectionnez")." "._("un")." "._("scrutin")." "._("solde")."
"._("selectionnez")." "._("un")." "._("scrutin")." "._("encours")."
"._("selectionnez")." "._("un")." "._("poste")."

"; echo ""; echo ""; echo "  "._("attention")."   "._("decision")." = ".$f->collectivite['decision']."  !"; echo ""; echo "
"; }else{ // validation = 1 echo "
"; // verification existence echo "
"._("traitement").""; $sql = "select count(candidature) from ".DB_PREFIXE."candidature where scrutin ='".$scrutin."' and poste ='".$poste."' and decision is true"; $nb = $f -> db -> getOne($sql); echo "
  "._("il_existe")." ".$nb." ".$poste." "._("pour")." ".$scrutin." "._("avec")." "._("decision")." = "._("oui")."

"; // selection $sql = "select bureau,recuperation,periode,candidature.agent,nom,prenom from ".DB_PREFIXE."candidature inner join ".DB_PREFIXE."agent on agent.agent=candidature.agent where scrutin ='". $scrutinsolde."' and candidature.poste ='".$poste."' and decision is true"; $res = $f -> db -> query($sql); $f->isDatabaseError($res); while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $candidature = $f -> db -> nextId(DB_PREFIXE.'candidature'); if($f->collectivite["decision"]=='oui') $decision = TRUE; else $decision = FALSE; $sql="insert into ".DB_PREFIXE."candidature (candidature,scrutin,decision,periode,poste,bureau,recuperation,note,agent) values('".$candidature."','".$scrutin."','".$decision."','".$row['periode']."','".$poste."','". $row['bureau']."','".$row['recuperation']."','transfert ".$scrutinsolde. "','".$row['agent']."')"; $res1 = $f -> db -> query($sql); $f->isDatabaseError($res1); echo "
".$row['agent']." ".$row['nom']." ".$row['prenom']."
BUREAU : ".$row['bureau'].' PERIODE '.$row['periode']."

"; } echo ""; echo "
"; echo "
"; } echo "
"; ?>