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


PHP UserModel::getUserById方法代码示例

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


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

示例1: __construct

 /**
  * If you want a new instance based on a known id, enter the $id
  * Else we will try to create a new instance based on the session information
  * which was set at authentication.
  * @param int $id 
  */
 public function __construct($id = null)
 {
     $model = new UserModel();
     // We want a new user object and we know the ID
     if ($id != null) {
         $userdata = $model->getUserById($id);
         $this->_data = $userdata;
     } else {
         // We want a new user object based on the current logged in user
         if (isset($_SESSION['userid'])) {
             $userdata = $model->getUserById($_SESSION['userid']);
             $this->_data = $userdata;
         }
     }
 }
开发者ID:sandervanmook,项目名称:forums,代码行数:21,代码来源:User.php

示例2: run

 public function run()
 {
     $autorize = Project::getSecurityManager()->getAutorize();
     $controller_class = $autorize->getController()->name;
     $controller = new $controller_class();
     $controller->init($autorize->getController(), $autorize->getAction());
     $action_function = $autorize->getAction()->name . 'Action';
     setcookie('PHPSESSID', session_id(), null, null, Project::getUser()->getDbUser()->login . '.next24.ru');
     $controller->{$action_function}();
     $this->_request_complete = true;
     // Сохраняем время пользователя на серваке
     $user = Project::getUser()->getDbUser();
     if ($user->id) {
         $userModel = new UserModel();
         $userModel->refreshUsersOnline();
         if (!$userModel->isUserOnline($user->id)) {
             $userModel->addUserOnline($user->id);
         } else {
             $userModel->updateUserOnline($user->id);
         }
         $userModel = new UserModel();
         $user = $userModel->getUserById($user->id);
         $userModel->checkForUserBans($user);
     }
     // END Сохраняем время пользователя на серваке
     return $controller;
 }
开发者ID:amanai,项目名称:next24,代码行数:27,代码来源:CApp.php

示例3: index

 public function index()
 {
     //var_dump($_SESSION['qq']);
     $articleId = $_GET['articleId'];
     $article = new ArticleModel();
     $content = $article->getArticleById($articleId);
     $collect = new CollectModel();
     $comment = new CommentModel();
     $commentNum = $comment->getCommentCountByArticleId($articleId);
     $content['commentNum'] = $commentNum;
     if ($this->isLogin()) {
         if ($collect->getCollects($article, $_SESSION['qq']['userId'])) {
             $this->assign('collects', '已收藏');
         } else {
             $collectNum = $collect->getCollectCountByuserId($article);
             $this->assign('collectNum', $collectNum);
             $this->assign('collects', '收藏');
         }
     }
     $this->assign('article', $content);
     //评论查询
     $comments = $comment->getComment($articleId);
     $user = new UserModel();
     $arr = array();
     foreach ($comments as $key => $val) {
         $val[$key]['user'] = $user->getUserById($val['userId']);
     }
     $this->assign('comments', $comments);
     $this->display();
 }
开发者ID:Jnnock,项目名称:myyyk,代码行数:30,代码来源:ArticleCtrl.class.php

示例4: imageAction

 public function imageAction()
 {
     $userModel = new UserModel();
     $userData = $userModel->fetchRow($userModel->getUserById($_GET['user']));
     //print_r($userData);
     if ($userData['nmuserimage'] == '') {
         $userData['nmuserimage'] = 'noUserPhoto_flat.png';
     }
     $this->view->image = $userData['nmuserimage'];
 }
开发者ID:robertsonmello,项目名称:projetos,代码行数:10,代码来源:LoginController.php

示例5: sendMessage

 function sendMessage($user_id, $subject, $cause, $url_referer)
 {
     $userModel = new UserModel();
     $user = $userModel->getUserById($user_id);
     if ($user) {
         $mailer = new PHPMailer();
         $mailer->CharSet = "utf-8";
         $mailer->From = "info@next24.ru";
         $mailer->FromName = "Next24.ru";
         $mailer->Subject = $subject;
         $sReferer = $url_referer ? "Ссылка " . $url_referer : "";
         $body = $subject . " <br>Описание: " . $cause . " <br>" . $sReferer;
         $alt_body = $subject . " \nОписание: " . $cause . " \n" . $sReferer;
         $mailer->Body = $body;
         $mailer->AltBody = $alt_body;
         $mailer->AddAddress($user['email'], $user['first_name'] . " " . $user['middle_name'] . " " . $user['last_name']);
         $mailer->Send();
     }
 }
