Compare commits

..

No commits in common. "2b2be5166ef113d598427c47236898dfc224ce1c" and "348af6b56d6e8d1788eadd7569f947f3a8e82877" have entirely different histories.

4 changed files with 61 additions and 127 deletions

View file

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

View file

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

View file

@ -1,14 +1,5 @@
<div class="panel panel-default">
<div 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>
<div class="row">
<div class="col-sm-9">{{ bulletin.getClasse() }}</div>
<div class="col-sm-3">Moyenne Générale : {{ bulletin.getMoyenne() }}</div>
</div>
</div>
<div id="{{ bulletin.getId() }}" class="panel-collapse collapse {{ opened }}" style="padding:5px">
<div id="accordion_{{ bulletin.getId() }}_matiere" class="panel-group">
{% for matiere in bulletin.getMatieres() %}
<div id="accordion_{{ bulletin.getId() }}_matiere" class="panel-group">
{% for matiere in bulletin.getMatieres() %}
{% if matiere.isVisible() %}
<div class="panel panel-primary">
<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">
@ -45,7 +36,5 @@
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% endfor %}
</div>