示例#1
0
 /**
  * @param $oRole
  */
 public function setRoles($oRole)
 {
     $oUserRoles = new UserRole();
     $oUserRoles->setRole($oRole);
     $oUserRoles->setUser($this);
     $aCollection = new \PropelCollection();
     $aCollection->append($oUserRoles);
     $this->setUserRoles($aCollection);
 }
示例#2
0
	/**
	 *
	 * Renvoi une description intelligible du traitement
	 *
	 * @return     String description
	 *
	 */
	public function getDescription() {
	    if (!isset($description) || $description === null) {
		$desc = 'n° '.$this->getId();
		$desc .= ' créé le ';
		$desc .= strftime("%a %d/%m/%Y", $this->getUpdatedAt('U'));
		$eleve_col = new PropelCollection();
		foreach ($this->getAbsenceEleveSaisies() as $abs_saisie) {
		    if ($abs_saisie->getEleve() != null) {
			$eleve_col->add($abs_saisie->getEleve());
		    }
		}
		foreach ($eleve_col as $eleve) {
		    if ($eleve_col->isFirst()) {
			$desc .= '; ';
		    }
		    $desc .= $eleve->getNom().' '.$eleve->getPrenom();
		    if (!$eleve_col->isLast()) {
			$desc .= ', ';
		    }
		}
		if ($this->getAbsenceEleveType() != null) {
		    $desc .= "; type : ".$this->getAbsenceEleveType()->getNom();
		}
		if ($this->getAbsenceEleveMotif() != null) {
		    $desc .= "; motif : ".$this->getAbsenceEleveMotif()->getNom();
		}
		if ($this->getAbsenceEleveJustification() != null) {
		    $desc .= "; justification : ".$this->getAbsenceEleveJustification()->getNom();
		}
		$notif = false;
		foreach ($this->getAbsenceEleveNotifications() as $notification) {
		    if ($notification->getStatutEnvoi() == AbsenceEleveNotificationPeer::STATUT_ENVOI_SUCCES
			    || $notification->getStatutEnvoi() == AbsenceEleveNotificationPeer::STATUT_ENVOI_SUCCES_AVEC_ACCUSE_DE_RECEPTION) {
			$notif = true;
			break;
		    }
		}
		if ($notif) {
		    $desc .= "; Notifié";
		}
		if ($this->getCommentaire() != null && $this->getCommentaire() != '') {
		    $desc .= "; Commentaire : ".$this->getCommentaire();
		}
		$description = $desc;
	    }
	    return $description;
	}
 /**
  * {@inheritdoc}
  */
 public function rewind()
 {
     if ($this->iterator) {
         $this->iterator->rewind();
         return;
     }
     $this->iterator = $this->collection->getIterator();
     $this->iterator->rewind();
 }
