/** * * Retourne tous les emplacements de cours pour la periode précisée du calendrier. * On recupere aussi les emplacements dont la periode n'est pas definie ou vaut 0. * * @return PropelObjectCollection EdtEmplacementCours une collection d'emplacement de cours ordonnée chronologiquement */ public function getEdtEmplacementCourssPeriodeCalendrierActuelle($v = 'now'){ if ( getSettingValue("autorise_edt_tous") != 'y') { return new PropelObjectCollection(); } $query = EdtEmplacementCoursQuery::create()->filterByGroupe($this->getGroupes()) ->filterByIdCalendrier(0) ->addOr(EdtEmplacementCoursPeer::ID_CALENDRIER, NULL); if ($v instanceof EdtCalendrierPeriode) { $query->addOr(EdtEmplacementCoursPeer::ID_CALENDRIER, $v->getIdCalendrier()); } else { $periodeCalendrier = EdtCalendrierPeriodePeer::retrieveEdtCalendrierPeriodeActuelle($v); if ($periodeCalendrier != null) { $query->addOr(EdtEmplacementCoursPeer::ID_CALENDRIER, $periodeCalendrier->getIdCalendrier()); } } $edtCoursCol = $query->find(); require_once("helpers/EdtEmplacementCoursHelper.php"); EdtEmplacementCoursHelper::orderChronologically($edtCoursCol); return $edtCoursCol; }
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this AidDetails is new, it will return * an empty collection; or if this AidDetails has previously * been saved, it will retrieve related EdtEmplacementCourss from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you * actually need in AidDetails. * * @param Criteria $criteria optional Criteria object to narrow the query * @param PropelPDO $con optional connection object * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return PropelCollection|array EdtEmplacementCours[] List of EdtEmplacementCours objects */ public function getEdtEmplacementCourssJoinUtilisateurProfessionnel($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $query = EdtEmplacementCoursQuery::create(null, $criteria); $query->joinWith('UtilisateurProfessionnel', $join_behavior); return $this->getEdtEmplacementCourss($query, $con); }
if ($type_selection == 'id_cours') { if(empty($id_cours)) { // On recherche le créneau courant if ($utilisateur->getStatut() == "professeur") { $current_cours = $utilisateur->getEdtEmplacementCours(); if ($current_cours != null) { $id_cours = $current_cours->getIdCours(); } } } if ($utilisateur->getStatut() == "professeur") { $current_cours = EdtEmplacementCoursQuery::create()->filterByUtilisateurProfessionnel($utilisateur)->findPk($id_cours); } else { $current_cours = EdtEmplacementCoursQuery::create()->findPk($id_cours); } $current_creneau = null; if ($current_cours != null) { $current_creneau = $current_cours->getEdtCreneau(); $current_groupe = $current_cours->getGroupe(); $id_groupe=$current_groupe->getId(); $current_aid = $current_cours->getAidDetails(); $dt_date_absence_eleve = $current_cours->getDate($id_semaine); } } else { if ($id_creneau == null) { $current_creneau = EdtCreneauPeer::retrieveEdtCreneauActuel(); } else { $current_creneau = EdtCreneauPeer::retrieveByPK($id_creneau); }
/** * Removes this object from datastore and sets delete attribute. * * @param PropelPDO $con * @return void * @throws PropelException * @see BaseObject::setDeleted() * @see BaseObject::isDeleted() */ public function delete(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getConnection(EdtEmplacementCoursPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $deleteQuery = EdtEmplacementCoursQuery::create() ->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { $deleteQuery->delete($con); $this->postDelete($con); $con->commit(); $this->setDeleted(true); } else { $con->commit(); } } catch (Exception $e) { $con->rollBack(); throw $e; } }
/** * Returns a new EdtEmplacementCoursQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * * @return EdtEmplacementCoursQuery */ public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof EdtEmplacementCoursQuery) { return $criteria; } $query = new EdtEmplacementCoursQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }
/** * Get the associated EdtEmplacementCours object * * @param PropelPDO Optional Connection object. * @return EdtEmplacementCours The associated EdtEmplacementCours object. * @throws PropelException */ public function getEdtEmplacementCours(PropelPDO $con = null) { if ($this->aEdtEmplacementCours === null && ($this->id_edt_emplacement_cours !== null)) { $this->aEdtEmplacementCours = EdtEmplacementCoursQuery::create()->findPk($this->id_edt_emplacement_cours, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aEdtEmplacementCours->addAbsenceEleveSaisies($this); */ } return $this->aEdtEmplacementCours; }
/** * * Retourne tous les emplacements de cours pour la periode précisée du calendrier. * On recupere aussi les emplacements dont la periode n'est pas definie ou vaut 0. * * @param mixed $v string, integer (timestamp), or DateTime value. EdtCalendrierPeriode est aussi accepté * * @return PropelObjectCollection EdtEmplacementCours une collection d'emplacement de cours ordonnée chronologiquement */ public function getEdtEmplacementCourssPeriodeCalendrierActuelle($v = 'now'){ if (!($v instanceof EdtCalendrierPeriode)) { $v = EdtCalendrierPeriodePeer::retrieveEdtCalendrierPeriodeActuelle($v); } $query = EdtEmplacementCoursQuery::create()->filterByLoginProf($this->getLogin()) ->leftJoinWith('Groupe') ->leftJoinWith('AidDetails') ->filterByIdCalendrier(0) ->addOr(EdtEmplacementCoursPeer::ID_CALENDRIER, NULL); if ($v != null) { $query->addOr(EdtEmplacementCoursPeer::ID_CALENDRIER, $v->getIdCalendrier()); } // $query->setComment('joinGroupeAid'); $edtCoursCol = $query->find(); //on utilise du sql directement pour optimiser la requete TODO : utiliser un formatter // if ($v != null) { // $sql = "SELECT // edt_cours.ID_COURS, edt_cours.ID_GROUPE, edt_cours.ID_AID, edt_cours.ID_SALLE, edt_cours.JOUR_SEMAINE, edt_cours.ID_DEFINIE_PERIODE, // edt_cours.DUREE, edt_cours.HEUREDEB_DEC, edt_cours.ID_SEMAINE, edt_cours.ID_CALENDRIER, edt_cours.MODIF_EDT, edt_cours.LOGIN_PROF // FROM `edt_cours` // LEFT JOIN groupes ON (groupes.ID=edt_cours.ID_GROUPE) // LEFT JOIN aid ON (aid.ID=edt_cours.ID_AID) // WHERE edt_cours.LOGIN_PROF='".$this->getLogin()."' // AND (edt_cours.ID_CALENDRIER=0 // OR edt_cours.ID_CALENDRIER IS NULL // OR edt_cours.ID_CALENDRIER=".$v->getIdCalendrier().")"; // } else { // $sql = "SELECT // edt_cours.ID_COURS, edt_cours.ID_GROUPE, edt_cours.ID_AID, edt_cours.ID_SALLE, edt_cours.JOUR_SEMAINE, edt_cours.ID_DEFINIE_PERIODE, // edt_cours.DUREE, edt_cours.HEUREDEB_DEC, edt_cours.ID_SEMAINE, edt_cours.ID_CALENDRIER, edt_cours.MODIF_EDT, edt_cours.LOGIN_PROF // FROM `edt_cours` // LEFT JOIN j_groupes_classes ON (groupes.ID=j_groupes_classes.ID_GROUPE) // LEFT JOIN aid ON (aid.ID=edt_cours.ID_AID) // WHERE edt_cours.LOGIN_PROF='".$this->getLogin()."' // AND (edt_cours.ID_CALENDRIER=0 // OR edt_cours.ID_CALENDRIER IS NULL)"; // } // $con = Propel::getConnection(EdtEmplacementCoursPeer::DATABASE_NAME, Propel::CONNECTION_READ); // $stmt = $con->prepare($sql); // $stmt->execute(); // // $col = EdtEmplacementCoursPeer::populateObjects($stmt); // $edtCoursCol = new PropelObjectCollection(); // $edtCoursCol->setModel('EdtEmplacementCours'); // foreach ($col as $edtCours) { // $edtCoursCol->append($edtCours); // } require_once("helpers/EdtEmplacementCoursHelper.php"); EdtEmplacementCoursHelper::orderChronologically($edtCoursCol); return $edtCoursCol; }
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this UtilisateurProfessionnel is new, it will return * an empty collection; or if this UtilisateurProfessionnel has previously * been saved, it will retrieve related EdtEmplacementCourss from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you * actually need in UtilisateurProfessionnel. * * @param Criteria $criteria optional Criteria object to narrow the query * @param PropelPDO $con optional connection object * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return PropelCollection|array EdtEmplacementCours[] List of EdtEmplacementCours objects */ public function getEdtEmplacementCourssJoinEdtCalendrierPeriode($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $query = EdtEmplacementCoursQuery::create(null, $criteria); $query->joinWith('EdtCalendrierPeriode', $join_behavior); return $this->getEdtEmplacementCourss($query, $con); }
public function test_getEdtEmplacementCoursActuel() { $edtCoursCol = EdtEmplacementCoursQuery::create()->find(); $edtCours = EdtEmplacementCoursHelper::getEdtEmplacementCoursActuel($edtCoursCol, VENDREDI_s45j5.' 11:20:00'); $this->assertNotNull($edtCours); }
/** * * Retourne tous les emplacements de cours pour la periode précisée du calendrier. * On recupere aussi les emplacements dont la periode n'est pas definie ou vaut 0. * * @return PropelObjectCollection EdtEmplacementCours une collection d'emplacement de cours ordonnée chronologiquement */ public function getEdtEmplacementCourssPeriodeCalendrierActuelle($v = 'now'){ // 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); } } //si il n'y a aucune periode ouverte actuellement, on renvoi tous les groupe et donc tous les emplacements de cours $colGroupeId = $this->getGroupes($this->getPeriodeNote($dt))->getPrimaryKeys(); $query = EdtEmplacementCoursQuery::create()->filterByIdGroupe($colGroupeId) ->filterByIdCalendrier(0) ->addOr(EdtEmplacementCoursPeer::ID_CALENDRIER, NULL); if ($v instanceof EdtCalendrierPeriode) { $query->addOr(EdtEmplacementCoursPeer::ID_CALENDRIER, $v->getIdCalendrier()); } else { $periodeCalendrier = EdtCalendrierPeriodePeer::retrieveEdtCalendrierPeriodeActuelle($v); if ($periodeCalendrier != null) { $query->addOr(EdtEmplacementCoursPeer::ID_CALENDRIER, $periodeCalendrier->getIdCalendrier()); } } $edtCoursCol = $query->find(); //si il n'y a aucune periode ouverte actuellement, on renvoi tous les groupe et donc tous les emplacements de cours $colAidId = $id_array = $this->getAidDetailss()->getPrimaryKeys(); $query = EdtEmplacementCoursQuery::create()->filterByIdAid($colAidId) ->filterByIdCalendrier(0) ->addOr(EdtEmplacementCoursPeer::ID_CALENDRIER, NULL); if ($v instanceof EdtCalendrierPeriode) { $query->addOr(EdtEmplacementCoursPeer::ID_CALENDRIER, $v->getIdCalendrier()); } else { $periodeCalendrier = EdtCalendrierPeriodePeer::retrieveEdtCalendrierPeriodeActuelle($v); if ($periodeCalendrier != null) { $query->addOr(EdtEmplacementCoursPeer::ID_CALENDRIER, $periodeCalendrier->getIdCalendrier()); } } $edtCoursCol->addCollection($query->find()); require_once(dirname(__FILE__)."/../../../helpers/EdtEmplacementCoursHelper.php"); EdtEmplacementCoursHelper::orderChronologically($edtCoursCol); return $edtCoursCol; }