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;
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
$entryManager = $wiki->services->get(EntryManager::class);
|
|
|
|
$entries = $entryManager->search(['formsIds' => 7, 'queries' =>[
|
|
|
|
'listefiche5bf_eleve' => $eleveId,
|
|
|
|
'listeListeMatièrebf_matiere' => $id
|
|
|
|
]]);
|
|
|
|
// echo var_dump($entries)."\n\n";
|
|
|
|
foreach ($entries as $entry) {
|
|
|
|
$this->notes[] = new Note($entry['bf_intitule'], $entry['bf_note'], $entry['bf_coef']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|