示例#4
0
    /**
    * Test that PropelCollection->add() prevents duplicates of objects strictly identical
    *
    */
   public function testAdd()
    {
        Propel::disableInstancePooling();
        $eleve1 = EleveQuery::create()->findOneByLogin('Florence Michu');
        $eleve1->setNom('test_different');
        $eleve_col = new PropelCollection();
        $eleve_col->add($eleve1);
        $eleve1idem = EleveQuery::create()->findOneByLogin('Florence Michu');
        $this->assertFalse($eleve_col->contains($eleve1idem));
        $eleve_col->add($eleve1idem);
        $this->assertEquals(2, count($eleve_col));
        Propel::enableInstancePooling();


        $eleve1 = EleveQuery::create()->findOneByLogin('Florence Michu');
        $eleve_col = new PropelCollection();
        $eleve_col->add($eleve1);
        $eleve_col->add($eleve1);
        $this->assertEquals(1, count($eleve_col));
    }
 /**
  * Filter the query by a related MeshingTrustType object
  *
  * @param     MeshingTrustType|PropelCollection $meshingTrustType The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    MeshingTrustLocalQuery The current query, for fluid interface
  */
 public function filterByMeshingTrustType($meshingTrustType, $comparison = null)
 {
     if ($meshingTrustType instanceof MeshingTrustType) {
         return $this->addUsingAlias(MeshingTrustLocalPeer::TYPE, $meshingTrustType->getId(), $comparison);
     } elseif ($meshingTrustType instanceof PropelCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(MeshingTrustLocalPeer::TYPE, $meshingTrustType->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByMeshingTrustType() only accepts arguments of type MeshingTrustType or PropelCollection');
     }
 }
示例#6
0
	echo $notification->getAdresse()->getCp().' '.$notification->getAdresse()->getCommune();
	if ($notification->getAdresse()->getPays() != null && $notification->getAdresse()->getPays() != '' && $notification->getAdresse()->getPays() != getsettingvalue('gepiSchoolPays')) {
	    echo '<br/>';
	    echo $notification->getAdresse()->getPays();
	}	
    }

    if ($notification->getModifiable()) {
	echo '<div>';
	echo '<form method="post" action="enregistrement_modif_notification.php">';
    echo '<input type="hidden" name="menu" value="'.$menu.'"/>';
	echo '<p>';
	echo '<input type="hidden" name="id_notification" value="'.$notification->getPrimaryKey().'"/>';
	echo '<input type="hidden" name="modif" value="adresse"/>';
	echo ("<select name=\"adr_id\" onchange='submit()'>");
	$adresse_col = new PropelCollection();
	if ($notification->getAbsenceEleveTraitement() != null) {
	    foreach ($notification->getAbsenceEleveTraitement()->getResponsablesInformationsSaisies() as $responsable_information) {
		if ($responsable_information->getResponsableEleve() != null && $responsable_information->getResponsableEleve()->getAdresse() != null) {
		     $adresse_col->add($responsable_information->getResponsableEleve()->getAdresse());
		}
	    }
	}
	foreach ($adresse_col as $responsable_addresse) {
	    //$responsable_addresse = new Adresse();
	    echo '<option value="'.$responsable_addresse->getPrimaryKey().'"';
	    if ($notification->getAdresse() != null &&
		    $responsable_addresse->getPrimaryKey() == $notification->getAdresse()->getPrimaryKey()) {
		echo " selected='selected' ";
	    }
	    echo ">";
	/**
	 * Filter the query by a related AbsenceEleveLieu object
	 *
	 * @param     AbsenceEleveLieu|PropelCollection $absenceEleveLieu The related object(s) to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    AbsenceEleveSaisieQuery The current query, for fluid interface
	 */
	public function filterByAbsenceEleveLieu($absenceEleveLieu, $comparison = null)
	{
		if ($absenceEleveLieu instanceof AbsenceEleveLieu) {
			return $this
				->addUsingAlias(AbsenceEleveSaisiePeer::ID_LIEU, $absenceEleveLieu->getId(), $comparison);
		} elseif ($absenceEleveLieu instanceof PropelCollection) {
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
			return $this
				->addUsingAlias(AbsenceEleveSaisiePeer::ID_LIEU, $absenceEleveLieu->toKeyValue('PrimaryKey', 'Id'), $comparison);
		} else {
			throw new PropelException('filterByAbsenceEleveLieu() only accepts arguments of type AbsenceEleveLieu or PropelCollection');
		}
	}
 /**
  * {@inheritdoc}
  */
 public function contains($element)
 {
     if ($element instanceof BaseObject) {
         if (null !== ($elt = $this->getIdenticalObject($element))) {
             $element = $elt;
         }
     }
     return parent::contains($element);
 }
    /**
     * Compte les demi-journees saisies. Les saisies doivent ètre triées par ordre de début.
     * Cette méthode ne travaille que sur les dates, et prend en compte les fermeture de l'établissement
     *
     * @param PropelObjectCollection $abs_saisie_col collection d'objets AbsenceEleveSaisie
     *
     * @return PropelCollection une collection de date time par demi journee comptee (un datetime pour le matin et un datetime pour l'apres midi
     */

    public static function compte_demi_journee($abs_saisie_col, $date_debut_iteration = null, $date_fin_iteration = null) {
        if ($abs_saisie_col->isEmpty()) {
            return new PropelCollection();
        }
        
        $abs_saisie_col->uasort(array("AbsencesEleveSaisieHelper", "compare_debut_absence"));
        
        //on récupère l'heure de demi-journée
        $heure_demi_journee = 11;//11:50 par défaut si rien n'est précisé dans les settings
        $minute_demi_journee = 50;
        if (getSettingValue("abs2_heure_demi_journee") != null) {
            try {
                $dt_demi_journee = new DateTime(getSettingValue("abs2_heure_demi_journee"));
                $heure_demi_journee = $dt_demi_journee->format('H');
                $minute_demi_journee = $dt_demi_journee->format('i');
            } catch (Exception $x) {
            }
        }
         
        //on va regarder la date du début pour notre algorithme
        if ($date_debut_iteration == null) {
            $date_debut_iteration = $abs_saisie_col->getFirst()->getDebutAbs(null);
        }
        if ($date_debut_iteration->format('Hi') < $heure_demi_journee.$minute_demi_journee) {
            $date_debut_iteration->setTime(0, 0, 0);
        } else {
            $date_debut_iteration->setTime(12, 0, 0);
        }
              
        //on va regarder la date du fin pour notre algorithme
        if ($date_fin_iteration == null) {
            foreach ($abs_saisie_col as $saisie) {
                if ($date_fin_iteration == null || $saisie->getFinAbs('U') > $date_fin_iteration->format('U')) {
                    $date_fin_iteration = $saisie->getFinAbs(null);
                }
            }
        }
        if ($date_fin_iteration->format('Hi') < $heure_demi_journee.$minute_demi_journee) {
            $date_fin_iteration->setTime(12, 0, 0);
        } else {
            $date_fin_iteration->setTime(23, 59, 59);
            $date_fin_iteration->modify("+1 second");
        }
        $date_fin_iteration->modify("+2 hours");//on ajout deux heures pour prendre en compte un décalage dans la date de compteur (+1h35) dans l'algorithme plus bas
        

        $result = new PropelCollection();
        $date_compteur = clone $date_debut_iteration;
        $horaire_tab = EdtHorairesEtablissementPeer::retrieveAllEdtHorairesEtablissementArrayCopy();
        require_once(dirname(__FILE__)."/EdtHelper.php");
        foreach($abs_saisie_col as $saisie) {
            if ($date_compteur->format('U') < $saisie->getDebutAbs('U')) {
                $date_compteur = clone $saisie->getDebutAbs(null);
            }
            if ($date_compteur >= $date_fin_iteration) {
                break;
            }
            
            while ($date_compteur <= $saisie->getFinAbs(null) && $date_compteur < $date_fin_iteration) {
                //est-ce un jour de la semaine ouvert ?
                if (!EdtHelper::isJourneeOuverte($date_compteur)) {
                    //etab fermé on va passer au lendemain
                    $date_compteur->setTime(23, 59, 59);
                    $date_compteur->modify("+2 hours");
                    continue;
                } elseif (!EdtHelper::isHoraireOuvert($date_compteur)) {
                    $horaire = $horaire_tab[EdtHelper::$semaine_declaration[$date_compteur->format("w")]];
                    if ($date_compteur->format('Hi') < $horaire->getOuvertureHoraireEtablissement('Hi')) {
                        //c'est le matin, on règle sur l'heure d'ouverture
                        $date_compteur->setTime($horaire->getOuvertureHoraireEtablissement('H'), $horaire->getOuvertureHoraireEtablissement('i'));
                    } else {
                        //on est apres la fermeture, on va passer au lendemain
                        $date_compteur->setTime(23, 59, 59);
                        $date_compteur->modify("+2 hours");
                    }
                    continue;
                } elseif ($date_compteur < $saisie->getDebutAbs(null) && !EdtHelper::isHoraireOuvert($saisie->getDebutAbs(null))) {
                    $date_compteur->modify("+19 minutes");
                    continue;
                }

                if ($date_compteur->format('Hi') < $heure_demi_journee.$minute_demi_journee) {
                    $date_compteur->setTime(0, 0, 0);
                } else {
                    $date_compteur->setTime(12, 0, 0);
                }
                $date_compteur_suivante = clone $date_compteur;
                $date_compteur_suivante->modify("+15 hours");//en ajoutant 15 heure on est sur de passer a la demi-journee suivante
                if ($date_compteur_suivante->format('H') < 12) {
                    $date_compteur_suivante->setTime(0, 0, 0);
                } else {
                    $date_compteur_suivante->setTime($heure_demi_journee, $minute_demi_journee, 0);
                }
                
                if ($saisie->getDebutAbs(null) < $date_compteur_suivante && $saisie->getFinAbs(null) > $date_compteur) {
                    $result->append(clone $date_compteur);
                    //on ajoute 1h35
                    //pour eviter le cas ou on a une saisie par exemple sur 11h45 -> 13h et de la compter comme deux demi-journees
                    $date_compteur_suivante->modify("+1 hour");
                    $date_compteur_suivante->modify("+45 minutes");
                }
                
                $date_compteur = $date_compteur_suivante;
                $saisie->clearAllReferences();
            }
        }
        return $result;
    }
 /**
  * Filter the query by a related Ciudad object
  *
  * @param     Ciudad|PropelCollection $ciudad The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    ClienteQuery The current query, for fluid interface
  */
 public function filterByCiudadRelatedByIdCiudad($ciudad, $comparison = null)
 {
     if ($ciudad instanceof Ciudad) {
         return $this->addUsingAlias(ClientePeer::ID_CIUDAD, $ciudad->getIdciudad(), $comparison);
     } elseif ($ciudad instanceof PropelCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(ClientePeer::ID_CIUDAD, $ciudad->toKeyValue('PrimaryKey', 'Idciudad'), $comparison);
     } else {
         throw new PropelException('filterByCiudadRelatedByIdCiudad() only accepts arguments of type Ciudad or PropelCollection');
     }
 }
示例#11
0
				}
				$absences_du_creneau = $absences_du_creneau_du_prof;
			}
		} else if ($current_creneau != null && $edt_creneau->getHeuredebutDefiniePeriode('U') > $current_creneau->getHeuredebutDefiniePeriode('U')) {
			//on n'affiche pas les informations apres le creneau en cours pour ne pas influencer la saisie si c'est un enseignant
			if($utilisateur->getStatut() == "professeur"){
				$absences_du_creneau = new PropelCollection();
			}else{
				$absences_du_creneau = $eleve->getAbsenceEleveSaisiesDuCreneau($edt_creneau, $dt_date_absence_eleve);
			}
		} else {
			//on affiche  les informations pour les crenaux avant la saisie sauf si configuré autrement
			if (getSettingValue("abs2_montrer_creneaux_precedents")=='y') {
				$absences_du_creneau = $eleve->getAbsenceEleveSaisiesDuCreneau($edt_creneau, $dt_date_absence_eleve);
			} else {
				$absences_du_creneau = new PropelCollection();
			}
		}

		$afficheEleve[$elv]['style'][$i] = "";
		if ($deja_saisie && $nb_creneau_a_saisir > 0) {
			$afficheEleve[$elv]['style'][$i] = "fondVert";
		}
		if (!$absences_du_creneau->isEmpty()) {
			foreach ($absences_du_creneau as $abs_saisie) {
				if ($abs_saisie->getManquementObligationPresence()) {
					$afficheEleve[$elv]['style'][$i] = "fondRouge";
					break;
				}
			}
		}
 /**
  * Filter the query by a related Genero object
  *
  * @param     Genero|PropelCollection $genero The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    ProductoQuery The current query, for fluid interface
  */
 public function filterByGenero($genero, $comparison = null)
 {
     if ($genero instanceof Genero) {
         return $this->addUsingAlias(ProductoPeer::IDGENERO, $genero->getIdgenero(), $comparison);
     } elseif ($genero instanceof PropelCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(ProductoPeer::IDGENERO, $genero->toKeyValue('PrimaryKey', 'Idgenero'), $comparison);
     } else {
         throw new PropelException('filterByGenero() only accepts arguments of type Genero or PropelCollection');
     }
 }
