Compare commits

...

3 commits

Author SHA1 Message Date
mckmonster
768ec94d92 [Notes] creation d'une classe bulletin 2024-07-13 20:39:43 +02:00
mckmonster
262715db5e [Notes] Filtrage des affichages
- Rajout d'icones
- Affichage plus propre
2024-07-13 12:18:39 +02:00
mckmonster
4a5ad7b40a [Absences] Visualisé les absences justifiés ou non 2024-07-13 11:48:15 +02:00
7 changed files with 194 additions and 32 deletions

View file

@ -5,7 +5,6 @@ namespace YesWiki\Meeo;
use YesWiki\Core\YesWikiAction; use YesWiki\Core\YesWikiAction;
use YesWiki\Bazar\Service\EntryManager; use YesWiki\Bazar\Service\EntryManager;
use YesWiki\Core\Service\UserManager; use YesWiki\Core\Service\UserManager;
use YesWiki\Bazar\Service\ListManager;
class NotesAction extends YesWikiAction class NotesAction extends YesWikiAction
{ {
@ -23,27 +22,28 @@ class NotesAction extends YesWikiAction
$entryManager = $this->getService(EntryManager::class); $entryManager = $this->getService(EntryManager::class);
$userManager = $this->getService(UserManager::class); $userManager = $this->getService(UserManager::class);
$listManager = $this->getService(ListManager::class);
if ( $userManager->isInGroup($groupeEE, admincheck: false) ) { if ( $userManager->isInGroup($groupeEE, admincheck: false) ) {
$eleves = $entryManager->search(['formsIds' => $meeo_config['elevesFormId']]); $eleves = $entryManager->search(['formsIds' => $meeo_config['elevesFormId']]);
$entries = $entryManager->search(['formsIds' => $formId]); $entries = $entryManager->search(['formsIds' => $formId]);
$matieres = $listManager->getOne('ListeMatiere');
include 'tools/meeo/libs/Bulletin.lib.php';
$bulletins = [];
foreach ( $eleves as $eleve) {
$bulletins[] = new Bulletin($this->wiki, $eleve, "Passerelle");
}
// echo var_dump($eleves); // echo var_dump($eleves);
// echo var_dump($entries); // echo var_dump($entries);
// echo var_dump($matieres); // echo var_dump($matieres);
return $this->render('@meeo/edu_notes.twig', [ return $this->render('@meeo/edu_notes.twig', [
"eleves" => $eleves, "bulletins" => $bulletins,
"entries" => $entries,
"matieres" => $matieres,
]); ]);
} else { } else {
$entries = $entryManager->search(['formsIds' => $formId]); $entries = $entryManager->search(['formsIds' => $formId]);
$matieres = $listManager->getOne('ListeMatiere');
return $this->render('@meeo/eeleve_notes.twig', [ return $this->render('@meeo/eeleve_notes.twig', [
"entries" => $entries, "bulletin" => $bulletin,
"matieres" => $matieres,
]); ]);
} }
} }

59
libs/Bulletin.lib.php Normal file
View file

@ -0,0 +1,59 @@
<?php
namespace YesWiki\Meeo;
include 'tools/meeo/libs/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;
}
}
}

56
libs/Matiere.lib.php Normal file
View file

@ -0,0 +1,56 @@
<?php
namespace YesWiki\Meeo;
include 'tools/meeo/libs/Note.lib.php';
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;
}
}

27
libs/Note.lib.php Normal file
View file

@ -0,0 +1,27 @@
<?php
namespace YesWiki\Meeo;
class Note {
private $intitule;
private $note;
private $coef;
public function __construct(string $intitule, int $note, float $coef = 1.0) {
$this->intitule = $intitule;
$this->note = $note;
$this->coef = $coef;
}
public function getIntitule() {
return $this->intitule;
}
public function getNote() {
return $this->note;
}
public function getCoef() {
return $this->coef;
}
}

View file

