當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CI_Loader::model方法代碼示例

本文整理匯總了PHP中CI_Loader::model方法的典型用法代碼示例。如果您正苦於以下問題:PHP CI_Loader::model方法的具體用法?PHP CI_Loader::model怎麽用?PHP CI_Loader::model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CI_Loader的用法示例。


在下文中一共展示了CI_Loader::model方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: showError

 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');
 }
開發者ID:zhaojianhui129,項目名稱:qirmp2016,代碼行數:35,代碼來源:MY_Controller.php

示例2: model

 /**
  * (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);
 }
開發者ID:s2software,項目名稱:codeigniter-powerful-model,代碼行數:12,代碼來源:MY_Loader.php

示例3: lang

 function __construct($menu_item = null)
 {
     parent::__construct();
     $this->menu_item = $menu_item;
     $this->load->model('languages_model');
     $get_lang = $this->input->get('l');
     //        dump($this->lang->language);die;
     if ($get_lang && array_key_exists($get_lang, $this->long_to_short)) {
         $this->current_language = $get_lang;
         $this->session->set_userdata('language', $get_lang);
     } else {
         if (!$this->session->userdata('language')) {
             $this->session->set_userdata('language', $this->getLanguage());
         } else {
             $this->current_language = $this->session->userdata('language');
         }
     }
     $this->lang->load("main", $this->current_language);
     $this->current_language_short = $this->long_to_short[$this->current_language];
     $this->menus = ['home' => ['url' => base_url(''), 'title' => lang('home'), 'additional_params' => 'data-href="1"'], 'contacts' => ['url' => base_url('contacts'), 'title' => lang('contacts'), 'additional_params' => 'data-href="11"'], 'about_me' => ['url' => base_url('about'), 'title' => lang('about_me'), 'additional_params' => ''], 'portfolio' => ['url' => base_url('portfolio'), 'title' => lang('portfolio'), 'additional_params' => '']];
 }
開發者ID:Speennaker,項目名稱:tanyaprykhodko,代碼行數:21,代碼來源:MY_base_controller.php

示例4: showError

 function MY_Controller()
 {
     parent::Controller();
     $this->load->model('timeUnitModel');
     $this->load->library('User', null, 'userLib');
     $this->user = $this->userLib->getUserInfo();
     if (!$this->user) {
         showError($this->userLib->error, '/');
     }
     //加載菜單,全局使用
     $this->load->library('Navbar', $this->user);
     $this->navbarList = $this->navbar->getNavbarList();
     //當前選中菜單默認為當前控製器
     $this->navbarFocus = $_GET['c'] . '_' . $_GET['m'];
     //當前默認選中的菜單項
     $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' => '首頁');
 }
開發者ID:zhaojianhui129,項目名稱:implement2016,代碼行數:23,代碼來源:MY_Controller.php

示例5: model

 /** Load a module model **/
 public function model($model, $object_name = NULL, $connect = FALSE)
 {
     if (is_array($model)) {
         return $this->models($model);
     }
     $_alias = $object_name or $_alias = basename($model);
     if (in_array($_alias, $this->_ci_models, TRUE)) {
         return CI::$APP->{$_alias};
     }
     /* check module */
     list($path, $_model) = Modules::find(strtolower($model), $this->_module, 'models/');
     if ($path == FALSE) {
         /* check application & packages */
         parent::model($model, $object_name);
     } else {
         class_exists('CI_Model', FALSE) or load_class('Model', 'core');
         if ($connect !== FALSE and !class_exists('CI_DB', FALSE)) {
             if ($connect === TRUE) {
                 $connect = '';
             }
             $this->database($connect, FALSE, TRUE);
         }
         Modules::load_file($_model, $path);
         $model = ucfirst($_model);
         CI::$APP->{$_alias} = new $model();
         $this->_ci_models[] = $_alias;
     }
     return CI::$APP->{$_alias};
 }
開發者ID:Rudianasaja,項目名稱:codeigniter-hmvc,代碼行數:30,代碼來源:Loader.php

示例6: service

 public function service($model, $name = '')
 {
     parent::model('services/' . $model, $name, false);
 }
開發者ID:shipSun,項目名稱:webSVN,代碼行數:4,代碼來源:My_Loader.php

