/** * * Renvoi le creneau actuel * * @return EdtCreneau EdtCreneau * */ public static function retrieveEdtCreneauActuel($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); } } return EdtCreneauQuery::create()->filterByHeuredebutDefiniePeriode($dt->format("H:i:s"), Criteria::LESS_EQUAL) ->filterByHeurefinDefiniePeriode($dt->format("H:i:s"), Criteria::GREATER_THAN)->findOne(); }
$dt_date_absence_eleve_fin_saisir_eleve = new DateTime('now'); } if ($type_selection == 'id_groupe') { if ($utilisateur->getStatut() == "professeur") { $current_groupe = GroupeQuery::create()->filterByUtilisateurProfessionnel($utilisateur)->findPk($id_groupe); } else { $current_groupe = GroupeQuery::create()->findPk($id_groupe); } $current_creneau = EdtCreneauQuery::create()->findPk($id_creneau); } else if ($type_selection == 'id_aid') { $current_aid = AidDetailsQuery::create()->findPk($id_aid); $current_creneau = EdtCreneauQuery::create()->findPk($id_creneau); } else if ($type_selection == 'id_classe') { $current_classe = ClasseQuery::create()->findPk($id_classe); $current_creneau = EdtCreneauQuery::create()->findPk($id_creneau); } else { } //============================================== $style_specifique[] = "templates/DefaultEDT/css/style_edt"; $style_specifique[] = "mod_abs2/lib/abs_style"; $style_specifique[] = "lib/DHTMLcalendar/calendarstyle"; $javascript_specifique[] = "lib/DHTMLcalendar/calendar"; $javascript_specifique[] = "lib/DHTMLcalendar/lang/calendar-fr"; $javascript_specifique[] = "lib/DHTMLcalendar/calendar-setup"; $javascript_specifique[] = "mod_abs2/lib/include"; $titre_page = "Les absences"; $utilisation_jsdivdrag = "non"; $_SESSION['cacher_header'] = "y"; require_once("../lib/header.inc.php");
/** * Get the associated EdtCreneau object * * @param PropelPDO Optional Connection object. * @return EdtCreneau The associated EdtCreneau object. * @throws PropelException */ public function getEdtCreneau(PropelPDO $con = null) { if ($this->aEdtCreneau === null && (($this->id_definie_periode !== "" && $this->id_definie_periode !== null))) { $this->aEdtCreneau = EdtCreneauQuery::create()->findPk($this->id_definie_periode, $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->aEdtCreneau->addEdtEmplacementCourss($this); */ } return $this->aEdtCreneau; }
/** * Get the associated EdtCreneau object * * @param PropelPDO Optional Connection object. * @return EdtCreneau The associated EdtCreneau object. * @throws PropelException */ public function getEdtCreneau(PropelPDO $con = null) { if ($this->aEdtCreneau === null && ($this->id_edt_creneau !== null)) { $this->aEdtCreneau = EdtCreneauQuery::create()->findPk($this->id_edt_creneau, $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->aEdtCreneau->addAbsenceEleveSaisies($this); */ } return $this->aEdtCreneau; }
/** * * 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; }
/** * 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(EdtCreneauPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $deleteQuery = EdtCreneauQuery::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; } }