Compare commits
No commits in common. "3dc1aed82df6348f9e87f2427f2e56ca18c43259" and "7ea50c721d50a3afb3ab9860d4f57755da70b477" have entirely different histories.
3dc1aed82d
...
7ea50c721d
4 changed files with 8 additions and 69 deletions
|
@ -50,12 +50,10 @@ class AbsencesAction extends YesWikiAction
|
||||||
$username = $userManager->getLoggedUsername();
|
$username = $userManager->getLoggedUsername();
|
||||||
$eleves = $elevemanager->getAll();
|
$eleves = $elevemanager->getAll();
|
||||||
foreach ($eleves as $eleve) {
|
foreach ($eleves as $eleve) {
|
||||||
if ($eleve->getNom() == $username || $eleve->isParent($username)) {
|
if ($eleve->getNom() == $username) {
|
||||||
$selectedEleve = $eleve;
|
$selectedEleve = $eleve;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($selectedEleve != null) {
|
|
||||||
$identifier = $selectedEleve->getId();
|
$identifier = $selectedEleve->getId();
|
||||||
// echo "<p>".var_dump($selectedEleve)."</p>";
|
// echo "<p>".var_dump($selectedEleve)."</p>";
|
||||||
$entries = $entryManager->search(['formsIds' => $formId, 'queries' => [ $eleveIdentifier => $identifier]]);
|
$entries = $entryManager->search(['formsIds' => $formId, 'queries' => [ $eleveIdentifier => $identifier]]);
|
||||||
|
@ -64,8 +62,5 @@ class AbsencesAction extends YesWikiAction
|
||||||
"entries" => $entries,
|
"entries" => $entries,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Utilisateur non connus : ". $username;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ class ApiController extends YesWikiController
|
||||||
// echo "Expediteur : ".var_dump($expediteur)."\n";
|
// echo "Expediteur : ".var_dump($expediteur)."\n";
|
||||||
|
|
||||||
// Récupération du destinataire
|
// Récupération du destinataire
|
||||||
$destinataire = implode(";", $eleve->getParentEmails());
|
$destinataire = $eleve->getEmail();
|
||||||
// echo "Envoyer à : ".$destinataire."\n";
|
// echo "Envoyer à : ".$destinataire."\n";
|
||||||
|
|
||||||
// Génération du rendu du mail
|
// Génération du rendu du mail
|
||||||
|
|
|
@ -2,26 +2,17 @@
|
||||||
|
|
||||||
namespace YesWiki\Meeo\Eleve;
|
namespace YesWiki\Meeo\Eleve;
|
||||||
|
|
||||||
include 'tools/meeo/libs/eleves/parent.lib.php';
|
|
||||||
|
|
||||||
use YesWiki\Bazar\Service\EntryManager;
|
use YesWiki\Bazar\Service\EntryManager;
|
||||||
use YesWiki\Meeo\Eleve\ParentEleve;
|
|
||||||
|
|
||||||
class Eleve {
|
class Eleve {
|
||||||
private $data;
|
private $data;
|
||||||
private $user;
|
private $user;
|
||||||
private $parents;
|
|
||||||
|
|
||||||
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.'bf_nom'];
|
$userId = $data['listefiche'.$yunoshostFormId.'bf_nom'];
|
||||||
$this->user = $entryManager->getOne($userId);
|
$this->user = $entryManager->getOne($userId);
|
||||||
// echo "<p>".var_dump($userId)."</p>";
|
|
||||||
$this->parents = [];
|
|
||||||
foreach ($entryManager->search(['formsIds' => 9, 'queries' => ['listefiche7bf_eleve' => $userId."2"]]) as $parent) {
|
|
||||||
array_push($this->parents, new ParentEleve($entryManager, $yunoshostFormId, $parent));
|
|
||||||
}
|
|
||||||
// echo "<p>".var_dump($this)."</p>";
|
// echo "<p>".var_dump($this)."</p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,23 +47,7 @@ class Eleve {
|
||||||
return $this->user['bf_mail'];
|
return $this->user['bf_mail'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getParentEmails() {
|
|
||||||
$emails = [];
|
|
||||||
foreach ($this->parents as $parent) {
|
|
||||||
array_push($emails, $parent->getEmail());
|
|
||||||
}
|
|
||||||
return $emails;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getData() {
|
public function getData() {
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isParent($username) {
|
|
||||||
foreach ($this->parents as $parent) {
|
|
||||||
if ($parent->getNom() == $username) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,31 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace YesWiki\Meeo\Eleve;
|
|
||||||
|
|
||||||
use YesWiki\Bazar\Service\EntryManager;
|
|
||||||
|
|
||||||
class ParentEleve {
|
|
||||||
private $data;
|
|
||||||
private $user;
|
|
||||||
|
|
||||||
public function __construct(EntryManager $entryManager, $yunoshostFormId, $data) {
|
|
||||||
$this->data = $data;
|
|
||||||
// echo "<p>".var_dump($data)."</p>";
|
|
||||||
$userId = $data['listefiche'.$yunoshostFormId.'bf_parent'];
|
|
||||||
$this->user = $entryManager->getOne($userId);
|
|
||||||
// echo "<p>".var_dump($userId)."</p>";
|
|
||||||
// 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