2024-07-13 18:39:43 +00:00
|
|
|
<?php
|
|
|
|
|
2024-07-20 07:15:55 +00:00
|
|
|
namespace YesWiki\Meeo\Bulletin;
|
2024-07-13 18:39:43 +00:00
|
|
|
|
2024-07-20 07:15:55 +00:00
|
|
|
include 'tools/meeo/libs/bulletin/Matiere.lib.php';
|
2024-07-13 18:39:43 +00:00
|
|
|
|
|
|
|
use YesWiki\Bazar\Service\ListManager;
|
2024-07-27 15:19:40 +00:00
|
|
|
use YesWiki\Meeo\Eleve\Eleve;
|
2024-07-13 18:39:43 +00:00
|
|
|
|
|
|
|
class Bulletin {
|
|
|
|
private $eleve;
|
|
|
|
private $matieres = [];
|
|
|
|
|
2024-07-27 15:19:40 +00:00
|
|
|
public function __construct($wiki, Eleve $eleve) {
|
2024-07-13 18:39:43 +00:00
|
|
|
$this->eleve = $eleve;
|
|
|
|
// echo var_dump($eleve);
|
|
|
|
|
|
|
|
$listManager = $wiki->services->get(ListManager::class);
|
|
|
|
$matieres = $listManager->getOne('ListeMatiere');
|
2024-07-27 15:19:40 +00:00
|
|
|
// echo "<p>".var_dump($matieres)."</p>";
|
2024-08-03 10:07:23 +00:00
|
|
|
foreach ($matieres['label'] as $id => $matiere) {
|
|
|
|
// echo "<p>".$id."</pd>";
|
|
|
|
$this->matieres[] = new Matiere($wiki, $this, $id, $matiere);
|
2024-07-13 18:39:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getId() {
|
2024-07-27 15:19:40 +00:00
|
|
|
return $this->eleve->getId();
|
2024-07-13 18:39:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getNom() {
|
2024-07-27 15:19:40 +00:00
|
|
|
return $this->eleve->getNom();
|
2024-07-13 18:39:43 +00:00
|
|
|
}
|
|
|
|
|
2024-07-27 15:37:51 +00:00
|
|
|
public function getClasse() {
|
|
|
|
return $this->eleve->getClasse();
|
2024-07-13 18:39:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getMoyenne() {
|
|
|
|
$total = 0;
|
2024-07-21 09:17:17 +00:00
|
|
|
$totalMatieres = 0;
|
2024-07-13 18:39:43 +00:00
|
|
|
foreach ( $this->matieres as $matiere) {
|
2024-07-21 09:17:17 +00:00
|
|
|
if ($matiere->isVisible()) {
|
|
|
|
$total += $matiere->getMoyenne();
|
|
|
|
++$totalMatieres;
|
|
|
|
}
|
2024-07-13 18:39:43 +00:00
|
|
|
}
|
2024-07-21 09:17:17 +00:00
|
|
|
return $total / $totalMatieres;
|
2024-07-13 18:39:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getMatieres() {
|
|
|
|
return $this->matieres;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isVisible() {
|
|
|
|
foreach ($this->matieres as $matiere) {
|
2024-07-27 15:37:51 +00:00
|
|
|
if ( $matiere->isVisible() ) {
|
|
|
|
return true;
|
2024-07-13 18:39:43 +00:00
|
|
|
}
|
2024-07-27 15:37:51 +00:00
|
|
|
return false;
|
2024-07-13 18:39:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|