Fix apiController
This commit is contained in:
parent
12d9bff044
commit
60c7958066
1 changed files with 14 additions and 6 deletions
|
@ -21,14 +21,17 @@ class ApiController extends YesWikiController
|
||||||
{
|
{
|
||||||
private $redirectParams;
|
private $redirectParams;
|
||||||
|
|
||||||
public function __construct(ParameterBagInterface $params) {
|
public function __construct() {
|
||||||
$this->redirectParams = $params->get('meeo')['redirect'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/api/meeo/eleves",methods={"POST"},options={"acl":{"public"}})
|
* @Route("/api/meeo/eleves",methods={"POST"},options={"acl":{"public"}})
|
||||||
*/
|
*/
|
||||||
public function eleveUpdate(Request $request) {
|
public function eleveUpdate(Request $request) {
|
||||||
|
$params = $this->getService(ParameterBagInterface::class);
|
||||||
|
$redirectParams = $params->get('meeo')['redirect'];
|
||||||
|
|
||||||
$eleveController = $this->getService(EleveManager::class);
|
$eleveController = $this->getService(EleveManager::class);
|
||||||
$content = $request->getContent();
|
$content = $request->getContent();
|
||||||
|
|
||||||
|
@ -49,13 +52,16 @@ class ApiController extends YesWikiController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// return new ApiResponse($data);
|
// return new ApiResponse($data);
|
||||||
return $this->wiki->redirect($this->redirectParams['eleveUpdate'], 200);
|
return $this->wiki->redirect($redirectParams['eleveUpdate'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/api/meeo/controle",methods={"POST"},options={"acl":{"public"}})
|
* @Route("/api/meeo/controle",methods={"POST"},options={"acl":{"public"}})
|
||||||
*/
|
*/
|
||||||
public function controle(Request $request) {
|
public function controle(Request $request) {
|
||||||
|
$params = $this->getService(ParameterBagInterface::class);
|
||||||
|
$redirectParams = $params->get('meeo')['redirect'];
|
||||||
|
|
||||||
$noteManager = $this->getService(NoteManager::class);
|
$noteManager = $this->getService(NoteManager::class);
|
||||||
$content = $request->getContent();
|
$content = $request->getContent();
|
||||||
|
|
||||||
|
@ -70,13 +76,15 @@ class ApiController extends YesWikiController
|
||||||
$controle = new Controle($parameters['intitule'], $parameters['matiere'], $parameters['coef'], $eleves);
|
$controle = new Controle($parameters['intitule'], $parameters['matiere'], $parameters['coef'], $eleves);
|
||||||
$controle->createNotes($noteManager);
|
$controle->createNotes($noteManager);
|
||||||
// return new ApiResponse($controle);
|
// return new ApiResponse($controle);
|
||||||
return $this->wiki->redirect($this->redirectParams['controle'], 200);
|
return $this->wiki->redirect($redirectParams['controle'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/api/meeo/absence",methods={"POST"},options={"acl":{"public"}})
|
* @Route("/api/meeo/absence",methods={"POST"},options={"acl":{"public"}})
|
||||||
*/
|
*/
|
||||||
public function absence(Request $request) {
|
public function absence(Request $request) {
|
||||||
|
$params = $this->getService(ParameterBagInterface::class);
|
||||||
|
$redirectParams = $params->get('meeo')['redirect'];
|
||||||
$content = $request->getContent();
|
$content = $request->getContent();
|
||||||
parse_str($content, $parameters);
|
parse_str($content, $parameters);
|
||||||
|
|
||||||
|
@ -104,7 +112,7 @@ class ApiController extends YesWikiController
|
||||||
if (!send_mail($expediteur['email'], $expediteur['name'], $destinataire, "Absence", $body, $body))
|
if (!send_mail($expediteur['email'], $expediteur['name'], $destinataire, "Absence", $body, $body))
|
||||||
echo "Erreur d'envoie de mail";
|
echo "Erreur d'envoie de mail";
|
||||||
|
|
||||||
return new ApiResponse($parameters);
|
// return new ApiResponse($parameters);
|
||||||
// return $this->wiki->redirect($this->redirectParams['absence'], 200);
|
return $this->wiki->redirect($redirectParams['absence'], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue