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