예제 #1
0
 public function dispatch()
 {
     $controller = self::getController() . 'Controller';
     $route = ROOT . DS . 'application' . DS . 'controller' . DS . $controller . '.php';
     $action = self::getAction();
     $params = self::getParams();
     if (is_readable($route)) {
         $controller = new $controller(self::getController(), $action, $params);
         if (!is_callable(array($controller, $action))) {
             $this->action = 'index';
         }
         if (isset($params)) {
             call_user_func_array(array($controller, self::getAction()), self::getParams());
         } else {
             call_user_func(array($controller, self::getAction()));
         }
     } else {
         $controller = new errorController('error', 'error404', array());
         $controller->error404();
     }
 }
예제 #2
0
 public function getHTML()
 {
     if ($this->url[1] == 'login' && $this->loginResult) {
         $message = "<h1>Welkom </h1>";
         $message .= "<p>U ben nu ingelogd.</p>";
         $title = "Login ";
         $details = array("contentLeft" => $message, "title" => $title);
         $layout = new LayoutController($details);
         $html = $layout->getHTML();
     } elseif ($this->url[1] == 'login' && !$this->loginResult) {
         $errorController = new errorController(array("title" => "Foute login!", "message" => "Verkeerde gebruikersnaam of wachtwoord."));
         $html = $errorController->getHTML();
     } else {
         $message = "<h1>Home</h1>";
         $message .= "<p>Welkom op de pagina voor TMTK1-11. Hier maken wij ons MVC CMS.</p>";
         $title = "Home ";
         $details = array("contentLeft" => $message, "title" => $title);
         $layout = new LayoutController($details);
         $html = $layout->getHTML();
     }
     return $html;
 }
예제 #3
0
 public function getHTML()
 {
     switch ($this->state) {
         //Page output / error handling
         case 'DONE':
             $html = $this->pagecontroller->getHTML();
             return $html;
             break;
         case 'CONTROLLER_INACTIVE':
             $message = array("title" => "Inactief!", "message" => "Pagina is niet (meer) actief");
             $errorController = new errorController($message);
             return $errorController->getHTML();
             break;
         case 'CONTROLLER_NOT_FOUND':
             $message = array("title" => "Kritieke fout!", "message" => "Fout tijdens het laden van de pagina. Neem contact op met de eigenaar van deze pagina.");
             $errorController = new errorController($message);
             return $errorController->getHTML();
             break;
         default:
             $message = array("title" => "Fout!", "message" => "Een onbekende fout heeft zich voorgedaan. Probeer het opnieuw.");
             $errorController = new errorController($message);
             return $errorController->getHTML();
             break;
     }
 }
예제 #4
0
파일: index.php 프로젝트: Bdiallo16/Be
require_once SITE_PATH . 'application/request.php';
require_once SITE_PATH . 'application/router.php';
require_once SITE_PATH . 'application/baseController.php';
require_once SITE_PATH . 'application/baseModel.php';
require_once SITE_PATH . 'application/load.php';
require_once SITE_PATH . 'application/session.php';
require_once SITE_PATH . 'controllers/errorController.php';
require_once SITE_PATH . 'models/usersModel.php';
require_once SITE_PATH . 'models/etudiantsModel.php';
require_once SITE_PATH . 'models/enseignantsModel.php';
require_once SITE_PATH . 'models/adminModel.php';
require_once SITE_PATH . 'models/formationsModel.php';
require_once SITE_PATH . 'models/matieresModel.php';
require_once SITE_PATH . 'models/devoirsModel.php';
require_once SITE_PATH . 'models/fichiersModel.php';
require_once SITE_PATH . 'models/fichiersattenduModel.php';
require_once SITE_PATH . 'models/noteModel.php';
require_once SITE_PATH . 'models/DAO/fichierDAO.php';
require_once SITE_PATH . 'models/DAO/userDAO.php';
require_once SITE_PATH . 'models/DAO/enseignantDAO.php';
require_once SITE_PATH . 'models/DAO/etudiantDAO.php';
require_once SITE_PATH . 'models/DAO/formationDAO.php';
require_once SITE_PATH . 'models/DAO/matiereDAO.php';
require_once SITE_PATH . 'models/DAO/devoirsDAO.php';
require_once SITE_PATH . 'models/DAO/noteDAO.php';
try {
    Router::route(new Request());
} catch (Exception $e) {
    $controller = new errorController();
    $controller->error($e->getMessage());
}