/**
	 * 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->aCahierTexteTravailAFaire !== null) {
				if ($this->aCahierTexteTravailAFaire->isModified() || $this->aCahierTexteTravailAFaire->isNew()) {
					$affectedRows += $this->aCahierTexteTravailAFaire->save($con);
				}
				$this->setCahierTexteTravailAFaire($this->aCahierTexteTravailAFaire);
			}

			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()
    }
    $jour_visibilite = $jour_courant;
    $date_visibilite_mal_formatee = "y";
}
$tab_tmp = explode("/", $jour_visibilite);
$jour_v = $tab_tmp[0];
$mois_v = $tab_tmp[1];
$annee_v = $tab_tmp[2];
if (!isset($id_devoir) || $id_devoir == "" || $date_visibilite_mal_formatee == "n") {
    $date_visibilite_eleve = mktime($heure_v, $min_v, 0, $mois_v, $jour_v, $annee_v);
} else {
    $date_visibilite_eleve = $ctTravailAFaire->getDateVisibiliteEleve();
}
$ctTravailAFaire->setDateVisibiliteEleve($date_visibilite_eleve);
//enregistrement de l'objet
$ctTravailAFaire->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_dev' . $ctTravailAFaire->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) {