ynh_extension_meeo/actions/NotesAction.php
2024-07-17 10:52:17 +02:00

50 lines
1.5 KiB
PHP

<?php
namespace YesWiki\Meeo;
use YesWiki\Core\YesWikiAction;
use YesWiki\Bazar\Service\EntryManager;
use YesWiki\Core\Service\UserManager;
class NotesAction extends YesWikiAction
{
public function formatArguments($arg)
{
return [];
}
public function run()
{
$meeo_config = $this->params->get('meeo');
$formId = $meeo_config['notesFormId'];
$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]);
include 'tools/meeo/libs/Bulletin.lib.php';
$bulletins = [];
foreach ( $eleves as $eleve) {
$bulletins[] = new Bulletin($this->wiki, $eleve, "Passerelle");
}
// echo var_dump($eleves);
// echo var_dump($entries);
// echo var_dump($matieres);
return $this->render('@meeo/edu_notes.twig', [
"bulletins" => $bulletins,
]);
} else {
$entries = $entryManager->search(['formsIds' => $formId]);
return $this->render('@meeo/eleve_notes.twig', [
"bulletin" => $bulletin,
]);
}
}
}