diff --git a/libs/eleves/eleve.lib.php b/libs/eleves/eleve.lib.php index e11471d..6ca6c1d 100644 --- a/libs/eleves/eleve.lib.php +++ b/libs/eleves/eleve.lib.php @@ -8,15 +8,10 @@ class Eleve { private $data; private $user; - public function __construct(EntryManager $entryManager, $data) { + public function __construct(EntryManager $entryManager, $yunoshostFormId, $data) { $this->data = $data; // echo "

".var_dump($data)."

"; - //TODO récupérer le bon numéro de liste - - if (empty($data['listefiche5Listebf_nom'])) - $userId = $data['listefichebf_nom']; - else - $userId = $data['listefiche5Listebf_nom']; + $userId = $data['listefiche'.$yunoshostFormId.'Listebf_nom']; $this->user = $entryManager->getOne($userId); // echo "

".var_dump($this)."

"; diff --git a/services/EleveManager.php b/services/EleveManager.php index 8bcbaf8..6bbdee1 100644 --- a/services/EleveManager.php +++ b/services/EleveManager.php @@ -13,6 +13,7 @@ use YesWiki\Meeo\Eleve\Eleve; class EleveManager { private $formId; + private $yunoshostFormId; private $entryManager; private $listManager; private $wiki; @@ -22,6 +23,7 @@ class EleveManager { $meeo_config = $params->get('meeo'); $this->wiki = $wiki; $this->formId = $meeo_config['elevesFormId']; + $this->yunoshostFormId = $meeo_config['yunohostFormId']; $this->entryManager = $entryManager; $this->listManager = $listManager; } @@ -43,7 +45,7 @@ class EleveManager { foreach ($this->entryManager->search(['formsIds' => $this->formId]) as $data) { - $eleve = new Eleve($this->entryManager, $data); + $eleve = new Eleve($this->entryManager, $this->yunoshostFormId, $data); // echo "

".var_dump($eleve)."

"; $eleves[] = $eleve; } @@ -51,7 +53,7 @@ class EleveManager { } public function getEleve(string $id) { - return new Eleve($this->entryManager, $this->entryManager->getOne($id)); + return new Eleve($this->entryManager, $this->yunoshostFormId, $this->entryManager->getOne($id)); } public function getCurrentEleve(string $username) {