/** * Get the associated Mef object * * @param PropelPDO Optional Connection object. * @return Mef The associated Mef object. * @throws PropelException */ public function getMef(PropelPDO $con = null) { if ($this->aMef === null && ($this->mef_code !== null)) { $this->aMef = MefQuery::create() ->filterByEleve($this) // here ->findOne($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->aMef->addEleves($this); */ } return $this->aMef; }
function ajoutMefParDefaut() { $mef = new Mef(); //$mef->setMefCode("1031000111"); //$mef->setLibelleCourt("3G"); $mef->setMefCode("1031001911"); $mef->setLibelleCourt("3EME"); $mef->setLibelleLong("3EME"); $mef->setLibelleEdition("3eme"); if (MefQuery::create()->filterByMefCode($mef->getMefCode())->find()->isEmpty()) { $mef->save(); } $mef = new Mef(); $mef->setMefCode("1021000111"); $mef->setLibelleCourt("4G"); $mef->setLibelleLong("4EME"); $mef->setLibelleEdition("4eme"); if (MefQuery::create()->filterByMefCode($mef->getMefCode())->find()->isEmpty()) { $mef->save(); } $mef = new Mef(); $mef->setMefCode("1011000111"); $mef->setLibelleCourt("5G"); $mef->setLibelleLong("5EME"); $mef->setLibelleEdition("5eme"); if (MefQuery::create()->filterByMefCode($mef->getMefCode())->find()->isEmpty()) { $mef->save(); } $mef = new Mef(); //$mef->setMefCode("1001000111"); //$mef->setLibelleCourt("6G"); $mef->setMefCode("1001001211"); $mef->setLibelleCourt("6EME"); $mef->setLibelleLong("6EME"); $mef->setLibelleEdition("6eme"); if (MefQuery::create()->filterByMefCode($mef->getMefCode())->find()->isEmpty()) { $mef->save(); } }
//recherche de l'utilisateur avec propel $utilisateur = UtilisateurProfessionnelPeer::getUtilisateursSessionEnCours(); if ($utilisateur == null) { header("Location: ../logout.php?auto=1"); die(); } //récupération des paramètres de la requète $id_mef = isset($_POST["id_mef"]) ? $_POST["id_mef"] :NULL; $total_eleves = isset($_POST["total_eleves"]) ? $_POST["total_eleves"] :(isset($_GET["total_eleves"]) ? $_GET["total_eleves"] :0); $message_enregistrement = ""; $mef = null; if ($id_mef != null && $id_mef != -1) { $mef = MefQuery::create()->findPk($id_mef); if ($mef == null) { $message_enregistrement .= "Probleme avec l'id du mef : ".$_POST['$id_mef']."<br/>"; } } for($i=0; $i<$total_eleves; $i++) { //$id_eleve = $_POST['id_eleve_absent'][$i]; //on test si l'eleve est enregistré absent if (!isset($_POST['active_mef_eleve'][$i])) { continue; } $eleve = EleveQuery::create()->findPk($_POST['active_mef_eleve'][$i]);
if (!$eleve_col->isEmpty()) { ?> <div class="centre_tout_moyen" style="width : 940px;"> <form method="post" action="enregistrement_eleve_mef.php" id="liste_mef_eleve"> <p> <input type="hidden" name="total_eleves" value="<?php echo($eleve_col->count()); ?>"/> </p> <p class="choix_fin"> <input value="Enregistrer" name="Valider" type="submit" onclick="this.form.submit();this.disabled=true;this.value='En cours'" /> </p> <!-- Afichage du tableau de la liste des élèves --> <!-- Legende du tableau--> <?php echo ('<p>'); $mef_collection = MefQuery::create()->find(); echo ("<label for=\"id_mef\">MEF</label> : <select id=\"id_mef\" name=\"id_mef\" class=\"small\">"); echo "<option value='-1'></option>\n"; foreach ($mef_collection as $mef) { echo "<option value='".$mef->getId()."'>"; echo $mef->getLibelleEdition().' '; echo $mef->getMefCode(); echo "</option>\n"; } echo "</select>"; echo '</p> '; ?> <!-- Fin de la legende --> <p><input type="hidden" name="total_eleves" value="<?php echo $eleve_col->count()?>" /></p> <table><tr><td style="vertical-align : top;"> <table style="width:750px;" class='sortable resizable'>
/** * 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(MefPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $deleteQuery = MefQuery::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; } }