示例7: redirect

 function BE_Controller()
 {
     $this->page_path = false;
     global $active_controller;
     global $active_show;
     $active_controller = $this;
     parent::__construct();
     $this->load->helper("url");
     if (!$this->is_installed() && $this->uri->segment(2) != "install" && $this->uri->segment(1) != "api") {
         redirect('/admin/install/index', 'location');
     }
     if ($this->is_installed()) {
         $this->load->database();
         @$this->load->library('datamapper');
     }
     if (!$active_show) {
         $this->show = new Show($this);
     } else {
         $this->show =& $active_show;
     }
     $this->load->model('BuilderEngine');
     $this->load->model('users');
     if ($this->is_installed()) {
         $this->load->model('user');
         global $cache;
         $this->load->model("cache");
         $cache = $this->cache;
         $this->BuilderEngine->load_settings();
         if (!EventManager::is_initialized() && !EventManager::is_initializing()) {
             EventManager::set_initializing(true);
             $this->load->model('module');
             $modules = $this->module;
             // $modules = new Module();
             foreach ($modules->get() as $module) {
                 if ($module->folder == "module_system") {
                     continue;
                 }
                 Modules::run($module->folder . "/register_events");
             }
             EventManager::set_initialized(true);
         }
         if (self::$s_user == null) {
             self::$s_user = new User();
             $session = $this->session;
             self::$s_user->_init($session);
         }
         $user_model = $this->users;
         global $user;
         $user = self::$s_user;
         $this->user =& self::$s_user;
         $CI =& get_instance();
         $this->load->model('links');
         $this->links_array = $this->links->get();
         foreach ($this->links_array as $link) {
             $link->target = str_replace("%site_root%", home_url('/'), $link->target);
         }
     }
     $this->BuilderEngine->set_option("active_backend_theme", "dashboard", false);
     $this->load->library('module_parser');
     $this->load->library('parser');
     //$this->BuilderEngine->activate_theme("default");
     //echo $this->get_page_path();
     $this->load->module("layout_system");
     $this->layout_system->load->model("blocks");
     $this->layout_system->load->model('versions');
     $this->versions =& $this->layout_system->versions;
     if ($this->is_installed()) {
         $this->load->model('Module');
         $this->load->model('Group');
         $this->load->model('Group_module_permission');
     }
 }
開發者ID:hyrmedia,項目名稱:builderengine,代碼行數:72,代碼來源:BE_Controller.php

示例8: model

 /**
  * Model Loader
  *
  * This function lets users load and instantiate models.
  *
  * @param	string	the name of the class
  * @param	string	name for the model
  * @param	bool	database connection
  * @return	void
  */
 public function model($model, $name = '', $db_conn = FALSE)
 {
     if (is_array($model)) {
         foreach ($model as $babe) {
             $this->model($babe);
         }
         return;
     }
     // Detect module
     if (list($module, $class) = $this->detect_module($model)) {
         // Module already loaded
         if (in_array($module, $this->_ci_modules)) {
             return parent::model($class, $name, $db_conn);
         }
         // Add module
         $this->add_module($module);
         // Let parent do the heavy work
         $void = parent::model($class, $name, $db_conn);
         // Remove module
         $this->remove_module();
         return $void;
     } else {
         return parent::model($model, $name, $db_conn);
     }
 }
開發者ID:sastrylal,項目名稱:tingting,代碼行數:35,代碼來源:Loader.php

示例9: model

 /** Load a module model **/
 public function model($model, $object_name = null, $connect = false)
 {
     if (is_array($model)) {
         return $this->models($model);
     }
     $model_pieces = explode('/', $model);
     $_alias = $object_name or $_alias = end($model_pieces);
     if (in_array($_alias, $this->_ci_models, true)) {
         return CI::$APP->{$_alias};
     }
     /* check module */
     list($path, $_model) = Modules::find(strtolower($model), $this->_module, 'models/');
     if ($path == false) {
         /* check application & packages */
         parent::model($model, $object_name);
     } else {
         class_exists('CI_Model', false) or load_class('Model', 'core');
         if ($connect !== false and !class_exists('CI_DB', false)) {
             if ($connect === true) {
                 $connect = '';
             }
             $this->database($connect, false, true);
         }
         Modules::load_file($_model, $path);
         $model = ucfirst($_model);
         CI::$APP->{$_alias} = new $model();
         $this->_ci_models[] = $_alias;
     }
     return CI::$APP->{$_alias};
 }
開發者ID:blekedeg,項目名稱:lbhpers,代碼行數:31,代碼來源:Loader.php

示例10: model

 /**
  * {@inheritdoc}
  */
 public function model($model, $object = NULL, $connect = FALSE)
 {
     $model = $this->_parse_path($model, $this->_ci_model_paths);
     return parent::model($model, $object, $connect);
 }
開發者ID:egig,項目名稱:CodeIgniter-HMVC-Support,代碼行數:8,代碼來源:Loader.php


注:本文中的CI_Loader::model方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。