示例#13
0
/**
 * Récupère les données d'un élève à afficher
 * @param objet $eleve Un élève issu de getEleves()
 * @param date $date_debut
 * @param date $date_fin
 * @param objet $justifie_col Collection Propel avec les justifications
 * @param bool $donneeBrut
 * @return array Une ligne du tableau à afficher
 * @see getEleves()
 */
function traiteEleve($eleve,$date_debut, $date_fin, $justifie_col, $donneeBrut, $erreur=FALSE) {
  $eleve_id = $eleve->getId();
  $donnees= array();
  $donnees[$eleve_id] = array();
  
  $propel_eleve = EleveQuery::create()->filterById($eleve_id)->findOne();
  $eleveNbAbs['demi_journees'] = $propel_eleve->getDemiJourneesAbsence($date_debut, $date_fin)->count();
  $eleveNbAbs['retards'] = $propel_eleve->getRetards($date_debut, $date_fin)->count();
	
	if ($eleveNbAbs['demi_journees'] > 0 || $eleveNbAbs['retards'] > 0 ) {
	  $eleveNbAbs['non_justifiees'] = $propel_eleve->getDemiJourneesNonJustifieesAbsence($date_debut, $date_fin)->count();
	  $eleveNbAbs['justifiees'] = $eleveNbAbs['demi_journees'] - $eleveNbAbs['non_justifiees']; 
	  $donnees[$eleve_id]['nom'] = $eleve->getNom();
	  $donnees[$eleve_id]['prenom'] = $eleve->getPrenom();
	  $donnees[$eleve_id]['classe'] = $eleve->getClasse();
	  $donnees[$eleve_id]['classe'] = $eleve->getClasseNom();        
	  $donnees[$eleve_id]['nbre_lignes_total'] = 0;
	  $donnees[$eleve_id]['demi_journees'] = $eleveNbAbs['demi_journees'];
	  $donnees[$eleve_id]['justifiees'] = $eleveNbAbs['justifiees'];
	  $donnees[$eleve_id]['non_justifiees'] = $eleveNbAbs['non_justifiees'];
	  $donnees[$eleve_id]['retards'] = $eleveNbAbs['retards'];
	  //Récupérer le décompte des traitements pour chaque élève	  
	  $totalDemi=0;
	foreach ($justifie_col as $justifie) {
	  // Décompte en données brutes 
		if ($donneeBrut == TRUE) {
		  $propel_traitEleve = AbsenceEleveTraitementQuery::create()->filterByAJustificationId($justifie->getid())
			->useJTraitementSaisieEleveQuery()
			  ->useAbsenceEleveSaisieQuery()
				->filterByEleveId($eleve_id)
				->filterByPlageTemps($date_debut,$date_fin )
			  ->endUse()
			->endUse() ;
		  $traiteEleve_col = $propel_traitEleve;
		  $donnees[$eleve_id]['traitement'][] = $traiteEleve_col->distinct()->count();
		} else {
		  // Décompte en 1/2 journées
                    $abs_saisie_col_filtrees = $eleve->getAbsenceEleveSaisiesDecompteDemiJournees($date_debut, $date_fin);
                    $justif_collection = new PropelCollection();
                    foreach ($abs_saisie_col_filtrees as $saisie) {
                        foreach ($saisie->getAbsenceEleveTraitements() as $traitement) {
                            if ($traitement->getAJustificationId() == $justifie->getid()) {
                                $justif_collection->add($saisie);
                            }
                        }
                    }

                    require_once(dirname(__FILE__)."/../orm//helpers/AbsencesEleveSaisieHelper.php");
                    $dm = AbsencesEleveSaisieHelper::compte_demi_journee($justif_collection, $date_debut, $date_fin);
                    $donnees[$eleve_id]['traitement'][] = $dm->count();
                    $totalDemi += $dm->count();
		}
	  }
	  $donnees[$eleve_id]['totalDemi']=$totalDemi;
	}
	unset ($eleveNbAbs, $traiteEleve_col, $propel_eleve, $propel_traitEleveDemi, $traiteEleveDemi, $traiteEleveDemi_col, $propel_traitEleve);
	if ($erreur && isset ($donnees[$eleve_id]['justifiees']) && ($donnees[$eleve_id]['justifiees']==$donnees[$eleve_id]['totalDemi'])) {
	  $donnees[$eleve_id] = array();
	}
	
	return $donnees;
}
	/**
	 * Filter the query by a related AbsenceEleveTraitement object
	 *
	 * @param     AbsenceEleveTraitement|PropelCollection $absenceEleveTraitement The related object(s) to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    JTraitementSaisieEleveQuery The current query, for fluid interface
	 */
	public function filterByAbsenceEleveTraitement($absenceEleveTraitement, $comparison = null)
	{
		if ($absenceEleveTraitement instanceof AbsenceEleveTraitement) {
			return $this
				->addUsingAlias(JTraitementSaisieElevePeer::A_TRAITEMENT_ID, $absenceEleveTraitement->getId(), $comparison);
		} elseif ($absenceEleveTraitement instanceof PropelCollection) {
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
			return $this
				->addUsingAlias(JTraitementSaisieElevePeer::A_TRAITEMENT_ID, $absenceEleveTraitement->toKeyValue('PrimaryKey', 'Id'), $comparison);
		} else {
			throw new PropelException('filterByAbsenceEleveTraitement() only accepts arguments of type AbsenceEleveTraitement or PropelCollection');
		}
	}
 public function testAddClassmatesWithPropelCollection()
 {
     $john = new DBStudent();
     $john->setName('john');
     $jean = new DBStudent();
     $jean->setName('jean');
     $phil = new DBStudent();
     $phil->setName('phil');
     $john->setClassmates(array($jean, $phil));
     $john->save();
     $this->assertEquals(3, DBStudentQuery::create()->count());
     $this->assertTrue($john->hasClassmate($jean));
     $this->assertTrue($john->hasClassmate($phil));
     $this->assertTrue($phil->hasClassmate($john));
     $this->assertTrue($jean->hasClassmate($john));
     $this->assertEquals(2, count($john->getClassmates()));
     $henri = new DBStudent();
     $henri->setName('henri');
     $marco = new DBStudent();
     $marco->setName('marco');
     $coll = new PropelCollection();
     $coll->append($henri);
     $coll->append($marco);
     $john->addClassmates($coll);
     $john->save();
     $this->assertEquals(5, DBStudentQuery::create()->count());
     $this->assertTrue($john->hasClassmate($henri));
     $this->assertTrue($john->hasClassmate($marco));
     $this->assertTrue($marco->hasClassmate($john));
     $this->assertTrue($henri->hasClassmate($john));
     $this->assertEquals(4, count($john->getClassmates()));
 }
     $id = $clone->getId();
     //this is done to avoid a bug in deepcopy
     $notification->copyInto($clone, true);
     // deep copy
     $clone->setId($id);
     $clone->setNew(false);
     $clone->setStatutEnvoi(AbsenceEleveNotificationPeer::STATUT_ENVOI_ETAT_INITIAL);
     $clone->setDateEnvoi(null);
     $clone->setErreurMessageEnvoi(null);
     $clone->save();
     $_POST["id_notification"] = $clone->getId();
     $message_enregistrement .= '<span style="color:green">Nouvelle notification</span>';
     include "visu_notification.php";
     die;
 } elseif ($modif == 'duplication_par_responsable') {
     $responsablesToAdd = new PropelCollection();
     $responsables_informations = $notification->getAbsenceEleveTraitement()->getResponsablesInformationsSaisies();
     foreach ($responsables_informations as $responsable_information) {
         $responsable = $responsable_information->getResponsableEleve();
         if ($responsable == null || $notification->getResponsableEleves()->contains($responsable) || $responsable_information->getNiveauResponsabilite() == '0') {
             continue;
         }
         $responsablesToAdd->append($responsable);
     }
     foreach ($responsablesToAdd as $responsableToAdd) {
         $clone = $notification->copy();
         //no deep copy
         $clone->save();
         $id = $clone->getId();
         //this is done to avoid a bug in deepcopy
         $notification->copyInto($clone, true);
示例#17
0
 public function testDiffWithACollectionHavingObjectsNotPresentInTheFirstCollection()
 {
     $col1 = new PropelCollection();
     $col2 = new PropelCollection();
     $b = new Book();
     $col2[] = $b;
     $result = $col1->diff($col2);
     $this->assertInstanceOf('PropelCollection', $result);
     $this->assertEquals(0, count($result));
 }
 /**
  * @expectedException PropelException
  */
 public function testGetConnectionNoModel()
 {
     $col = new PropelCollection();
     $col->getConnection();
 }
示例#19
0
 /**
  * Filter the query by a related sfGuardUser object
  *
  * @param     sfGuardUser|PropelCollection $sfGuardUser The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    CommentQuery The current query, for fluid interface
  */
 public function filterBysfGuardUserRelatedByCheckUserId($sfGuardUser, $comparison = null)
 {
     if ($sfGuardUser instanceof sfGuardUser) {
         return $this->addUsingAlias(CommentPeer::CHECK_USER_ID, $sfGuardUser->getId(), $comparison);
     } elseif ($sfGuardUser instanceof PropelCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(CommentPeer::CHECK_USER_ID, $sfGuardUser->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterBysfGuardUserRelatedByCheckUserId() only accepts arguments of type sfGuardUser or PropelCollection');
     }
 }
 /**
  * Filter the query by a related Pelicula object
  *
  * @param     Pelicula|PropelCollection $pelicula The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    SocioAlquilerQuery The current query, for fluid interface
  */
 public function filterByPelicula($pelicula, $comparison = null)
 {
     if ($pelicula instanceof Pelicula) {
         return $this->addUsingAlias(SocioAlquilerPeer::PELICULA_ID, $pelicula->getId(), $comparison);
     } elseif ($pelicula instanceof PropelCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(SocioAlquilerPeer::PELICULA_ID, $pelicula->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByPelicula() only accepts arguments of type Pelicula or PropelCollection');
     }
 }
	/**
	 * Filter the query by a related CahierTexteSequence object
	 *
	 * @param     CahierTexteSequence|PropelCollection $cahierTexteSequence The related object(s) to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    CahierTexteCompteRenduQuery The current query, for fluid interface
	 */
	public function filterByCahierTexteSequence($cahierTexteSequence, $comparison = null)
	{
		if ($cahierTexteSequence instanceof CahierTexteSequence) {
			return $this
				->addUsingAlias(CahierTexteCompteRenduPeer::ID_SEQUENCE, $cahierTexteSequence->getId(), $comparison);
		} elseif ($cahierTexteSequence instanceof PropelCollection) {
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
			return $this
				->addUsingAlias(CahierTexteCompteRenduPeer::ID_SEQUENCE, $cahierTexteSequence->toKeyValue('PrimaryKey', 'Id'), $comparison);
		} else {
			throw new PropelException('filterByCahierTexteSequence() only accepts arguments of type CahierTexteSequence or PropelCollection');
		}
	}
示例#22
0
	}
	echo "</select>&nbsp;";

	echo '<button type="submit">Afficher les élèves</button>';
echo '</p>';
	echo "</form>";
	echo "</td>";
}
echo "</tr></table>";

if (isset($message_enregistrement)) {
    echo "<span style='color:green'>".$message_enregistrement."</span>";
}

//afichage des eleves
$eleve_col = new PropelCollection();
if ($type_selection == 'id_eleve') {
    $query = EleveQuery::create();
    if ($utilisateur->getStatut() != "cpe" || getSettingValue("GepiAccesAbsTouteClasseCpe")!='yes') {
	$query->filterByUtilisateurProfessionnel($utilisateur);
    }
    $eleve = $query->filterById($id_eleve)
            ->where('Eleve.DateSortie<?','0')
            ->orWhere('Eleve.DateSortie is NULL')
            ->orWhere('Eleve.DateSortie>?', $dt_date_absence_eleve_debut_saisir_eleve->format('U'))
            ->findOne();
    if ($eleve != null) {
	$eleve_col->append($eleve);
    }
} else if ($type_selection == 'nom_eleve') {
    $query = EleveQuery::create();
	/**
	 * Filter the query by a related UtilisateurProfessionnel object
	 *
	 * @param     UtilisateurProfessionnel|PropelCollection $utilisateurProfessionnel The related object(s) to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    JProfesseursMatieresQuery The current query, for fluid interface
	 */
	public function filterByProfesseur($utilisateurProfessionnel, $comparison = null)
	{
		if ($utilisateurProfessionnel instanceof UtilisateurProfessionnel) {
			return $this
				->addUsingAlias(JProfesseursMatieresPeer::ID_PROFESSEUR, $utilisateurProfessionnel->getLogin(), $comparison);
		} elseif ($utilisateurProfessionnel instanceof PropelCollection) {
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
			return $this
				->addUsingAlias(JProfesseursMatieresPeer::ID_PROFESSEUR, $utilisateurProfessionnel->toKeyValue('PrimaryKey', 'Login'), $comparison);
		} else {
			throw new PropelException('filterByProfesseur() only accepts arguments of type UtilisateurProfessionnel or PropelCollection');
		}
	}
 /**
  * Filter the query by a related Usuario object
  *
  * @param     Usuario|PropelCollection $usuario The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    Libro_colaboradorQuery The current query, for fluid interface
  */
 public function filterByUsuario($usuario, $comparison = null)
 {
     if ($usuario instanceof Usuario) {
         return $this->addUsingAlias(Libro_colaboradorPeer::IDUSUARIO, $usuario->getId(), $comparison);
     } elseif ($usuario instanceof PropelCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(Libro_colaboradorPeer::IDUSUARIO, $usuario->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByUsuario() only accepts arguments of type Usuario or PropelCollection');
     }
 }
示例#25
0
 /**
  * Returns an array of objects present in the collection that
  * are not presents in the given collection.
  *
  * @param PropelCollection $collection	A Propel collection.
  * @return PropelCollection				An array of Propel objects from the collection that are not presents in the given collection.
  */
 public function diff(PropelCollection $collection)
 {
     $diff = clone $this;
     $diff->clear();
     foreach ($this as $object) {
         if (!$collection->contains($object)) {
             $diff[] = $object;
         }
     }
     return $diff;
 }
	/**
	 * Filter the query by a related Adresse object
	 *
	 * @param     Adresse|PropelCollection $adresse The related object(s) to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    AbsenceEleveNotificationQuery The current query, for fluid interface
	 */
	public function filterByAdresse($adresse, $comparison = null)
	{
		if ($adresse instanceof Adresse) {
			return $this
				->addUsingAlias(AbsenceEleveNotificationPeer::ADR_ID, $adresse->getId(), $comparison);
		} elseif ($adresse instanceof PropelCollection) {
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
			return $this
				->addUsingAlias(AbsenceEleveNotificationPeer::ADR_ID, $adresse->toKeyValue('PrimaryKey', 'Id'), $comparison);
		} else {
			throw new PropelException('filterByAdresse() only accepts arguments of type Adresse or PropelCollection');
		}
	}
 /**
  * Get an array representation of the collection
  *
  * @param string $keyColumn If null, the returned array uses an incremental index.
  *                                 Otherwise, the array is indexed using the specified column
  * @param boolean $usePrefix If true, the returned array prefixes keys
  *                                 with the model class name ('Article_0', 'Article_1', etc).
  *
  * <code>
  *   $bookCollection->getArrayCopy();
  *   array(
  *    0 => $book0,
  *    1 => $book1,
  *   )
  *   $bookCollection->getArrayCopy('Id');
  *   array(
  *    123 => $book0,
  *    456 => $book1,
  *   )
  *   $bookCollection->getArrayCopy(null, true);
  *   array(
  *    'Book_0' => $book0,
  *    'Book_1' => $book1,
  *   )
  * </code>
  *
  * @return array
  */
 public function getArrayCopy($keyColumn = null, $usePrefix = false)
 {
     if (null === $keyColumn && false === $usePrefix) {
         return parent::getArrayCopy();
     }
     $ret = array();
     $keyGetterMethod = 'get' . $keyColumn;
     foreach ($this as $key => $obj) {
         $key = null === $keyColumn ? $key : $obj->{$keyGetterMethod}();
         $key = $usePrefix ? $this->getModel() . '_' . $key : $key;
         $ret[$key] = $obj;
     }
     return $ret;
 }
示例#28
0
 /**
  * Filter the query by a related User object
  *
  * @param     User|PropelCollection $user The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    ActionQuery The current query, for fluid interface
  */
 public function filterByUser($user, $comparison = null)
 {
     if ($user instanceof User) {
         return $this->addUsingAlias(ActionPeer::USER_ID, $user->getId(), $comparison);
     } elseif ($user instanceof PropelCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(ActionPeer::USER_ID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByUser() only accepts arguments of type User or PropelCollection');
     }
 }
 /**
  * Synonym for toArray(), to provide a similar interface to PopelObjectCollection
  *
  * @param string  $keyColumn
  * @param boolean $usePrefix
  *
  * @return array
  */
 public function getArrayCopy($keyColumn = null, $usePrefix = false)
 {
     if (null === $keyColumn && false === $usePrefix) {
         return parent::getArrayCopy();
     } else {
         return $this->toArray($keyColumn, $usePrefix);
     }
 }
	/**
	 * Filter the query by a related ResponsableEleve object
	 *
	 * @param     ResponsableEleve|PropelCollection $responsableEleve The related object(s) to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    JNotificationResponsableEleveQuery The current query, for fluid interface
	 */
	public function filterByResponsableEleve($responsableEleve, $comparison = null)
	{
		if ($responsableEleve instanceof ResponsableEleve) {
			return $this
				->addUsingAlias(JNotificationResponsableElevePeer::PERS_ID, $responsableEleve->getResponsableEleveId(), $comparison);
		} elseif ($responsableEleve instanceof PropelCollection) {
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
			return $this
				->addUsingAlias(JNotificationResponsableElevePeer::PERS_ID, $responsableEleve->toKeyValue('PrimaryKey', 'ResponsableEleveId'), $comparison);
		} else {
			throw new PropelException('filterByResponsableEleve() only accepts arguments of type ResponsableEleve or PropelCollection');
		}
	}