Loads views and files
Автор: ExpressionEngine Dev Team
Пример #1
0
/**
 * 提供按钮的ID列表,初始化插件组件
 * @param array $buttonIds
 * @param string $uploadUrl
 * @param string $secType 选择图片类型(local:本地上传,remote:远程图片,all:本地远程图片)
 * @param string $managerUrl 远程图片列表地址(远程图片列表json格式,具体格式参考模板文件)
 */
function initUploadImage($buttonIds = array(), $uploadUrl = '', $secType = 'local', $managerUrl = '')
{
    $data = array('buttonIds' => $buttonIds, 'uploadUrl' => $uploadUrl, 'secType' => $secType, 'managerUrl' => $managerUrl);
    $loader = new CI_Loader();
    $content = $loader->view('common/initUploadImage', $data, true);
    echo $content;
}
Пример #2
0
 function show_view($view, $vars = array(), $return = FALSE)
 {
     $load = new CI_Loader();
     $load->view("includes/header");
     $load->view($view, $vars, $return);
     $load->view("includes/footer");
 }
 public function render_view($view, $breadcrumbs, $data, $folder = 'admin', $js = [], $css = [], $return = false)
 {
     // Загружаем хэдер
     $page['footer'] = $this->load->view('_blocks/header', ['page_title' => lang('main_title'), 'custom_js' => $js, 'custom_css' => $css, 'menus' => $this->get_menus(), 'menu_item' => $this->menu_item, 'breadcrumbs' => $breadcrumbs], $return);
     // Загружаем шаблон страницы
     $page['body'] = $this->load->view($folder . '/' . $view, $data, $return);
     // Загружаем футер
     $page['footer'] = $this->load->view('_blocks/footer', [], $return);
     if ($return) {
         return implode('', $page);
     }
 }
Пример #4
0
 function MY_Controller()
 {
     parent::Controller();
     //当前用户信息初始化
     $this->load->library('User', null, 'userLib');
     $userInfo = $this->userLib->getUserInfo();
     $this->user = $userInfo;
     if (!$this->user) {
         showError($this->userLib->error, '/');
     }
     /* if (in_array($this->user['userId'], array(694,3767,3868))) {
            showError('测试账号禁止进去正式地址');
        } */
     //加载菜单,全局使用
     $this->load->library('Navbar', $this->user);
     $this->navbarList = $this->navbar->getNavbarList();
     //公告内容
     $this->load->model('HelperNoticeModel');
     $this->viewData['noticeData'] = $this->HelperNoticeModel->getLatest($this->user['userRole']);
     if ($this->viewData['noticeData']) {
         $this->navbarList[] = array('Help', 'noticeCheck', 'title' => '公告');
     }
     //当前选中菜单默认为当前控制器
     $this->navbarFocus = $this->input->get('c');
     //当前默认选中的菜单项
     $this->navChildFocus = $this->input->get('c') . '_' . $this->input->get('m');
     //当前主题
     $this->theme = $this->config->item('theme');
     //加载认证类,全局可以调用
     $this->load->library('Auth', $this->user);
     //面包屑导航
     $this->viewData['breadcrumb'][] = array('url' => printUrl('Main', 'index'), 'title' => '首页');
     //加载时段模型
     $this->load->model('timeUnitModel');
 }
 /**
  * Class constructor method
  */
 public function __construct()
 {
     parent::__construct();
     $this->config('loader', TRUE);
     $this->_initialize();
     log_message('info', __CLASS__ . ' Class Initialized');
 }
Пример #6
0
 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     parent::__construct();
     $this->_ci_service_paths = array(APPPATH);
     $this->_ci_services = array();
     log_message('debug', "MY_Loader Class Initialized");
 }
Пример #7
0
 public function view($view, $vars = array(), $return = FALSE)
 {
     $CI =& get_instance();
     if (isset($CI->local)) {
         $file_exists = FALSE;
         $_ci_path = '';
         $_ci_view = $view . '__' . $CI->local['code'];
         $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION);
         $_ci_file = $_ci_ext === '' ? $_ci_view . '.php' : $_ci_view;
         foreach ($this->_ci_view_paths as $_ci_view_file => $cascade) {
             if (file_exists($_ci_view_file . $_ci_file)) {
                 $_ci_path = $_ci_view_file . $_ci_file;
                 $file_exists = TRUE;
                 break;
             }
             if (!$cascade) {
                 break;
             }
         }
         if ($file_exists or file_exists($_ci_path)) {
             $view = $_ci_view;
         }
     }
     return parent::view($view, $vars, $return);
 }
Пример #8
0
 function CI_Base()
 {
     global $OBJ;
     parent::CI_Loader();
     $this->load =& $this;
     $OBJ = $this->load;
 }
 /**
  * Constructor. Define SPARKPATH if it doesn't exist, initialize parent
  */
 function __construct()
 {
     if (!defined('SPARKPATH')) {
         define('SPARKPATH', APPPATH . 'sparks/');
     }
     parent::__construct();
 }