开发者ID:amanai,项目名称:next24,代码行数:19,代码来源:WarningModel.php

示例6: addGomeAction

 public function addGomeAction()
 {
     Zend_Loader::loadClass('UserModel');
     $user_model = new UserModel();
     $params = $this->_arrParam;
     if ($this->_request->isPost()) {
         try {
             if (!empty($this->_user)) {
                 $user = $user_model->getUserById($this->_user->user_id);
                 if (!empty($user) && count($user)) {
                     if ($user['user_gome'] + $params["gome"] >= 0) {
                         $user_model->update(array("user_gome" => $user['user_gome'] + $params["gome"]), "user_id = " . $this->_user->user_id);
                         $data = array("code" => 1, "content" => array("user_gome" => $user['user_gome'] + $params["gome"]));
                     } else {
                         $data = array("code" => 0, "content" => "Not enough gome");
                     }
                 } else {
                     $data = array("code" => 0, "content" => "Invalid user");
                 }
             } else {
                 $data = array("code" => 0, "content" => "Authentication failed");
             }
         } catch (exception $e) {
             $data = array("code" => 0, "content" => "Error in server");
         }
         echo json_encode($data);
     }
     exit;
 }
开发者ID:backviet01,项目名称:zegome-service,代码行数:29,代码来源:IndexController.php

示例7: loadFarm

 /**
  * 加载好友农场
  *
  * @param $channel
  */
 private function loadFarm($channel = 'load_farm')
 {
     // 好友ID
     $uid = (string) $this->input->id;
     $ret = new stdClass();
     $ret->channel = trim($channel);
     $ret->state = 'ok';
     $ret->farm = new stdClass();
     $ret->farm->map = $this->getUserMaps($uid);
     // 获得邻居个人资料
     $user = new UserModel();
     $info = $user->getUserById($uid);
     $ret->farm->size_x = isset($info->size_x) ? $info->size_x : 0;
     $ret->farm->size_y = isset($info->size_y) ? $info->size_y : 0;
     $ret->farm->top_map_size = isset($info->top_map_size) ? $info->top_map_size : 0;
     unset($user, $info);
     $ret->farm->uid = $uid;
     $ret->farm->helped = true;
     $ret->farm->has_app = true;
     $ret->farm->help_xp = self::HELP_XP;
     $ret->farm->help_coins = self::HELP_COINS;
     // 判断今天是否浇过地
     if ($uid != $this->uid) {
         $neighbor = new NeighborsModel();
         $data = $neighbor->getNeighborByUidAndNuid($this->uid, $uid);
         if ($data) {
             $this->debugMsg($neighbor->getLastQuery());
             if ($this->timestamp - $data->last_help_time >= self::HELP_TIME) {
                 $ret->farm->helped = false;
             }
             unset($neighbor);
         }
     }
     if ($this->debug) {
         $ret->demsg = $this->demsg;
     }
     return $ret;
 }
开发者ID:atlas1308,项目名称:testtesttestfarm,代码行数:43,代码来源:DataHandler.php

