made it possible or mod's to watch the support group lists, though not to edit them + fixed userlist

This commit is contained in:
Quitta 2013-07-19 00:12:29 +02:00
parent bbe74c8fba
commit c1132373e3
6 changed files with 24 additions and 13 deletions

View file

@ -3,14 +3,17 @@
function sgroup_list(){
//if logged in
if(WebUsers::isLoggedIn()){
if(Ticket_User::isAdmin($_SESSION['ticket_user'])){
if(Ticket_User::isMod($_SESSION['ticket_user'])){
if(isset($_GET['delete'])){
if(isset($_GET['delete']) && Ticket_User::isAdmin($_SESSION['ticket_user'])){
$delete_id = filter_var($_GET['delete'], FILTER_SANITIZE_NUMBER_INT);
$result['delete'] = Support_Group::deleteSupportGroup( $delete_id);
header("Location: index.php?page=sgroup_list");
exit;
}
if(Ticket_User::isAdmin($_SESSION['ticket_user'])){
$result['isAdmin'] = "TRUE";
}
$result['grouplist'] = Gui_Elements::make_table(Support_Group::getGroups(), Array("getSGroupId","getName","getTag"), Array("sGroupId","name","tag"));
return $result;
}else{

View file

@ -3,19 +3,23 @@
function show_sgroup(){
//if logged in
if(WebUsers::isLoggedIn()){
if(Ticket_User::isAdmin($_SESSION['ticket_user'])){
if(Ticket_User::isMod($_SESSION['ticket_user'])){
if( isset($_GET['id'])){
//['target_id'] holds the id of the group!
$result['target_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
if(isset($_GET['delete'])){
if(isset($_GET['delete']) && Ticket_User::isAdmin($_SESSION['ticket_user'])){
$delete_id = filter_var($_GET['delete'], FILTER_SANITIZE_NUMBER_INT);
$result['delete'] = Support_Group::deleteUserOfSupportGroup( $delete_id, $result['target_id'] );
header("Location: index.php?page=show_sgroup&id=" . $result['target_id']);
exit;
}
if(Ticket_User::isAdmin($_SESSION['ticket_user'])){
$result['isAdmin'] = "TRUE";
}
$group = Support_Group::getGroup($result['target_id']);
$result['groupsname'] = $group->getName();

View file

@ -8,7 +8,7 @@ function userlist(){
while($row = $users->fetch(PDO::FETCH_ASSOC)){
$pageResult['userlist'][$i]['id'] = $row['UId'];
$pageResult['userlist'][$i]['username'] = $row['Login'];
$pageResult['userlist'][$i]['permission'] = $row['Permission'];
$pageResult['userlist'][$i]['permission'] = Ticket_User::constr_ExternId($row['UId'])->getPermission();
$pageResult['userlist'][$i]['email'] = $row['Email'];
$i++;
}

View file

@ -19,7 +19,7 @@
<th>ID</th>
<th>Name</th>
<th>Tag</th>
<th>Action</th>
{if isset($isAdmin) && $isAdmin eq 'TRUE'}<th>Action</th>{/if}
</tr>
</thead>
<tbody>
@ -28,7 +28,7 @@
<td>{$group.sGroupId}</td>
<td><a href ="index.php?page=show_sgroup&id={$group.sGroupId}">{$group.name}</a></td>
<td class="center"><span class="label label-important" >{$group.tag}</span></td>
<td class="center"><a class="btn btn-danger" href="index.php?page=sgroup_list&delete={$group.sGroupId}"><i class="icon-trash icon-white"></i> Delete</a></td>
{if isset($isAdmin) && $isAdmin eq 'TRUE'}<td class="center"><a class="btn btn-danger" href="index.php?page=sgroup_list&delete={$group.sGroupId}"><i class="icon-trash icon-white"></i> Delete</a></td>{/if}
</tr>
{/foreach}
@ -37,7 +37,7 @@
</div>
</div>
</div><!--/span-->
{if isset($isAdmin) && $isAdmin eq 'TRUE'}
<div class="box span3">
<div class="box-header well" data-original-title="">
<h2><i class="icon-plus-sign"></i> Add</h2>
@ -102,6 +102,7 @@
</div>
</div>
</div><!--/span-->
{/if}
</div><!--/row-->
{/block}

View file

@ -16,7 +16,7 @@
<tr>
<th>ID</th>
<th>Name</th>
<th>Action</th>
{if isset($isAdmin) && $isAdmin eq 'TRUE'}<th>Action</th>{/if}
</tr>
</thead>
@ -25,7 +25,7 @@
<tr>
<td>{$user.tUserId}</td>
<td><a href ="index.php?page=show_user&id={$user.tUserId}">{$user.name}</a></td>
<td class="center"><a class="btn btn-danger" href="index.php?page=show_sgroup&id={$target_id}&delete={$user.tUserId}"><i class="icon-trash icon-white"></i> Delete</a></td>
{if isset($isAdmin) && $isAdmin eq 'TRUE'}<td class="center"><a class="btn btn-danger" href="index.php?page=show_sgroup&id={$target_id}&delete={$user.tUserId}"><i class="icon-trash icon-white"></i> Delete</a></td>{/if}
</tr>
{/foreach}
@ -34,7 +34,8 @@
</div>
</div>
</div><!--/span-->
{if isset($isAdmin) && $isAdmin eq 'TRUE'}
<div class="box span3">
<div class="box-header well" data-original-title="">
<h2><i class="icon-plus-sign"></i> Add User</h2>
@ -91,6 +92,7 @@
</div>
</div>
</div><!--/span-->
{/if}
</div><!--/row-->
{/block}

View file

@ -27,7 +27,8 @@
<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"><span class="label label-success">User</span></td>{/if}
{if $element.permission eq 2}<td class="center"><span class="label label-warning">Admin</span></td>{/if}
{if $element.permission eq 2}<td class="center"><span class="label label-warning">Moderator</span></td>{/if}
{if $element.permission eq 3}<td class="center"><span class="label label-important">Admin</span></td>{/if}
<td class="center">
<a class="btn btn-primary" href="index.php?page=show_user&id={$element.id}"><i class=" icon-pencil icon-white"></i>Show User</a>
<a class="btn btn-info" href="index.php?page=settings&id={$element.id}"><i class=" icon-pencil icon-white"></i>Edit User</a>