Пример #10
0
 /**
  * Initialize both database and forge components
  */
 public static function init($driver)
 {
     if (empty(static::$db) && empty(static::$forge)) {
         $config = Mock_Database_DB::config($driver);
         $connection = new Mock_Database_DB($config);
         $db = Mock_Database_DB::DB($connection->set_dsn($driver), TRUE);
         CI_TestCase::instance()->ci_instance_var('db', $db);
         $loader = new CI_Loader();
         $loader->dbforge();
         $forge = CI_TestCase::instance()->ci_instance_var('dbforge');
         static::$db = $db;
         static::$forge = $forge;
         static::$driver = $driver;
     }
     return static::$db;
 }
Пример #11
0
 public function __construct()
 {
     $this->_ci_library_paths = array(PATH_APP, PATH_APPS, PATH_SYSTEM);
     $this->_ci_helper_paths = array(PATH_APP, PATH_APPS, PATH_SYSTEM);
     $this->_ci_view_paths = array(VIEWPATH => TRUE, MODULES_DIR => TRUE);
     parent::__construct();
 }
Пример #12
0
 function __construct()
 {
     if (!defined('SPARKPATH')) {
         define('SPARKPATH', 'sparks/');
     }
     $this->_ci_events_paths = array(APPPATH);
     parent::__construct();
 }
Пример #13
0
 public function __construct()
 {
     parent::__construct();
     # -- Loading libraries, helpers and modules from SHAREDPATH
     $this->_ci_library_paths = array(SHAREDPATH, BASEPATH);
     $this->_ci_helper_paths = array(SHAREDPATH, BASEPATH);
     $this->_ci_model_paths = array(SHAREDPATH);
 }
 /**
  * (non-PHPdoc)
  * @see CI_Loader::model()
  */
 public function model($model, $name = '', $db_conn = FALSE)
 {
     if (is_string($model) && $name == '') {
         $name = $model;
         $model = $model . '_model';
     }
     parent::model($model, $name, $db_conn);
 }
Пример #15
0
 /**
  * To accomodate CI 2.1.0, we override the initialize() method instead of
  *  the ci_autoloader() method. Once sparks is integrated into CI, we
  *  can avoid the awkward version-specific logic.
  * @return Loader
  */
 function initialize()
 {
     parent::initialize();
     if (!$this->_is_lt_210) {
         $this->ci_autoloader();
     }
     return $this;
 }
Пример #16
0
 /**
  * Constructor
  *
  */
 function __construct()
 {
     // Call the Loader Constructor
     parent::__construct();
     // Create an instance to CI
     $CI =& get_instance();
     // Load the Widget model
     $this->model('Widgets_model', 'widgets');
 }
Пример #17
0
/**
 * 打印题目数据
 * @param array $data
 */
function printProActItem($data)
{
    //操作类型(edit:编辑,check:查看,)
    $data['action'] = isset($data['action']) ? $data['action'] : 'edit';
    $loader = new CI_Loader();
    //上传图片配置
    if ($data['type'] == 6) {
        $data['uploadUrl'] = printUrl('Upload', 'uploadSave', array('dir' => 'image'));
        $data['extraParams'] = array('itemId' => $data['itemId'], 'proId' => $data['proId'], 'actId' => $data['actId'], 'type' => $data['type']);
    }
    //上传附件配置
    if ($data['type'] == 7) {
        $data['uploadUrl'] = printUrl('Upload', 'uploadSave', array('dir' => 'settleFile'));
        $data['extraParams'] = array('itemId' => $data['itemId'], 'proId' => $data['proId'], 'actId' => $data['actId'], 'type' => $data['type']);
    }
    $content = $loader->view('ProActItem/actItem' . $data['type'], $data, true);
    echo $content;
}
Пример #18
0
 function __construct()
 {
     parent::__construct();
     // 修改路径 添加ROOT
     $this->_ci_helper_paths = array(APPPATH, LIBS_PATH, BASEPATH);
     $this->_ci_library_paths = array(APPPATH, LIBS_PATH, BASEPATH);
     $this->_ci_model_paths = array(APPPATH, LIBS_PATH);
     //$this->_ci_view_paths = array(ROOT.'views/'	=> TRUE);
 }
Пример #19
0
 function __construct()
 {
     parent::__construct();
     // Fix the paths. The next line is the only change here. The rest is the exact CI function.
     $this->_ci_library_paths = array(BASEPATH, APPPATH, COMMONPATH);
     $module = $this->is_modular();
     if ($module) {
         $this->add_package_path(APPPATH . 'plugins/' . $module, TRUE);
     }
 }
Пример #20
0
 /**
  * Constructor
  *
  * Sets the path to the view files and gets the initial output buffering level
  */
 public function __construct()
 {
     parent::__construct();
     $this->_ci_ob_level = ob_get_level();
     // CodeIgniter uses 'application/views/' directory for loading views
     // But we want to use 'themes/' directory
     $this->_ci_view_paths = array(THEMESPATH => TRUE);
     // (THEMESPATH is defined in index.php)
     log_message('debug', "Loader Class Initialized");
 }
