59 lines
No EOL
1.2 KiB
PHP
59 lines
No EOL
1.2 KiB
PHP
<?php
|
|
|
|
namespace YesWiki\Meeo\Bulletin;
|
|
|
|
include 'tools/meeo/libs/bulletin/Matiere.lib.php';
|
|
|
|
use YesWiki\Bazar\Service\ListManager;
|
|
|
|
class Bulletin {
|
|
private $eleve;
|
|
private $classe;
|
|
private $matieres = [];
|
|
|
|
public function __construct($wiki, $eleve, $classe) {
|
|
$this->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['bf_titre'];
|
|
}
|
|
|
|
public function getNom() {
|
|
return $this->eleve['bf_nom'];
|
|
}
|
|
|
|
public function getClass() {
|
|
return $this->classe;
|
|
}
|
|
|
|
public function getMoyenne() {
|
|
$total = 0;
|
|
foreach ( $this->matieres as $matiere) {
|
|
$total += $matiere->getMoyenne();
|
|
}
|
|
|
|
return $total / count($this->matieres);
|
|
}
|
|
|
|
public function getMatieres() {
|
|
return $this->matieres;
|
|
}
|
|
|
|
public function isVisible() {
|
|
foreach ($this->matieres as $matiere) {
|
|
if ( !$matiere->isVisible() ) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
} |