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 5033e45c6a
commit cb9289f09c
6 changed files with 24 additions and 13 deletions

View file

@ -3,14 +3,17 @@
function sgroup_list(){ function sgroup_list(){
//if logged in //if logged in
if(WebUsers::isLoggedIn()){ 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); $delete_id = filter_var($_GET['delete'], FILTER_SANITIZE_NUMBER_INT);
$result['delete'] = Support_Group::deleteSupportGroup( $delete_id); $result['delete'] = Support_Group::deleteSupportGroup( $delete_id);
header("Location: index.php?page=sgroup_list"); header("Location: index.php?page=sgroup_list");
exit; 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")); $result['grouplist'] = Gui_Elements::make_table(Support_Group::getGroups(), Array("getSGroupId","getName","getTag"), Array("sGroupId","name","tag"));
return $result; return $result;
}else{ }else{

View file

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

View file

@ -8,7 +8,7 @@ function userlist(){
while($row = $users->fetch(PDO::FETCH_ASSOC)){ while($row = $users->fetch(PDO::FETCH_ASSOC)){
$pageResult['userlist'][$i]['id'] = $row['UId']; $pageResult['userlist'][$i]['id'] = $row['UId'];
$pageResult['userlist'][$i]['username'] = $row['Login']; $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']; $pageResult['userlist'][$i]['email'] = $row['Email'];
$i++; $i++;
} }

View file

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

View file

@ -16,7 +16,7 @@
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Name</th> <th>Name</th>
<th>Action</th> {if isset($isAdmin) && $isAdmin eq 'TRUE'}<th>Action</th>{/if}
</tr> </tr>
</thead> </thead>
@ -25,7 +25,7 @@
<tr> <tr>
<td>{$user.tUserId}</td> <td>{$user.tUserId}</td>
<td><a href ="index.php?page=show_user&id={$user.tUserId}">{$user.name}</a></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> </tr>
{/foreach} {/foreach}
@ -35,6 +35,7 @@
</div> </div>
</div><!--/span--> </div><!--/span-->
{if isset($isAdmin) && $isAdmin eq 'TRUE'}
<div class="box span3"> <div class="box span3">
<div class="box-header well" data-original-title=""> <div class="box-header well" data-original-title="">
<h2><i class="icon-plus-sign"></i> Add User</h2> <h2><i class="icon-plus-sign"></i> Add User</h2>
@ -91,6 +92,7 @@
</div> </div>
</div> </div>
</div><!--/span--> </div><!--/span-->
{/if}
</div><!--/row--> </div><!--/row-->
{/block} {/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"><a href="index.php?page=show_user&id={$element.id}">{$element.username}</a></td>
<td class="center">{$element.email}</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 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"> <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-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> <a class="btn btn-info" href="index.php?page=settings&id={$element.id}"><i class=" icon-pencil icon-white"></i>Edit User</a>