Show single replies works, though the code for it is a bit ugly, have to refactor that though
This commit is contained in:
parent
15237002aa
commit
c912daecae
6 changed files with 69 additions and 8 deletions
|
@ -48,10 +48,9 @@ class Ticket_User{
|
||||||
$dbl = new DBLayer("lib");
|
$dbl = new DBLayer("lib");
|
||||||
$statement = $dbl->execute("SELECT * FROM ticket_user WHERE TUserId=:id", array('id' => $id));
|
$statement = $dbl->execute("SELECT * FROM ticket_user WHERE TUserId=:id", array('id' => $id));
|
||||||
$row = $statement->fetch();
|
$row = $statement->fetch();
|
||||||
$instance->tUserId = $row['TUserId'];
|
$this->tUserId = $row['TUserId'];
|
||||||
$instance->permission = $row['Permission'];
|
$this->permission = $row['Permission'];
|
||||||
$instance->externId = $row['ExternId'];
|
$this->externId = $row['ExternId'];
|
||||||
return $instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//update private data to DB.
|
//update private data to DB.
|
||||||
|
|
|
@ -33,6 +33,8 @@ t_send = "Send reply"
|
||||||
|
|
||||||
[show_ticket_log]
|
[show_ticket_log]
|
||||||
|
|
||||||
|
[show_reply]
|
||||||
|
|
||||||
[ticket_log]
|
[ticket_log]
|
||||||
1 = "created the ticket"
|
1 = "created the ticket"
|
||||||
2 = "created the ticket for"
|
2 = "created the ticket for"
|
||||||
|
|
|
@ -31,6 +31,8 @@ t_send = "Envoyer la reponse"
|
||||||
|
|
||||||
[createticket]
|
[createticket]
|
||||||
|
|
||||||
|
[show_reply]
|
||||||
|
|
||||||
[show_ticket_log]
|
[show_ticket_log]
|
||||||
|
|
||||||
[ticket_log]
|
[ticket_log]
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function show_reply(){
|
||||||
|
//if logged in
|
||||||
|
if(WebUsers::isLoggedIn() && isset($_GET['id'])){
|
||||||
|
|
||||||
|
$result['reply_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
|
||||||
|
$reply = new Ticket_Reply();
|
||||||
|
$reply->load_With_TReplyId($result['reply_id']);
|
||||||
|
|
||||||
|
$ticket = new Ticket();
|
||||||
|
$ticket->load_With_TId($reply->getTicket());
|
||||||
|
|
||||||
|
if(($ticket->getAuthor() == $_SESSION['ticket_user']->getTUserId()) || WebUsers::isAdmin() ){
|
||||||
|
$content = new Ticket_Content();
|
||||||
|
$content->load_With_TContentId($reply->getContent());
|
||||||
|
|
||||||
|
$author = new Ticket_User();
|
||||||
|
$author->load_With_TUserId($reply->getAuthor());
|
||||||
|
|
||||||
|
|
||||||
|
$result['ticket_id'] = $reply->getTicket();
|
||||||
|
$result['reply_timestamp'] = $reply->getTimestamp();
|
||||||
|
$result['author_permission'] = $author->getPermission();
|
||||||
|
$result['reply_content'] = $content->getContent();
|
||||||
|
$result['author'] = $author->getExternId();
|
||||||
|
$result['authorName'] = WebUsers::getUsername($author->getExternId());
|
||||||
|
if(WebUsers::isAdmin()){
|
||||||
|
$result['isAdmin'] = "TRUE";
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="row-fluid sortable ui-sortable">
|
<div class="row-fluid sortable ui-sortable">
|
||||||
<div class="box span12">
|
<div class="box span12">
|
||||||
<div class="box-header well" data-original-title="">
|
<div class="box-header well" data-original-title="">
|
||||||
<h2><i class="icon-user"></i> Reply ID# of Ticket #</h2>
|
<h2><i class="icon-user"></i> Show Reply</h2>
|
||||||
<div class="box-icon">
|
<div class="box-icon">
|
||||||
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
|
<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>
|
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
|
||||||
|
@ -10,8 +10,22 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="box-content">
|
<div class="box-content">
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<legend>Info</legend>
|
<legend>Reply ID#{$reply_id} of Ticket <a href="index.php?page=show_ticket&id={$ticket_id}">#{$ticket_id}</a></legend>
|
||||||
|
<table class="table table-bordered" >
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<p><span class="label label-info"> {$reply_timestamp} {$author_permission}</span>
|
||||||
|
{if $author_permission eq '1'}
|
||||||
|
<!-- <span class="label label-important"><strong></i>[User]:</strong></span>-->
|
||||||
|
{else if $author_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>{if isset($isAdmin) and $isAdmin eq "TRUE"} <a href="index.php?page=show_user&id={$author}"><font color="white">{$authorName}</font>{else}{$authorName} {/if}</a></strong></span></p>
|
||||||
|
|
||||||
|
<p><pre{if $author_permission eq '2'} style="background-color:rgb(248, 200, 200);"{/if}>{$reply_content}</pre></p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div><!--/span-->
|
</div><!--/span-->
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
{foreach from=$ticket_logs item=log}
|
{foreach from=$ticket_logs item=log}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{$log.tLogId}</td>
|
<td>{$log.tLogId}</td>
|
||||||
<td><a href="#" title="{$log.timestamp_elapsed}" data-rel="tooltip" data-placement="right">{$log.timestamp}</td>
|
<td><span title="{$log.timestamp_elapsed}" data-rel="tooltip" data-placement="right">{$log.timestamp}</span></td>
|
||||||
<td>{$log.query}</td>
|
<td>{$log.query}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|
Loading…
Reference in a new issue