Compare commits
No commits in common. "e2a83cd841d72f07de726d437ce488ab01639b9e" and "1c1196955460bf085e18f63dbd077c3efb46b20b" have entirely different histories.
e2a83cd841
...
1c11969554
4 changed files with 14 additions and 31 deletions
|
@ -4,7 +4,7 @@ parameters:
|
||||||
absencesFormId: 7
|
absencesFormId: 7
|
||||||
notesFormId: 8
|
notesFormId: 8
|
||||||
yunohostFormId: 5
|
yunohostFormId: 5
|
||||||
groupeEE: 'equipeeducative'
|
groupeEE: 'EquipeEducative'
|
||||||
redirect:
|
redirect:
|
||||||
eleveUpdate: '?Eleves'
|
eleveUpdate: '?Eleves'
|
||||||
controle: '?Bulletin'
|
controle: '?Bulletin'
|
||||||
|
|
|
@ -21,10 +21,6 @@ class Eleve {
|
||||||
return $this->data['id_fiche'];
|
return $this->data['id_fiche'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserId() {
|
|
||||||
return $this->user['bf_titre'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getNom() {
|
public function getNom() {
|
||||||
if (empty($this->user['bf_nom'])) {
|
if (empty($this->user['bf_nom'])) {
|
||||||
return $this->user['bf_titre'];
|
return $this->user['bf_titre'];
|
||||||
|
|
|
@ -44,6 +44,7 @@ class EleveManager {
|
||||||
$eleves = [];
|
$eleves = [];
|
||||||
foreach ($this->entryManager->search(['formsIds' => $this->formId]) as $data)
|
foreach ($this->entryManager->search(['formsIds' => $this->formId]) as $data)
|
||||||
{
|
{
|
||||||
|
|
||||||
$eleve = new Eleve($this->entryManager, $this->yunoshostFormId, $data);
|
$eleve = new Eleve($this->entryManager, $this->yunoshostFormId, $data);
|
||||||
// echo "<p>".var_dump($eleve)."</p>";
|
// echo "<p>".var_dump($eleve)."</p>";
|
||||||
$eleves[] = $eleve;
|
$eleves[] = $eleve;
|
||||||
|
@ -56,12 +57,7 @@ class EleveManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCurrentEleve(string $username) {
|
public function getCurrentEleve(string $username) {
|
||||||
$all = $this->getAll();
|
return $this->entryManager->getOne(str_replace(".","", $username));
|
||||||
foreach ($all as $eleve) {
|
|
||||||
echo "<p>".var_dump($eleve)."</p>";
|
|
||||||
if ($eleve->getUserId() == $username)
|
|
||||||
return $eleve;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function view() {
|
public function view() {
|
||||||
|
|
|
@ -5,7 +5,6 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use YesWiki\Bazar\Service\EntryManager;
|
use YesWiki\Bazar\Service\EntryManager;
|
||||||
use YesWiki\Bazar\Service\ListManager;
|
use YesWiki\Bazar\Service\ListManager;
|
||||||
use YesWiki\Core\Controller\AuthController;
|
use YesWiki\Core\Controller\AuthController;
|
||||||
use YesWiki\Core\Service\UserManager;
|
|
||||||
use YesWiki\Wiki;
|
use YesWiki\Wiki;
|
||||||
use YesWiki\Meeo\Bulletin\Bulletin;
|
use YesWiki\Meeo\Bulletin\Bulletin;
|
||||||
use YesWiki\Meeo\Service\EleveManager;
|
use YesWiki\Meeo\Service\EleveManager;
|
||||||
|
@ -17,35 +16,31 @@ class NoteManager {
|
||||||
protected $listManager;
|
protected $listManager;
|
||||||
protected $formId;
|
protected $formId;
|
||||||
protected $eleveFormId;
|
protected $eleveFormId;
|
||||||
protected $eeGroup;
|
|
||||||
protected $authController;
|
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->wiki = $wiki;
|
||||||
$this->params = $params;
|
$this->params = $params;
|
||||||
$this->entryManager = $entryManager;
|
$this->entryManager = $entryManager;
|
||||||
$this->listManager = $listManager;
|
$this->listManager = $listManager;
|
||||||
$this->authController = $authController;
|
$this->authController = $authController;
|
||||||
$this->userManager = $userManager;
|
|
||||||
|
|
||||||
$meeo_config = $this->params->get('meeo');
|
$meeo_config = $this->params->get('meeo');
|
||||||
$this->formId = $meeo_config['notesFormId'];
|
$this->formId = $meeo_config['notesFormId'];
|
||||||
$this->eleveFormId = $meeo_config['elevesFormId'];
|
$this->eleveFormId = $meeo_config['elevesFormId'];
|
||||||
$this->eeGroup = $meeo_config['groupeEE'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewBulletins() {
|
public function viewBulletins() {
|
||||||
$eleveManager = $this->wiki->services->get(EleveManager::class);
|
$eleveManager = $this->wiki->services->get(EleveManager::class);
|
||||||
|
$username = $this->authController->getLoggedUserName();
|
||||||
// echo "<p>".$username."</p>";
|
// echo "<p>".$username."</p>";
|
||||||
|
|
||||||
include 'tools/meeo/libs/bulletin/Bulletin.lib.php';
|
include 'tools/meeo/libs/bulletin/Bulletin.lib.php';
|
||||||
|
|
||||||
$loggedUser = $this->authController->getLoggedUser();
|
$currentEleve = $eleveManager->getCurrentEleve($username);
|
||||||
echo "<p>".var_dump($loggedUser)."</p>";
|
// echo "<p>".var_dump($currentEleve)."</p>";
|
||||||
if ($this->userManager->isInGroup($this->eeGroup, $loggedUser['name'], false)) {
|
// if ($currentEleve == null) {
|
||||||
$eleves = $eleveManager->getAll();
|
$eleves = $eleveManager->getAll();
|
||||||
|
|
||||||
$bulletins = [];
|
$bulletins = [];
|
||||||
|
@ -58,16 +53,12 @@ class NoteManager {
|
||||||
return $this->wiki->render('@meeo/edu_notes.twig', [
|
return $this->wiki->render('@meeo/edu_notes.twig', [
|
||||||
"bulletins" => $bulletins,
|
"bulletins" => $bulletins,
|
||||||
]);
|
]);
|
||||||
} else {
|
// } else {
|
||||||
echo "Eleve";
|
// $bulletin = new Bulletin($this->wiki, $currentEleve);
|
||||||
$currentEleve = $eleveManager->getCurrentEleve($loggedUser['name']);
|
// return $this->wiki->render('@meeo/eleve_notes.twig', [
|
||||||
if ($currentEleve != null) {
|
// "bulletin" => $bulletin,
|
||||||
$bulletin = new Bulletin($this->wiki, $currentEleve);
|
// ]);
|
||||||
return $this->wiki->render('@meeo/eleve_notes.twig', [
|
// }
|
||||||
"bulletin" => $bulletin,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewControle() {
|
public function viewControle() {
|
||||||
|
|
Loading…
Reference in a new issue