本文整理汇总了PHP中UserRepository::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRepository::GetList方法的具体用法?PHP UserRepository::GetList怎么用?PHP UserRepository::GetList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserRepository
的用法示例。
在下文中一共展示了UserRepository::GetList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PageLoad
public function PageLoad()
{
if ($this->page->GetUserId() != null) {
$userList = $this->userRepository->GetList(1, 1, null, null, new SqlFilterEquals(ColumnNames::USER_ID, $this->page->GetUserId()));
} else {
$userList = $this->userRepository->GetList($this->page->GetPageNumber(), $this->page->GetPageSize(), null, null, null, $this->page->GetFilterStatusId());
}
$this->page->BindUsers($userList->Results());
$this->page->BindPageInfo($userList->PageInfo());
$groups = $this->groupViewRepository->GetList();
$this->page->BindGroups($groups->Results());
$resources = array();
$user = $this->userRepository->LoadById(ServiceLocator::GetServer()->GetUserSession()->UserId);
$allResources = $this->resourceRepository->GetResourceList();
foreach ($allResources as $resource) {
if ($user->IsResourceAdminFor($resource)) {
$resources[] = $resource;
}
}
$this->page->BindResources($resources);
$userIds = array();
/** @var $user UserItemView */
foreach ($userList->Results() as $user) {
$userIds[] = $user->Id;
}
$attributeList = $this->attributeService->GetAttributes(CustomAttributeCategory::USER, $userIds);
$this->page->BindAttributeList($attributeList);
}
示例2: GetUsers
/**
* @param $term string
* @return array|AutocompleteUser[]
*/
private function GetUsers($term)
{
if ($term == 'group') {
return $this->GetGroupUsers($this->GetQuerystring(QueryStringKeys::GROUP_ID));
}
$filter = new SqlFilterLike(ColumnNames::FIRST_NAME, $term);
$filter->_Or(new SqlFilterLike(ColumnNames::LAST_NAME, $term));
$filter->_Or(new SqlFilterLike(ColumnNames::EMAIL, $term));
$users = array();
$r = new UserRepository();
$results = $r->GetList(1, PageInfo::All, null, null, $filter)->Results();
/** @var $result UserItemView */
foreach ($results as $result) {
$users[] = new AutocompleteUser($result->Id, $result->First, $result->Last, $result->Email, $result->Username);
}
return $users;
}
示例3: PageLoad
public function PageLoad()
{
if ($this->page->GetUserId() != null) {
$userList = $this->userRepository->GetList(1, 1, null, null, new SqlFilterEquals(ColumnNames::USER_ID, $this->page->GetUserId()));
} else {
$userList = $this->userRepository->GetList($this->page->GetPageNumber(), $this->page->GetPageSize(), null, null, null, $this->page->GetFilterStatusId());
}
$this->page->BindUsers($userList->Results());
$this->page->BindPageInfo($userList->PageInfo());
$groups = $this->groupViewRepository->GetList();
$this->page->BindGroups($groups->Results());
$user = $this->userRepository->LoadById(ServiceLocator::GetServer()->GetUserSession()->UserId);
$resources = $this->GetResourcesThatCurrentUserCanAdminister($user);
$this->page->BindResources($resources);
$attributeList = $this->attributeService->GetByCategory(CustomAttributeCategory::USER);
$this->page->BindAttributeList($attributeList);
}
示例4: testCanGetPageableListOfUsers
public function testCanGetPageableListOfUsers()
{
$page = 3;
$pageSize = 5;
$count = 51;
$totalPages = 11;
$offset = 10;
$countRow = array('total' => $count);
$row1 = $this->GetUserRow(1, 'first', 'last', 'email', 'un1', '2011-01-01', 'utc', AccountStatus::ACTIVE, null, 'pref1=val1,pref2=val2');
$row2 = $this->GetUserRow(2, 'first', 'last', 'email', null, '2010-01-01');
$userRows = array($row1, $row2);
$this->db->SetRow(0, array($countRow));
$this->db->SetRow(1, $userRows);
$userRepo = new UserRepository();
$pageable = $userRepo->GetList($page, $pageSize);
$this->assertEquals($count, $pageable->PageInfo()->Total);
$this->assertEquals($totalPages, $pageable->PageInfo()->TotalPages);
$this->assertEquals($pageSize, $pageable->PageInfo()->PageSize);
$this->assertEquals($page, $pageable->PageInfo()->CurrentPage);
$results = $pageable->Results();
$this->assertEquals(UserItemView::Create($row1), $results[0]);
$this->assertEquals(UserItemView::Create($row2), $results[1]);
$this->assertEquals($offset, $this->db->_Offset);
$this->assertEquals($pageSize, $this->db->_Limit);
}