ynh_extension_meeo/actions/NotesAction.php

51 lines
1.5 KiB
PHP
Raw Normal View History

2024-07-04 05:32:34 +00:00
<?php
namespace YesWiki\Meeo;
use YesWiki\Core\YesWikiAction;
2024-07-12 14:49:50 +00:00
use YesWiki\Bazar\Service\EntryManager;
use YesWiki\Core\Service\UserManager;
2024-07-04 05:32:34 +00:00
class NotesAction extends YesWikiAction
{
public function formatArguments($arg)
{
return [];
}
public function run()
{
2024-07-12 14:49:50 +00:00
$meeo_config = $this->params->get('meeo');
$formId = $meeo_config['notes']['formId'];
$eleveIdentifier = 'listefiche'.$meeo_config['elevesFormId'].'bf_eleve';
$groupeEE = $meeo_config['groupeEE'];
$entryManager = $this->getService(EntryManager::class);
$userManager = $this->getService(UserManager::class);
if ( $userManager->isInGroup($groupeEE, admincheck: false) ) {
$eleves = $entryManager->search(['formsIds' => $meeo_config['elevesFormId']]);
$entries = $entryManager->search(['formsIds' => $formId]);
2024-07-13 18:39:43 +00:00
include 'tools/meeo/libs/Bulletin.lib.php';
$bulletins = [];
foreach ( $eleves as $eleve) {
$bulletins[] = new Bulletin($this->wiki, $eleve, "Passerelle");
}
2024-07-12 14:49:50 +00:00
// echo var_dump($eleves);
// echo var_dump($entries);
2024-07-12 14:49:50 +00:00
// echo var_dump($matieres);
return $this->render('@meeo/edu_notes.twig', [
2024-07-13 18:39:43 +00:00
"bulletins" => $bulletins,
2024-07-12 14:49:50 +00:00
]);
} else {
$entries = $entryManager->search(['formsIds' => $formId]);
2024-07-13 18:39:43 +00:00
2024-07-15 18:20:30 +00:00
return $this->render('@meeo/eleve_notes.twig', [
2024-07-13 18:39:43 +00:00
"bulletin" => $bulletin,
]);
2024-07-12 14:49:50 +00:00
}
2024-07-04 05:32:34 +00:00
}
}