Compare commits

..

No commits in common. "768ec94d92592c70cf82842dedd87142cefca46f" and "a279834374dd679d7336d7e7578daf7fcbb4fbdd" have entirely different histories.

7 changed files with 32 additions and 194 deletions

View file

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

View file

@ -1,59 +0,0 @@
<?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;
}
}
}

View file

@ -1,56 +0,0 @@
<?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;
}
}

View file

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

View file

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

View file

@ -1,26 +1,16 @@
<div id="accordion" class="panel-group" role="tablist" aria-multiselectable="true">
{% for matiere in bulletin.getMatieres() %}
<div class="panel panel-primary">
<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">{{ matiere.getNom() }}</h4>
<p>Moyenne : {{ matiere.getMoyenne() }}</p>
</button>
<div id="{{ bulletin.getId() }}_{{ matiere.getId() }}" class="panel-collapse collapse in" style="padding:5px" aria-expanded="false">
{% for note in matiere.getNotes() %}
<div>
{% if note.getNote() >= 20 %}
<i class="fa fa-star" style="color:gold"></i>
{% 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 %}
{% for identifier, matiere in matieres['label'] %}
<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">
<h4 class="panel-title">{{ identifier }}</h4>
</button>
<div id="{{ identifier }}" class="panel-collapse collapse in" aria-expanded="false">
{% for idEntry, entry in entries|filter(e => e['listeListeMatièrebf_matiere'] == identifier) -%}
<div>
{{ entry['bf_intitule'] }} : {{ entry['bf_note'] }}
</div>
{% endfor %}
</div>
</div>
</div>
{% endfor %}
</div>