示例8: testModifyUserById

 public function testModifyUserById()
 {
     $table = new UserModel();
     $ret = $table->getUserByPhone('222222');
     $table->modifyUserById($ret['id'], null, '李四改', '武汉', 'abc123', 'abc123', 'tmp.jpg');
     $ret = $table->getUserById($ret['id']);
     $this->assertTrue($ret['phone'] == '222222' && $ret['nickname'] == '李四改' && $ret['address'] == '武汉' && $ret['img'] == 'tmp.jpg');
     $ret = $table->getUserByPhone('222222');
     $ret = $table->modifyUserById($ret['id'], '111111');
     $this->assertTrue($ret == false);
     $this->assertTrue($table->getError()['phone'] == '手机号码已被注册');
     $ret = $table->modifyUserById($ret['id'], null, '真图');
     $this->assertTrue($ret == false);
     $this->assertTrue($table->getError()['nickname'] == '昵称不能用');
     $ret = $table->getUserByPhone('222222');
     $table->modifyUserById($ret['id'], null, '李四改改', '武汉', 'abc123', 'bb', 'tmp.jpg');
     $this->assertTrue($table->getError()['repassword'] == '两次输入密码不一致');
 }
开发者ID:chen8840,项目名称:LMJ-s-project,代码行数:18,代码来源:UserModelTest.php

示例9: deleteAction

 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function deleteAction($id)
 {
     $user = UserModel::getUserById($id);
     if ($id == '1') {
         $this->redirect[] = array('text' => '用户列表', 'href' => $this->forward);
         $this->message('系统用户不能删除', self::MSG_ERROR, true);
     }
     $administrator = $user['user_name'];
     $flag = $this->db->update('{{admin}}', array('status' => UserModel::STAT_STATUS_DELETED), 'user_id=:user_id', array(':user_id' => $id));
     if ($flag) {
         //记录操作日志
         $message = '{user_name}删除了管理员{administrator}';
         $data = array('administrator' => $user['username'], 'data' => $user);
         UserLogsModel::inst()->add('Admin/Admin', $user['user_id'], 'Delete', 'success', $message, $data);
     }
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $this->redirect[] = array('text' => '', 'href' => $this->forward);
         $this->message('删除管理员信息完成', self::MSG_SUCCESS, true);
     }
 }
开发者ID:nbaiwan,项目名称:yav,代码行数:26,代码来源:Movie.php

示例10: returnDoStakePage

 function returnDoStakePage($lastStakeId)
 {
     $sessiovVars = Project::getSession();
     $idNow = $sessiovVars->getKey('idNow');
     //echo $idNow." == ".$lastStakeId.";";
     if ($lastStakeId && $idNow < $lastStakeId) {
         $sessiovVars->add('idNow', $lastStakeId);
         $debateModel = new DebateModel();
         $userModel = new UserModel();
         $debateNow = $debateModel->getDebateNow();
         $message['debateNow'] = $debateNow;
         $user = Project::getUser()->getDbUser();
         if (!$user->id) {
             $user->id = 0;
         }
         $message['user_id'] = $user->id;
         $userNumber = $debateModel->getUserNumber($debateNow, $user->id);
         $message['userNumber'] = $userNumber;
         $currentUser = $userModel->getUserById($user->id);
         $message['currentUser'] = $currentUser;
         $user1 = $userModel->getUserById($debateNow['user_id_1']);
         $message['debateUser1'] = $user1;
         $user2 = $userModel->getUserById($debateNow['user_id_2']);
         $message['debateUser2'] = $user2;
         $aUserStakes = $debateModel->getDebateStakesByUserId($user->id, 0);
         $message['aUserStakes'] = $aUserStakes;
         if ($userNumber) {
             $isReady = $debateNow['is_ready_' . $userNumber] ? true : false;
             $message['isReady'] = $isReady;
             $message['stakesCount'] = $debateModel->getDebateStakesCount($user->id, 0);
             $message['stakesSum'] = $debateModel->getDebateStakesSum($user->id, 0);
         } else {
             $message['stakesCount'] = $debateModel->getDebateStakesCount(0, 0);
             $message['stakesSum'] = $debateModel->getDebateStakesSum(0, 0);
         }
         $this->_view->returnDoStakePage($message);
         $this->_view->ajax();
     }
 }
开发者ID:amanai,项目名称:next24,代码行数:39,代码来源:DebateController.php

示例11: albumInfo

 public function albumInfo()
 {
     $blogerId = Data::get($_GET['blogerId'], Data::Int);
     $albumId = Data::get($_GET['albumId'], Data::Int);
     if (!is_int($blogerId) && $blogerId <= 0) {
         R('Index', 'index');
     }
     if (!is_int($albumId) && $albumId <= 0) {
         R('Index', 'index');
     }
     // $blogerId=$_GET['blogerId'];
     // $albumId=$_GET['albumId'];
     $album = new AlbumModel();
     $albums = $album->getAlbumById($albumId);
     $photo = new PhotosModel();
     $photos = $photo->getPhotos($albumId);
     $time = 0;
     foreach ($photos as $v) {
         $addtime = strtotime($v['addTime']);
         if ($time < $addtime) {
             $time = $addtime;
         }
     }
     $time = date("Y-m-d H:i:s", $time);
     $photoCount = $photo->getPhotosCountByAlbumId($albumId);
     $comment = new CommentModel();
     $a = $comment->getCommentByAlbumId($albumId);
     $user = new UserModel();
     $comments = array();
     foreach ($a as $v) {
         $users = $v;
         $users['user'] = $user->getUserById($v['userId']);
         $comments[] = $users;
     }
     //博主个人信息
     $blogerInfo = $this->getBlogerInfo($blogerId);
     $this->assign('blogerInfo', $blogerInfo);
     //某博主信息
     $count = $this->articleCount($blogerId);
     $this->assign('count', $count);
     //某博主文章总数
     //获取所有文章标签
     $allTags = $this->getAllTags();
     $this->assign("allTags", $allTags);
     //所有文章标签
     //获取所有文章分类
     $allTypes = $this->getAllTypes($blogerId);
     $this->assign("allTypes", $allTypes);
     //某人所有文章分类
     $latestComments = $this->getLatestComments($blogerId, '0,3');
     $this->assign('latestComments', $latestComments);
     //最新三条评论
     //用户个人信息
     $allUserInfo = $this->getAllUserInfo();
     $this->assign('allUserInfo', $allUserInfo);
     //某用户信息
     //该相册下的所有评论
     $this->assign('comments', $comments);
     //该相册下的所有相片
     $this->assign('photos', $photos);
     //相片最后的添加时间
     $this->assign('time', $time);
     //相册的相片数
     $this->assign('photoCount', $photoCount);
     //相册的部分信息
     $this->assign('album', $albums);
     $this->display();
 }
开发者ID:Jnnock,项目名称:myyyk,代码行数:68,代码来源:IndexCtrl.class.php

示例12: UserModel

									<th>Количество голосов</th>
								</tr>
							</thead>
							<tbody>
			<?php 
