- Fix pour afficher les bulletins
- Redirection vers la page Notes après l'enregistrement d'un controle
This commit is contained in:
parent
573d5753b2
commit
0664776352
6 changed files with 58 additions and 42 deletions
|
@ -15,6 +15,6 @@ class NotesAction extends YesWikiAction
|
|||
public function run()
|
||||
{
|
||||
$noteManager = $this->getService(NoteManager::class);
|
||||
$noteManager->viewBulletins();
|
||||
return $noteManager->viewBulletins();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,8 +53,6 @@ class ApiController extends YesWikiController
|
|||
$controle = new Controle($parameters['intitule'], $parameters['matiere'], $parameters['coef'], $eleves);
|
||||
|
||||
$eleveController->addNotes($controle->getNotes());
|
||||
|
||||
return new ApiResponse(['parameters' => $controle->getNotes()]);
|
||||
// return $this->wiki->redirect('?Notes', 200);
|
||||
return $this->wiki->redirect('?Notes', 200);
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ class Bulletin {
|
|||
}
|
||||
|
||||
public function getId() {
|
||||
return $this->eleve['bf_titre'];
|
||||
return $this->eleve['id_fiche'];
|
||||
}
|
||||
|
||||
public function getNom() {
|
||||
|
@ -37,11 +37,14 @@ class Bulletin {
|
|||
|
||||
public function getMoyenne() {
|
||||
$total = 0;
|
||||
$totalMatieres = 0;
|
||||
foreach ( $this->matieres as $matiere) {
|
||||
$total += $matiere->getMoyenne();
|
||||
if ($matiere->isVisible()) {
|
||||
$total += $matiere->getMoyenne();
|
||||
++$totalMatieres;
|
||||
}
|
||||
}
|
||||
|
||||
return $total / count($this->matieres);
|
||||
return $total / $totalMatieres;
|
||||
}
|
||||
|
||||
public function getMatieres() {
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace YesWiki\Meeo\Bulletin;
|
|||
include 'tools/meeo/libs/bulletin/Note.lib.php';
|
||||
|
||||
use YesWiki\Bazar\Service\EntryManager;
|
||||
use YesWiki\Meeo\Service\NoteManager;
|
||||
|
||||
class Matiere {
|
||||
private $id;
|
||||
|
@ -17,12 +18,10 @@ class Matiere {
|
|||
|
||||
$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";
|
||||
$noteManager = $wiki->services->get(NoteManager::class);
|
||||
$entries = $noteManager->getNotes($eleveId, $id);
|
||||
|
||||
// echo "<p>".var_dump($entries)."</p>";
|
||||
foreach ($entries as $entry) {
|
||||
$this->notes[] = new Note($entry['bf_intitule'], $entry['bf_note'], $entry['bf_coef']);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace YesWiki\Meeo\Service;
|
|||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use YesWiki\Bazar\Service\EntryManager;
|
||||
use YesWiki\Bazar\Service\ListManager;
|
||||
use YesWiki\Core\Service\UserManager;
|
||||
use YesWiki\Core\Controller\AuthController;
|
||||
use YesWiki\Wiki;
|
||||
use YesWiki\Meeo\Bulletin\Bulletin;
|
||||
use YesWiki\Meeo\Service\EleveManager;
|
||||
|
@ -15,50 +15,51 @@ class NoteManager {
|
|||
protected $params;
|
||||
protected $entryManager;
|
||||
protected $listManager;
|
||||
protected $userManager;
|
||||
protected $formId;
|
||||
protected $authController;
|
||||
|
||||
public function __construct( Wiki $wiki, ParameterBagInterface $params, EntryManager $entryManager, ListManager $listManager, UserManager $userManager)
|
||||
public function __construct( Wiki $wiki, ParameterBagInterface $params, EntryManager $entryManager, ListManager $listManager, AuthController $authController)
|
||||
{
|
||||
$this->wiki = $wiki;
|
||||
$this->params = $params;
|
||||
$this->entryManager = $entryManager;
|
||||
$this->listManager = $listManager;
|
||||
$this->userManager = $userManager;
|
||||
$this->authController = $authController;
|
||||
|
||||
$meeo_config = $this->params->get('meeo');
|
||||
$this->formId = $meeo_config['notesFormId'];
|
||||
}
|
||||
|
||||
public function viewBulletins() {
|
||||
// $eleveIdentifier = 'listefiche'.$meeo_config['elevesFormId'].'bf_eleve';
|
||||
// $groupeEE = $meeo_config['groupeEE'];
|
||||
|
||||
$eleveIdentifier = 'listefiche'.$meeo_config['elevesFormId'].'bf_eleve';
|
||||
$groupeEE = $meeo_config['groupeEE'];
|
||||
$username = $this->authController->getLoggedUserName();
|
||||
|
||||
if ( $this->userManager->isInGroup($groupeEE, admincheck: false) ) {
|
||||
$eleves = $this->entryManager->search(['formsIds' => $meeo_config['elevesFormId']]);
|
||||
$entries = $this->entryManager->search(['formsIds' => $this->formId]);
|
||||
$eleves = $this->wiki->services->get(EleveManager::class)->getAll();
|
||||
// $eleves = $ $this->entryManager->search(['formsIds' => $meeo_config['elevesFormId']]);
|
||||
$entries = $this->entryManager->search(['formsIds' => $this->formId]);
|
||||
include 'tools/meeo/libs/bulletin/Bulletin.lib.php';
|
||||
|
||||
include 'tools/meeo/libs/bulletin/Bulletin.lib.php';
|
||||
|
||||
$bulletins = [];
|
||||
foreach ( $eleves as $eleve) {
|
||||
//TODO enlever "Passerelle"
|
||||
$bulletins[] = new Bulletin($this->wiki, $eleve, "Passerelle");
|
||||
}
|
||||
// echo var_dump($eleves);
|
||||
// echo var_dump($entries);
|
||||
// echo var_dump($matieres);
|
||||
return $this->wiki->render('@meeo/edu_notes.twig', [
|
||||
"bulletins" => $bulletins,
|
||||
]);
|
||||
} else {
|
||||
$entries = $entryManager->search(['formsIds' => $this->formId]);
|
||||
|
||||
return $this->wiki->render('@meeo/eleve_notes.twig', [
|
||||
"bulletin" => $bulletin,
|
||||
]);
|
||||
$bulletins = [];
|
||||
foreach ( $eleves as $eleve) {
|
||||
//TODO enlever "Passerelle"
|
||||
$bulletins[] = new Bulletin($this->wiki, $eleve, "Passerelle");
|
||||
}
|
||||
// echo "<p>".var_dump($eleves)."</p>";
|
||||
// echo "<p>".var_dump($entries)."</p>";
|
||||
// echo "<p>".var_dump($bulletins)."</p>";
|
||||
|
||||
return $this->wiki->render('@meeo/edu_notes.twig', [
|
||||
"bulletins" => $bulletins,
|
||||
]);
|
||||
// } else {
|
||||
// $entries = $entryManager->search(['formsIds' => $this->formId]);
|
||||
|
||||
// return $this->wiki->render('@meeo/eleve_notes.twig', [
|
||||
// "bulletin" => $bulletin,
|
||||
// ]);
|
||||
// }
|
||||
}
|
||||
|
||||
public function viewControle() {
|
||||
|
@ -77,4 +78,17 @@ class NoteManager {
|
|||
$this->entryManager->create($this->formId, $note);
|
||||
}
|
||||
}
|
||||
|
||||
public function getNotes($eleveId, $matiereId) {
|
||||
// echo "<p>".$eleveId."</p>";
|
||||
// echo "<p>".$matiereId."</p>";
|
||||
$entries = $this->entryManager->search(['formsIds' => $this->formId,
|
||||
'queries' =>[
|
||||
'listefiche6bf_eleve' => $eleveId,
|
||||
'listeListeMatierebf_matiere' => $matiereId
|
||||
]
|
||||
]);
|
||||
// echo "<p>".var_dump($entries)."</p>";
|
||||
return $entries;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
<div id="accordion_{{ bulletin.getId() }}_matiere" class="panel-group">
|
||||
{% for matiere in bulletin.getMatieres() %}
|
||||
{% if matiere.isVisible() %}
|
||||
<div class="panel panel-primary">
|
||||
<button 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">
|
||||
<h4 class="panel-title">{{ matiere.getNom() }}</h4>
|
||||
|
@ -34,5 +35,6 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
Loading…
Reference in a new issue