/**
  * Trouve toutes les promotions
  *
  * @param none
  * @return array(\SIOC\donnees\Promotion)
  */
 public function findAll()
 {
     $sql = "SELECT * FROM Promotion ORDER BY pro_id";
     $result = $this->getDb()->fetchAll($sql);
     $promotions = array();
     foreach ($result as $row) {
         $promotionId = $row['pro_id'];
         $eleves = new UtilisateurDAO($this->getDb());
         $row['pro_eleves'] = $eleves->findAllbyPromotion($promotionId);
         $promotions[$promotionId] = $this->buildDomainObject($row);
     }
     return $promotions;
 }
Example #2
0
 /**
  * Trouve toutes les activites a l'utilisateur associe
  *
  * @param integer $utilisateurId
  * @return array(\SIOC\donnees\Activite)
  */
 public function findAllbyUtilisateur($utilisateurId)
 {
     $sql = "SELECT A.act_id, A.act_debut, A.act_duree, A.act_periode, A.act_libelle, A.act_description" . " FROM Activite AS A, Utilisateur AS U" . " WHERE A.act_eleve = U.uti_id" . " AND U.uti_id = ?";
     $result = $this->getDb()->fetchAll($sql, array($utilisateurId));
     $activites = array();
     foreach ($result as $row) {
         $activiteId = $row['act_id'];
         $utilisateur = new UtilisateurDAO($this->getDb());
         $row['act_eleve'] = $utilisateur->findbyActivite($activiteId);
         $competences = new CompetenceDAO($this->getDb());
         $row['act_competences'] = $competences->findAllbyActivite($activiteId);
         $activites[$activiteId] = $this->buildDomainObject($row);
     }
     return $activites;
 }