Ejemplo n.º 1
0
 /**
  * Instancia ou busca um objeto helper ja instanciado
  * @param string $name
  * @return Ibe_Helper 
  */
 public static function get($name)
 {
     if (!isset(self::$instances[$name])) {
         self::$instances[$name] = Ibe_Load::helper($name);
     }
     return self::$instances[$name];
 }
Ejemplo n.º 2
0
 /**
  * Inicializa um plugin
  * @param string $plugin_name
  */
 public static function init($plugin_name)
 {
     if (!isset(self::$instances[$plugin_name])) {
         $objPlugin = Ibe_Load::plugin();
         $objPlugin->initialize();
         self::$instances[$plugin_name] = $objPlugin;
     }
 }
Ejemplo n.º 3
0
 /**
  * Mostra o layout na saida
  */
 public function show($type_show)
 {
     $configure = Ibe_Load::configure();
     if (!$configure->isActionReturnJson() && $type_show != Ibe_View::JSON) {
         $app_path = "_modules" . DS . "inc_views.php";
         $mod_path = "_modules" . DS . $this->context->getModule() . DS . "inc_views.php";
         $ctr_path = "_modules" . DS . $this->context->getModule() . DS . $this->context->getController() . DS . "inc_views.php";
         $act_path = "_modules" . DS . $this->context->getModule() . DS . $this->context->getController() . DS . "_views" . DS . "inc_" . $this->context->getAction() . ".php";
         switch ($type_show) {
             case Ibe_View::APPLICATION:
                 $cts = $this->view_action->__include($act_path);
                 $cts = $this->view_controller->__set("view_action", $cts)->__include($ctr_path);
                 $cts = $this->view_module->__set("view_controller", $cts)->__include($mod_path);
                 $cts = $this->view_application->__set("view_module", $cts)->__include($app_path);
                 break;
             case Ibe_View::MODULE:
                 $cts = $this->view_action->__include($act_path);
                 $cts = $this->view_controller->__set("view_action", $cts)->__include($ctr_path);
                 $cts = $this->view_module->__set("view_controller", $cts)->__include($mod_path);
                 break;
             case Ibe_View::CONTROLLER:
                 $cts = $this->view_action->__include($act_path);
                 $cts = $this->view_controller->__set("view_action", $cts)->__include($ctr_path);
                 break;
             case Ibe_View::ACTION:
                 $cts = $this->view_action->__include($act_path);
                 break;
             case Ibe_View::NONE:
                 $cts = "";
                 break;
             default:
                 $act_path = "_modules" . DS . $this->context->getModule() . DS . $this->context->getController() . DS . "_views" . DS . "inc_" . rtrim(str_replace(' ', '_', strtolower($type_show))) . ".php";
                 $cts = $this->view_action->__include($act_path);
                 break;
         }
         echo $cts;
     } else {
         header('Cache-Control: no-cache, must-revalidate');
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         header('Content-type: application/json');
         $value = new Ibe_Object();
         if (!is_object($type_show) && isset($type_show) && $type_show != Ibe_View::JSON) {
             $value->response = $type_show;
         } else {
             $arr = (array) $this->view_action->response;
             $value->__setVars($arr, TRUE);
         }
         echo $value->toJson();
         exit;
     }
 }
Ejemplo n.º 4
0
 /**
  * Realiza a validacao do parametro atraves atraves a verificacao
  * nos arquivos do repositorio _validators
  * @param string $validator
  * @throws Ibe_Exception
  */
 private function isExternalValidated($nome, $valor, $type)
 {
     $ibe_validator = Ibe_Load::validator($type);
     if ($ibe_validator === FALSE) {
         if (!preg_match($type, $valor)) {
             throw new Ibe_Exception('Valor de ' . $nome . ' [' . $valor . '] invalido');
         }
     } else {
         if (!$ibe_validator->isValid($valor)) {
             throw new Ibe_Exception($ibe_validator->getMessage());
         }
     }
 }
Ejemplo n.º 5
0
 public static function configure()
 {
     if (!isset(self::$instance_configue)) {
         $configureName = "Configure";
         $path = "_modules" . DS . "inc_configure.php";
         if (file_exists($path)) {
             include_once $path;
             $cls = new ReflectionClass($configureName);
             self::$instance_configue = $cls->newInstance();
         }
     }
     return self::$instance_configue;
 }
Ejemplo n.º 6
0
 /**
  * Retorna uma instancia de um modelo
  * @param type $model_class_name
  * @return Ibe_Map
  */
 public static function getTable($model_class_name)
 {
     return Ibe_Load::map($model_class_name);
 }
Ejemplo n.º 7
0
 /**
  * Carrega os componentes se eles nao forem desativado
  * no arquivo de configuracao do modulo
  */
 private function configureComponents()
 {
     if ($this->configure->isAllowComponents()) {
         $var_moduleComponent = array();
         $var_component = array();
         $moduleComponent = Ibe_Load::componentConfigureModule();
         if ($moduleComponent !== FALSE) {
             $moduleComponent->setAction($this->view_action)->setController($this->view_controller)->setModule($this->view_module)->setApplication($this->view_application);
             $moduleComponent->configure();
         }
         $component = Ibe_Load::componentConfigureAction();
         if ($component !== FALSE) {
             $component->setAction($this->view_action)->setController($this->view_controller)->setModule($this->view_module)->setApplication($this->view_application);
             $component->configure();
         }
     }
 }
Ejemplo n.º 8
0
 /**
  * Instancia um Elemento Componente 
  * @param string $name
  * @throws Ibe_Exception_Component
  * @return Ibe_Component_Interface
  */
 public static function getInstance($name)
 {
     $className = Ibe_Load::component($name);
     return $reflection->newInstance();
 }