本文整理汇总了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;
}
示例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;
}