2024-07-17 17:15:22 +00:00
|
|
|
<?php
|
|
|
|
namespace YesWiki\Meeo\Controller;
|
|
|
|
|
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
use Symfony\Component\Routing\Annotation\Route;
|
|
|
|
use YesWiki\Core\ApiResponse;
|
|
|
|
use YesWiki\Core\YesWikiController;
|
2024-07-18 19:18:59 +00:00
|
|
|
use YesWiki\Meeo\Service\EleveManager;
|
2024-07-17 17:15:22 +00:00
|
|
|
|
|
|
|
class ApiController extends YesWikiController
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @Route("/api/meeo/eleves",methods={"POST"},options={"acl":{"public"}})
|
|
|
|
*/
|
|
|
|
public function eleveUpdate(Request $request) {
|
2024-07-18 19:18:59 +00:00
|
|
|
$eleveController = $this->getService(EleveManager::class);
|
2024-07-17 17:15:22 +00:00
|
|
|
$content = $request->getContent();
|
|
|
|
|
|
|
|
parse_str($content, $parameters);
|
|
|
|
|
2024-07-18 19:18:59 +00:00
|
|
|
$datas = [];
|
2024-07-17 17:15:22 +00:00
|
|
|
foreach ($parameters as $cle => $valeur) {
|
|
|
|
$clef_action = explode('_', $cle);
|
|
|
|
if ($clef_action[1] == 'classe' && $valeur != 'aucune') {
|
2024-07-18 19:18:59 +00:00
|
|
|
$datas[] = $eleveController->updateClasse($clef_action[0], $valeur);
|
2024-07-17 17:15:22 +00:00
|
|
|
}
|
|
|
|
if ($clef_action[1] == 'del') {
|
2024-07-18 19:18:59 +00:00
|
|
|
$eleveController->del($clef_action[0]);
|
2024-07-17 17:15:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-18 19:18:59 +00:00
|
|
|
return $this->wiki->redirect('?Eleves', 200);
|
2024-07-17 17:15:22 +00:00
|
|
|
}
|
|
|
|
}
|