Compare commits

...

2 commits

Author SHA1 Message Date
Mickael Veaudour
2b2be5166e
Group bulletin par classe 2024-11-05 11:05:51 +01:00
Mickael Veaudour
fe9affb53c
Afficher la moyenne générale sur les eleves 2024-11-05 09:22:50 +01:00
4 changed files with 129 additions and 63 deletions

View file

@ -0,0 +1,40 @@
<?php
namespace YesWiki\Meeo\Classes;
use YesWiki\Bazar\Service\EntryManager;
use YesWiki\Meeo\Service\NoteManager;
class Classe {
private $id;
private $name;
private $bulletins = [];
public function __construct($wiki, $id, $name) {
$this->id = $id;
$this->name = $name;
$noteManager = $wiki->services->get(NoteManager::class);
foreach ($noteManager->allBulletins() as $bulletin) {
if ($bulletin->getClasse() == $this->id) {
array_push($this->bulletins, $bulletin);
}
}
}
public function getId() {
return $this->id;
}
public function getName() {
return $this->name;
}
public function getBulletins() {
return $this->bulletins;
}
public function haveBulletins(){
return sizeof($this->bulletins) > 0;
}
}

View file

@ -9,6 +9,7 @@ use YesWiki\Core\Service\UserManager;
use YesWiki\Wiki; use YesWiki\Wiki;
use YesWiki\Meeo\Bulletin\Bulletin; use YesWiki\Meeo\Bulletin\Bulletin;
use YesWiki\Meeo\Service\EleveManager; use YesWiki\Meeo\Service\EleveManager;
use YesWiki\Meeo\Classes\Classe;
class NoteManager { class NoteManager {
protected $wiki; protected $wiki;
@ -36,25 +37,38 @@ class NoteManager {
$this->eeGroup = $meeo_config['groupeEE']; $this->eeGroup = $meeo_config['groupeEE'];
} }
public function allBulletins() {
$eleveManager = $this->wiki->services->get(EleveManager::class);
$eleves = $eleveManager->getAll();
$bulletins = [];
foreach ( $eleves as $eleve) {
$bulletins[] = new Bulletin($this->wiki, $eleve);
}
return $bulletins;
}
public function viewBulletins() { public function viewBulletins() {
$eleveManager = $this->wiki->services->get(EleveManager::class); $eleveManager = $this->wiki->services->get(EleveManager::class);
include 'tools/meeo/libs/bulletin/Bulletin.lib.php'; include 'tools/meeo/libs/bulletin/Bulletin.lib.php';
include 'tools/meeo/libs/classes/Classe.lib.php';
$loggedUser = $this->authController->getLoggedUser(); $loggedUser = $this->authController->getLoggedUser();
// echo "<p>".var_dump($loggedUser)."</p>";
if ($this->userManager->isInGroup($this->eeGroup, $loggedUser['name'], false)) {
$eleves = $eleveManager->getAll();
$bulletins = []; // echo "<p>".var_dump($loggedUser)."</p>";
foreach ( $eleves as $eleve) { if (true) {//($this->userManager->isInGroup($this->eeGroup, $loggedUser['name'], false)) {
$bulletins[] = new Bulletin($this->wiki, $eleve);
}
// echo "<p>".var_dump($eleves)."</p>"; // echo "<p>".var_dump($eleves)."</p>";
// echo "<p>".var_dump($bulletins)."</p>"; // echo "<p>".var_dump($bulletins)."</p>";
$classes = [];
$listClasse = $this->listManager->getOne('ListeClasses');
foreach ($listClasse['label'] as $id => $classe) {
array_push($classes, new Classe($this->wiki, $id, $classe));
}
// echo "<p>".var_dump($classes)."</p>";
return $this->wiki->render('@meeo/edu_notes.twig', [ return $this->wiki->render('@meeo/edu_notes.twig', [
"bulletins" => $bulletins, "classes" => $classes,
"opened" => ""
]); ]);
} else { } else {
// echo "Eleve"; // echo "Eleve";
@ -63,6 +77,7 @@ class NoteManager {
$bulletin = new Bulletin($this->wiki, $currentEleve); $bulletin = new Bulletin($this->wiki, $currentEleve);
return $this->wiki->render('@meeo/eleve_notes.twig', [ return $this->wiki->render('@meeo/eleve_notes.twig', [
"bulletin" => $bulletin, "bulletin" => $bulletin,
"opened" => "in"
]); ]);
} }
} }

View file

@ -1,18 +1,18 @@
<div id="accordion_bulletins" class="panel-group"> <div class="panel-group">
{% for bulletin in bulletins|sort %} {% for classe in classes %}
{% if bulletin.isVisible() %} {% if classe.haveBulletins() %}
<div class="panel panel-default"> <div class="panel panel-primary">
<div id="head_{{ bulletin.getId() }}" class="panel-heading collapsed" data-parent="#accordion_bulletins" data-target="#{{ bulletin.getId() }}" data-toggle="collapse"> <div class="panel-heading">{{ classe.getName() }}</div>
<h4 class="panel-title">{{ bulletin.getNom() }}</h4> <div class="panel-body">
<div class="row"> <div id="accordion_bulletins" class="panel-group">
<div class="col-sm-9">{{ bulletin.getClasse() }}</div> {% for bulletin in classe.getBulletins() %}
<div class="col-sm-3">Moyenne Générale : {{ bulletin.getMoyenne() }}</div> {% if bulletin.isVisible() %}
{% include '@meeo/eleve_notes.twig' with { 'bulletin' : bulletin } %}
{% endif %}
{% endfor %}
</div>
</div>
</div> </div>
</div> {% endif %}
<div id="{{ bulletin.getId() }}" class="panel-collapse collapse" style="padding:5px"> {% endfor %}
{% include '@meeo/eleve_notes.twig' with { 'bulletin' : bulletin } %}
</div>
</div>
{% endif %}
{% endfor %}
</div> </div>

View file

@ -1,40 +1,51 @@
<div id="accordion_{{ bulletin.getId() }}_matiere" class="panel-group"> <div class="panel panel-default">
{% for matiere in bulletin.getMatieres() %} <div id="head_{{ bulletin.getId() }}" class="panel-heading collapsed" data-parent="#accordion_bulletins" data-target="#{{ bulletin.getId() }}" data-toggle="collapse">
{% if matiere.isVisible() %} <h4 class="panel-title">{{ bulletin.getNom() }}</h4>
<div class="panel panel-primary"> <div class="row">
<div id="head_{{ bulletin.getId() }}_{{ matiere.getId() }}" class="panel-heading collapsed" data-parent="#accordion_{{ bulletin.getId() }}_matiere" data-target="#{{ bulletin.getId() }}_{{ matiere.getId() }}" data-toggle="collapse"> <div class="col-sm-9">{{ bulletin.getClasse() }}</div>
<h4 class="panel-title">{{ matiere.getNom() }}</h4> <div class="col-sm-3">Moyenne Générale : {{ bulletin.getMoyenne() }}</div>
<div class="row"> </div>
<div class="col-sm-10"></div> </div>
<div class="col-sm-2"> <div id="{{ bulletin.getId() }}" class="panel-collapse collapse {{ opened }}" style="padding:5px">
Moyenne : {{ matiere.getMoyenne() }} / 20 <div id="accordion_{{ bulletin.getId() }}_matiere" class="panel-group">
</div> {% for matiere in bulletin.getMatieres() %}
</div> {% if matiere.isVisible() %}
</div> <div class="panel panel-primary">
<div id="{{ bulletin.getId() }}_{{ matiere.getId() }}" class="panel-collapse collapse in" style="padding:5px"> <div id="head_{{ bulletin.getId() }}_{{ matiere.getId() }}" class="panel-heading collapsed" data-parent="#accordion_{{ bulletin.getId() }}_matiere" data-target="#{{ bulletin.getId() }}_{{ matiere.getId() }}" data-toggle="collapse">
{% for note in matiere.getNotes() %} <h4 class="panel-title">{{ matiere.getNom() }}</h4>
<div class="row"> <div class="row">
<div class="col-sm-1"> <div class="col-sm-10"></div>
{% if note.getNoteOn20() >= 20 %} <div class="col-sm-2">
<i class="fa fa-star" style="color:gold"></i> Moyenne : {{ matiere.getMoyenne() }} / 20
{% elseif note.getNoteOn20() >= 15 %} </div>
<i class="fa fa-heart" style="color:red"></i> </div>
{% elseif note.getNoteOn20() >= 12 %} </div>
<i class="fa fa-smile" style="color:green"></i> <div id="{{ bulletin.getId() }}_{{ matiere.getId() }}" class="panel-collapse collapse in" style="padding:5px">
{% elseif note.getNoteOn20() >= 9 %} {% for note in matiere.getNotes() %}
<i class="fa fa-thumbs-up" style="color:green"></i> <div class="row">
{% endif %} <div class="col-sm-1">
</div> {% if note.getNoteOn20() >= 20 %}
<div class="col-sm-10"> <i class="fa fa-star" style="color:gold"></i>
{{ note.getIntitule() }} {% elseif note.getNoteOn20() >= 15 %}
</div> <i class="fa fa-heart" style="color:red"></i>
<div class="col-sm-1"> {% elseif note.getNoteOn20() >= 12 %}
{{ note.getNote() }} / {{ note.getMax() }} <i class="fa fa-smile" style="color:green"></i>
</div> {% elseif note.getNoteOn20() >= 9 %}
</div> <i class="fa fa-thumbs-up" style="color:green"></i>
{% endfor %} {% endif %}
</div>
<div class="col-sm-10">
{{ note.getIntitule() }}
</div>
<div class="col-sm-1">
{{ note.getNote() }} / {{ note.getMax() }}
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% endfor %}
</div> </div>
</div> </div>
{% endif %}
{% endfor %}
</div> </div>