mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 15:46:18 +00:00
Show single replies works, though the code for it is a bit ugly, have to refactor that though
--HG-- branch : quitta-gsoc-2013
This commit is contained in:
parent
c1b7915219
commit
6f43d4f003
6 changed files with 69 additions and 8 deletions
|
@ -48,10 +48,9 @@ class Ticket_User{
|
|||
$dbl = new DBLayer("lib");
|
||||
$statement = $dbl->execute("SELECT * FROM ticket_user WHERE TUserId=:id", array('id' => $id));
|
||||
$row = $statement->fetch();
|
||||
$instance->tUserId = $row['TUserId'];
|
||||
$instance->permission = $row['Permission'];
|
||||
$instance->externId = $row['ExternId'];
|
||||
return $instance;
|
||||
$this->tUserId = $row['TUserId'];
|
||||
$this->permission = $row['Permission'];
|
||||
$this->externId = $row['ExternId'];
|
||||
}
|
||||
|
||||
//update private data to DB.
|
||||
|
|
|
@ -33,6 +33,8 @@ t_send = "Send reply"
|
|||
|
||||
[show_ticket_log]
|
||||
|
||||
[show_reply]
|
||||
|
||||
[ticket_log]
|
||||
1 = "created the ticket"
|
||||
2 = "created the ticket for"
|
||||
|
|
|
@ -31,6 +31,8 @@ t_send = "Envoyer la reponse"
|
|||
|
||||
[createticket]
|
||||
|
||||
[show_reply]
|
||||
|
||||
[show_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="box span12">
|
||||
<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">
|
||||
<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>
|
||||
|
@ -10,8 +10,22 @@
|
|||
</div>
|
||||
<div class="box-content">
|
||||
<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><!--/span-->
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
{foreach from=$ticket_logs item=log}
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
|
Loading…
Reference in a new issue