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


PHP UserInfo::model方法代码示例

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


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

示例1: getUserInfo

 public function getUserInfo()
 {
     if (!$this->_userInfo) {
         $this->_userInfo = UserInfo::model()->findByAttributes(array('email' => $this->username));
     }
     return $this->_userInfo;
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:7,代码来源:UserIdentity.php

示例2: 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($Oauth = false)
 {
     $user = User::model()->findByAttributes(array('email' => $this->username));
     if (!$user) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } elseif (!$user->comparePassword($this->password) && !$Oauth) {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
     } else {
         $this->errorCode = self::ERROR_NONE;
         $userInfo = UserInfo::model()->findByAttributes(array('email' => $this->username));
         $userInfo->upTime = time();
         $userInfo->save();
         if ($userInfo->status == 'frozened') {
             throw new CHttpException(404, '错误!你的账号已被冻结.');
             Yii::app()->end();
         }
         //动态设为超级用户
         if ($userInfo->isAdmin) {
             Yii::app()->user->setIsSuperuser(true);
         }
         //			elseif($userInfo->inRoles(array('superAdmin','admin'))) Yii::app()->user->setIsSuperuser(true);
         $this->_id = $userInfo->id;
         //用setState添加的变量会加入Yii::app()->user的属性中
         $this->setState('displayName', $userInfo->name);
     }
     return !$this->errorCode;
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:35,代码来源:UserIdentity.php

示例3: fioById

 static function fioById($id)
 {
     $model = UserInfo::model()->findByAttributes(['user_id' => $id]);
     if ($model) {
         return $model->surname . ' ' . $model->name . ' ' . $model->otchestvo;
     }
 }
开发者ID:Alamast,项目名称:pravoved,代码行数:7,代码来源:AddQuestion.php

示例4: getInfo

 public static function getInfo($uid, $type)
 {
     if (!$uid || !$type) {
         return false;
     }
     $info = UserInfo::model()->find('uid=:uid AND `name`=:name', array(':uid' => $uid, ':name' => $type));
     return $info['value'];
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:8,代码来源:UserInfo.php

示例5: check

 /**
  * @return bool
  * 检查数据库中是否有相同的用户名
  */
 public function check()
 {
     $user = UserInfo::model()->findByAttributes(array('user_name' => $this->username));
     if (empty($user)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:FavorMylikes,项目名称:ResumeManager,代码行数:13,代码来源:SignForm.php

示例6: userExtraInfo

 public static function userExtraInfo($uid, $type = '')
 {
     $dataProvider = UserInfo::model()->findAllByAttributes(array('uid' => $uid));
     $settings = CHtml::listData($dataProvider, 'name', 'value');
     if (!empty($type)) {
         return $settings[$type];
     } else {
         return $settings;
     }
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:10,代码来源:zmf.php

示例7: actionUpdate

 /**
  * 用户更新资料方法
  * @param  int $userId  用户的ID
  */
 public function actionUpdate($userId)
 {
     // 实例化userInfo表的操作模型,调用updateByPK方法,很好用
     $result = UserInfo::model()->updateByPk($userId, $_POST);
     $arr = $_POST;
     $arr['userId'] = $userId;
     // 将更新的数据再次赋给session
     $_SESSION['userMsg'] = $arr;
     // 跳转
     $this->redirect("index.php?r=reaction/index/act/update/rst/{$result}");
 }
开发者ID:EthanFrancis,项目名称:Laofan_Bbs,代码行数:15,代码来源:UserController.php

示例8: checkUser

 /**
  * 检查用户是否存在
  */
 public function checkUser()
 {
     parent::beforeSave();
     $user = UserInfo::model()->find("name='{$_POST['People']['userName']}'");
     if (!isset($user)) {
         Yii::app()->user->setFlash('error', Yii::t('app', '用户不存在'));
         Yii::app()->controller->redirect(array('create', 'userName' => $_POST['People']['userName']));
     } else {
         $this->userId = $user->id;
         return true;
     }
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:15,代码来源:People.php

示例9: login

 public function login($identity, $duration = 0)
 {
     $result = parent::login($identity, $duration);
     if (!$result) {
         return $result;
     }
     $session = Yii::app()->getSession();
     $info = UserInfo::model()->findByAttributes(['user_id' => $identity->getId()]);
     $session['username'] = $info->name;
     $session['surname'] = $info->surname;
     $session['otchestvo'] = $info->otchestvo;
     return $result;
 }
开发者ID:evgen45115,项目名称:pravoved,代码行数:13,代码来源:User.php

示例10: actionHovercard

 public function actionHovercard()
 {
     $user = UserInfo::model()->findByPk(Yii::app()->user->id);
     if (count($user->noticesUnisChecked) > 0) {
         $dataProvider = new CArrayDataProvider($user->noticesUnisChecked, array('keyField' => 'id'));
         Notice::model()->updateAll(array('isChecked' => 1), 'userId=:userId and isChecked=0', array('userId' => Yii::app()->user->id));
     } else {
         $dataProvider = new CActiveDataProvider('Notice', array('criteria' => array('condition' => 'userId=' . Yii::app()->user->id, 'order' => 'addTime DESC'), 'pagination' => array('pageSize' => 5)));
     }
     Yii::app()->clientScript->scriptMap['*.js'] = false;
     $this->renderPartial('hovercard', array('dataProvider' => $dataProvider), false, true);
     //		$this->renderPartial('hovercard',null,false,true );
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:13,代码来源:NoticeController.php

示例11: actionIndex

 public function actionIndex()
 {
     $this->pageTitle = "论坛首页";
     // 论坛公告
     $notices = Notices::model()->find();
     // 讨论区类别
     $bbsType = BbsType::model()->findAll();
     // 话题计数
     $bbsCount = BbsInfo::model()->count();
     // 回帖计数
     $revCount = Reviews::model()->count();
     // 用户计数
     $userCount = UserInfo::model()->count();
     // 绑定数据
     $data = array('notices' => $notices, 'bbsType' => $bbsType, 'bbsCount' => $bbsCount, 'revCount' => $revCount, 'userCount' => $userCount);
     $this->render('index', $data);
 }
开发者ID:EthanFrancis,项目名称:Laofan_Bbs,代码行数:17,代码来源:IndexController.php

示例12: getNoticeParam

 /**
  *
  */
 private function getNoticeParam($user)
 {
     $mailData['userName'] = $user['name'];
     // 未读的私信
     $mailData['messageDataProvider'] = new CArrayDataProvider(UserInfo::model()->findByPk($user['id'])->messagesReceived, array('keyField' => 'id', 'pagination' => array('pageSize' => 1)));
     // 未读的提醒
     $mailData['noticeDataProvider'] = new CArrayDataProvider(UserInfo::model()->findByPk($user['id'])->notices, array('keyField' => 'id', 'pagination' => array('pageSize' => 3)));
     // 如果没有私信和提醒
     if (!count($mailData['messageDataProvider']->getData()) && !count($mailData['noticeDataProvider']->getData())) {
         $param['nullMailData'] = 1;
         return $param;
     }
     $param['to'] = 'zhanghooyo@qq.com';
     $param['subject'] = 'test title';
     $param['html'] = $this->renderPartial('_mail_template', $mailData, true);
     return $param;
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:20,代码来源:SendNoticeAndMessageMailController.php

示例13: actionGotoPhpems

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionGotoPhpems()
 {
     //取得user
     $user = UserInfo::model()->findByPk(Yii::app()->user->id);
     //准备参数
     $userid = $user->id;
     //用户ID
     $username = $user->name;
     //用户名,GET方式过来
     $email = $user->email;
     //邮箱,GET方式过来
     $ts = time();
     $sign = md5($userid . $username . $email . $this->_sc . $ts);
     //跳转到phpems
     $this->redirect($this->_phpemsurl . '&userid=' . $userid . '&username=' . $username . '&useremail=' . $email . '&ts=' . $ts . '&sign=' . $sign);
     //$this->redirect($this->_phpemsurl,array('exam-api-login'=>'','userid'=>$userid,'username'=>$username,'useremail'=>$email,'ts'=>$ts,'sign'=>$sign));
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:21,代码来源:ConnectController.php

示例14: actionLogin

 /**
  * 登录类登录方法
  */
 public function actionLogin()
 {
     $userName = $_POST['userName'];
     $password = md5($_POST['password']);
     // 实例化userinfo表并调用find方法
     $userInfo = UserInfo::model()->find("userName='{$userName}' AND password='{$password}'");
     // 登录失败跳转提醒
     if ($userInfo == NULL) {
         $result = 0;
         $this->redirect("index.php?r=reaction/index/act/login/rst/{$result}");
     } else {
         // 将从数据库中获取到的userinfo赋给变量,将session转化成一维数组
         $array = array('userId' => $userInfo['userId'], 'userName' => $userInfo['userName'], 'password' => $userInfo['password'], 'mailBox' => $userInfo['mailBox'], 'sex' => $userInfo['sex'], 'address' => $userInfo['address'], 'qq' => $userInfo['qq'], 'tel' => $userInfo['tel'], 'headPic' => $userInfo['headPic'], 'signWord' => $userInfo['signWord']);
         $_SESSION['userMsg'] = $array;
         // 登录成功跳转
         $this->redirect("index.php?r=reaction/index/act/login/rst/1");
     }
 }
开发者ID:EthanFrancis,项目名称:Laofan_Bbs,代码行数:21,代码来源:LoginController.php

示例15: actionAnswer

 /**
  * 为帖子投票
  * Enter description here ...
  * @param unknown_type $postid
  * @param unknown_type $value
  */
 public function actionAnswer($answerid, $value = 0)
 {
     //$vote = new PostVote;
     $vote = AnswerVote::model()->findByAttributes(array('userId' => Yii::app()->user->id, 'answerid' => $answerid));
     $answer = Answer::model()->with('question')->findByPk($answerid);
     if ($vote && $vote->value == $value) {
         //再点击赞同(反对),即取消第一次投的赞同(反对)
         $result = $vote->delete();
     } else {
         //赞同(反对)被第一次点击
         $vote or $vote = new AnswerVote();
         $vote->answerid = $answerid;
         $vote->value = $value;
         $vote->userId = Yii::app()->user->id;
         $vote->addTime = time();
         $result = $vote->save();
         //发送系统通知给回答主人
         if ($answer->userId != $vote->userId) {
             $notice = new Notice();
             $notice->type = 'vote_answer';
             $notice->setData(array('voteId' => $vote->getPrimaryKey()));
             $notice->userId = $answer->userId;
             $notice->save();
         }
     }
     if ($result) {
         //		$question = Question::model()->findByPk($answer->question)
         //修改答案投票次数统计
         $answer->voteupNum = $answer->voteupCount;
         $answer->count_votedown = $answer->votedownCount;
         $answer->save();
         //修改问题投票次数统计
         $answer->question->updateVoteCount();
         //修改用户被赞数量
         $user = UserInfo::model()->findByPk($answer->userId);
         $user->answerVoteupNum = $user->getAnswerVoteupCount();
         $user->save();
         $score = $answer->voteupCount - $answer->votedownCount;
         $this->renderPartial('result', array('score' => $score, 'voteupers' => $answer->voteupers));
     }
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:47,代码来源:VoteController.php


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