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/Note.lib.php';
|
2024-07-13 18:39:43 +00:00
|
|
|
|
|
|
|
use YesWiki\Bazar\Service\EntryManager;
|
2024-07-21 09:17:17 +00:00
|
|
|
use YesWiki\Meeo\Service\NoteManager;
|
2024-07-13 18:39:43 +00:00
|
|
|
|
|
|
|
class Matiere {
|
|
|
|
private $id;
|
|
|
|
private $nom;
|
|
|
|
private $notes;
|
|
|
|
|
|
|
|
public function __construct($wiki, Bulletin $bulletin, string $id, string $nom) {
|
|
|
|
$this->id = $id;
|
|
|
|
$this->nom = $nom;
|
|
|
|
|
|
|
|
$eleveId = $bulletin->getId();
|
2024-07-27 15:19:40 +00:00
|
|
|
// echo "<p>".$eleveId."</p>";
|
2024-07-13 18:39:43 +00:00
|
|
|
|
2024-07-21 09:17:17 +00:00
|
|
|
$noteManager = $wiki->services->get(NoteManager::class);
|
|
|
|
$entries = $noteManager->getNotes($eleveId, $id);
|
|
|
|
|
|
|
|
// echo "<p>".var_dump($entries)."</p>";
|
2024-07-13 18:39:43 +00:00
|
|
|
foreach ($entries as $entry) {
|
2024-07-27 15:37:51 +00:00
|
|
|
if (!empty($entry['bf_note']))
|
2024-09-11 06:47:50 +00:00
|
|
|
$this->notes[] = new Note($entry['bf_intitule'], $entry['bf_note'], $entry['listeListeNotemaxbf_notemax'], $entry['bf_coef']);
|
2024-07-13 18:39:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getId() {
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getNom() {
|
|
|
|
return $this->nom;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getMoyenne() {
|
|
|
|
$total = 0;
|
|
|
|
$totalCoef = 0.0;
|
|
|
|
foreach ($this->notes as $note) {
|
|
|
|
$total += $note->getNote() * $note->getCoef();
|
|
|
|
$totalCoef += $note->getCoef();
|
|
|
|
}
|
|
|
|
return $total / $totalCoef;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getNotes() {
|
|
|
|
return $this->notes;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isVisible() {
|
|
|
|
return $this->notes;
|
|
|
|
}
|
|
|
|
}
|