/**
  * Retorna a instancia do contexto da aplicacao
  * @param type $module
  * @param type $controller
  * @param type $action
  * @return Ibe_Context
  */
 public static function getInstance($module = NULL, $controller = NULL, $action = NULL, $is_https = FALSE)
 {
     if (is_null(self::$instance)) {
         self::$instance = new self($module, $controller, $action);
     }
     return self::$instance;
 }
Beispiel #2
0
 public function __construct(Ibe_Template $app = NULL, Ibe_Template $mod = NULL, Ibe_Template $ctr = NULL, Ibe_Template $act = NULL)
 {
     $this->view_application = $app;
     $this->view_module = $mod;
     $this->view_controller = $ctr;
     $this->view_action = $act;
     $this->context = Ibe_Context::getInstance();
 }
 /**
  * Inicia a execucao de uma nova requisicao HTTP ao aplicativo
  * @return Ibe_Request 
  */
 public static function dispatch($init_session = FALSE)
 {
     if ($init_session) {
         self::initSession();
     }
     $ctx = Ibe_Context::getInstance(self::$_module, self::$_controller, self::$_action, self::$_is_https);
     $request = new self();
     $action = Ibe_Load::action();
     $action->setContext($ctx);
     $action->preAction($request);
     $template = $action->execute($request);
     $action->posAction($request);
     $view_app = $action->getViewApplication();
     $view_mod = $action->getViewModule();
     $view_ctr = $action->getViewController();
     $view_act = $action->getViewAction();
     if ($template == Ibe_View::JSON) {
         $view_act->response = $action->getResponse();
     }
     $view = new Ibe_View($view_app, $view_mod, $view_ctr, $view_act);
     $view->show($template);
 }
Beispiel #4
0
 /**
  * Retorna a classe de configuracao componentes de todas as tela
  * @throws Ibe_Exception_Load
  * @return Ibe_Component
  */
 public static function componentConfigureModule()
 {
     $context = Ibe_Context::getInstance();
     $actionPath = '_modules' . DS . 'inc_components.php';
     if (!file_exists($actionPath)) {
         $core_action = IBE_FRAMEWORK_PATH . 'default' . DS . $actionPath;
         //Ibe_Debug::error($core_action);
         if (file_exists($core_action)) {
             include_once $core_action;
         }
         return FALSE;
     } else {
         include_once $actionPath;
     }
     $objAction = NULL;
     if (class_exists('Components')) {
         //Instanciando um objeto Action
         $clsAction = new ReflectionClass('Components');
         if ($clsAction->isSubclassOf('Ibe_Component')) {
             //instancia um novo controlador
             $objAction = $clsAction->newInstanceArgs();
         } else {
             throw new Ibe_Exception_Load('A classe nao extende a classe Ibe_Component');
         }
     } else {
         throw new Ibe_Exception_Load('A classe de configuracao de componentes [Components] nao existe');
     }
     return $objAction;
 }
 /**
  * Redireciona uma requisicao a outra acao
  * @param string $mod
  * @param string $ctr
  * @param string $action
  * @param array $get 
  */
 public function redirect($mod, $ctr, $action, array $get = array())
 {
     $url = Ibe_Context::getInstance()->getUrlBase();
     $param = '/';
     foreach ($get as $name => $value) {
         $param .= $name . '/' . $value . '/';
     }
     header('location:' . $url . 'index.php/' . $mod . '/' . $ctr . '/' . $action . $param);
     exit;
 }