Fix bulletin

This commit is contained in:
mckmonster 2024-07-27 17:37:51 +02:00
parent 8fe95ee094
commit 166cbfc20b
4 changed files with 15 additions and 17 deletions

View file

@ -31,8 +31,8 @@ class Bulletin {
return $this->eleve->getNom(); return $this->eleve->getNom();
} }
public function getClass() { public function getClasse() {
return $this->eleve->classe; return $this->eleve->getClasse();
} }
public function getMoyenne() { public function getMoyenne() {
@ -53,10 +53,10 @@ class Bulletin {
public function isVisible() { public function isVisible() {
foreach ($this->matieres as $matiere) { foreach ($this->matieres as $matiere) {
if ( !$matiere->isVisible() ) { if ( $matiere->isVisible() ) {
return false; return true;
} }
return true; return false;
} }
} }
} }

View file

@ -24,6 +24,7 @@ class Matiere {
// echo "<p>".var_dump($entries)."</p>"; // echo "<p>".var_dump($entries)."</p>";
foreach ($entries as $entry) { foreach ($entries as $entry) {
if (!empty($entry['bf_note']))
$this->notes[] = new Note($entry['bf_intitule'], $entry['bf_note'], $entry['bf_coef']); $this->notes[] = new Note($entry['bf_intitule'], $entry['bf_note'], $entry['bf_coef']);
} }
} }

View file

@ -42,18 +42,12 @@ class NoteManager {
// echo "<p>".var_dump($currentEleve)."</p>"; // echo "<p>".var_dump($currentEleve)."</p>";
// if ($currentEleve == null) { // if ($currentEleve == null) {
$eleves = $eleveManager->getAll(); $eleves = $eleveManager->getAll();
// $eleves = $ $this->entryManager->search(['formsIds' => $meeo_config['elevesFormId']]);
// $entries = $this->entryManager->search(['formsIds' => $this->formId]);
$bulletins = []; $bulletins = [];
foreach ( $eleves as $eleve) { foreach ( $eleves as $eleve) {
//TODO enlever "Passerelle" $bulletins[] = new Bulletin($this->wiki, $eleve);
$bulletin = new Bulletin($this->wiki, $eleve, "Passerelle");
if ($bulletin->isVisible())
$bulletins[] = $bulletin;
} }
// echo "<p>".var_dump($eleves)."</p>"; // echo "<p>".var_dump($eleves)."</p>";
// echo "<p>".var_dump($entries)."</p>";
// echo "<p>".var_dump($bulletins)."</p>"; // echo "<p>".var_dump($bulletins)."</p>";
return $this->wiki->render('@meeo/edu_notes.twig', [ return $this->wiki->render('@meeo/edu_notes.twig', [
@ -78,7 +72,10 @@ class NoteManager {
} }
public function createNote($intitule, $eleve, $matiere, $note, $coef) { public function createNote($intitule, $eleve, $matiere, $note, $coef) {
$note = [ if ($note == 0)
return;
$data = [
'bf_titre' => "Note : ".$intitule." - ".$eleve." - ".$matiere, 'bf_titre' => "Note : ".$intitule." - ".$eleve." - ".$matiere,
'bf_intitule' => $intitule, 'bf_intitule' => $intitule,
'listeListeMatierebf_matiere' => $matiere, 'listeListeMatierebf_matiere' => $matiere,
@ -87,12 +84,12 @@ class NoteManager {
'bf_coef' => $coef, 'bf_coef' => $coef,
'antispam' => true 'antispam' => true
]; ];
$this->entryManager->create($this->formId, $note); $this->entryManager->create($this->formId, $data);
} }
public function getNotes($eleveId, $matiereId) { public function getNotes($eleveId, $matiereId) {
echo "<p>".$eleveId."</p>"; // echo "<p>".$eleveId."</p>";
echo "<p>".$matiereId."</p>"; // echo "<p>".$matiereId."</p>";
$entries = $this->entryManager->search(['formsIds' => $this->formId, $entries = $this->entryManager->search(['formsIds' => $this->formId,
'queries' =>[ 'queries' =>[
'listefiche'.$this->eleveFormId.'bf_eleve' => \strtolower($eleveId), 'listefiche'.$this->eleveFormId.'bf_eleve' => \strtolower($eleveId),

View file

@ -5,7 +5,7 @@
<button id="head_{{ bulletin.getId() }}" class="panel-heading collapsed" data-parent="#accordion_bulletins" data-target="#{{ bulletin.getId() }}" data-toggle="collapse"> <button id="head_{{ bulletin.getId() }}" class="panel-heading collapsed" data-parent="#accordion_bulletins" data-target="#{{ bulletin.getId() }}" data-toggle="collapse">
<h4 class="panel-title">{{ bulletin.getNom() }}</h4> <h4 class="panel-title">{{ bulletin.getNom() }}</h4>
<div class="row"> <div class="row">
<div class="col-sm-9">{{ bulletin.getClass() }}</div> <div class="col-sm-9">{{ bulletin.getClasse() }}</div>
<div class="col-sm-3">Moyenne Générale : {{ bulletin.getMoyenne() }}</div> <div class="col-sm-3">Moyenne Générale : {{ bulletin.getMoyenne() }}</div>
</div> </div>
</button> </button>