$insert = mysqli_query($GLOBALS["mysqli"], $sql);
        echo "Erreur enregistrement de compte rendu : formulaire déjà posté précédemment.\nUne copie de sauvegarde a été créée en notice privée.";
    } else {
        echo "Erreur enregistrement de compte rendu : formulaire déjà posté précédemment.";
    }
    die;
}
$_SESSION['uid_prime'] = $uid_post;
//récupération du compte rendu
//$ctCompteRendu = new CahierTexteCompteRendu();
if ($id_ct != null) {
    //$criteria = new Criteria();
    //$criteria->add(CahierTexteCompteRenduPeer::ID_CT, $id_ct, "=");
    //$ctCompteRendus = $utilisateur->getCahierTexteCompteRendus($criteria);
    //$ctCompteRendu = $ctCompteRendus[0];
    $ctCompteRendu = CahierTexteCompteRenduQuery::create()->findPk($id_ct);
    if ($ctCompteRendu == null) {
        echo "Erreur enregistrement de compte rendu : Compte rendu non trouvé";
        die;
    }
    $groupe = $ctCompteRendu->getGroupe();
    if (!$groupe->belongsTo($utilisateur)) {
        echo "Erreur edition de compte rendu : le groupe n'appartient pas au professeur";
        die;
    }
} else {
    //si pas  du compte rendu précisé, récupération du groupe dans la requete et création d'un nouvel objet CahierTexteCompteRendu
    foreach ($utilisateur->getGroupes() as $group) {
        if ($id_groupe == $group->getId()) {
            $groupe = $group;
            break;
	/**
	 * Returns a new CahierTexteCompteRenduQuery object.
	 *
	 * @param     string $modelAlias The alias of a model in the query
	 * @param     Criteria $criteria Optional Criteria to build the query from
	 *
	 * @return    CahierTexteCompteRenduQuery
	 */
	public static function create($modelAlias = null, $criteria = null)
	{
		if ($criteria instanceof CahierTexteCompteRenduQuery) {
			return $criteria;
		}
		$query = new CahierTexteCompteRenduQuery();
		if (null !== $modelAlias) {
			$query->setModelAlias($modelAlias);
		}
		if ($criteria instanceof Criteria) {
			$query->mergeWith($criteria);
		}
		return $query;
	}
示例#3
0
 /**
  * Renvoie la liste des derniers compte-rendus pour chaque enseignement auxquels est inscrit un élève
  *
  * @param object Eleve $_eleve
  * @return array Liste des Compte-Rendus d'un élève
  */
 public function cdtCREleve($_eleve)
 {
     $var = array();
     $now = new DateTime('now');
     $rep = CahierTexteCompteRenduQuery::create()->orderByDateCt()->distinct()->useGroupeQuery()->useJEleveGroupeQuery()->filterByEleve($_eleve)->endUse()->endUse()->filterByDateCt($now->format('U') - 6058000, Criteria::GREATER_THAN)->find();
     foreach ($rep as $r) {
         $var[$r->getDateCt()] = $this->_encodage == 'utf8' ? utf8_encode($r->getContenu()) : $r->getContenu();
     }
     return $var;
 }
	/**
	 * 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 CahierTexteCompteRendus 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 CahierTexteCompteRendu[] List of CahierTexteCompteRendu objects
	 */
	public function getCahierTexteCompteRendusJoinCahierTexteSequence($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
	{
		$query = CahierTexteCompteRenduQuery::create(null, $criteria);
		$query->joinWith('CahierTexteSequence', $join_behavior);

		return $this->getCahierTexteCompteRendus($query, $con);
	}
	/**
	 * 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(CahierTexteCompteRenduPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
		}

		$con->beginTransaction();
		try {
			$deleteQuery = CahierTexteCompteRenduQuery::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;
		}
	}
	/**
	 * Get the associated CahierTexteCompteRendu object
	 *
	 * @param      PropelPDO Optional Connection object.
	 * @return     CahierTexteCompteRendu The associated CahierTexteCompteRendu object.
	 * @throws     PropelException
	 */
	public function getCahierTexteCompteRendu(PropelPDO $con = null)
	{
		if ($this->aCahierTexteCompteRendu === null && ($this->id_ct !== null)) {
			$this->aCahierTexteCompteRendu = CahierTexteCompteRenduQuery::create()->findPk($this->id_ct, $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->aCahierTexteCompteRendu->addCahierTexteCompteRenduFichierJoints($this);
			 */
		}
		return $this->aCahierTexteCompteRendu;
	}
示例#7
0
	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this CahierTexteSequence is new, it will return
	 * an empty collection; or if this CahierTexteSequence has previously
	 * been saved, it will retrieve related CahierTexteCompteRendus 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 CahierTexteSequence.
	 *
	 * @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 CahierTexteCompteRendu[] List of CahierTexteCompteRendu objects
	 */
	public function getCahierTexteCompteRendusJoinUtilisateurProfessionnel($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
	{
		$query = CahierTexteCompteRenduQuery::create(null, $criteria);
		$query->joinWith('UtilisateurProfessionnel', $join_behavior);

		return $this->getCahierTexteCompteRendus($query, $con);
	}