Beispiel #1
0
    /**
     * @package load.class.php
     * @method view()
     * @desc Loads a view
     * @example 1) $this->Load->View('Inicio/view.php');
     *          2) $data['mi_var']; $this->Load->View('folder/view.php',$data);
     *          3) $this->putContent('{list}',$listValues);$this->Load->View('folder/view.php');
     * @since 0.1 Beta
     */
    public function view($view, $data = array(), $ReturnResult = false)
    {
        // False: Imprime resultado, true devuelve resultado
        $this->ReturnResult = $ReturnResult;
        $view_file = 'app/views/' . $view;
        $view_file_path = SYSTEM_PATH . $view_file;
        $view_exist = false;
        if (fk_file_exists($view_file)) {
            $view_exist = true;
        }
        if ($view_exist == FALSE) {
            //view no existe
            if ($GLOBALS['FKORE']['RUNNING']['app']['interactive'] == true) {
                try {
                    throw new FkException("Archivo: " . $view_file . " no existe ");
                } catch (FkException $e) {
                    $e->description = 'Es requerido el archivo view <b>' . $view_file . '</b>,
					                    sin embargo no fue encontrado';
                    $e->solution = 'Cree el archivo <b>' . $view_file . '</b> y agregue el codigo requerido.
					                 Ejemplo:';
                    $e->solution_code = fk_str_format('<?php fk_header();?>
Este es el archivo ' . $view_file . '
<?php fk_footer();?> ', 'html');
                    $e->show('code_help');
                }
            } else {
                die("<fieldset><h1>Error 404 -1: La p&aacute;gina no existe </h1></fieldset>");
            }
        } else {
            // Preprocesar la vista
            return $this->PreProcessFile($view_file_path, $data);
        }
    }
Beispiel #2
0
    /**
     *@package AppForm
     *@since v0.1 beta
     *@method useTemplateView()
     * */
    public function useTemplateView($tpl, $ArrayData = array())
    {
        $this->ArrData = $ArrayData;
        $v_path = 'app/views';
        $file_path = $v_path . '/' . $tpl;
        if (fk_file_exists($file_path) == TRUE) {
            // Get Template
            $this->use_template = TRUE;
            $this->template = file_get_contents(SYSTEM_PATH . $file_path);
        } else {
            try {
                throw new FkException("El template " . $tpl . " no existe");
            } catch (FkException $e) {
                $e->description = "El template " . $v_path . "/" . $tpl . " no existe. ";
                $e->solution = 'Verifique que este bien escrito y que exista
				<h2><a href="' . fk_link('FkDev/creaAppFormtemplate/' . encode($v_path)) . '/' . encode($tpl) . '/" target="_blank">Crear template ahora</a></h2>
				';
                $e->error_code = 'AF000001';
                $e->show();
            }
        }
    }
Beispiel #3
0
 /**
  *@package AppForm
  *@since v0.1 beta
  *@method useTemplateView()
  * */
 public function useTemplateView($tpl, $ArrayData = array())
 {
     $this->ArrData = $ArrayData;
     $v_path = 'app/views';
     $file_path = $v_path . '/' . $tpl;
     if (fk_file_exists($file_path) == TRUE) {
         // Get Template
         $this->use_template = TRUE;
         $this->template = file_get_contents(SYSTEM_PATH . $file_path);
     } else {
         try {
             throw new FkException("El template " . $tpl . " no existe");
         } catch (FkException $e) {
             $e->description = "El template " . $v_path . "/" . $tpl . " no existe. ";
             $e->solution = 'Verifique que este bien escrito y que exista';
             $e->error_code = 'AF000001';
             $e->show();
         }
     }
 }
Beispiel #4
0
    /**
     *@package fkore
     *@method Initialize()
     *@since v0.1 beta
     *@desc  runs freekore
     **/
    public static function InitializeFK($P_GET, $p_mod_rewrite = true)
    {
        //load view
        if (isset($P_GET['!'])) {
            $url_rs = self::url_processor($P_GET['!'], false);
        } else {
            if (isset($P_GET['url'])) {
                $url_rs = self::url_processor($P_GET['url']);
            }
        }
        if (!isset($url_rs)) {
            $url_rs['controller'] = 'IndexController';
            $url_rs['module'] = 'index';
            $url_rs['action'] = 'index';
            $url_rs['file_controller'] = 'index' . CONTROLLER . '.php';
            $url_rs['file_view'] = 'index/index' . VIEW . '.php';
        }
        $controller_exist = false;
        if (fk_file_exists(@$GLOBALS['FKORE']['config']['APP']['controllers_dir'] . '/' . $url_rs['file_controller'])) {
            $controller_exist = true;
        }
        if ($controller_exist == true) {
            // controler existe
            // view existe
            //EJECUTAR CONTROLLER
            require SYSTEM_PATH . $GLOBALS['FKORE']['config']['APP']['controllers_dir'] . '/' . $url_rs['file_controller'];
            //EJECUTAR CONTROLLER
            $page = new $url_rs['controller']($url_rs);
        } else {
            // controler no existe
            if ($GLOBALS['FKORE']['RUNNING']['app']['interactive'] == true) {
                // MOSTRAR ERROR Y AYUDA
                $cont_control = str_replace('__ControlerName__', $url_rs['controller'], file_get_contents(SYSTEM_PATH . 'Freekore/build/templates/controller-layout.tpl'));
                try {
                    throw new FkException('El Controlador "' . $url_rs['file_controller'] . '" no existe');
                } catch (FkException $e) {
                    $e->description = 'Es requerido el archivo Controllador <b>' . $url_rs['file_controller'] . '</b>
						                    , sin embargo no fue encontrado.';
                    $e->solution = '1. Crea la clase <b>' . $url_rs['controller'] . '</b> en el archivo
						                    <b>' . $url_rs['file_controller'] . '</b> ';
                    $e->solution_code = fk_str_format($cont_control, 'html');
                    $e->show('code_help');
                }
            } else {
                require SYSTEM_PATH . 'FreeKore/sys_messages/page/error_404.php';
            }
        }
    }