added admin function to change setting + changed color of admin bg when they reply + some other fixes
This commit is contained in:
parent
002bf2abff
commit
5fd3b54015
6 changed files with 42 additions and 16 deletions
|
@ -11,6 +11,14 @@ class Ticket{
|
|||
|
||||
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||
|
||||
/*FUNCTION: getStatusArray
|
||||
* returns all possible statusses
|
||||
*
|
||||
*/
|
||||
public static function getStatusArray() {
|
||||
return Array("Waiting on user reply","Waiting on support","Waiting on Dev reply","Closed");
|
||||
}
|
||||
|
||||
/*FUNCTION: getEntireTicket
|
||||
* return all ticket of the given author's id.
|
||||
*
|
||||
|
@ -54,7 +62,7 @@ class Ticket{
|
|||
public static function create_Ticket( $title, $content, $category, $author) {
|
||||
|
||||
$ticket = new Ticket();
|
||||
$ticket->set($title,0,0,$category,$author);
|
||||
$ticket->set($title,1,0,$category,$author);
|
||||
$ticket->create();
|
||||
$ticket_id = $ticket->getTId();
|
||||
Ticket_Reply::createReply($content, $author, $ticket_id);
|
||||
|
@ -128,15 +136,8 @@ class Ticket{
|
|||
}
|
||||
|
||||
public function getStatusText(){
|
||||
$statusId = $this->getStatus();
|
||||
if ($statusId == 0){
|
||||
return "Waiting on support..";
|
||||
}else if($statusId == 1){
|
||||
return "Being handled..";
|
||||
}else if($statusId == 2){
|
||||
return "Closed";
|
||||
}
|
||||
return "Error";
|
||||
$statusArray = Ticket::getStatusArray();
|
||||
return $statusArray[$this->getStatus()];
|
||||
}
|
||||
|
||||
public function getCategoryName(){
|
||||
|
|
|
@ -16,6 +16,14 @@ function reply_on_ticket(){
|
|||
$content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING);
|
||||
$author = $_SESSION['ticket_user']->getTUserId();
|
||||
Ticket_Reply::createReply($content, $author, $ticket_id);
|
||||
|
||||
if(isset($_POST['ChangeStatus']) && WebUsers::isAdmin()){
|
||||
$newStatus = filter_var($_POST['ChangeStatus'], FILTER_SANITIZE_NUMBER_INT);
|
||||
$ticket = new Ticket();
|
||||
$ticket->load_With_TId($ticket_id);
|
||||
$ticket->setStatus($newStatus);
|
||||
$ticket->update();
|
||||
}
|
||||
header("Location: index.php?page=show_ticket&id=".$ticket_id);
|
||||
exit;
|
||||
|
||||
|
|
|
@ -19,6 +19,10 @@ function show_ticket(){
|
|||
$result['ticket_replies'][$i]['author'] = WebUsers::getUsername($reply['authorExtern']);
|
||||
$i++;
|
||||
}
|
||||
if(WebUsers::isAdmin()){
|
||||
$result['isAdmin'] = "TRUE";
|
||||
$result['statusList'] = Ticket::getStatusArray();
|
||||
}
|
||||
return $result;
|
||||
|
||||
}else{
|
||||
|
|
|
@ -22,7 +22,7 @@ function show_user(){
|
|||
$ticket_user = Ticket_User::constr_ExternId($result['target_id']);
|
||||
$ticketlist = Ticket::getTicketsOf($ticket_user->getTUserId());
|
||||
|
||||
$result['ticketlist'] = Gui_Elements::make_table($ticketlist, Array("getTId","getTimestamp","getTitle","getStatus","getStatusText","getCategoryName"), Array("tId","timestamp","title","status","statusText","category"));
|
||||
$result['ticketlist'] = Gui_Elements::make_table($ticketlist, Array("getTId","getTimestamp","getTitle","getStatus","getStatusText","getStatusText","getCategoryName"), Array("tId","timestamp","title","status","statustext","statusText","category"));
|
||||
return $result;
|
||||
|
||||
}else{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{block name=content}
|
||||
<div class="row-fluid sortable ui-sortable">
|
||||
<div class="box span12">
|
||||
<div class="box span9">
|
||||
<div class="box-header well" data-original-title="">
|
||||
<h2><i class="icon-tags"></i> {$t_title}[ID#{$ticket_tId}] </h2>
|
||||
<div class="box-icon">
|
||||
|
@ -11,10 +11,10 @@
|
|||
<div class="box-content">
|
||||
<div class="row-fluid">
|
||||
<legend>{$title}: {$ticket_title} </legend>
|
||||
<table class="table table-striped" >
|
||||
<table class="table" >
|
||||
<tbody>
|
||||
{foreach from=$ticket_replies item=reply}
|
||||
<tr>
|
||||
<tr {if $reply.permission eq '2'} style="background-color:rgb(242, 222, 222);{/if}">
|
||||
<td>
|
||||
<p><span class="label label-info"><i class="icon-tag icon-white"></i> [ID#{$reply.tReplyId}] {$reply.timestamp}</span>
|
||||
{if $reply.permission eq '1'}
|
||||
|
@ -22,7 +22,8 @@
|
|||
{else if $reply.permission eq '2'}
|
||||
<span class="label label-important"><strong><i class="icon-star icon-white"></i>[CSR]</strong></span>
|
||||
{/if}
|
||||
<span class="label label-warning"><strong><i class="icon-user icon-white"></i>{$reply.author}</strong></span></p>
|
||||
<span class="label label-warning"><strong><i class="icon-user icon-white"></i>{if isset($isAdmin) and $isAdmin eq "TRUE"} <a href="index.php?page=show_user&id={$reply.authorExtern}"><font color="white">{$reply.author}</font>{else}{$reply.author} {/if}</a></strong></span></p>
|
||||
|
||||
<p><pre>{$reply.replyContent}</pre></p>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -39,6 +40,18 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{if isset($isAdmin) and $isAdmin eq "TRUE"}
|
||||
<div class="control-group">
|
||||
<label class="control-label">Change Status to</label>
|
||||
<div class="controls">
|
||||
<select name="ChangeStatus">
|
||||
{foreach from=$statusList key=k item=v}
|
||||
<option value="{$k}">{$v}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<input type="hidden" name="function" value="reply_on_ticket">
|
||||
<input type="hidden" name="ticket_id" value="{$ticket_id}">
|
||||
<div class="control-group">
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
<td class="center"><i>{$ticket.timestamp}</i></td>
|
||||
<td class="center">{$ticket.category}</td>
|
||||
|
||||
<td class="center"><span class="label {if $ticket.status eq 0}label-success{else if $ticket.status eq 1}label-warning{else if $ticket.status eq 2}label-important{/if}">{$ticket.statusText}</span></td>
|
||||
<td class="center"><span class="label {if $ticket.status eq 0}label-success{else if $ticket.status eq 1}label-warning{else if $ticket.status eq 2}label-important{/if}">{if $ticket.status eq 0} <i class="icon-exclamation-sign icon-white"></i>{/if} {$ticket.statusText}</span></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
||||
|
|
Loading…
Reference in a new issue