/** * Performs the work of inserting or updating the row in the database. * * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see save() */ protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // We call the save method on the following object(s) if they // were passed to this object by their coresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aCahierTexteCompteRendu !== null) { if ($this->aCahierTexteCompteRendu->isModified() || $this->aCahierTexteCompteRendu->isNew()) { $affectedRows += $this->aCahierTexteCompteRendu->save($con); } $this->setCahierTexteCompteRendu($this->aCahierTexteCompteRendu); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; $this->resetModified(); } $this->alreadyInSave = false; } return $affectedRows; } // doSave()
// On ne fait rien, on n'enregistre pas un CR sans date } else { $contenu = $cr[$i] == '' ? '...' : $cr[$i]; // pour rester cohérent avec le module cdt // On formate la date demandée $test_date = explode("/", $dateseance[$i]); $ts_seance = mktime(0, 0, 0, $test_date[1], $test_date[0], $test_date[2]); // on enregistre alors ce CR $seance = new CahierTexteCompteRendu(); $seance->setIdSequence($sequence->getId()); $seance->setHeureEntry(date("H:i:s", date("U"))); $seance->setIdGroupe($enseignement); $seance->setDateCt($ts_seance); $seance->setIdLogin($_SESSION["login"]); $seance->setContenu($contenu); if ($seance->save()) { //$verif = 'yes'; $nb_reg++; } else { $verif = 'no'; } } } // Gestion des erreurs//@TODO pas encore utilisé dans la page de retour if ($verif == 'no') { $msg = "<p>Au moins un compte-rendu n'a pas pu être enregistré !</p>"; } header("Location: ../cahier_texte_2/index.php?id_groupe=" . $enseignement); die; } elseif ($nb_reg > 0) { $msg = "Enregistrement effectué.";
//} //============================= // Corriger en chemins relatifs les chemins absolus débutant par getSettingValue('url_racine_gepi')... // pas seulement: on peut avoir le nom DNS et l'IP dans le cas d'un gepi en DMZ ou plus généralement atteint en IP ou en nom DNS. $url_absolues_gepi = getSettingValue("url_absolues_gepi"); if ($url_absolues_gepi != "") { $contenu_cor = cdt_changer_chemin_absolu_en_relatif($contenu_cor); } //============================= $contenu_cor = cdt_copie_fichiers_archive_vers_cdt_courant($contenu_cor, "compte_rendu", $id_groupe); $ctCompteRendu->setContenu($contenu_cor); $ctCompteRendu->setDateCt($date_ct); $ctCompteRendu->setGroupe($groupe); $ctCompteRendu->setHeureEntry($heure_entry); //enregistrement de l'objet $ctCompteRendu->save(); //traitement de telechargement de documents joints if (!empty($doc_file['name'][0])) { require_once "traite_doc.php"; $total_max_size = getSettingValue("total_max_size"); $max_size = getSettingValue("max_size"); $multi = isset($multisite) && $multisite == 'y' ? $_COOKIE['RNE'] . '/' : NULL; if (isset($multisite) && $multisite == 'y' && is_dir('../documents/' . $multi) === false) { mkdir('../documents/' . $multi); } $dest_dir = '../documents/' . $multi . 'cl' . $ctCompteRendu->getIdCt(); //il y a au plus trois documents joints dans l'interface de saisie for ($index_doc = 0; $index_doc < 3; $index_doc++) { if (!empty($doc_file['tmp_name'][$index_doc])) { $file_path = ajout_fichier($doc_file, $dest_dir, $index_doc, $id_groupe); if ($file_path != null) {