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


PHP loadModel函數代碼示例

本文整理匯總了PHP中loadModel函數的典型用法代碼示例。如果您正苦於以下問題:PHP loadModel函數的具體用法?PHP loadModel怎麽用?PHP loadModel使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: __construct

    /**
     * 構造函數
     */
    public function __construct() {
        parent::__construct();
        $this->_model = loadModel('Index');
        $this->_ModelCom = loadModel('Common');
        $this->_admin_model = loadModel('Admin.Admin');
        $this->_openid = isset($_COOKIE['huishi_openid']) ? $_COOKIE['huishi_openid'] : $this->getParam("openid");
        $this->_card_id = $this->getParam("card_id");
        $this->_token = $this->_ModelCom->getAccessToken();

        //獲取openid
        if (!$this->_openid && empty($_COOKIE['huishi_openid'])) {
            $nowUrl = url('Index', 'index', array(), 'index.php');
            $url = "http://call.socialjia.com/Wxapp/weixin_common/oauth2.0/link.php?entid=" . C('ENT_ID') . "&url=" . urlencode($nowUrl);
            header("location:$url");
            exit();
        }

        //獲取card id
        if (!$this->_card_id) {
            //默認獲取第一個card_id
            $id = $this->getParam('id') ? intval($this->getParam('id')) : 1;
            $this->_card_id = $this->_model->getCardId($id);
        }
        //保存openid到數據庫
        if ($this->_openid) {
            $this->_user_id = $this->_model->saveOpenid($this->_openid, $this->_card_id);
        }

        if ($this->_openid && !isset($_COOKIE['huishi_openid'])) {
            setcookie("huishi_openid", $this->_openid, time() + 86400);
            $_COOKIE['huishi_openid'] = $this->_openid;
        }

        $this->assign('title', '惠氏健康生活館會員卡');
    }
開發者ID:neil-chen,項目名稱:NeilChen,代碼行數:38,代碼來源:IndexAction.class.php

示例2: index

function index()
{
    modTitle('Planit | Recheche');
    if (!isCO()) {
        setAlert('Veuillez vous connecter pour faire une recherche', 'warning');
    }
    loadModel('villes');
    $k['villes'] = getAllVille();
    set($k);
    if (!empty($_POST)) {
        $ok = 0;
        foreach ($_POST as $post) {
            if (!empty($post)) {
                $ok = 1;
                break;
            }
        }
        if ($ok) {
            loadModel('recherche');
            $v['result'] = search_result($_POST);
            if (empty($v['result'])) {
                setAlert('Aucun resultat trouve', 'warning');
            }
            set($v);
        } else {
            setAlert('Remplir au moins un champs', 'danger');
        }
    }
    render();
}
開發者ID:kasuke5,項目名稱:planit,代碼行數:30,代碼來源:recherche.php

示例3: __construct

 public function __construct(){
     parent::__construct();
     $this->_Model = loadModel('Index.Cardto');
     /*$this->_openid = $this->getParam("openid");
     if(!isset($_COOKIE['5100openid']) || empty($_COOKIE['5100openid']) ){
         if (!isset($this->_openid) && empty($this->_openid)) {
             $nowUrl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
             $url = "http://call.socialjia.com/Wxapp/weixin_common/oauth2.0/link.php?entid=" . C('ENT_ID') . "&url=" . urlencode($nowUrl);
             header("location:$url");
             exit;    
         }
         setcookie("5100openid", $this->_openid, time() + 86400);
         $_COOKIE['5100openid'] = $this->_openid;       
     }else{
         $this->_openid = $_COOKIE['5100openid'];    
     }*/
     $this->_openid = $this->_openId;
     //$this->_openid = 'oaCwJs_TMDNrapbDen7v1sBfdu6I';
                                                                                                             
     //$partner = $this->_Model->getPartner($this->_openid);
     
     //$this->assign('partner', $partner);
     $this->assign('openid', $this->_openid); 
     
 }               
開發者ID:neil-chen,項目名稱:NeilChen,代碼行數:25,代碼來源:ObtaincardAction.class.php

示例4: __construct

 public function __construct()
 {
     $this->db = loadModel('session_model');
     $this->lifetime = loadConfig('config', 'session_ttl');
     session_set_save_handler(array(&$this, 'open'), array(&$this, 'close'), array(&$this, 'read'), array(&$this, 'write'), array(&$this, 'destroy'), array(&$this, 'gc'));
     session_start();
 }
