Compare commits

..

No commits in common. "e2a83cd841d72f07de726d437ce488ab01639b9e" and "1c1196955460bf085e18f63dbd077c3efb46b20b" have entirely different histories.

4 changed files with 14 additions and 31 deletions

View file

@ -4,7 +4,7 @@ parameters:
absencesFormId: 7
notesFormId: 8
yunohostFormId: 5
groupeEE: 'equipeeducative'
groupeEE: 'EquipeEducative'
redirect:
eleveUpdate: '?Eleves'
controle: '?Bulletin'

View file

@ -21,10 +21,6 @@ class Eleve {
return $this->data['id_fiche'];
}
public function getUserId() {
return $this->user['bf_titre'];
}
public function getNom() {
if (empty($this->user['bf_nom'])) {
return $this->user['bf_titre'];

View file

@ -44,6 +44,7 @@ class EleveManager {
$eleves = [];
foreach ($this->entryManager->search(['formsIds' => $this->formId]) as $data)
{
$eleve = new Eleve($this->entryManager, $this->yunoshostFormId, $data);
// echo "<p>".var_dump($eleve)."</p>";
$eleves[] = $eleve;
@ -56,12 +57,7 @@ class EleveManager {
}
public function getCurrentEleve(string $username) {
$all = $this->getAll();
foreach ($all as $eleve) {
echo "<p>".var_dump($eleve)."</p>";
if ($eleve->getUserId() == $username)
return $eleve;
}
return $this->entryManager->getOne(str_replace(".","", $username));
}
public function view() {

View file

@ -5,7 +5,6 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use YesWiki\Bazar\Service\EntryManager;
use YesWiki\Bazar\Service\ListManager;
use YesWiki\Core\Controller\AuthController;
use YesWiki\Core\Service\UserManager;
use YesWiki\Wiki;
use YesWiki\Meeo\Bulletin\Bulletin;
use YesWiki\Meeo\Service\EleveManager;
@ -17,35 +16,31 @@ class NoteManager {
protected $listManager;
protected $formId;
protected $eleveFormId;
protected $eeGroup;
protected $authController;
protected $userManager;
public function __construct( Wiki $wiki, ParameterBagInterface $params, EntryManager $entryManager, ListManager $listManager, AuthController $authController, UserManager $userManager)
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;
$this->userManager = $userManager;
$meeo_config = $this->params->get('meeo');
$this->formId = $meeo_config['notesFormId'];
$this->eleveFormId = $meeo_config['elevesFormId'];
$this->eeGroup = $meeo_config['groupeEE'];
}
public function viewBulletins() {
$eleveManager = $this->wiki->services->get(EleveManager::class);
$username = $this->authController->getLoggedUserName();
// echo "<p>".$username."</p>";
include 'tools/meeo/libs/bulletin/Bulletin.lib.php';
$loggedUser = $this->authController->getLoggedUser();
echo "<p>".var_dump($loggedUser)."</p>";
if ($this->userManager->isInGroup($this->eeGroup, $loggedUser['name'], false)) {
$currentEleve = $eleveManager->getCurrentEleve($username);
// echo "<p>".var_dump($currentEleve)."</p>";
// if ($currentEleve == null) {
$eleves = $eleveManager->getAll();
$bulletins = [];
@ -58,16 +53,12 @@ class NoteManager {
return $this->wiki->render('@meeo/edu_notes.twig', [
"bulletins" => $bulletins,
]);
} else {
echo "Eleve";
$currentEleve = $eleveManager->getCurrentEleve($loggedUser['name']);
if ($currentEleve != null) {
$bulletin = new Bulletin($this->wiki, $currentEleve);
return $this->wiki->render('@meeo/eleve_notes.twig', [
"bulletin" => $bulletin,
]);
}
}
// } else {
// $bulletin = new Bulletin($this->wiki, $currentEleve);
// return $this->wiki->render('@meeo/eleve_notes.twig', [
// "bulletin" => $bulletin,
// ]);
// }
}
public function viewControle() {