2013-07-03 03:57:50 +00:00
|
|
|
<?php
|
2013-09-13 22:39:03 +00:00
|
|
|
/**
|
|
|
|
* This function is beign used to load info that's needed for the userlist page.
|
|
|
|
* this function will return all users by using he pagination class, so that it can be used in the template. Only Mods and Admins can browse this page though.
|
|
|
|
* @author Daan Janssens, mentored by Matthew Lagoe
|
|
|
|
*/
|
2013-07-03 03:57:50 +00:00
|
|
|
function userlist(){
|
2013-09-09 01:47:32 +00:00
|
|
|
if(Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){
|
2013-08-05 19:12:58 +00:00
|
|
|
|
|
|
|
$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();
|
|
|
|
|
2013-07-03 03:57:50 +00:00
|
|
|
$i = 0;
|
2013-08-05 19:12:58 +00:00
|
|
|
foreach( $pageResult['userlist'] as $user ){
|
|
|
|
$pageResult['userlist'][$i]['permission'] = Ticket_User::constr_ExternId($pageResult['userlist'][$i]['id'])->getPermission();
|
2013-07-03 03:57:50 +00:00
|
|
|
$i++;
|
|
|
|
}
|
2013-08-05 19:12:58 +00:00
|
|
|
|
2013-09-09 01:47:32 +00:00
|
|
|
if (Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))){
|
2013-07-19 14:30:58 +00:00
|
|
|
$pageResult['isAdmin'] = "TRUE";
|
|
|
|
}
|
2013-09-09 01:47:32 +00:00
|
|
|
global $INGAME_WEBPATH;
|
|
|
|
$pageResult['ingame_webpath'] = $INGAME_WEBPATH;
|
|
|
|
global $BASE_WEBPATH;
|
|
|
|
$pageResult['base_webpath'] = $BASE_WEBPATH;
|
2013-07-03 03:57:50 +00:00
|
|
|
return $pageResult;
|
|
|
|
}else{
|
2013-07-03 16:49:23 +00:00
|
|
|
//ERROR: No access!
|
|
|
|
$_SESSION['error_code'] = "403";
|
|
|
|
header("Location: index.php?page=error");
|
2013-07-03 03:57:50 +00:00
|
|
|
exit;
|
|
|
|
}
|
2013-09-09 01:47:32 +00:00
|
|
|
}
|