show user added, where admins can create a ticket from another user

This commit is contained in:
Quitta 2013-07-08 17:14:03 +02:00
parent 07cda95e11
commit 6170f1139c
6 changed files with 117 additions and 3 deletions

View file

@ -20,6 +20,7 @@ name = "Name"
email = "Email" email = "Email"
action = "Action" action = "Action"
[show_user]
[createticket] [createticket]

View file

@ -22,6 +22,7 @@ action = "Action"
[createticket] [createticket]
[show_user]
[error] [error]
title404 = "Pas<br/>trouvez!" title404 = "Pas<br/>trouvez!"

View file

@ -0,0 +1,35 @@
<?php
function show_user(){
//if logged in
if(WebUsers::isLoggedIn()){
if(WebUsers::isAdmin()){
if(isset($_GET['id'])){
$result['target_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
}else{
$result['target_id'] = $_SESSION['id'];
}
$result['target_name'] = WebUsers::getUsername( $result['target_id']);
$result['mail'] = WebUsers::getEmail( $result['target_id']);
$info = WebUsers::getInfo($result['target_id']);
$result['firstName'] = $info['FirstName'];
$result['lastName'] = $info['LastName'];
$result['country'] = $info['Country'];
$result['gender'] = $info['Gender'];
return $result;
}else{
//ERROR: No access!
$_SESSION['error_code'] = "403";
header("Location: index.php?page=error");
exit;
}
}else{
//ERROR: not logged in!
header("Location: index.php");
exit;
}
}

View file

@ -96,8 +96,6 @@
<span class="caret"></span> <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="#">Profile</a></li>
<li class="divider"></li>
<li><a href="index.php?page=logout">Logout</a></li> <li><a href="index.php?page=logout">Logout</a></li>
</ul> </ul>
</div> </div>

View file

@ -0,0 +1,78 @@
{block name=content}
<div class="row-fluid sortable ui-sortable">
<div class="box span9">
<div class="box-header well" data-original-title="">
<h2><i class="icon-user"></i> Profile of {$target_name}</h2>
<div class="box-icon">
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<div class="box-content">
<div class="row-fluid">
<legend>Info</legend>
<table class="table table-striped" >
<tbody>
<tr >
<td><strong>Email:</strong></td>
<td>{$mail}</td>
</tr>
{if $firstName neq ""}
<tr>
<td><strong>Firstname:</strong></td>
<td>{$firstName}</td>
</tr>
{/if}
{if $lastName neq ""}
<tr>
<td><strong>LastName:</strong></td>
<td>{$lastName}</td>
</tr>
{/if}
{if $country neq ""}
<tr>
<td><strong>Country:</strong></td>
<td>{$country}</td>
</tr>
{/if}
{if $gender neq 0}
<tr>
<td><strong>Gender:</strong></td>
{if $gender eq 1}
<td><strong>♂</strong></td>
{else if $gender eq 2}
<td><strong>♀</strong></td>
{/if}
</tr>
{/if}
</tbody>
</table>
</div>
</div>
</div><!--/span-->
<div class="box span3">
<div class="box-header well" data-original-title="">
<h2><i class="icon-th"></i>Actions</h2>
<div class="box-icon">
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<div class="box-content">
<div class="row-fluid">
<div class="btn-group">
<button class="btn btn-primary btn-large dropdown-toggle" data-toggle="dropdown">Actions<span class="caret"></span></button>
<ul class="dropdown-menu">
<li class="divider"></li>
<li><a href="index.php?page=settings&id={$target_id}">Edit User</a></li>
<li><a href="index.php?page=createticket&user_id={$target_id}">Send Ticket</a></li>
<li class="divider"></li>
</ul>
</div>
</div>
</div>
</div><!--/span-->
</div><!--/row-->
{/block}

View file

@ -24,11 +24,12 @@
{foreach from=$userlist item=element} {foreach from=$userlist item=element}
<tr> <tr>
<td>{$element.id}</td> <td>{$element.id}</td>
<td class="center">{$element.username}</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">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-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>
</td> </td>