開發者ID:iquanxin,項目名稱:march,代碼行數:7,代碼來源:session.cls.php

示例5: manageSubjects

function manageSubjects($config, $parameters)
{
    if (!isset($_SESSION['uname']) || isset($_SESSION['urole']) && 3 != $_SESSION['urole']) {
        header('Location: /');
        exit;
    }
    $userName = $_SESSION['uname'];
    loadModel('models/Students');
    $profile = getStudentByStudentUserName($config, $userName);
    if (!$profile['status']) {
        return ['status' => false, 'message' => 'Invalid student profile found.'];
    }
    $student = $profile['student'];
    loadModel('models/Subjects');
    $remainingSubjects = getSubjectsNotTakenByStudent($config, $student['ID']);
    if (!$remainingSubjects['status']) {
        return ['status' => false, 'message' => 'An error occured while trying to get remaining subjects.'];
    }
    if ('POST' == getRequestMethod()) {
        if (!isset($_SESSION['uname'])) {
            header('Location: /students');
        }
        $studentName = $_SESSION['uname'];
        $result = addSubjectsToStudent($config, array_merge(['UserName' => $studentName], $_POST));
        $_SESSION['addStatus'] = $result['status'];
        $_SESSION['addStatusMessage'] = $result['message'];
        header('Location: /students');
    }
    return $remainingSubjects;
}
開發者ID:redspade-redspade,項目名稱:academetrics,代碼行數:30,代碼來源:profile.php

示例6: startup

 /**
  * Startup - Link the component to the controller.
  *
  * @param controller
  */
 function startup(&$controller)
 {
     $this->controller =& $controller;
     if (!isset($this->Acl->Aro)) {
         loadModel('Aro');
         loadModel('Aco');
         $this->Acl->Aro = new Aro();
         // Temporary
         $this->Acl->Aco = new Aco();
         // Temporary
     }
     $this->aro = $this->getAro();
     $this->aco = $this->getAco(null, 'ROOT');
     if (isset($this->controller->publicAccess) && $this->controller->publicAccess || $this->controller->_isRequestAction()) {
         return true;
     }
     if (low($this->name) == 'app') {
         // It's an error don't do anything
     } elseif ($this->controller->here == '/') {
         // don't do anything for the root url to avoid loops
     } else {
         if (isset($this->params[CAKE_ADMIN])) {
             if ($this->aro != $this->siteAdmin) {
                 $this->accessDenied($this->aro, 'ADMIN');
             }
         }
         if (!$this->checkACL($this->aro, $this->aco)) {
             $this->accessDenied($this->aro, $this->aco);
         }
     }
 }
開發者ID:javan-it-services,項目名稱:internal,代碼行數:36,代碼來源:a_c.php

示例7: addAdditionalArgs

	protected function addAdditionalArgs( $tpl_args ){
		// get recent properties
		if ($account_user = EntityAggregator::GetCurrent()->getEntity(EntityType::ACCOUNT_USER)) {

		} else {
			$account_user = EntityAggregator::GetCurrent()->getEntity(EntityType::ANONYMOUS_USER);
		}
		$recent_properties = $account_user->getRecentItemsByType(RecentItemsTypes::PROPERTY)->getItems();
		$tpl_args['recent_properties'] = array();
		foreach ($recent_properties as $recent_prop) {
			$recent_prop->load_info(PropertyLoadLevel::IDX_SUMMARY);
			$tpl_args['recent_properties'][] = $recent_prop->getAsDictionary();
		}

		// get property notes
		loadModel( '/entities/EntityAggregator' );
		if( $account_user instanceof AccountUser ){
			loadModel( '/property/FavoriteProperty' );
			try{
				$favProp = new FavoriteProperty( $account_user->get_id(), $tpl_args['company_property_id'] );
				$tpl_args['enterprise_account_note'] = $favProp->notes;
			}
			catch( Exception $e ){
				//Not a fav property.
			}
		}

		return $tpl_args;
	}
開發者ID:nicholasbooj,項目名稱:Enterprise_Boilerplate,代碼行數:29,代碼來源:ctrl_Property.action.php

