Exemplo n.º 1
0
function ajoutMotifsParDefaut() {
    $motif = new AbsenceEleveMotif();
    $motif->setNom("Médical");
    $motif->setCommentaire("L'élève est absent pour raison médicale");
    if (AbsenceEleveMotifQuery::create()->filterByNom($motif->getNom())->find()->isEmpty()) {
	$motif->save();
    }

    $motif = new AbsenceEleveMotif();
    $motif->setNom("Familial");
    $motif->setCommentaire("L'élève est absent pour raison familiale");
    if (AbsenceEleveMotifQuery::create()->filterByNom($motif->getNom())->find()->isEmpty()) {
	$motif->save();
    }

    $motif = new AbsenceEleveMotif();
    $motif->setNom("Sportive");
    $motif->setCommentaire("L'élève est absent pour cause de compétition sportive");
    if (AbsenceEleveMotifQuery::create()->filterByNom($motif->getNom())->find()->isEmpty()) {
	$motif->save();
    }
}
Exemplo n.º 2
0
	/**
	 * Exclude object from result
	 *
	 * @param     AbsenceEleveMotif $absenceEleveMotif Object to remove from the list of results
	 *
	 * @return    AbsenceEleveMotifQuery The current query, for fluid interface
	 */
	public function prune($absenceEleveMotif = null)
	{
		if ($absenceEleveMotif) {
			$this->addUsingAlias(AbsenceEleveMotifPeer::ID, $absenceEleveMotif->getId(), Criteria::NOT_EQUAL);
		}

		return $this;
	}
Exemplo n.º 3
0
	/**
	 * Declares an association between this object and a AbsenceEleveMotif object.
	 *
	 * @param      AbsenceEleveMotif $v
	 * @return     AbsenceEleveTraitement The current object (for fluent API support)
	 * @throws     PropelException
	 */
	public function setAbsenceEleveMotif(AbsenceEleveMotif $v = null)
	{
		if ($v === null) {
			$this->setAMotifId(NULL);
		} else {
			$this->setAMotifId($v->getId());
		}

		$this->aAbsenceEleveMotif = $v;

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

		return $this;
	}
Exemplo n.º 4
0
	<a href="admin_motifs_absences.php?action=ajouter"><img src='../../images/icons/add.png' alt='' class='back_link' /> Ajouter un motif</a>
	<br/><br/>
	<a href="admin_motifs_absences.php?action=ajouterdefaut<?php echo add_token_in_url();?>"><img src='../../images/icons/add.png' alt='' class='back_link' /> Ajouter les motifs par défaut</a>
	<br/><br/>
    <table cellpadding="0" cellspacing="1" class="menu">
      <tr>
        <td>Nom</td>
        <td>Commentaire</td>
        <td style="width: 25px;"></td>
        <td style="width: 25px;"></td>
      </tr>
    <?php
    $motif_collection = new PropelCollection();
    $motif_collection = AbsenceEleveMotifQuery::create()->findList();
    $motif = new AbsenceEleveMotif();
    $i = '1';
    foreach ($motif_collection as $motif) { ?>
        <tr>
	  <td><?php echo $motif->getNom(); ?></td>
	  <td><?php echo $motif->getCommentaire(); ?></td>
          <td><a href="admin_motifs_absences.php?action=modifier&amp;id_motif=<?php echo $motif->getId(); echo add_token_in_url();?>"><img src="../../images/icons/configure.png" title="Modifier" border="0" alt="" /></a></td>
          <td><a href="admin_motifs_absences.php?action=supprimer&amp;id_motif=<?php echo $motif->getId(); echo add_token_in_url();?>" onClick="return confirm('Etes-vous sûr de vouloir supprimer ce motif ?')"><img src="../../images/icons/delete.png" width="22" height="22" title="Supprimer" border="0" alt="" /></a></td>
          <td><a href="admin_motifs_absences.php?action=monter&amp;id_motif=<?php echo $motif->getId(); echo add_token_in_url();?>"><img src="../../images/up.png" width="22" height="22" title="monter" border="0" alt="" /></a></td>
          <td><a href="admin_motifs_absences.php?action=descendre&amp;id_motif=<?php echo $motif->getId(); echo add_token_in_url();?>"><img src="../../images/down.png" width="22" height="22" title="descendre" border="0" alt="" /></a></td>
        </tr>
     <?php } ?>
    </table>
    <br/><br/>
</div>
Exemplo n.º 5
0
	/**
	 * Exchange the rank of the object with the one passed as argument, and saves both objects
	 *
	 * @param     AbsenceEleveMotif $object
	 * @param     PropelPDO $con optional connection
	 *
	 * @return    AbsenceEleveMotif the current object
	 *
	 * @throws Exception if the database cannot execute the two updates
	 */
	public function swapWith($object, PropelPDO $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(AbsenceEleveMotifPeer::DATABASE_NAME);
		}
		$con->beginTransaction();
		try {
			$oldRank = $this->getSortableRank();
			$newRank = $object->getSortableRank();
			$this->setSortableRank($newRank);
			$this->save($con);
			$object->setSortableRank($oldRank);
			$object->save($con);
			$con->commit();
	
			return $this;
		} catch (Exception $e) {
			$con->rollback();
			throw $e;
		}
	}
	/**
	 * Filter the query by a related AbsenceEleveMotif object
	 *
	 * @param     AbsenceEleveMotif|PropelCollection $absenceEleveMotif The related object(s) to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    AbsenceEleveTraitementQuery The current query, for fluid interface
	 */
	public function filterByAbsenceEleveMotif($absenceEleveMotif, $comparison = null)
	{
		if ($absenceEleveMotif instanceof AbsenceEleveMotif) {
			return $this
				->addUsingAlias(AbsenceEleveTraitementPeer::A_MOTIF_ID, $absenceEleveMotif->getId(), $comparison);
		} elseif ($absenceEleveMotif instanceof PropelCollection) {
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
			return $this
				->addUsingAlias(AbsenceEleveTraitementPeer::A_MOTIF_ID, $absenceEleveMotif->toKeyValue('PrimaryKey', 'Id'), $comparison);
		} else {
			throw new PropelException('filterByAbsenceEleveMotif() only accepts arguments of type AbsenceEleveMotif or PropelCollection');
		}
	}