当前位置: 首页>>代码示例>>PHP>>正文


PHP user::model方法代码示例

本文整理汇总了PHP中user::model方法的典型用法代码示例。如果您正苦于以下问题:PHP user::model方法的具体用法?PHP user::model怎么用?PHP user::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在user的用法示例。


在下文中一共展示了user::model方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionGetUsers

 public function actionGetUsers()
 {
     $keyword = addslashes(trim($_GET['keyword']));
     $condition = "1=1 ";
     if ($keyword) {
         $condition = $condition . " and name like '%{$keyword}%'";
     }
     if (isset($_GET['page_num']) && is_numeric($_GET['page_num'])) {
         $page_num = intval($_GET['page_num']);
     } else {
         $page_num = 1;
     }
     if (isset($_GET['page_size']) && is_numeric($_GET['page_size'])) {
         $page_size = intval($_GET['page_size']);
     } else {
         $page_size = 10;
     }
     $result = UserManager::findAll($page_num, $page_size, $condition);
     //pagination
     $criteria = new CDbCriteria();
     $criteria->condition = $condition;
     $records = user::model()->findAll($criteria);
     $number = count($records);
     $sum_page = ceil($number / $page_size);
     $result = array('sum_page' => $sum_page, 'data' => $result, 'sum_count' => $number);
     echo CJSON::encode($result);
 }
开发者ID:Renbaozhan,项目名称:ecar,代码行数:27,代码来源:MoveCarController.php

示例2: actionIndex

 public function actionIndex()
 {
     $access = parent::getAccess();
     if (0 < $access) {
         $this->ajaxReturn(array("login" => true, "formhash" => FORMHASH, "uid" => Yii::app()->user->uid, "user" => user::model()->fetchByUid(Yii::app()->user->uid)), "JSONP");
     } else {
         $this->ajaxReturn(array("login" => false, "msg" => "登录已超时,请重新登录"), "JSONP");
         exit;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:10,代码来源:DefaultController.php

示例3: authenticate

 /**
  * Authenticates a user.
  * The example implementation makes sure if the username and password
  * are both 'demo'.
  * In practical applications, this should be changed to authenticate
  * against some persistent user identity storage (e.g. database).
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     $userInfo = user::model()->find('username = :name', array(':name' => $this->username));
     if ($userInfo == NULL) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
         return false;
     }
     if ($userInfo['password'] != md5($this->password)) {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
         return false;
     }
     $this->errorCode = self::ERROR_NONE;
     return true;
 }
开发者ID:xupp,项目名称:yii,代码行数:22,代码来源:UserIdentity.php

示例4: authenticate

 /**
  * Authenticates a user.
  * The example implementation makes sure if the username and password
  * are both 'demo'.
  * In practical applications, this should be changed to authenticate
  * against some persistent user identity storage (e.g. database).
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     $user = user::model()->find('username=:username', array(':username' => $this->username));
     if ($user == null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } elseif (!$user->validatePassword($this->password)) {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
     } else {
         $this->_id = $user->id;
         $this->setState('userid', $user->id);
         $this->setState('username', $this->username);
         $this->errorCode = self::ERROR_NONE;
     }
     return $this->errorCode == self::ERROR_NONE;
 }
开发者ID:liudaiming,项目名称:Datastructure,代码行数:23,代码来源:UserIdentity.php

示例5: authenticate

 /**
  * Authenticates a user.
  * The example implementation makes sure if the username and password
  * are both 'demo'.
  * In practical applications, this should be changed to authenticate
  * against some persistent user identity storage (e.g. database).
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     $username = $this->username;
     $password = $this->password;
     $user = user::model()->find(array('condition' => "username='{$username}'"));
     if (!empty($user)) {
         if ($password == $user->password) {
             $this->errorCode = self::ERROR_NONE;
             $this->setState('user', $user->username);
             $this->setState('id', $user->id);
         } else {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         }
     } else {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     }
     return !$this->errorCode;
 }
开发者ID:Rakesh69,项目名称:myapp,代码行数:26,代码来源:UserIdentity.php

示例6: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = user::model()->findbyPk($_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
开发者ID:dalinhuang,项目名称:styleshop,代码行数:16,代码来源:UserController.php

示例7: array

?>
	 </div>
    </div>
 </div>

 <div class="row">
	<div class="form-group">
     <div class="span2">
		<?php 
echo $form->labelEx($model, 'created_by');
?>
        </div>
        <div class="col-sm-8 clearLeftPadding">
		<?php 
//echo $form->textField($model,'created_by');
echo $form->dropDownList($model, 'created_by', CHtml::listData(user::model()->findAll(array('select' => 'id, username', 'order' => 'username')), 'id', 'username'), array('empty' => '- Select -'));
?>
		<?php 
echo $form->error($model, 'created_by');
?>
	 </div>
    </div>
 </div>

 <div class="row">
	<div class="form-group">
     <div class="span2">
		<?php 
echo $form->labelEx($model, 'is_current');
?>
        </div>
开发者ID:artmart,项目名称:verare,代码行数:31,代码来源:_form.php

示例8: activeEmployer

 public static function activeEmployer($id)
 {
     $user = user::model()->findByPk($id);
     $user->activated = 1;
     $user->save(false);
 }
开发者ID:erick305,项目名称:testing,代码行数:6,代码来源:User.php

示例9: actionPassword

 public function actionPassword()
 {
     $password = 'abc123456';
     $user = user::model()->createPassword($password);
     var_dump($user);
 }
开发者ID:liudaiming,项目名称:Datastructure,代码行数:6,代码来源:UserController.php

示例10: actionUpdatepw

 public function actionUpdatepw()
 {
     if (!API_UPDATEPW) {
         echo API_RETURN_FORBIDDEN;
     }
     $username = $_GET['username'];
     $password = $_GET['password'];
     $user = user::model()->findByAttributes(array('username' => $username));
     if ($user !== null) {
         $user->password = md5($password);
         if ($user->save()) {
             echo API_RETURN_SUCCEED;
         } else {
             echo API_RETURN_FAILED;
         }
     } else {
         echo API_RETURN_FAILED;
     }
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:19,代码来源:UcController.php

示例11: model

 /**
  * Returns the static model of the specified AR class.
  * @param string $className active record class name.
  * @return user the static model class
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
开发者ID:nitinprajapati1404,项目名称:YiiGeneralAdmin,代码行数:9,代码来源:user.php


注:本文中的user::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。