예제 #1
0
파일: App.php 프로젝트: vitordm/VTRMVC
 /**
  * @throws Exceptions\InvalidRouteException
  */
 private function executeError()
 {
     header("HTTP/1.0 404 Not Found");
     if ($this->configuration->getRoute("404")) {
         $action = $this->getAction($this->configuration->getRoute("404"));
         if (!App::loadController($action->controller_class)) {
             throw new Exceptions\InvalidRouteException("Error - Invalid route definition | " . __METHOD__, 1010);
         }
         Router::redirect($this->configuration->getRoute("404"));
     }
     throw new Exceptions\InvalidRouteException("Error 404 - Not found");
 }
예제 #2
0
파일: View.php 프로젝트: vitordm/VTRMVC
 /**
  * Inclui a página de erro ao renderizar
  */
 public function include_error_page()
 {
     $this->define_http_code(self::HTTP_CODE_NOT_FOUND);
     if ($this->error_page) {
         App::import($this->error_page);
     } else {
         throw new InvalidRouteException("Not possible execute view");
     }
 }
예제 #3
0
파일: Model.php 프로젝트: vitordm/VTRMVC
 /**
  * Carrega os component editaveis
  * @param string $component nome do component ex: \Namespace\Component
  */
 public function loadComponent($component)
 {
     App::loadComponent('AppComponent');
     $components = func_get_args();
     foreach ($components as $component) {
         $component = ltrim($component, "\\");
         $fulComponent = explode("\\", $component);
         $componentName = end($fulComponent);
         $component .= 'Component';
         if (App::loadComponent($component)) {
             $this->components->{$componentName} = new $component();
         }
     }
 }