userlist ingame works + fixed a bug in demoting/promoting users with roles, which was looking at the wrong id

This commit is contained in:
Quitta 2013-08-06 04:31:01 +02:00
parent 18ce5ec1fe
commit 1c54b43080
5 changed files with 110 additions and 7 deletions

View file

@ -14,8 +14,11 @@ title_bg_color = "#303030"
;default info text color ;default info text color
info_color = "#00CED1" info_color = "#00CED1"
;admin/mod name color ;Account (user/admin/mod) name color
team_color = "red" team_color = "red"
user_color = "green"
mod_color = "orange"
admin_color = "red"
;main table bg color ;main table bg color
main_tbl_color = "#00000030" main_tbl_color = "#00000030"
@ -35,4 +38,7 @@ closed_tbl_color = "#FFE69960"
;table header tr bg color ;table header tr bg color
table_header_tr_color = "#00000090" table_header_tr_color = "#00000090"
;pagination current page bg
pagination_current_page_bg = "#00CED190"
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------

View file

@ -9,7 +9,7 @@
<table cellspacing="0" cellpadding="4"> <table cellspacing="0" cellpadding="4">
<tr> <tr>
{if isset($isMod) and $isMod eq "TRUE"}<td valign="middle" nowrap><a href="index.php?page=show_ticket_log&id={$ticket_tId}">Show Ticket Log</a></td>{/if} {if isset($isMod) and $isMod eq "TRUE"}<td valign="middle" nowrap><a href="index.php?page=show_ticket_log&id={$ticket_tId}">Show Ticket Log</a></td>{/if}
<td valign="middle" nowrap><a href="index.php?page=createticket&user_id={$target_id}">Send Other Ticket</a></td> <td valign="middle" nowrap><a href="index.php?page=createticket&user_id={$ticket_author}">Send Other Ticket</a></td>
</tr> </tr>
</table> </table>
</td> </td>

View file

@ -79,9 +79,9 @@
<tr> <tr>
<td><strong>Role:</strong></td> <td><strong>Role:</strong></td>
<td> <td>
{if $userPermission eq 1}<span class="label label-success">User</span>{/if} {if $userPermission eq 1}<font color="{$user_color}">User</font>{/if}
{if $userPermission eq 2}<span class="label label-warning">Moderator</span>{/if} {if $userPermission eq 2}<font color="{$mod_color}">Moderator</font>{/if}
{if $userPermission eq 3}<span class="label label-important">Admin</span>{/if} {if $userPermission eq 3}<font color="{$admin_color}">Admin</font>{/if}
</td> </td>
</tr> </tr>
{if $firstName neq ""} {if $firstName neq ""}

View file

@ -0,0 +1,96 @@
{block name=content}
<tr><td>
<table width="100%" bgcolor="{$title_bg_color}" cellspacing="2">
<tr><td height="7"></td><td></td></tr>
<tr>
<td width="3%"></td>
<td width="100%" height="12" valign="middle"><h1>Members</h1></td>
</tr>
<tr>
<td height="5"></td><td></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr bgcolor="#000000" valign="middle">
<td>
<table>
<tr><td height="8"></td></tr>
</table>
</td>
</tr>
<tr><td height="2"></td></tr>
<tr><td height="1" bgcolor="#000000"></td></tr>
<tr><td height="10"></td></tr>
<tr valign="middle">
<td>
<table width="100%" height="100%" cellpadding="10">
<tr><td>
<table width="100%" bgcolor="{$main_tbl_color}" border="2">
<tr><td>
<table width="100%" cellpadding="10">
<tr><td>
<p><h3>All Acounts</h3></p>
<table width="100%" cellpadding="4" cellspacing="2">
<tr bgcolor="{$table_header_tr_color}">
<td>Id</td>
<td>Username</td>
<td>Email</td>
<td>Permission</td>
<td>Action</td>
</tr>
{foreach from=$userlist item=element}
<tr>
<td>{$element.id}</td>
<td class="center"><a href="index.php?page=show_user&id={$element.id}">{$element.username}</a></td>
<td class="center">{$element.email}</td>
{if $element.permission eq 1}<td class="center"><font color="{$user_color}">User</font></td>{/if}
{if $element.permission eq 2}<td class="center"><font color="{$mod_color}">Moderator</font></td>{/if}
{if $element.permission eq 3}<td class="center"><font color="{$admin_color}">Admin</font></td>{/if}
<td class="center">
<a href="index.php?page=show_user&id={$element.id}">Show User</a>
<a href="index.php?page=settings&id={$element.id}">Edit User</a>
{if isset($isAdmin) and $isAdmin eq 'TRUE' and $element.id neq 1}
{if $element.permission eq 1}
<a href="index.php?page=change_permission&user_id={$element.id}&value=2">Make Moderator</a>
<a href="index.php?page=change_permission&user_id={$element.id}&value=3">Make Admin</a>
{else if $element.permission eq 2 }
<a href="index.php?page=change_permission&user_id={$element.id}&value=1">Demote to User</a>
<a href="index.php?page=change_permission&user_id={$element.id}&value=3">Make Admin</a>
{else if $element.permission eq 3 }
<a href="index.php?page=change_permission&user_id={$element.id}&value=1">Demote to User</a>
<a href="index.php?page=change_permission&user_id={$element.id}&value=2">Demote to Moderator</a>
{/if}
{/if}
</td>
</tr>
{/foreach}
</table>
</td></tr>
<tr><td align = "center">
<table>
<tr>
<td><a href="index.php?page=userlist&pagenum=1">&laquo;</a></td>
{foreach from=$links item=link}
<td {if $link == $currentPage}bgcolor="{$pagination_current_page_bg}"{/if}><a href="index.php?page=userlist&pagenum={$link}">{$link}</a></td>
{/foreach}
<td><a href="index.php?page=userlist&pagenum={$lastPage}">&raquo;</a></td>
</tr>
</table>
</td></tr>
</table>
</td></tr>
</table>
</td></tr>
</table>
</td>
</tr>
</table>
</td></tr>
{/block}

View file

@ -10,7 +10,8 @@ function change_permission(){
if(isset($_GET['user_id']) && isset($_GET['value']) && $_GET['user_id'] != 1 && $_GET['value'] < 4 ){ if(isset($_GET['user_id']) && isset($_GET['value']) && $_GET['user_id'] != 1 && $_GET['value'] < 4 ){
$user_id = filter_var($_GET['user_id'], FILTER_SANITIZE_NUMBER_INT); $user_id = filter_var($_GET['user_id'], FILTER_SANITIZE_NUMBER_INT);
$value = filter_var($_GET['value'], FILTER_SANITIZE_NUMBER_INT); $value = filter_var($_GET['value'], FILTER_SANITIZE_NUMBER_INT);
Ticket_User::change_permission($user_id, $value);
Ticket_User::change_permission(Ticket_User::constr_ExternId($user_id)->getTUserId(), $value);
header("Location: index.php?page=show_user&id=".$user_id); header("Location: index.php?page=show_user&id=".$user_id);
exit; exit;