Add NoteManager
This commit is contained in:
parent
1ebeee196e
commit
ebf108e354
2 changed files with 61 additions and 33 deletions
|
@ -3,8 +3,7 @@
|
|||
namespace YesWiki\Meeo;
|
||||
|
||||
use YesWiki\Core\YesWikiAction;
|
||||
use YesWiki\Bazar\Service\EntryManager;
|
||||
use YesWiki\Core\Service\UserManager;
|
||||
use YesWiki\Meeo\Service\NoteManager;
|
||||
|
||||
class NotesAction extends YesWikiAction
|
||||
{
|
||||
|
@ -15,36 +14,7 @@ class NotesAction extends YesWikiAction
|
|||
|
||||
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,
|
||||
]);
|
||||
}
|
||||
$noteManager = $this->getService(NoteManager::class);
|
||||
$noteManager->viewBulletins();
|
||||
}
|
||||
}
|
||||
|
|
58
services/NoteManager.php
Normal file
58
services/NoteManager.php
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?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;
|
||||
use YesWiki\Meeo\Bulletin;
|
||||
|
||||
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]);
|
||||
|
||||
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->wiki->render('@meeo/edu_notes.twig', [
|
||||
"bulletins" => $bulletins,
|
||||
]);
|
||||
} else {
|
||||
$entries = $entryManager->search(['formsIds' => $formId]);
|
||||
|
||||
return $this->wiki->render('@meeo/eleve_notes.twig', [
|
||||
"bulletin" => $bulletin,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue