/** * * Renvoi le creneau precedent du type donné * * @return EdtCreneau EdtCreneau * */ public function getPrevEdtCreneau($type_creneau = null) { $found = false; //on recupere la liste complete des creneaux $all_creneau = EdtCreneauPeer::retrieveAllEdtCreneauxOrderByTime(); //on parcourt la liste $all_creneau->getFirst(); while (!$found && ($all_creneau->getCurrent() != null)) { if ($all_creneau->getCurrent()->getIdDefiniePeriode() == $this->getIdDefiniePeriode()) { $found = true; } else { $all_creneau->getNext(); } } if (!$found) { return null; } if ($type_creneau == null) { return $all_creneau->getPrevious(); } else { $all_creneau->getNext(); while ($all_creneau->getCurrent() != null) { if ($all_creneau->getCurrent()->getTypeCreneaux() == $type_creneau) { return $all_creneau->getCurrent(); } $all_creneau->getPrevious(); } } }
public static function afficherPetitTableauDesCreneaux($options = NULL){ $_color = isset($options["couleur"]) ? $options["couleur"] : 'red'; $_background = isset($options["background"]) ? $options["background"] : 'silver'; $criteria = new Criteria(); $tab_creneaux = EdtCreneauPeer::getAllCreneauxOrderByTime(); $aff_creneaux = '<table><tr>'; foreach ($tab_creneaux as $creneaux){ // S'il s'agit d'un créneau de cours, on l'affiche if ($creneaux->getTypeCreneau() == 'cours'){ $aff_creneaux .= ' <td style="color: '.$_color.'; font-weight: bold; background-color: '.$_background.';">' . $creneaux->getNomCreneau() . '</td>'; } } $aff_creneaux .= '</tr></table>'; return $aff_creneaux; }
function format_selectbox_heure($utilisateur, $id_creneau, $dt_date_absence_eleve, $id_box) { if ($utilisateur->getStatut() != 'professeur' || getSettingValue("abs2_saisie_prof_decale_journee")=='y' || getSettingValue("abs2_saisie_prof_decale")=='y') { ?> <label class="invisible" for="<?php echo $id_box; ?>">heure</label> <select id="<?php echo $id_box; ?>" name="id_creneau" class="small"> <?php //echo ("<select name=\"id_creneau\" class=\"small\">"); $edt_creneau_col = EdtCreneauPeer::retrieveAllEdtCreneauxOrderByTime(); ?> <option value='-1'>choisissez un créneau</option> <?php foreach ($edt_creneau_col as $edt_creneau) { if ($edt_creneau->getTypeCreneaux() == EdtCreneau::TYPE_PAUSE || $edt_creneau->getTypeCreneaux() == EdtCreneau::TYPE_REPAS) { continue; } echo "<option value='".$edt_creneau->getIdDefiniePeriode()."'"; if ($id_creneau == $edt_creneau->getIdDefiniePeriode()) echo " selected='selected' "; echo ">"; echo $edt_creneau->getDescription(); echo "</option>\n"; } ?> </select> <?php } else { $current_creneau = EdtCreneauPeer::retrieveEdtCreneauActuel(); if ($current_creneau != null) { echo $current_creneau->getDescription().' '; echo '<input type="hidden" name="id_creneau" value="'.$current_creneau->getIdDefiniePeriode().'"/>'; } else { echo "Aucun creneau actuellement. "; } } if ($utilisateur->getStatut() != 'professeur' || (getSettingValue("abs2_saisie_prof_decale")=='y' && getSettingValue("abs2_saisie_prof_decale_journee")=='y')) { $rand_id = rand(0,10000000); echo '<label class="invisible" for="date_absence_eleve_'.$rand_id.'">date</label>'; echo '<input size="9" id="date_absence_eleve_'.$rand_id.'" name="date_absence_eleve" value="'.$dt_date_absence_eleve->format('d/m/Y').'" /> '; echo ' <script type="text/javascript"> Calendar.setup({ inputField : "date_absence_eleve_'.$rand_id.'", // id of the input field ifFormat : "%d/%m/%Y", // format of the input field button : "date_absence_eleve_1", // trigger for the calendar (button ID) align : "Bl", // alignment (defaults to "Bl") singleClick : true }); </script>'; } else { echo ' Le '.$dt_date_absence_eleve->format('d/m/Y').' '; } }
/** * Selects a collection of AbsenceEleveSaisie objects pre-filled with all related objects except AbsenceEleveLieu. * * @param Criteria $criteria * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of AbsenceEleveSaisie objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptAbsenceEleveLieu(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden // $criteria->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(self::DATABASE_NAME); } AbsenceEleveSaisiePeer::addSelectColumns($criteria); $startcol2 = AbsenceEleveSaisiePeer::NUM_HYDRATE_COLUMNS; UtilisateurProfessionnelPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + UtilisateurProfessionnelPeer::NUM_HYDRATE_COLUMNS; ElevePeer::addSelectColumns($criteria); $startcol4 = $startcol3 + ElevePeer::NUM_HYDRATE_COLUMNS; EdtCreneauPeer::addSelectColumns($criteria); $startcol5 = $startcol4 + EdtCreneauPeer::NUM_HYDRATE_COLUMNS; EdtEmplacementCoursPeer::addSelectColumns($criteria); $startcol6 = $startcol5 + EdtEmplacementCoursPeer::NUM_HYDRATE_COLUMNS; GroupePeer::addSelectColumns($criteria); $startcol7 = $startcol6 + GroupePeer::NUM_HYDRATE_COLUMNS; ClassePeer::addSelectColumns($criteria); $startcol8 = $startcol7 + ClassePeer::NUM_HYDRATE_COLUMNS; AidDetailsPeer::addSelectColumns($criteria); $startcol9 = $startcol8 + AidDetailsPeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(AbsenceEleveSaisiePeer::UTILISATEUR_ID, UtilisateurProfessionnelPeer::LOGIN, $join_behavior); $criteria->addJoin(AbsenceEleveSaisiePeer::ELEVE_ID, ElevePeer::ID_ELEVE, $join_behavior); $criteria->addJoin(AbsenceEleveSaisiePeer::ID_EDT_CRENEAU, EdtCreneauPeer::ID_DEFINIE_PERIODE, $join_behavior); $criteria->addJoin(AbsenceEleveSaisiePeer::ID_EDT_EMPLACEMENT_COURS, EdtEmplacementCoursPeer::ID_COURS, $join_behavior); $criteria->addJoin(AbsenceEleveSaisiePeer::ID_GROUPE, GroupePeer::ID, $join_behavior); $criteria->addJoin(AbsenceEleveSaisiePeer::ID_CLASSE, ClassePeer::ID, $join_behavior); $criteria->addJoin(AbsenceEleveSaisiePeer::ID_AID, AidDetailsPeer::ID, $join_behavior); // soft_delete behavior if (AbsenceEleveSaisieQuery::isSoftDeleteEnabled()) { $criteria->add(AbsenceEleveSaisiePeer::DELETED_AT, null, Criteria::ISNULL); } else { AbsenceEleveSaisiePeer::enableSoftDelete(); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = AbsenceEleveSaisiePeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = AbsenceEleveSaisiePeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $cls = AbsenceEleveSaisiePeer::getOMClass(false); $obj1 = new $cls(); $obj1->hydrate($row); AbsenceEleveSaisiePeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined UtilisateurProfessionnel rows $key2 = UtilisateurProfessionnelPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = UtilisateurProfessionnelPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = UtilisateurProfessionnelPeer::getOMClass(false); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); UtilisateurProfessionnelPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (AbsenceEleveSaisie) to the collection in $obj2 (UtilisateurProfessionnel) $obj2->addAbsenceEleveSaisie($obj1); } // if joined row is not null // Add objects for joined Eleve rows $key3 = ElevePeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = ElevePeer::getInstanceFromPool($key3); if (!$obj3) { $cls = ElevePeer::getOMClass(false); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); ElevePeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (AbsenceEleveSaisie) to the collection in $obj3 (Eleve) $obj3->addAbsenceEleveSaisie($obj1); } // if joined row is not null // Add objects for joined EdtCreneau rows $key4 = EdtCreneauPeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = EdtCreneauPeer::getInstanceFromPool($key4); if (!$obj4) { $cls = EdtCreneauPeer::getOMClass(false); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); EdtCreneauPeer::addInstanceToPool($obj4, $key4); } // if $obj4 already loaded // Add the $obj1 (AbsenceEleveSaisie) to the collection in $obj4 (EdtCreneau) $obj4->addAbsenceEleveSaisie($obj1); } // if joined row is not null // Add objects for joined EdtEmplacementCours rows $key5 = EdtEmplacementCoursPeer::getPrimaryKeyHashFromRow($row, $startcol5); if ($key5 !== null) { $obj5 = EdtEmplacementCoursPeer::getInstanceFromPool($key5); if (!$obj5) { $cls = EdtEmplacementCoursPeer::getOMClass(false); $obj5 = new $cls(); $obj5->hydrate($row, $startcol5); EdtEmplacementCoursPeer::addInstanceToPool($obj5, $key5); } // if $obj5 already loaded // Add the $obj1 (AbsenceEleveSaisie) to the collection in $obj5 (EdtEmplacementCours) $obj5->addAbsenceEleveSaisie($obj1); } // if joined row is not null // Add objects for joined Groupe rows $key6 = GroupePeer::getPrimaryKeyHashFromRow($row, $startcol6); if ($key6 !== null) { $obj6 = GroupePeer::getInstanceFromPool($key6); if (!$obj6) { $cls = GroupePeer::getOMClass(false); $obj6 = new $cls(); $obj6->hydrate($row, $startcol6); GroupePeer::addInstanceToPool($obj6, $key6); } // if $obj6 already loaded // Add the $obj1 (AbsenceEleveSaisie) to the collection in $obj6 (Groupe) $obj6->addAbsenceEleveSaisie($obj1); } // if joined row is not null // Add objects for joined Classe rows $key7 = ClassePeer::getPrimaryKeyHashFromRow($row, $startcol7); if ($key7 !== null) { $obj7 = ClassePeer::getInstanceFromPool($key7); if (!$obj7) { $cls = ClassePeer::getOMClass(false); $obj7 = new $cls(); $obj7->hydrate($row, $startcol7); ClassePeer::addInstanceToPool($obj7, $key7); } // if $obj7 already loaded // Add the $obj1 (AbsenceEleveSaisie) to the collection in $obj7 (Classe) $obj7->addAbsenceEleveSaisie($obj1); } // if joined row is not null // Add objects for joined AidDetails rows $key8 = AidDetailsPeer::getPrimaryKeyHashFromRow($row, $startcol8); if ($key8 !== null) { $obj8 = AidDetailsPeer::getInstanceFromPool($key8); if (!$obj8) { $cls = AidDetailsPeer::getOMClass(false); $obj8 = new $cls(); $obj8->hydrate($row, $startcol8); AidDetailsPeer::addInstanceToPool($obj8, $key8); } // if $obj8 already loaded // Add the $obj1 (AbsenceEleveSaisie) to the collection in $obj8 (AidDetails) $obj8->addAbsenceEleveSaisie($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
echo "<td style='width:270px; vertical-align: top;'>"; echo '<div style="border-width: 1px; border-style: solid; text-align: left; padding : 4px;">'; echo '<p>'; echo 'Début : <input size="9" id="date_absence_eleve_debut_saisir_eleve" name="date_absence_eleve_debut_saisir_eleve" value="'.$dt_date_absence_eleve_debut_saisir_eleve->format('d/m/Y').'" /> '; echo '</p>'; echo ' <script type="text/javascript"> Calendar.setup({ inputField : "date_absence_eleve_debut_saisir_eleve", // id of the input field ifFormat : "%d/%m/%Y", // format of the input field button : "date_absence_eleve_debut_saisir_eleve", // trigger for the calendar (button ID) align : "Bl", // alignment (defaults to "Bl") singleClick : true }); </script> '; $edt_creneau_col = EdtCreneauPeer::retrieveAllEdtCreneauxOrderByTime(); echo '<br/>'; echo '<p>'; echo 'Fin : <input size="9" id="date_absence_eleve_fin_saisir_eleve" name="date_absence_eleve_fin_saisir_eleve" value="'.$dt_date_absence_eleve_fin_saisir_eleve->format('d/m/Y').'" /> '; echo '</p>'; echo ' <script type="text/javascript"> Calendar.setup({ inputField : "date_absence_eleve_fin_saisir_eleve", // id of the input field ifFormat : "%d/%m/%Y", // format of the input field button : "date_absence_eleve_fin_saisir_eleve", // trigger for the calendar (button ID) align : "Bl", // alignment (defaults to "Bl") singleClick : true }); </script><br/>';
echo ' Sans lieu défini'."\n"; echo ' </button>'."\n"; $lieux=AbsenceEleveLieuQuery::create()->findList(); if (!$lieux->isempty()) { foreach($lieux as $lieu){ echo ' <button dojoType="dijit.MenuItem" onClick="document.getElementById(\'filtre_actif\').value = \'lieu\'; document.getElementById(\'id_lieu\').value = \''.$lieu->getId().'\';document.totaux_du_jour.submit() ">'."\n"; echo ' Lieu : '.$lieu->getNom()."\n"; echo ' </button>'."\n"; } } ?> </div> </div> </form> <?php $col_creneaux = EdtCreneauPeer::retrieveAllEdtCreneauxOrderByTime(); echo'<table class="sortable resizable" border="1" style="border: 1px solid black; background-color:lightgrey">'; echo'<tr align="center"> <th style="border: 1px solid black; background-color: grey;" class="nosort">Créneau</th> <th style="border: 1px solid black; background-color: grey;" title ="Cliquez pour trier sur la colonne" class="text">Heure</th> <th style="border: 1px solid black; background-color: grey;" title ="Cliquez pour trier sur la colonne" class="number">Nombre d\'élèves absents</th> <th style="border: 1px solid black; background-color: grey;" title ="Cliquez pour trier sur la colonne" class="number">Nombre de demi_pensionnaires </th> <th style="border: 1px solid black; background-color: grey;" title ="Cliquez pour trier sur la colonne" class="number">Nombre d\'internes</th> <th style="border: 1px solid black; background-color: grey;" title ="Cliquez pour trier sur la colonne" class="number">Nombre d\'externes</th> </tr>'; $cpt_eleve=0; $nbre_total_retards=0; $eleves_absents=array (); foreach($col_creneaux as $creneau){ $decompte_du_creneau =0;
function isAffichable($abs, $date, $eleve) { $creneau_col = EdtCreneauPeer::retrieveAllEdtCreneauxOrderByTime(); $test_ouverture = false; foreach ($creneau_col as $creneau) { $datedebutabs = explode(" ", $abs->getDebutAbs()); $dt_date_debut_abs = new DateTime($datedebutabs[0]); $heure_debut = explode(":", $datedebutabs[1]); $dt_date_debut_abs->setTime($heure_debut[0], $heure_debut[1], $heure_debut[2]); $tab_heure = explode(":", $creneau->getHeuredebutDefiniePeriode()); $date->setTime($tab_heure[0], $tab_heure[1], $tab_heure[2]); //on verifie si le creneau est ouvert et s'il est posterieur au debut de l'absence if ($date->Format('U') > $dt_date_debut_abs->Format('U') && EdtHelper::isEtablissementOuvert($date)) { $test_ouverture = true; } } if ($test_ouverture && $abs->getManquementObligationPresence()) { return true; } else { return false; } }
<table class="tb_absences" style="padding-bottom:1em;"> <caption class="invisible no_print"><?php echo $eleve_col->count(); ?> élèves.</caption> <thead> <tr class="titre_tableau_gestion" style="white-space: nowrap;"> <th class="center" >Veille</th> <th class="center" abbr="élèves">Liste des élèves</th> <th colspan="<?php echo (EdtCreneauPeer::retrieveAllEdtCreneauxOrderByTime()->count()*2); ?>" class="th_abs_suivi" abbr="Créneaux">Suivi sur la journée</th> <th></th> <th></th> </tr> <tr> <td></td> <td class="center" ></td> <?php $i=0; foreach(EdtCreneauPeer::retrieveAllEdtCreneauxOrderByTime() as $edt_creneau){ ?> <td class="td_nom_creneau center" colspan="2"> <?php echo $edt_creneau->getNomDefiniePeriode();?> </td> <?php $i++; }?> <td colspan="2" title="Créer un traitement différent pour chaque saisie">Plusieurs traitements</td> </tr> </thead> <tbody> <?php $cpt=0; foreach($afficheEleve as $eleve) {
/** * Renvoie la liste des creneaux de la journee * * @return PropelObjectCollection EdtCreneau */ public static function retrieveAllEdtCreneauxOrderByTime(){ if (self::$_all_creneaux == null) { self::$_all_creneaux = EdtCreneauQuery::create()->addAscendingOrderByColumn(EdtCreneauPeer::HEUREDEBUT_DEFINIE_PERIODE)->find(); } return clone self::$_all_creneaux; }
/** * * Retourne la collection des absences saisies pour ce creneau. Si null, on prend le creneau actuel * * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will * be treated as NULL for temporal objects. * @return PropelObjectCollection AbsenceEleveSaisie */ public function getEdtCreneauAbsenceSaisie($edtcreneau = null, $v = 'now'){ if ($edtcreneau == null) { $edtcreneau = EdtCreneauPeer::retrieveEdtCreneauActuel($v); } if (!($edtcreneau instanceof EdtCreneau)) { $edtcreneau = EdtCreneauQuery::create()->findPk($edtcreneau); if ($edtcreneau == null) { return new PropelObjectCollection(); } } // we treat '' and NULL as 'now' for temporal if ($v === null || $v === '') { $dt = new DateTime('now'); } elseif ($v instanceof DateTime) { $dt = clone $v; } else { // some string/numeric value passed; we normalize that so that we can // validate it. try { if (is_numeric($v)) { // if it's a unix timestamp $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); // We have to explicitly specify and then change the time zone because of a // DateTime bug: http://bugs.php.net/bug.php?id=43003 $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); } else { $dt = new DateTime($v); } } catch (Exception $x) { throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); } } $query = AbsenceEleveSaisieQuery::create(); $query->filterByUtilisateurProfessionnel($this); $dt->setTime($edtcreneau->getHeuredebutDefiniePeriode('H'), $edtcreneau->getHeuredebutDefiniePeriode('i')); $dt_end = clone $dt; $dt_end->setTime($edtcreneau->getHeurefinDefiniePeriode('H'), $edtcreneau->getHeurefinDefiniePeriode('i')); $query->filterByPlageTemps($dt, $dt_end); $col = $query->find(); return $col; }
//ajout du groupe au professeur $newUtilisateurProfessionnel->addGroupe($groupe); $newUtilisateurProfessionnel->save(); $newGroupes = $newUtilisateurProfessionnel->getGroupes(); echo ($logger->getDisplay()); if ($newGroupes->count() != 1) { echo('test ajout groupe au professeur a <font color="red">echoue</font> <br><br/>'); } else { echo('test ajout groupe au professeur a reussi<br/><br/>'); } $edtCours = new EdtEmplacementCours(); $edtCours->setGroupe($groupe); $edtCours->setHeuredebDec('0.5'); $edtCours->setUtilisateurProfessionnel($newUtilisateurProfessionnel); $edtCours->setEdtCreneau(EdtCreneauPeer::retrieveFirstEdtCreneau()); $edtCours->setJourSemaine('lundi'); $edtCours->setTypeSemaine(''); $edtCours->save(); echo ($logger->getDisplay()); echo('emplacement de cours ajouté.<br>'); echo('Debut du cours : '.$edtCours->getHeureDebut('H:i').'<br>'); echo('Fin du cours : '.$edtCours->getHeureFin('H:i').'<br><br/>'); $colEdtCours = $newUtilisateurProfessionnel->getEdtEmplacementCourss(); echo ($logger->getDisplay()); if ($colEdtCours->count() != 1) { echo('test recuperation emplacement de cours du professeur a <font color="red">echoue</font> <br><br/>'); } else { echo('test recuperation emplacement de cours du professeur a reussi<br/><br/>'); }
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * The default key type is the column's phpname (e.g. 'AuthorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = EdtCreneauPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setIdDefiniePeriode($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setNomDefiniePeriode($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setHeuredebutDefiniePeriode($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setHeurefinDefiniePeriode($arr[$keys[3]]); if (array_key_exists($keys[4], $arr)) $this->setSuiviDefiniePeriode($arr[$keys[4]]); if (array_key_exists($keys[5], $arr)) $this->setTypeCreneaux($arr[$keys[5]]); if (array_key_exists($keys[6], $arr)) $this->setJourCreneau($arr[$keys[6]]); }
/** * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * * @param mixed $key Primary key to use for the query * @param PropelPDO $con A connection object * * @return EdtCreneau A model object, or null if the key is not found */ protected function findPkSimple($key, $con) { $sql = 'SELECT ID_DEFINIE_PERIODE, NOM_DEFINIE_PERIODE, HEUREDEBUT_DEFINIE_PERIODE, HEUREFIN_DEFINIE_PERIODE, SUIVI_DEFINIE_PERIODE, TYPE_CRENEAUX, JOUR_CRENEAU FROM edt_creneaux WHERE ID_DEFINIE_PERIODE = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->execute(); } catch (Exception $e) { Propel::log($e->getMessage(), Propel::LOG_ERR); throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); } $obj = null; if ($row = $stmt->fetch(PDO::FETCH_NUM)) { $obj = new EdtCreneau(); $obj->hydrate($row); EdtCreneauPeer::addInstanceToPool($obj, (string) $key); } $stmt->closeCursor(); return $obj; }
/** * Selects a collection of EdtEmplacementCours objects pre-filled with all related objects except UtilisateurProfessionnel. * * @param Criteria $criteria * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of EdtEmplacementCours objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptUtilisateurProfessionnel(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden // $criteria->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(self::DATABASE_NAME); } EdtEmplacementCoursPeer::addSelectColumns($criteria); $startcol2 = EdtEmplacementCoursPeer::NUM_HYDRATE_COLUMNS; GroupePeer::addSelectColumns($criteria); $startcol3 = $startcol2 + GroupePeer::NUM_HYDRATE_COLUMNS; AidDetailsPeer::addSelectColumns($criteria); $startcol4 = $startcol3 + AidDetailsPeer::NUM_HYDRATE_COLUMNS; EdtSallePeer::addSelectColumns($criteria); $startcol5 = $startcol4 + EdtSallePeer::NUM_HYDRATE_COLUMNS; EdtCreneauPeer::addSelectColumns($criteria); $startcol6 = $startcol5 + EdtCreneauPeer::NUM_HYDRATE_COLUMNS; EdtCalendrierPeriodePeer::addSelectColumns($criteria); $startcol7 = $startcol6 + EdtCalendrierPeriodePeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(EdtEmplacementCoursPeer::ID_GROUPE, GroupePeer::ID, $join_behavior); $criteria->addJoin(EdtEmplacementCoursPeer::ID_AID, AidDetailsPeer::ID, $join_behavior); $criteria->addJoin(EdtEmplacementCoursPeer::ID_SALLE, EdtSallePeer::ID_SALLE, $join_behavior); $criteria->addJoin(EdtEmplacementCoursPeer::ID_DEFINIE_PERIODE, EdtCreneauPeer::ID_DEFINIE_PERIODE, $join_behavior); $criteria->addJoin(EdtEmplacementCoursPeer::ID_CALENDRIER, EdtCalendrierPeriodePeer::ID_CALENDRIER, $join_behavior); $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = EdtEmplacementCoursPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = EdtEmplacementCoursPeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $cls = EdtEmplacementCoursPeer::getOMClass(false); $obj1 = new $cls(); $obj1->hydrate($row); EdtEmplacementCoursPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Groupe rows $key2 = GroupePeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = GroupePeer::getInstanceFromPool($key2); if (!$obj2) { $cls = GroupePeer::getOMClass(false); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); GroupePeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (EdtEmplacementCours) to the collection in $obj2 (Groupe) $obj2->addEdtEmplacementCours($obj1); } // if joined row is not null // Add objects for joined AidDetails rows $key3 = AidDetailsPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = AidDetailsPeer::getInstanceFromPool($key3); if (!$obj3) { $cls = AidDetailsPeer::getOMClass(false); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); AidDetailsPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (EdtEmplacementCours) to the collection in $obj3 (AidDetails) $obj3->addEdtEmplacementCours($obj1); } // if joined row is not null // Add objects for joined EdtSalle rows $key4 = EdtSallePeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = EdtSallePeer::getInstanceFromPool($key4); if (!$obj4) { $cls = EdtSallePeer::getOMClass(false); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); EdtSallePeer::addInstanceToPool($obj4, $key4); } // if $obj4 already loaded // Add the $obj1 (EdtEmplacementCours) to the collection in $obj4 (EdtSalle) $obj4->addEdtEmplacementCours($obj1); } // if joined row is not null // Add objects for joined EdtCreneau rows $key5 = EdtCreneauPeer::getPrimaryKeyHashFromRow($row, $startcol5); if ($key5 !== null) { $obj5 = EdtCreneauPeer::getInstanceFromPool($key5); if (!$obj5) { $cls = EdtCreneauPeer::getOMClass(false); $obj5 = new $cls(); $obj5->hydrate($row, $startcol5); EdtCreneauPeer::addInstanceToPool($obj5, $key5); } // if $obj5 already loaded // Add the $obj1 (EdtEmplacementCours) to the collection in $obj5 (EdtCreneau) $obj5->addEdtEmplacementCours($obj1); } // if joined row is not null // Add objects for joined EdtCalendrierPeriode rows $key6 = EdtCalendrierPeriodePeer::getPrimaryKeyHashFromRow($row, $startcol6); if ($key6 !== null) { $obj6 = EdtCalendrierPeriodePeer::getInstanceFromPool($key6); if (!$obj6) { $cls = EdtCalendrierPeriodePeer::getOMClass(false); $obj6 = new $cls(); $obj6->hydrate($row, $startcol6); EdtCalendrierPeriodePeer::addInstanceToPool($obj6, $key6); } // if $obj6 already loaded // Add the $obj1 (EdtEmplacementCours) to the collection in $obj6 (EdtCalendrierPeriode) $obj6->addEdtEmplacementCours($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(EdtCreneauPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(EdtCreneauPeer::DATABASE_NAME); $criteria->add(EdtCreneauPeer::ID_DEFINIE_PERIODE, $pks, Criteria::IN); $objs = EdtCreneauPeer::doSelect($criteria, $con); } return $objs; }
/** * * Retourne une liste d'absence qui montrent un manquement à l'obligation de présence pour le creneau et le jour donné. * * @param EdtCreneau $edtcreneau * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will * be treated as NULL for temporal objects. * * @return PropelColection AbsenceEleveSaisie[] */ public function getAbsenceEleveSaisiesDecompteDemiJourneesDuCreneau($edtcreneau = null, $v = 'now') { if ($edtcreneau == null) { $edtcreneau = EdtCreneauPeer::retrieveEdtCreneauActuel($v); } if (!($edtcreneau instanceof EdtCreneau)) { throw new PropelException('Le premier argument doit etre de la classe EdtCreneau'); } // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') // -- which is unexpected, to say the least. //$dt = new DateTime(); if ($v === null || $v === '') { $dt = null; } elseif ($v instanceof DateTime) { $dt = clone $v; } else { // some string/numeric value passed; we normalize that so that we can // validate it. try { if (is_numeric($v)) { // if it's a unix timestamp $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); // We have to explicitly specify and then change the time zone because of a // DateTime bug: http://bugs.php.net/bug.php?id=43003 $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); } else { $dt = new DateTime($v); } } catch (Exception $x) { throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); } } $dt->setTime($edtcreneau->getHeuredebutDefiniePeriode('H'), $edtcreneau->getHeuredebutDefiniePeriode('i'), 0); $dt_fin_creneau = clone $dt; $dt_fin_creneau->setTime($edtcreneau->getHeurefinDefiniePeriode('H'), $edtcreneau->getHeurefinDefiniePeriode('i'), 0); return $this->getAbsenceEleveSaisiesDecompteDemiJournees($dt, $dt_fin_creneau); }