示例8: _auth

    /**
     * 權限認證
     */
    private function _auth() {
        $action = $this->getParam('a');
        $method = $this->getParam('m');

        // 如果是 AJAX 不做處理
        if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
            return true;
        }

        // 過濾白名單
        if (in_array($action, array_keys($this->_noPartnerAuth))) {

            if (in_array($method, $this->_noPartnerAuth[$action])) {
                return true;
            }
        }

        //檢查用戶是否合夥人,如果不是則重定向到 合夥人申請頁
        $partner = loadModel('Index.User')->getPartner($this->_openId);
        //申請通過,申請未通過的 不執行跳轉
        if ($partner['state'] != 1 && $partner['state'] != 2) {
            $url = url('User', 'index', null, 'index.php');
            header("location:$url");
            exit();
        }
    }
開發者ID:neil-chen,項目名稱:NeilChen,代碼行數:29,代碼來源:WebAction.class.php

示例9: index

function index()
{
    modTitle('Planit | Gérer les vols');
    loadModel('ajouter_vol');
    $v['vols'] = getAllVol();
    set($v);
    render();
}
開發者ID:kasuke5,項目名稱:planit,代碼行數:8,代碼來源:gerer_vol.php

示例10: getPartnerList

    /**
     * 根據條件獲取合夥人列表
     * @param array $param
     * @param String $fields  需要獲取的字段
     * return  合夥人數組
     */
    public function getPartnerList($param, $fields = "*") {
        $where = "1";
        if (!empty($param['name'])) {
            $where .= " AND (p.name LIKE '%{$param['name']}%' OR p.phone LIKE '%{$param['name']}%' OR p.code LIKE '%{$param['name']}%')";
        }
        if (!empty($param['sTime'])) {
            $where.= " AND p.create_time >='" . $param['sTime'] . ' 00:00:00' . "'";
        }
        if (!empty($param['eTime'])) {
            $where.= " AND p.create_time <='" . $param['eTime'] . ' 23:59:59' . "'";
        }
        if ($param['state'] >= 0 && $param['state'] != '') {
            $where .= " AND p.state = {$param['state']}";
        }
        if (!empty($param['sex'])) {
            $where .= " AND p.sex = {$param['sex']}";
        }
        if (!empty($param['grade'])) {
            $score = $this->getPartnerLevel($param['grade']);
            $where .= " AND p.integral >= {$score['from_score']} AND p.integral < {$score['score']}";
        }
        if (!empty($param['channel'])) {
            $where .= " AND p.channel = {$param['channel']}";
        }
        if (!empty($param['ids'])) {
            $where .= " AND p.id IN ({$param['ids']})";
        }

        $sql = "SELECT {$fields} FROM wx_partner_info p 
                LEFT JOIN wx_partner_statistics ps ON p.openid = ps.openid
                WHERE {$where} {$param['special']} {$param['order']} ";

        if (isset($param['limit']) && $param['limit']) {
            $sql .= " {$param['limit']} ";
        }
        $data = $this->_db->getAll($sql);

        //獲取渠道列表
        $channel = loadModel('Admin.Channel')->getlist();
        $keyChannel = array();
        foreach ($channel as $val) {
            $keyChannel[$val['id']] = $val;
        }
        
        if ($data) {
            foreach ($data as $k => $v) {
                $data[$k] = $v;
                //獲取用戶等級
                $level = $this->getPartnerLevelByScore($v['integral']);
                $data[$k]['level'] = $level;
                $data[$k]['level_name'] = $level['name'];
                $data[$k]['state_name'] = $this->_status[$v['state']];
                $data[$k]['gender'] = $this->_sex[$v['sex']];
                $data[$k]['channel_name'] = $v['channel'] ? $keyChannel[$v['channel']]['name'] : '-';
            }
        }
        return $data;
    }
開發者ID:neil-chen,項目名稱:NeilChen,代碼行數:64,代碼來源:PartnerModel.class.php

示例11: index

function index($config, $parameters)
{
    loadModel('models/Subjects');
    $subjects = getAllSubjects($config);
    if ($subjects['status']) {
        return $subjects;
    }
    return ['status' => false, 'message' => 'An error occured while trying to retrieve Subjects records.', 'code' => 500];
}
開發者ID:redspade-redspade,項目名稱:academetrics,代碼行數:9,代碼來源:subjects.php

示例12: __construct

 /**
  * 構造方法,初始化
  */
 public function __construct() {
     parent::__construct();
     $this->_statusConfig = array(
         '0' => '待審核',
         '1' => '已補充',
         '2' => '拒絕補充'
     );
     $this->_partnerModel = loadModel('Admin.Partner');
     $this->_db = $this->getDb();
 }
開發者ID:neil-chen,項目名稱:NeilChen,代碼行數:13,代碼來源:CardModel.class.php

示例13: init

 /**
  * Initialize the Cache Engine
  *
  * Called automatically by the cache frontend
  * To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
  *
  * @param array $setting array of setting for the engine
  * @return boolean True if the engine has been successfully initialized, false if not
  * @access public
  */
 function init($settings)
 {
     parent::init($settings);
     $defaults = array('className' => 'Cache', 'fields' => array('data', 'expires'));
     $this->settings = am($this->settings, $defaults, $settings);
     if (!class_exists($this->settings['className']) && !loadModel($this->settings['className'])) {
         $this->__Model = new $modelName();
     } else {
         $this->__Model = new Model(array('name' => $this->settings['className']));
     }
 }
開發者ID:rhencke,項目名稱:mozilla-cvs-history,代碼行數:21,代碼來源:model.php

示例14: init

 /**
  * Initialize the fixture.
  *
  */
 function init()
 {
     if (isset($this->import) && (is_string($this->import) || is_array($this->import))) {
         $import = array();
         if (is_string($this->import) || is_array($this->import) && isset($this->import['model'])) {
             $import = am(array('records' => false), ife(is_array($this->import), $this->import, array()));
             $import['model'] = ife(is_array($this->import), $this->import['model'], $this->import);
         } elseif (isset($this->import['table'])) {
             $import = am(array('connection' => 'default', 'records' => false), $this->import);
         }
         if (isset($import['model']) && (class_exists($import['model']) || loadModel($import['model']))) {
             $model =& new $import['model']();
             $db =& ConnectionManager::getDataSource($model->useDbConfig);
             $db->cacheSources = false;
             $this->table = $this->useTable;
             $schema = $model->schema(true);
             $this->fields = $schema->value;
             $this->fields[$model->primaryKey]['key'] = 'primary';
         } elseif (isset($import['table'])) {
             $model =& new Model(null, $import['table'], $import['connection']);
             $db =& ConnectionManager::getDataSource($import['connection']);
             $db->cacheSources = false;
             $model->name = Inflector::camelize(Inflector::singularize($import['table']));
             $model->table = $import['table'];
             $model->tablePrefix = $db->config['prefix'];
             $schema = $model->schema(true);
             $this->fields = $schema->value;
         }
         if ($import['records'] !== false && isset($model) && isset($db)) {
             $this->records = array();
             $query = array('fields' => array_keys($this->fields), 'table' => $db->name($model->table), 'alias' => $model->name, 'conditions' => array(), 'order' => null, 'limit' => null);
             foreach ($query['fields'] as $index => $field) {
                 $query['fields'][$index] = $db->name($query['alias']) . '.' . $db->name($field);
             }
             $records = $db->fetchAll($db->buildStatement($query, $model), false, $model->name);
             if ($records !== false && !empty($records)) {
                 $this->records = Set::extract($records, '{n}.' . $model->name);
             }
         }
     }
     if (!isset($this->table)) {
         $this->table = Inflector::underscore(Inflector::pluralize($this->name));
     }
     if (!isset($this->primaryKey) && isset($this->fields['id'])) {
         $this->primaryKey = 'id';
     }
     if (isset($this->fields)) {
         foreach ($this->fields as $index => $field) {
             if (empty($field['default'])) {
                 unset($this->fields[$index]['default']);
             }
         }
     }
 }
開發者ID:rhencke,項目名稱:mozilla-cvs-history,代碼行數:58,代碼來源:cake_test_fixture.php

示例15: submitLogin

 public function submitLogin()
 {
     $user = $this->input->post('username');
     $pass = $this->input->post('password');
     $this->load->helper('database');
     loadModel('login_model');
     if ($this->login_model->login($user, $pass)) {
         # code...
     }
     // echo $this->login_model->login($user, $pass);
 }
開發者ID:bwood1,項目名稱:InternetSecurityProject,代碼行數:11,代碼來源:welcome.php


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