try a fix to get parents link

This commit is contained in:
mckmonster 2024-09-06 11:54:14 +02:00
parent 7927889bab
commit 5fde53b4c5
3 changed files with 16 additions and 7 deletions

View file

@ -4,6 +4,7 @@ parameters:
absencesFormId: 8
notesFormId: 9
yunohostFormId: 6
parentsFormId: 10
groupeEE: 'equipeeducative'
redirect:
eleveUpdate: '?Eleves'

View file

@ -12,14 +12,21 @@ class Eleve {
private $user;
private $parents;
public function __construct(EntryManager $entryManager, $yunoshostFormId, $data) {
public function __construct(EntryManager $entryManager, $meeo_config, $data) {
$this->data = $data;
// echo "<p>".var_dump($data)."</p>";
$yunoshostFormId = $meeo_config['yunohostFormId'];
$parentsFormId = $meeo_config['parentsFormId'];
$elevesFormId = $meeo_config['elevesFormId'];
// echo "<p>Config : ".var_dump($meeo_config)."</p>";
$userId = $data['listefiche'.$yunoshostFormId.'bf_nom'];
$this->user = $entryManager->getOne($userId);
// echo "<p>".var_dump($userId)."</p>";
$this->parents = [];
foreach ($entryManager->search(['formsIds' => 10, 'queries' => ['listefiche7bf_eleve' => $userId]]) as $parent) {
$parents = $entryManager->search(['formsIds' => $parentsFormId, 'queries' => ['listefiche'.$elevesFormId.'bf_eleve' => $userId.'2']]);
// $parents = $entryManager->search(['formsIds' => $parentsFormId]);
// echo "<p>Parents : ".var_dump($parents)."</p>";
foreach ( $parents as $parent) {
array_push($this->parents, new ParentEleve($entryManager, $yunoshostFormId, $parent));
}
// echo "<p>".var_dump($this)."</p>";

View file

@ -17,13 +17,14 @@ class EleveManager {
private $entryManager;
private $listManager;
private $wiki;
private $meeo_config;
public function __construct( Wiki $wiki, ParameterBagInterface $params, EntryManager $entryManager, ListManager $listManager)
{
$meeo_config = $params->get('meeo');
$this->meeo_config = $params->get('meeo');
$this->wiki = $wiki;
$this->formId = $meeo_config['elevesFormId'];
$this->yunoshostFormId = $meeo_config['yunohostFormId'];
$this->formId = $this->meeo_config['elevesFormId'];
$this->yunoshostFormId = $this->meeo_config['yunohostFormId'];
$this->entryManager = $entryManager;
$this->listManager = $listManager;
}
@ -44,7 +45,7 @@ class EleveManager {
$eleves = [];
foreach ($this->entryManager->search(['formsIds' => $this->formId]) as $data)
{
$eleve = new Eleve($this->entryManager, $this->yunoshostFormId, $data);
$eleve = new Eleve($this->entryManager, $this->meeo_config, $data);
// echo "<p>".var_dump($eleve)."</p>";
$eleves[] = $eleve;
}
@ -52,7 +53,7 @@ class EleveManager {
}
public function getEleve(string $id) {
return new Eleve($this->entryManager, $this->yunoshostFormId, $this->entryManager->getOne($id));
return new Eleve($this->entryManager, $this->meeo_config, $this->entryManager->getOne($id));
}
public function getCurrentEleve(string $username) {