0664776352
- Redirection vers la page Notes après l'enregistrement d'un controle
94 lines
No EOL
3.1 KiB
PHP
94 lines
No EOL
3.1 KiB
PHP
<?php
|
|
|
|
namespace YesWiki\Meeo\Service;
|
|
|
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|
use YesWiki\Bazar\Service\EntryManager;
|
|
use YesWiki\Bazar\Service\ListManager;
|
|
use YesWiki\Core\Controller\AuthController;
|
|
use YesWiki\Wiki;
|
|
use YesWiki\Meeo\Bulletin\Bulletin;
|
|
use YesWiki\Meeo\Service\EleveManager;
|
|
|
|
class NoteManager {
|
|
protected $wiki;
|
|
protected $params;
|
|
protected $entryManager;
|
|
protected $listManager;
|
|
protected $formId;
|
|
protected $authController;
|
|
|
|
public function __construct( Wiki $wiki, ParameterBagInterface $params, EntryManager $entryManager, ListManager $listManager, AuthController $authController)
|
|
{
|
|
$this->wiki = $wiki;
|
|
$this->params = $params;
|
|
$this->entryManager = $entryManager;
|
|
$this->listManager = $listManager;
|
|
$this->authController = $authController;
|
|
|
|
$meeo_config = $this->params->get('meeo');
|
|
$this->formId = $meeo_config['notesFormId'];
|
|
}
|
|
|
|
public function viewBulletins() {
|
|
// $eleveIdentifier = 'listefiche'.$meeo_config['elevesFormId'].'bf_eleve';
|
|
// $groupeEE = $meeo_config['groupeEE'];
|
|
|
|
$username = $this->authController->getLoggedUserName();
|
|
|
|
$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';
|
|
|
|
$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>";
|
|
|
|
return $this->wiki->render('@meeo/edu_notes.twig', [
|
|
"bulletins" => $bulletins,
|
|
]);
|
|
// } else {
|
|
// $entries = $entryManager->search(['formsIds' => $this->formId]);
|
|
|
|
// return $this->wiki->render('@meeo/eleve_notes.twig', [
|
|
// "bulletin" => $bulletin,
|
|
// ]);
|
|
// }
|
|
}
|
|
|
|
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]);
|
|
}
|
|
|
|
public function addNotes($notes) {
|
|
foreach ($notes as $note) {
|
|
$note['antispam'] = true;
|
|
$this->entryManager->create($this->formId, $note);
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
} |