fix Absence
This commit is contained in:
parent
100c1761db
commit
753f8d6483
3 changed files with 21 additions and 10 deletions
|
@ -3,6 +3,7 @@
|
||||||
use YesWiki\Core\YesWikiAction;
|
use YesWiki\Core\YesWikiAction;
|
||||||
use YesWiki\Bazar\Service\EntryManager;
|
use YesWiki\Bazar\Service\EntryManager;
|
||||||
use YesWiki\Core\Service\UserManager;
|
use YesWiki\Core\Service\UserManager;
|
||||||
|
use YesWiki\Meeo\Service\EleveManager;
|
||||||
|
|
||||||
class AbsencesAction extends YesWikiAction
|
class AbsencesAction extends YesWikiAction
|
||||||
{
|
{
|
||||||
|
@ -20,16 +21,19 @@ class AbsencesAction extends YesWikiAction
|
||||||
|
|
||||||
$entryManager = $this->getService(EntryManager::class);
|
$entryManager = $this->getService(EntryManager::class);
|
||||||
$userManager = $this->getService(UserManager::class);
|
$userManager = $this->getService(UserManager::class);
|
||||||
|
$elevemanager = $this->getService(EleveManager::class);
|
||||||
|
|
||||||
if ( $userManager->isInGroup($groupeEE, admincheck: false) ) {
|
if ( $userManager->isInGroup($groupeEE, admincheck: false) ) {
|
||||||
$entries = $entryManager->search(['formsIds' => $formId]);
|
$entries = $entryManager->search(['formsIds' => $formId]);
|
||||||
$grouped_entries = [];
|
$grouped_entries = [];
|
||||||
|
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
|
// echo "<p>".var_dump($entry)."</p>";
|
||||||
$identifier = $entry[$eleveIdentifier];
|
$identifier = $entry[$eleveIdentifier];
|
||||||
$eleve = $entryManager->getOne($identifier);
|
//echo "<p>".var_dump($identifier)."</p>";
|
||||||
echo "<p>".var_dump($eleve)."</p>";
|
$eleve = $elevemanager->getEleve($identifier);
|
||||||
$nom = $eleve['bf_nom'];
|
// echo "<p>".var_dump($eleve)."</p>";
|
||||||
|
$nom = $eleve->getNom();
|
||||||
if (!isset($grouped_entries[$identifier])) {
|
if (!isset($grouped_entries[$identifier])) {
|
||||||
$grouped_entries[$identifier] = [
|
$grouped_entries[$identifier] = [
|
||||||
'nom' => $nom,
|
'nom' => $nom,
|
||||||
|
@ -44,7 +48,15 @@ class AbsencesAction extends YesWikiAction
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$username = $userManager->getLoggedUsername();
|
$username = $userManager->getLoggedUsername();
|
||||||
$entries = $entryManager->search(['formsIds' => $formId, 'queries' => [ $eleveIdentifier => $username."2"]]);
|
$eleves = $elevemanager->getAll();
|
||||||
|
foreach ($eleves as $eleve) {
|
||||||
|
if ($eleve->getNom() == $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', [
|
return $this->render('@meeo/eleve_absences.twig', [
|
||||||
"entries" => $entries,
|
"entries" => $entries,
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
parameters:
|
parameters:
|
||||||
meeo:
|
meeo:
|
||||||
elevesFormId: 6
|
elevesFormId: 7
|
||||||
absencesFormId: 7
|
absencesFormId: 8
|
||||||
notesFormId: 8
|
notesFormId: 9
|
||||||
yunohostFormId: 5
|
yunohostFormId: 6
|
||||||
groupeEE: 'equipeeducative'
|
groupeEE: 'equipeeducative'
|
||||||
redirect:
|
redirect:
|
||||||
eleveUpdate: '?Eleves'
|
eleveUpdate: '?Eleves'
|
||||||
|
|
|
@ -11,8 +11,7 @@ class Eleve {
|
||||||
public function __construct(EntryManager $entryManager, $yunoshostFormId, $data) {
|
public function __construct(EntryManager $entryManager, $yunoshostFormId, $data) {
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
// echo "<p>".var_dump($data)."</p>";
|
// echo "<p>".var_dump($data)."</p>";
|
||||||
$userId = $data['listefiche'.$yunoshostFormId.'Listebf_nom'];
|
$userId = $data['listefiche'.$yunoshostFormId.'bf_nom'];
|
||||||
|
|
||||||
$this->user = $entryManager->getOne($userId);
|
$this->user = $entryManager->getOne($userId);
|
||||||
// echo "<p>".var_dump($this)."</p>";
|
// echo "<p>".var_dump($this)."</p>";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue