* Finish task#44806
This commit is contained in:
@@ -492,11 +492,12 @@ class gitlab extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browseUser($gitlabID)
|
||||
public function browseUser($gitlabID, $orderBy = 'id_desc')
|
||||
{
|
||||
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->browseUser;
|
||||
$this->view->gitlabID = $gitlabID;
|
||||
$this->view->gitlabUserList = $this->gitlab->apiGetUsers($gitlabID);
|
||||
$this->view->gitlabUserList = $this->gitlab->apiGetUsers($gitlabID, false, $orderBy);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -455,16 +455,22 @@ class gitlabModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function apiGetUsers($gitlabID, $onlyLinked = false)
|
||||
public function apiGetUsers($gitlabID, $onlyLinked = false, $orderBy)
|
||||
{
|
||||
/* GitLab API '/users' can only return 20 users per page in default, so we use a loop to fetch all users. */
|
||||
$page = 1;
|
||||
$response = array();
|
||||
$apiRoot = $this->getApiRoot($gitlabID);
|
||||
|
||||
/* Get order data. */
|
||||
$orders = explode('_', $orderBy);
|
||||
$sort = array_pop($orders);
|
||||
$order = join('_', $orders);
|
||||
|
||||
while(true)
|
||||
{
|
||||
/* Also use `per_page=20` to fetch users in API. Fetch active users only. */
|
||||
$url = sprintf($apiRoot, "/users") . "&page={$page}&per_page=20&active=true";
|
||||
$url = sprintf($apiRoot, "/users") . "&order_by={$order}&sort={$sort}&page={$page}&per_page=20&active=true";
|
||||
$result = json_decode(commonModel::http($url));
|
||||
if(!empty($result))
|
||||
{
|
||||
|
||||
@@ -26,11 +26,12 @@
|
||||
<?php else:?>
|
||||
<div id='mainContent' class='main-row'>
|
||||
<form class='main-table' id='ajaxForm' method='post'>
|
||||
<table id='gitlabUserList' class='table table-borderless'>
|
||||
<table id='gitlabUserList' class='table has-sort-head table-borderless'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='c-id'><?php echo $lang->gitlab->user->id;?></th>
|
||||
<th class='c-name text-left w-60px'><?php echo $lang->gitlab->user->name;?></th>
|
||||
<?php $vars = "gitlabID=$gitlabID&orderBy=%s";?>
|
||||
<th class='c-id'><?php common::printOrderLink('id', $orderBy, $vars, $lang->gitlab->user->id);?></th>
|
||||
<th class='c-name text-left w-60px'><?php common::printOrderLink('name', $orderBy, $vars, $lang->gitlab->user->name);?></th>
|
||||
<th class='c-name text-left'></th>
|
||||
<th class='text-left'><?php echo $lang->gitlab->user->createOn;?></th>
|
||||
<th class='text-left'><?php echo $lang->gitlab->user->lastActivity;?></th>
|
||||
|
||||
Reference in New Issue
Block a user