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


PHP UserMapper::getUserList方法代碼示例

本文整理匯總了PHP中UserMapper::getUserList方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserMapper::getUserList方法的具體用法?PHP UserMapper::getUserList怎麽用?PHP UserMapper::getUserList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserMapper的用法示例。


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

示例1: getAction

 public function getAction($request, $db)
 {
     $user_id = $this->getItemId($request);
     // verbosity
     $verbose = $this->getVerbosity($request);
     // pagination settings
     $start = $this->getStart($request);
     $resultsperpage = $this->getResultsPerPage($request);
     if (isset($request->url_elements[4])) {
         switch ($request->url_elements[4]) {
             case 'talks':
                 $talk_mapper = new TalkMapper($db, $request);
                 $list = $talk_mapper->getTalksBySpeaker($user_id, $resultsperpage, $start, $request, $verbose);
                 break;
             case 'attended':
                 $event_mapper = new EventMapper($db, $request);
                 $list = $event_mapper->getEventsAttendedByUser($user_id, $resultsperpage, $start, $request, $verbose);
                 break;
             default:
                 throw new InvalidArgumentException('Unknown Subrequest', 404);
                 break;
         }
     } else {
         $mapper = new UserMapper($db, $request);
         if ($user_id) {
             $list = $mapper->getUserById($user_id, $verbose);
         } else {
             $list = $mapper->getUserList($resultsperpage, $start, $verbose);
         }
     }
     return $list;
 }
開發者ID:jaytaph,項目名稱:joind.in,代碼行數:32,代碼來源:UsersController.php

示例2: getAction

 public function getAction($request, $db)
 {
     $user_id = $this->getItemId($request);
     // verbosity
     $verbose = $this->getVerbosity($request);
     // pagination settings
     $start = $this->getStart($request);
     $resultsperpage = $this->getResultsPerPage($request);
     if (isset($request->url_elements[4])) {
         switch ($request->url_elements[4]) {
             case 'talks':
                 $talk_mapper = new TalkMapper($db, $request);
                 $talks = $talk_mapper->getTalksBySpeaker($user_id, $resultsperpage, $start);
                 $list = $talks->getOutputView($request, $verbose);
                 break;
             case 'hosted':
                 $event_mapper = new EventMapper($db, $request);
                 $list = $event_mapper->getEventsHostedByUser($user_id, $resultsperpage, $start, $verbose);
                 break;
             case 'attended':
                 $event_mapper = new EventMapper($db, $request);
                 $list = $event_mapper->getEventsAttendedByUser($user_id, $resultsperpage, $start, $verbose);
                 break;
             case 'talk_comments':
                 $talkComment_mapper = new TalkCommentMapper($db, $request);
                 $list = $talkComment_mapper->getCommentsByUserId($user_id, $resultsperpage, $start, $verbose);
                 break;
             default:
                 throw new InvalidArgumentException('Unknown Subrequest', 404);
                 break;
         }
     } else {
         $mapper = new UserMapper($db, $request);
         if ($user_id) {
             $list = $mapper->getUserById($user_id, $verbose);
             if (count($list['users']) == 0) {
                 throw new Exception('User not found', 404);
             }
         } else {
             if (isset($request->parameters['username'])) {
                 $username = filter_var($request->parameters['username'], FILTER_SANITIZE_STRING);
                 $list = $mapper->getUserByUsername($username, $verbose);
                 if ($list === false) {
                     throw new Exception('Username not found', 404);
                 }
             } else {
                 $list = $mapper->getUserList($resultsperpage, $start, $verbose);
             }
         }
     }
     return $list;
 }
開發者ID:chimneysweep13,項目名稱:joindin-api,代碼行數:52,代碼來源:UsersController.php


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