mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-29 20:30:54 +00:00
userlist works with pagination
--HG-- branch : quitta-gsoc-2013
This commit is contained in:
parent
99ad1504e3
commit
91e758c1ee
4 changed files with 31 additions and 10 deletions
|
@ -68,6 +68,7 @@ class WebUsers extends Users{
|
|||
}
|
||||
}
|
||||
|
||||
//returns te id for a given username
|
||||
public static function getId($username){
|
||||
$dbw = new DBLayer("web");
|
||||
$statement = $dbw->execute("SELECT * FROM ams_user WHERE Login=:username", array('username' => $username));
|
||||
|
@ -75,6 +76,10 @@ class WebUsers extends Users{
|
|||
return $row['UId'];
|
||||
}
|
||||
|
||||
public function getUId(){
|
||||
return $this->uId;
|
||||
}
|
||||
|
||||
public function getUsername(){
|
||||
$dbw = new DBLayer("web");
|
||||
if(! isset($this->login) || $this->login == ""){
|
||||
|
@ -148,4 +153,8 @@ class WebUsers extends Users{
|
|||
return $data;
|
||||
}
|
||||
|
||||
public static function getAllUsersQuery(){
|
||||
return "SELECT * FROM ams_user";
|
||||
}
|
||||
|
||||
}
|
|
@ -2,16 +2,19 @@
|
|||
|
||||
function userlist(){
|
||||
if(Ticket_User::isMod($_SESSION['ticket_user'])){
|
||||
$users = WebUsers::getUsers();
|
||||
|
||||
$pagination = new Pagination(WebUsers::getAllUsersQuery(),"web",10,"WebUsers");
|
||||
$pageResult['userlist'] = Gui_Elements::make_table($pagination->getElements() , Array("getUId","getUsername","getEmail"), Array("id","username","email"));
|
||||
$pageResult['links'] = $pagination->getLinks(5);
|
||||
$pageResult['lastPage'] = $pagination->getLast();
|
||||
$pageResult['currentPage'] = $pagination->getCurrent();
|
||||
|
||||
$i = 0;
|
||||
$pageResult['userlist'] = Array();
|
||||
while($row = $users->fetch(PDO::FETCH_ASSOC)){
|
||||
$pageResult['userlist'][$i]['id'] = $row['UId'];
|
||||
$pageResult['userlist'][$i]['username'] = $row['Login'];
|
||||
$pageResult['userlist'][$i]['permission'] = Ticket_User::constr_ExternId($row['UId'])->getPermission();
|
||||
$pageResult['userlist'][$i]['email'] = $row['Email'];
|
||||
foreach( $pageResult['userlist'] as $user ){
|
||||
$pageResult['userlist'][$i]['permission'] = Ticket_User::constr_ExternId($pageResult['userlist'][$i]['id'])->getPermission();
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (Ticket_User::isAdmin($_SESSION['ticket_user'])){
|
||||
$pageResult['isAdmin'] = "TRUE";
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</div>
|
||||
{/if}
|
||||
|
||||
<table class="table table-striped table-bordered bootstrap-datatable datatable">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<table class="table table-striped table-bordered bootstrap-datatable datatable">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
|
@ -62,7 +62,16 @@
|
|||
{/foreach}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
<div style="width: 300px; margin:0px auto;">
|
||||
<ul class="pagination">
|
||||
<li><a href="index.php?page=userlist&pagenum=1">«</a></li>
|
||||
{foreach from=$links item=link}
|
||||
<li {if $link == $currentPage}class="active"{/if}><a href="index.php?page=userlist&pagenum={$link}">{$link}</a></li>
|
||||
{/foreach}
|
||||
<li><a href="index.php?page=userlist&pagenum={$lastPage}">»</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--/span-->
|
||||
|
||||
|
|
Loading…
Reference in a new issue