Add access to absence for parent
This commit is contained in:
parent
e1078eb5ab
commit
3dc1aed82d
3 changed files with 28 additions and 7 deletions
|
@ -50,17 +50,22 @@ class AbsencesAction extends YesWikiAction
|
|||
$username = $userManager->getLoggedUsername();
|
||||
$eleves = $elevemanager->getAll();
|
||||
foreach ($eleves as $eleve) {
|
||||
if ($eleve->getNom() == $username) {
|
||||
if ($eleve->getNom() == $username || $eleve->isParent($username)) {
|
||||
$selectedEleve = $eleve;
|
||||
}
|
||||
}
|
||||
$identifier = $selectedEleve->getId();
|
||||
// echo "<p>".var_dump($selectedEleve)."</p>";
|
||||
$entries = $entryManager->search(['formsIds' => $formId, 'queries' => [ $eleveIdentifier => $identifier]]);
|
||||
|
||||
return $this->render('@meeo/eleve_absences.twig', [
|
||||
"entries" => $entries,
|
||||
]);
|
||||
if ($selectedEleve != null) {
|
||||
$identifier = $selectedEleve->getId();
|
||||
// echo "<p>".var_dump($selectedEleve)."</p>";
|
||||
$entries = $entryManager->search(['formsIds' => $formId, 'queries' => [ $eleveIdentifier => $identifier]]);
|
||||
|
||||
return $this->render('@meeo/eleve_absences.twig', [
|
||||
"entries" => $entries,
|
||||
]);
|
||||
}
|
||||
|
||||
return "Utilisateur non connus : ". $username;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,4 +67,12 @@ class Eleve {
|
|||
public function getData() {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function isParent($username) {
|
||||
foreach ($this->parents as $parent) {
|
||||
if ($parent->getNom() == $username) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,6 +17,14 @@ class ParentEleve {
|
|||
// echo "<p>".var_dump($this)."</p>";
|
||||
}
|
||||
|
||||
public function getNom() {
|
||||
if (empty($this->user['bf_nom'])) {
|
||||
return $this->user['bf_titre'];
|
||||
} else {
|
||||
return $this->user['bf_nom'];
|
||||
}
|
||||
}
|
||||
|
||||
public function getEmail() {
|
||||
return $this->user['bf_mail'];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue