当前位置: 首页>>代码示例>>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;未经允许,请勿转载。