eleve = $eleve; // echo var_dump($eleve); $this->classe = $classe; $listManager = $wiki->services->get(ListManager::class); $matieres = $listManager->getOne('ListeMatiere'); foreach ($matieres['label'] as $id => $nom) { $this->matieres[] = new Matiere($wiki, $this, $id, $nom); } } public function getId() { return $this->eleve['id_fiche']; } public function getNom() { return $this->eleve['bf_nom']; } public function getClass() { return $this->classe; } public function getMoyenne() { $total = 0; $totalMatieres = 0; foreach ( $this->matieres as $matiere) { if ($matiere->isVisible()) { $total += $matiere->getMoyenne(); ++$totalMatieres; } } return $total / $totalMatieres; } public function getMatieres() { return $this->matieres; } public function isVisible() { foreach ($this->matieres as $matiere) { if ( !$matiere->isVisible() ) { return false; } return true; } } }