Beispiel #1
0
 public static function dispatch($request)
 {
     $registry = Model3_Registry::getInstance();
     $config = $registry->get('config');
     $carray = $config->getArray();
     self::$_request = $request;
     if (self::$_request->isComponent()) {
         $componente = self::$_request->getComponent();
         restore_include_path();
         set_include_path('../lib/' . PATH_SEPARATOR . get_include_path());
         set_include_path('../app/Components/' . $componente . '/app/' . PATH_SEPARATOR . get_include_path());
         set_include_path('../app/Components/' . $componente . '/app/Controller/' . PATH_SEPARATOR . get_include_path());
         set_include_path('../app/Model/' . PATH_SEPARATOR . get_include_path());
         self::initSite('../app/Components/' . $componente . '/app/Config/config.ini', $componente);
         self::$_request->constructsFromGet();
     }
     if ($carray['general']['debug'] != true) {
         ob_start();
     }
     $controller = self::$_request->getController();
     $action = self::$_request->getAction();
     $params = self::$_request->getParams();
     self::preController();
     $app = self::runController();
     self::postController();
     if ($carray['general']['debug'] != true) {
         ob_end_clean();
     }
     // Manage view
     ob_start();
     $layout = NULL;
     if (!empty($carray['general']['layout'])) {
         $layout = $carray['general']['layout'];
     }
     $template = $app->getView()->getTemplate($layout);
     self::loadTemplate($app->getView(), $template);
     $output = ob_get_clean();
     echo $output;
 }