|
|
|
@ -41,11 +41,12 @@ class FrontController{
|
|
|
|
|
|
|
|
|
|
$match = $this->router->match();
|
|
|
|
|
if ($this->validMatch($match)){
|
|
|
|
|
$this->roleControl($match['target']);
|
|
|
|
|
var_dump($match);
|
|
|
|
|
$this->controlRoute($match['target']);
|
|
|
|
|
} else {
|
|
|
|
|
$this->displayByViewKind(ViewHttpResponse::twig("error.html.twig", [], HttpCodes::NOT_FOUND));
|
|
|
|
|
}
|
|
|
|
|
// $this->roleControl($match["target"]);
|
|
|
|
|
// $this->controlRoute($match["target"]);
|
|
|
|
|
// $this->handleByResponseType($this->matchRoute());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -86,23 +87,15 @@ class FrontController{
|
|
|
|
|
*
|
|
|
|
|
* @return ViewHttpResponse
|
|
|
|
|
*/
|
|
|
|
|
private function roleControl(string $actionController){
|
|
|
|
|
|
|
|
|
|
private function controlRoute(string $tag){
|
|
|
|
|
if (isset($_SESSION['role'])){
|
|
|
|
|
if($_SESSION['role'] = $this->dictControllerRole[$actionController]){
|
|
|
|
|
echo "Là on redirige vers le bon controller";
|
|
|
|
|
if($_SESSION['role'] = $this->dictControllerRole[$tag]){
|
|
|
|
|
$controller = new $tag();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$_SESSION['role']
|
|
|
|
|
echo "session initialisé";
|
|
|
|
|
$_SESSION['role'] = 'public'; // Remplacer par appel de la méthode de connexion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // Page not found
|
|
|
|
|
// if ($match == null) {
|
|
|
|
@ -117,7 +110,9 @@ class FrontController{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function controlRole($match){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Redirect the return of the response by the response's type
|
|
|
|
|
*
|
|
|
|
|