try to fix EleveAction

This commit is contained in:
mckmonster 2024-08-02 19:00:18 +02:00
parent 775b24f184
commit 000d5ce133
2 changed files with 6 additions and 9 deletions

View file

@ -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 "<p>".var_dump($data)."</p>";
//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 "<p>".var_dump($this)."</p>";

View file

@ -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 "<p>".var_dump($eleve)."</p>";
$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) {