$userModel = new UserModel();
$i = 1;
foreach ($this->aDebateHistory as $debateHistory) {
    if ($i / 2 == 1) {
        $tr_id = "";
        $i = 1;
    } else {
        $tr_id = "cmod_tab2";
        $i++;
    }
    $user1 = $userModel->getUserById($debateHistory['user_id_1']);
    $user2 = $userModel->getUserById($debateHistory['user_id_2']);
    $helper1_1 = $userModel->getUserById($debateHistory['helper_id_1_1']);
    $helper1_2 = $userModel->getUserById($debateHistory['helper_id_1_2']);
    $helper2_1 = $userModel->getUserById($debateHistory['helper_id_2_1']);
    $helper2_2 = $userModel->getUserById($debateHistory['helper_id_2_2']);
    echo '
	    		<tr id="' . $tr_id . '">
	       			<td>' . $debateHistory['start_time'] . '</td>
	       			<td>' . $debateHistory['theme'] . '</td>
	       			<td>
	           			<a href="' . $this->createUrl('User', 'Profile', null, $user1['login']) . '">' . $user1['login'] . '</a><br/>[';
    if ($helper1_1) {
        echo '<a href="' . $this->createUrl('User', 'Profile', null, $helper1_1['login']) . '">' . $helper1_1['login'] . '</a>';
    }
    if ($helper1_1 && $helper1_2) {
开发者ID:amanai,项目名称:next24,代码行数:31,代码来源:debate_history.tpl.php

示例13: SendMessageAction

 public function SendMessageAction()
 {
     $messagesModel = new MessagesModel();
     $friendModel = new FriendModel();
     $userModel = new UserModel();
     $user = Project::getUser()->getDbUser();
     $request = Project::getRequest();
     $this->_view->clearFlashMessages();
     $message_to = $request->message_to;
     $mess_header = trim($request->mess_header);
     $m_text = trim($request->m_text);
     $recipient_name = trim($request->recipient_name);
     //	    $this -> _view -> assign('tab_list', TabController::getOwnTabs(false, false, false, false, false, false, false, false, true));
     $this->_view->assign('tab_list', TabController::getOwnTabs(false, false, false, false, false, false, false, false, false, true));
     if ($request->message_action == 'new_message') {
         $noErrors = true;
         if (!$request->recipient && !$recipient_name && $message_to != "admin") {
             $this->_view->addFlashMessage(FM::ERROR, "Выберите из списка друзей или введите имя вручную");
             $noErrors = false;
         } else {
             if ($message_to == "admin") {
                 $aAdmins = $userModel->getUsersByType(1);
             } else {
                 $recipient_name = $recipient_name ? $recipient_name : $request->recipient;
                 $recipient = $userModel->getUserByLogin($recipient_name);
                 if (!$recipient) {
                     $this->_view->addFlashMessage(FM::ERROR, "Такого пользователя нет");
                     $noErrors = false;
                 }
             }
         }
         if (!$mess_header) {
             $this->_view->addFlashMessage(FM::ERROR, "Введите тему сообщения");
             $noErrors = false;
         }
         if (!$m_text) {
             $this->_view->addFlashMessage(FM::ERROR, "Введите текст сообщения");
             $noErrors = false;
         }
         if ($noErrors) {
             if ($message_to == "admin") {
                 foreach ($aAdmins as $admin) {
                     $this->sendMessage($mess_header, $m_text, $user->id, $admin['id'], $request->avatar_id, 0, 0);
                 }
                 $addUrl = '/message_to:admin';
             } else {
                 $this->sendMessage($mess_header, $m_text, $user->id, $recipient['id'], $request->avatar_id, 0, 0);
                 $addUrl = '';
             }
             $redirect_controller = $request->redirect_controller ? $request->redirect_controller : 'Messages';
             $redirect_action = $request->redirect_action ? $request->redirect_action : 'SendMessage';
             $redirect_url = $request->redirect_url ? $request->redirect_url : "/message_action:sent" . $addUrl;
             Project::getResponse()->redirect(Project::getRequest()->createUrl($redirect_controller, $redirect_action) . $redirect_url);
         }
     } elseif ($request->message_action == 'reply') {
         // ответить на сообщение
         $messagesModel->load($request->mess_id);
         if ($messagesModel->id == $request->mess_id && $messagesModel->recipient_id == $user->id) {
             $mess_header = "Re: " . $messagesModel->header;
             $m_text = ">> " . $messagesModel->m_text;
             $author = $userModel->getUserById($messagesModel->author_id);
             $recipient_name = $author['login'];
         }
     } elseif ($request->message_action == 'sent') {
         $this->_view->addFlashMessage(FM::INFO, "Ваше сообщение успешно отправлено. Можете отправить еще сообщение");
     }
     $this->_view->assign('message_to', $message_to);
     $this->_view->assign('mess_header', $mess_header);
     $this->_view->assign('m_text', $m_text);
     $this->_view->assign('recipient_name', $recipient_name);
     $this->_view->assign('user_friends', $friendModel->getFriendsAll($user->id));
     $aGroupMessagesCount['all'] = array("new" => $messagesModel->getCountMessagesToUser($user->id, -1, 1, 0), "read" => $messagesModel->getCountMessagesToUser($user->id, -1, 1, 1));
     $this->_view->assign('aGroupMessagesCount', $aGroupMessagesCount);
     $this->_view->assign('user_avatars', $userModel->getAllUserAvatars($user->id));
     $this->_view->SendMessagePage();
     $this->_view->parse();
 }
开发者ID:amanai,项目名称:next24,代码行数:77,代码来源:MessagesController.php


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