<?php /** * $Id: affectation_heure.php,v 1.7 2008-07-21 13:54:59 jbastide Exp $ */ require_once "../obj/utils.class.php"; $f = new utils(NULL, "affectation_heure", _("affectation_heure")); // GET - POST if (isset ($_GET['validation'])){ $validation=$_GET['validation']; }else{ $validation=0; } if (isset ($_POST['scrutin'])){ $scrutin=$_POST['scrutin']; }else{ $scrutin=0; } echo "\n<div id=\"edition\">\n"; if($validation==0){ $validation=1; echo "<table class='tab-tab' CELLPADDING='5px' CELLSPACING='10px'>"; echo "<tr class=\"ui-tabs-nav ui-accordion ui-state-default tab-title\"><th colspan='2'>"._("affectation_automatique_des_heures")." - "._("table")." \"periode\"</th></tr>"; echo "<form method=\"POST\" action=\"affectation_heure.php?validation=".$validation."\" name=f1>"; // choix scrutin $sql="select scrutin,libelle from ".DB_PREFIXE."scrutin where solde is false"; $res = $f -> db -> query($sql); $f->isDatabaseError($res); echo "<tr><td><br>Selectionner un scrutin :<select name='scrutin' size='1' class='champFormulaire' >"; while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ echo "<option value='".$row['scrutin']."'>".$row['libelle']."</option>"; } echo "</select> <br></td></tr>"; echo "<tr><td colspan=2><br>"; echo "<input type='submit' value='"._("confirmation")." "._("de")." "._("l_")." "._("affectation automatique des heures")."'>"; echo "<font id=\"commentaire\"> "._("attention")." "._("toute")." "._("les")." "._("saisies")." "._("seront_ecrasees")." !</font>"; echo "</form>"; echo "</td></tr></table>"; }else{ // validation = 1 echo "<div id='edition'>"; $sql="select candidature,periode,debut,fin,nom,prenom from ".DB_PREFIXE."candidature inner join ".DB_PREFIXE."agent on agent.agent=candidature.agent where scrutin='". $scrutin."' and decision is true order by nom"; $res = $f -> db -> query($sql); echo "<fieldset class='cadre'><legend>"._("candidature")." "._("concernees")."</legend>"; echo "<table class='tab-tab' CELLPADDING='5px' CELLSPACING='0px' border='1'>"; echo "<thead>"; echo "<tr class=\"ui-tabs-nav ui-accordion ui-state-default tab-title\"><th colspan='6'>"._("affectation des heures")."</th></tr>"; echo "<thead>"; echo "<tbody>"; $f->isDatabaseError($res); while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $sql = "select debut from ".DB_PREFIXE."periode where periode ='".$row['periode']."'"; $debut = $f -> db -> getOne($sql); //if(is_object($debut)) $debut='00:00'; $sql = "select fin from ".DB_PREFIXE."periode where periode ='".$row['periode']."'"; $fin = $f -> db -> getOne($sql); echo "<tr class='tab-data odd'><td class='col-0'>"; echo $row['candidature']."</td><td class='col-1'>".$row['nom']."</td><td class='col-2'>".$row['prenom']."</td><td class='col-3'>".$row['periode']."</td><td class='col-4'>"._("debut")." : ".$debut."</td><td class='col-5'>"._("fin")." : ".$fin."</td>"; echo "</tr>"; $sql="update ".DB_PREFIXE."candidature set debut='".$debut."', fin = '".$fin. "' where candidature=".$row['candidature']; $res1 = $f -> db -> query($sql); $f->isDatabaseError($res1); } echo "</td></tr>"; echo "</tbody>"; echo "</table>"; echo "<br>"; echo "<font id=\"commentaire\">"._("affectation")." "._("heures")." "._("effectuee")." !</font>"; echo "<br></fieldset>"; echo "</div>"; } echo "</div>"; ?>