本文整理匯總了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;
}