added admin function to change setting + changed color of admin bg when they reply + some other fixes

This commit is contained in:
Quitta 2013-07-11 02:39:52 +02:00
parent e1a7e13c4e
commit be66aa7cef
6 changed files with 42 additions and 16 deletions

View file

@ -11,6 +11,14 @@ class Ticket{
////////////////////////////////////////////Functions//////////////////////////////////////////////////// ////////////////////////////////////////////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 /*FUNCTION: getEntireTicket
* return all ticket of the given author's id. * return all ticket of the given author's id.
* *
@ -54,7 +62,7 @@ class Ticket{
public static function create_Ticket( $title, $content, $category, $author) { public static function create_Ticket( $title, $content, $category, $author) {
$ticket = new Ticket(); $ticket = new Ticket();
$ticket->set($title,0,0,$category,$author); $ticket->set($title,1,0,$category,$author);
$ticket->create(); $ticket->create();
$ticket_id = $ticket->getTId(); $ticket_id = $ticket->getTId();
Ticket_Reply::createReply($content, $author, $ticket_id); Ticket_Reply::createReply($content, $author, $ticket_id);
@ -128,15 +136,8 @@ class Ticket{
} }
public function getStatusText(){ public function getStatusText(){
$statusId = $this->getStatus(); $statusArray = Ticket::getStatusArray();
if ($statusId == 0){ return $statusArray[$this->getStatus()];
return "Waiting on support..";
}else if($statusId == 1){
return "Being handled..";
}else if($statusId == 2){
return "Closed";
}
return "Error";
} }
public function getCategoryName(){ public function getCategoryName(){

View file

@ -16,6 +16,14 @@ function reply_on_ticket(){
$content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING); $content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING);
$author = $_SESSION['ticket_user']->getTUserId(); $author = $_SESSION['ticket_user']->getTUserId();
Ticket_Reply::createReply($content, $author, $ticket_id); 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); header("Location: index.php?page=show_ticket&id=".$ticket_id);
exit; exit;

View file

@ -19,6 +19,10 @@ function show_ticket(){
$result['ticket_replies'][$i]['author'] = WebUsers::getUsername($reply['authorExtern']); $result['ticket_replies'][$i]['author'] = WebUsers::getUsername($reply['authorExtern']);
$i++; $i++;
} }
if(WebUsers::isAdmin()){
$result['isAdmin'] = "TRUE";
$result['statusList'] = Ticket::getStatusArray();
}
return $result; return $result;
}else{ }else{

View file

@ -22,7 +22,7 @@ function show_user(){
$ticket_user = Ticket_User::constr_ExternId($result['target_id']); $ticket_user = Ticket_User::constr_ExternId($result['target_id']);
$ticketlist = Ticket::getTicketsOf($ticket_user->getTUserId()); $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; return $result;
}else{ }else{

View file

@ -1,6 +1,6 @@
{block name=content} {block name=content}
<div class="row-fluid sortable ui-sortable"> <div class="row-fluid sortable ui-sortable">
<div class="box span12"> <div class="box span9">
<div class="box-header well" data-original-title=""> <div class="box-header well" data-original-title="">
<h2><i class="icon-tags"></i> {$t_title}[ID#{$ticket_tId}] </h2> <h2><i class="icon-tags"></i> {$t_title}[ID#{$ticket_tId}] </h2>
<div class="box-icon"> <div class="box-icon">
@ -11,10 +11,10 @@
<div class="box-content"> <div class="box-content">
<div class="row-fluid"> <div class="row-fluid">
<legend>{$title}: {$ticket_title} </legend> <legend>{$title}: {$ticket_title} </legend>
<table class="table table-striped" > <table class="table" >
<tbody> <tbody>
{foreach from=$ticket_replies item=reply} {foreach from=$ticket_replies item=reply}
<tr> <tr {if $reply.permission eq '2'} style="background-color:rgb(242, 222, 222);{/if}">
<td> <td>
<p><span class="label label-info"><i class="icon-tag icon-white"></i> [ID#{$reply.tReplyId}] {$reply.timestamp}</span> <p><span class="label label-info"><i class="icon-tag icon-white"></i> [ID#{$reply.tReplyId}] {$reply.timestamp}</span>
{if $reply.permission eq '1'} {if $reply.permission eq '1'}
@ -22,7 +22,8 @@
{else if $reply.permission eq '2'} {else if $reply.permission eq '2'}
<span class="label label-important"><strong><i class="icon-star icon-white"></i>[CSR]</strong></span> <span class="label label-important"><strong><i class="icon-star icon-white"></i>[CSR]</strong></span>
{/if} {/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> <p><pre>{$reply.replyContent}</pre></p>
</td> </td>
</tr> </tr>
@ -39,6 +40,18 @@
</div> </div>
</div> </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="function" value="reply_on_ticket">
<input type="hidden" name="ticket_id" value="{$ticket_id}"> <input type="hidden" name="ticket_id" value="{$ticket_id}">
<div class="control-group"> <div class="control-group">

View file

@ -105,7 +105,7 @@
<td class="center"><i>{$ticket.timestamp}</i></td> <td class="center"><i>{$ticket.timestamp}</i></td>
<td class="center">{$ticket.category}</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> </tr>
{/foreach} {/foreach}