@ -1,14 +1,18 @@
<div id="accordion" class="panel-group" role="tablist" aria-multiselectable="true"> <div id="accordion" class="panel-group" role="tablist" aria-multiselectable="true">
{% for identifier, eleve in eleves|sort %} {% for bulletin in bulletins|sort %}
{% if bulletin.isVisible() %}
<div class="panel panel-default"> <div class="panel panel-default">
<button id="head_{{ identifier }}" class="panel-heading collapsed" data-parent="#accordion" data-target="#{{ identifier }}" data-toggle="collapse" aria-expanded="false"> <button id="head_{{ bulletin.getId() }}" class="panel-heading collapsed" data-parent="#accordion" data-target="#{{ bulletin.getId() }}" data-toggle="collapse" aria-expanded="false">
<h4 class="panel-title">{{ eleve['bf_nom'] }}</h4> <h4 class="panel-title">{{ bulletin.getNom() }}</h4>
<p>
{{ bulletin.getClass() }}<br/>
Moyenne Générale : {{ bulletin.getMoyenne() }}
</p>
</button> </button>
<div id="{{ identifier }}" class="panel-collapse collapse in" aria-expanded="false"> <div id="{{ bulletin.getId() }}" class="panel-collapse collapse in" style="padding:5px" aria-expanded="false">
{% set filteredEntries = entries|filter(e => e['listefiche5bf_eleve'] == identifier) %} {% include '@meeo/eleve_notes.twig' with { 'bulletin' : bulletin } %}
{% include '@meeo/eleve_notes.twig' with { 'entries' : filteredEntries } %}
</div> </div>
</div> </div>
{% endif %}
{% endfor %} {% endfor %}
</div> </div>

View file

@ -1,8 +1,14 @@
<div class="panel-body"> <div class="panel-body">
{% for entry in entries|sort((a,b) => a['bf_date_debut'] <=> b['bf_date_debut'])|reverse %} {% for entry in entries|sort((a,b) => a['bf_date_debut'] <=> b['bf_date_debut'])|reverse %}
{% set justifie = entry['bf_commentaire']|default %}
<div> <div>
<div> <div>
<h5> <h5>
{% if justifie == false %}
<i class="fa fa-exclamation" style="color:red" ></i>
{% else %}
<i class="fa fa-check" style="color:green" ></i>
{% endif %}
{% if entry['bf_date_debut'] == entry['bf_date_fin'] %} {% if entry['bf_date_debut'] == entry['bf_date_fin'] %}
{{ entry['bf_date_debut']|date("m/d/Y") }} {{ entry['bf_date_debut']|date("m/d/Y") }}
{% else %} {% else %}
@ -14,10 +20,10 @@
</h5> </h5>
</div> </div>
<div> <div>
{% if entry['bf_commentaire']|default %} {% if justifie %}
{{ entry['bf_commentaire'] }} Motif : {{ entry['bf_commentaire'] }}
{% else %} {% else %}
Aucune information <span>Absence non justifié</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View file

@ -1,16 +1,26 @@
<div id="accordion" class="panel-group" role="tablist" aria-multiselectable="true"> <div id="accordion" class="panel-group" role="tablist" aria-multiselectable="true">
{% for identifier, matiere in matieres['label'] %} {% for matiere in bulletin.getMatieres() %}
<div class="panel panel-primary"> <div class="panel panel-primary">
<button id="head_{{ identifier }}" class="panel-heading collapsed" data-parent="#accordion" data-target="#{{ identifier }}" data-toggle="collapse" aria-expanded="false"> <button id="head_{{ bulletin.getId() }}_{{ matiere.getId() }}" class="panel-heading collapsed" data-parent="#accordion" data-target="#{{ bulletin.getId() }}_{{ matiere.getId() }}" data-toggle="collapse" aria-expanded="false">
<h4 class="panel-title">{{ identifier }}</h4> <h4 class="panel-title">{{ matiere.getNom() }}</h4>
</button> <p>Moyenne : {{ matiere.getMoyenne() }}</p>
<div id="{{ identifier }}" class="panel-collapse collapse in" aria-expanded="false"> </button>
{% for idEntry, entry in entries|filter(e => e['listeListeMatièrebf_matiere'] == identifier) -%} <div id="{{ bulletin.getId() }}_{{ matiere.getId() }}" class="panel-collapse collapse in" style="padding:5px" aria-expanded="false">
<div> {% for note in matiere.getNotes() %}
{{ entry['bf_intitule'] }} : {{ entry['bf_note'] }} <div>
</div> {% if note.getNote() >= 20 %}
{% endfor %} <i class="fa fa-star" style="color:gold"></i>
</div> {% elseif note.getNote() >= 15 %}
<i class="fa fa-heart" style="color:red"></i>
{% elseif note.getNote() >= 12 %}
<i class="fa fa-smile" style="color:green"></i>
{% elseif note.getNote() >= 9 %}
<i class="fa fa-thumbs-up" style="color:green"></i>
{% endif %}
{{ note.getIntitule() }} : {{ note.getNote() }}
</div>
{% endfor %}
</div> </div>
</div>
{% endfor %} {% endfor %}
</div> </div>