Пример #21
0
 function view($view, $params = array(), $string = false)
 {
     $str_contenido = parent::view($view, $params, true);
     $str = parent::view("layout/layout", array("contenido" => $str_contenido), true);
     if ($string) {
         return $str;
     } else {
         echo $str;
     }
 }
Пример #22
0
 function CI_Base()
 {
     // This allows syntax like $this->load->foo() to work
     parent::CI_Loader();
     $this->load =& $this;
     // This allows resources used within controller constructors to work
     global $OBJ;
     $OBJ = $this->load;
     // Do NOT use a reference.
 }
Пример #23
0
 public function __construct()
 {
     parent::__construct();
     // Add custom path information for libraries, helpers, models and views
     log_message('debug', 'Plain_Loader Class Initialized');
     array_unshift($this->_ci_library_paths, CUSTOMPATH);
     array_unshift($this->_ci_helper_paths, CUSTOMPATH);
     array_unshift($this->_ci_model_paths, CUSTOMPATH);
     $this->_ci_view_paths = array(CUSTOMPATH . 'views/' => true, APPPATH . 'views/' => true);
 }
Пример #24
0
 public function __construct()
 {
     parent::__construct();
     //        $query = new Java("com.dbms.java.Query", 'SELECT 123');
     //        echo $query->last_query();
     ////        exit;
     //        $db =new Java("com.dbms.java.DB");
     //        $this->db =$db;
     //        $CI =& get_instance();
     //        $CI->db = $db;
 }
Пример #25
0
 function view($view, $vars = array(), $return = FALSE)
 {
     // if $view is an array, bump all parameters up
     if (is_array($view)) {
         $return = !is_array($vars);
         $vars = $view;
         global $RTR;
         return parent::view($RTR->fetch_method(), $vars, $return);
     } else {
         return parent::view($view, $vars, $return);
     }
 }
Пример #26
0
 /**
  * Initialize both database and forge components
  */
 public static function init($driver)
 {
     if (empty(self::$db) && empty(self::$forge)) {
         // E_DEPRECATED notices thrown by mysql_connect(), mysql_pconnect()
         // on PHP 5.5+ cause the tests to fail
         if ($driver === 'mysql' && version_compare(PHP_VERSION, '5.5', '>=')) {
             error_reporting(E_ALL & ~E_DEPRECATED);
         }
         $config = Mock_Database_DB::config($driver);
         $connection = new Mock_Database_DB($config);
         $db = Mock_Database_DB::DB($connection->set_dsn($driver), TRUE);
         CI_TestCase::instance()->ci_instance_var('db', $db);
         $loader = new CI_Loader();
         $loader->dbforge();
         $forge = CI_TestCase::instance()->ci_instance_var('dbforge');
         self::$db = $db;
         self::$forge = $forge;
         self::$driver = $driver;
     }
     return self::$db;
 }
Пример #27
0
 /**
  * Constructor
  *
  * Sets the path to the view files and gets the initial output buffering level
  *
  * @access    public
  */
 function MY_Loader()
 {
     // {{{ Matchbox
     $this->_matchbox =& load_class('Matchbox');
     $this->_ci_tables = array();
     parent::CI_Loader();
     // }}}
     $this->_ci_is_php5 = floor(phpversion()) >= 5 ? TRUE : FALSE;
     $this->_ci_view_path = APPPATH . 'views/';
     $this->_ci_ob_level = ob_get_level();
     log_message('debug', "Loader Class Initialized");
 }
Пример #28
0
 /**
  * Constructor
  */
 public function __construct()
 {
     self::$instance =& $this;
     // Assign all the class objects that were instantiated by the
     // bootstrap file (CodeIgniter.php) to local class variables
     // so that CI can run as one big super object.
     foreach (is_loaded() as $var => $class) {
         $this->{$var} =& load_class($class);
     }
     $this->load =& load_class('Loader', 'core');
     $this->load->initialize();
     log_message('debug', "Controller Class Initialized");
 }
Пример #29
0
 function __construct()
 {
     parent::__construct();
     // 修改路径 添加ROOT
     $this->_ci_helper_paths = array(APPPATH, LIBS_PATH, BASEPATH);
     $this->_ci_library_paths = array(APPPATH, LIBS_PATH, BASEPATH);
     $this->_ci_model_paths = array(APPPATH, LIBS_PATH);
     if (defined('VIEWS')) {
         $this->_ci_view_paths = array(VIEWS => TRUE);
     } else {
         define('VIEWS', APPPATH . 'views/');
     }
 }
Пример #30
-8
 /**
  * Check & Set URI resource to determine the side of application
  *
  */
 public function __construct()
 {
     parent::__construct();
     $uri =& load_class('URI', 'core');
     $admin = $uri->segment(1);
     $this->is_admin = $admin == 'administrator' || $admin == 'admin' ? true : false;
 }