2024-07-19 14:52:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
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\Wiki;
|
2024-07-20 07:15:55 +00:00
|
|
|
use YesWiki\Meeo\Bulletin\Bulletin;
|
2024-07-19 14:52:37 +00:00
|
|
|
|
|
|
|
class NoteManager {
|
|
|
|
protected $wiki;
|
|
|
|
protected $params;
|
|
|
|
protected $entryManager;
|
|
|
|
protected $listManager;
|
|
|
|
protected $userManager;
|
|
|
|
|
|
|
|
public function __construct( Wiki $wiki, ParameterBagInterface $params, EntryManager $entryManager, ListManager $listManager, UserManager $userManager)
|
|
|
|
{
|
|
|
|
$this->wiki = $wiki;
|
|
|
|
$this->params = $params;
|
|
|
|
$this->entryManager = $entryManager;
|
|
|
|
$this->listManager = $listManager;
|
|
|
|
$this->userManager = $userManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function viewBulletins() {
|
|
|
|
$meeo_config = $this->params->get('meeo');
|
|
|
|
$formId = $meeo_config['notesFormId'];
|
|
|
|
$eleveIdentifier = 'listefiche'.$meeo_config['elevesFormId'].'bf_eleve';
|
|
|
|
$groupeEE = $meeo_config['groupeEE'];
|
|
|
|
|
|
|
|
if ( $this->userManager->isInGroup($groupeEE, admincheck: false) ) {
|
|
|
|
$eleves = $this->entryManager->search(['formsIds' => $meeo_config['elevesFormId']]);
|
|
|
|
$entries = $this->entryManager->search(['formsIds' => $formId]);
|
|
|
|
|
2024-07-20 07:15:55 +00:00
|
|
|
include 'tools/meeo/libs/bulletin/Bulletin.lib.php';
|
2024-07-19 14:52:37 +00:00
|
|
|
|
|
|
|
$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->wiki->render('@meeo/edu_notes.twig', [
|
|
|
|
"bulletins" => $bulletins,
|
|
|
|
]);
|
|
|
|
} else {
|
|
|
|
$entries = $entryManager->search(['formsIds' => $formId]);
|
|
|
|
|
|
|
|
return $this->wiki->render('@meeo/eleve_notes.twig', [
|
|
|
|
"bulletin" => $bulletin,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
2024-07-20 07:15:55 +00:00
|
|
|
|
|
|
|
public function viewCreateNotes() {
|
|
|
|
return $this->wiki->render('@meeo/edu_create_notes.twig', []);
|
|
|
|
}
|
2024-07-19 14:52:37 +00:00
|
|
|
}
|