示例#1
0
 $sequence->setDescription($descsequence);
 $sequence->save();
 // Maintenant on peut relier les compte-rendus avec cette séquence
 $nbre = count($cr);
 for ($i = 0; $i < $nbre; $i++) {
     // On vérifie si le CR est bien renseigné ainsi que sa date
     if ($dateseance[$i] == '') {
         // 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
	/**
	 * Exclude object from result
	 *
	 * @param     CahierTexteCompteRendu $cahierTexteCompteRendu Object to remove from the list of results
	 *
	 * @return    CahierTexteCompteRenduQuery The current query, for fluid interface
	 */
	public function prune($cahierTexteCompteRendu = null)
	{
		if ($cahierTexteCompteRendu) {
			$this->addUsingAlias(CahierTexteCompteRenduPeer::ID_CT, $cahierTexteCompteRendu->getIdCt(), Criteria::NOT_EQUAL);
		}

		return $this;
	}
    }
} 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;
        }
    }
    // cela economise un acces db par rapport à  $current_group = GroupePeer::retrieveByPK($id_groupe), et permet de ne pas avoir a nettoyer les reference de utilisateurs.
    if ($groupe == null) {
        echo "Erreur enregistrement de compte rendu : pas de groupe ou mauvais groupe spécifié";
        die;
    }
    //pas de notices, on lance une création de notice
    $ctCompteRendu = new CahierTexteCompteRendu();
    $ctCompteRendu->setIdGroupe($groupe->getId());
    $ctCompteRendu->setIdLogin($utilisateur->getLogin());
}
// interdire la modification d'un visa par le prof si c'est un visa
if ($ctCompteRendu->getVise() == 'y') {
    echo "Erreur enregistrement de compte rendu : Notice signée, edition impossible/";
    die;
}
if (isset($_POST['get_devoirs_du_jour']) && $_POST['get_devoirs_du_jour'] == 'y') {
    $sql = "SELECT id_ct, contenu FROM ct_devoirs_entry WHERE id_groupe='{$id_groupe}' AND date_ct='" . $date_ct . "';";
    $res_ct = mysqli_query($GLOBALS["mysqli"], $sql);
    if (mysqli_num_rows($res_ct) == 0) {
        echo "Erreur : Aucun travail à importer.";
        die;
    } elseif (mysqli_num_rows($res_ct) == 1) {
	/**
	 * Filter the query by a related CahierTexteCompteRendu object
	 *
	 * @param     CahierTexteCompteRendu $cahierTexteCompteRendu  the related object to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    CahierTexteSequenceQuery The current query, for fluid interface
	 */
	public function filterByCahierTexteCompteRendu($cahierTexteCompteRendu, $comparison = null)
	{
		if ($cahierTexteCompteRendu instanceof CahierTexteCompteRendu) {
			return $this
				->addUsingAlias(CahierTexteSequencePeer::ID, $cahierTexteCompteRendu->getIdSequence(), $comparison);
		} elseif ($cahierTexteCompteRendu instanceof PropelCollection) {
			return $this
				->useCahierTexteCompteRenduQuery()
				->filterByPrimaryKeys($cahierTexteCompteRendu->getPrimaryKeys())
				->endUse();
		} else {
			throw new PropelException('filterByCahierTexteCompteRendu() only accepts arguments of type CahierTexteCompteRendu or PropelCollection');
		}
	}
	/**
	 * Filter the query by a related CahierTexteCompteRendu object
	 *
	 * @param     CahierTexteCompteRendu|PropelCollection $cahierTexteCompteRendu The related object(s) to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    CahierTexteCompteRenduFichierJointQuery The current query, for fluid interface
	 */
	public function filterByCahierTexteCompteRendu($cahierTexteCompteRendu, $comparison = null)
	{
		if ($cahierTexteCompteRendu instanceof CahierTexteCompteRendu) {
			return $this
				->addUsingAlias(CahierTexteCompteRenduFichierJointPeer::ID_CT, $cahierTexteCompteRendu->getIdCt(), $comparison);
		} elseif ($cahierTexteCompteRendu instanceof PropelCollection) {
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
			return $this
				->addUsingAlias(CahierTexteCompteRenduFichierJointPeer::ID_CT, $cahierTexteCompteRendu->toKeyValue('PrimaryKey', 'IdCt'), $comparison);
		} else {
			throw new PropelException('filterByCahierTexteCompteRendu() only accepts arguments of type CahierTexteCompteRendu or PropelCollection');
		}
	}
    // Vérification : est-ce que l'utilisateur a le droit de travailler sur ce groupe ?
    if (!$groupe->belongsTo($utilisateur)) {
        echo "Erreur edition de compte rendu : le groupe n'appartient pas au professeur";
        die;
    }
    if ($ajout_nouvelle_notice != "oui") {
        //on cherche si il y a une notice pour le groupe à la date précisée
        $criteria = new Criteria(CahierTexteCompteRenduPeer::DATABASE_NAME);
        $criteria->add(CahierTexteCompteRenduPeer::DATE_CT, $today, '=');
        $criteria->add(CahierTexteCompteRenduPeer::ID_LOGIN, $utilisateur->getLogin());
        $ctCompteRendus = $groupe->getCahierTexteCompteRendus($criteria);
        $ctCompteRendu = isset($ctCompteRendus[0]) ? $ctCompteRendus[0] : NULL;
    }
    if ($ctCompteRendu == null) {
        //pas de notices, on initialise un nouvel objet
        $ctCompteRendu = new CahierTexteCompteRendu();
        $ctCompteRendu->setIdGroupe($groupe->getId());
        $ctCompteRendu->setDateCt($today);
        $ctCompteRendu->setIdLogin($utilisateur->getLogin());
    }
}
// Vérification : est-ce que l'utilisateur a le droit de modifier cette entré ?
if (my_strtolower($ctCompteRendu->getIdLogin()) != my_strtolower($utilisateur->getLogin()) && getSettingValue("cdt_autoriser_modif_multiprof") != "yes") {
    echo "Erreur edition de compte rendu : vous n'avez pas le droit de modifier cette notice car elle appartient à un autre professeur.";
    die;
}
if ($ctCompteRendu->getVise() == 'y') {
    // interdire la modification d'un visa par le prof si c'est un visa
    echo "Erreur edition de compte rendu : Notices signée, edition impossible";
    die;
}
	/**
	 * @param	CahierTexteCompteRendu $cahierTexteCompteRendu The cahierTexteCompteRendu object to add.
	 */
	protected function doAddCahierTexteCompteRendu($cahierTexteCompteRendu)
	{
		$this->collCahierTexteCompteRendus[]= $cahierTexteCompteRendu;
		$cahierTexteCompteRendu->setUtilisateurProfessionnel($this);
	}
示例#8
0
	/**
	 * @param	CahierTexteCompteRendu $cahierTexteCompteRendu The cahierTexteCompteRendu object to add.
	 */
	protected function doAddCahierTexteCompteRendu($cahierTexteCompteRendu)
	{
		$this->collCahierTexteCompteRendus[]= $cahierTexteCompteRendu;
		$cahierTexteCompteRendu->setGroupe($this);
	}
	/**
	 * Declares an association between this object and a CahierTexteCompteRendu object.
	 *
	 * @param      CahierTexteCompteRendu $v
	 * @return     CahierTexteCompteRenduFichierJoint The current object (for fluent API support)
	 * @throws     PropelException
	 */
	public function setCahierTexteCompteRendu(CahierTexteCompteRendu $v = null)
	{
		if ($v === null) {
			$this->setIdCt(0);
		} else {
			$this->setIdCt($v->getIdCt());
		}

		$this->aCahierTexteCompteRendu = $v;

		// Add binding for other direction of this n:n relationship.
		// If this object has already been added to the CahierTexteCompteRendu object, it will not be re-added.
		if ($v !== null) {
			$v->addCahierTexteCompteRenduFichierJoint($this);
		}

		return $this;
	}