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;
|
2024-07-21 09:17:17 +00:00
|
|
|
use YesWiki\Core\Controller\AuthController;
|
2024-07-19 14:52:37 +00:00
|
|
|
use YesWiki\Wiki;
|
2024-07-20 07:15:55 +00:00
|
|
|
use YesWiki\Meeo\Bulletin\Bulletin;
|
2024-07-20 08:13:50 +00:00
|
|
|
use YesWiki\Meeo\Service\EleveManager;
|
2024-07-19 14:52:37 +00:00
|
|
|
|
|
|
|
class NoteManager {
|
|
|
|
protected $wiki;
|
|
|
|
protected $params;
|
|
|
|
protected $entryManager;
|
|
|
|
protected $listManager;
|
2024-07-20 18:58:35 +00:00
|
|
|
protected $formId;
|
2024-07-21 09:17:17 +00:00
|
|
|
protected $authController;
|
2024-07-19 14:52:37 +00:00
|
|
|
|
2024-07-21 09:17:17 +00:00
|
|
|
public function __construct( Wiki $wiki, ParameterBagInterface $params, EntryManager $entryManager, ListManager $listManager, AuthController $authController)
|
2024-07-19 14:52:37 +00:00
|
|
|
{
|
|
|
|
$this->wiki = $wiki;
|
|
|
|
$this->params = $params;
|
|
|
|
$this->entryManager = $entryManager;
|
|
|
|
$this->listManager = $listManager;
|
2024-07-21 09:17:17 +00:00
|
|
|
$this->authController = $authController;
|
2024-07-20 18:58:35 +00:00
|
|
|
|
|
|
|
$meeo_config = $this->params->get('meeo');
|
|
|
|
$this->formId = $meeo_config['notesFormId'];
|
2024-07-19 14:52:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function viewBulletins() {
|
2024-07-21 09:17:17 +00:00
|
|
|
// $eleveIdentifier = 'listefiche'.$meeo_config['elevesFormId'].'bf_eleve';
|
|
|
|
// $groupeEE = $meeo_config['groupeEE'];
|
2024-07-20 18:58:35 +00:00
|
|
|
|
2024-07-21 09:17:17 +00:00
|
|
|
$username = $this->authController->getLoggedUserName();
|
2024-07-19 14:52:37 +00:00
|
|
|
|
2024-07-21 09:17:17 +00:00
|
|
|
$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';
|
2024-07-19 14:52:37 +00:00
|
|
|
|
2024-07-21 09:17:17 +00:00
|
|
|
$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>";
|
2024-07-19 14:52:37 +00:00
|
|
|
|
2024-07-21 09:17:17 +00:00
|
|
|
return $this->wiki->render('@meeo/edu_notes.twig', [
|
|
|
|
"bulletins" => $bulletins,
|
|
|
|
]);
|
|
|
|
// } else {
|
|
|
|
// $entries = $entryManager->search(['formsIds' => $this->formId]);
|
2024-07-19 14:52:37 +00:00
|
|
|
|
2024-07-21 09:17:17 +00:00
|
|
|
// return $this->wiki->render('@meeo/eleve_notes.twig', [
|
|
|
|
// "bulletin" => $bulletin,
|
|
|
|
// ]);
|
|
|
|
// }
|
2024-07-19 14:52:37 +00:00
|
|
|
}
|
2024-07-20 07:15:55 +00:00
|
|
|
|
2024-07-20 08:13:50 +00:00
|
|
|
public function viewControle() {
|
|
|
|
$eleves = $this->wiki->services->get(EleveManager::class)->getAll();
|
|
|
|
// echo var_dump($eleves);
|
|
|
|
$matieres = $this->listManager->getOne('ListeMatiere');
|
|
|
|
// echo var_dump($matieres);
|
|
|
|
$classes = $this->listManager->getOne('ListeClasses');
|
|
|
|
// echo var_dump($classes);
|
|
|
|
return $this->wiki->render('@meeo/edu_controle.twig', ['matieres' => $matieres['label'], 'classes' => $classes['label'], 'eleves' => $eleves]);
|
2024-07-20 07:15:55 +00:00
|
|
|
}
|
2024-07-20 18:58:35 +00:00
|
|
|
|
|
|
|
public function addNotes($notes) {
|
|
|
|
foreach ($notes as $note) {
|
|
|
|
$note['antispam'] = true;
|
|
|
|
$this->entryManager->create($this->formId, $note);
|
|
|
|
}
|
|
|
|
}
|
2024-07-21 09:17:17 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2024-07-19 14:52:37 +00:00
|
|
|
}
|