mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-10 09:19:01 +00:00
ticket reply show correct username, this was harder then expected
This commit is contained in:
parent
51f4bd1ded
commit
e1a7e13c4e
4 changed files with 28 additions and 14 deletions
|
@ -19,19 +19,23 @@ class Ticket_Reply{
|
|||
//return constructed element based on TCategoryId
|
||||
public static function getRepliesOfTicket( $ticket_id) {
|
||||
$dbl = new DBLayer("lib");
|
||||
$statement = $dbl->execute("SELECT * FROM ticket_reply INNER JOIN ticket_content ON ticket_reply.Content = ticket_content.TContentId and ticket_reply.Ticket=:id", array('id' => $ticket_id));
|
||||
$statement = $dbl->execute("SELECT * FROM ticket_reply INNER JOIN ticket_content INNER JOIN ticket_user ON ticket_reply.Content = ticket_content.TContentId and ticket_reply.Ticket=:id and ticket_user.TUserId = ticket_reply.Author ORDER BY ticket_reply.TReplyId ASC", array('id' => $ticket_id));
|
||||
$row = $statement->fetchAll();
|
||||
$result = Array();
|
||||
foreach($row as $tReply){
|
||||
$instanceReply = new self();
|
||||
$instanceReply->setTReplyId($tReply['TReplyId']);
|
||||
$instanceReply->setTimestamp($tReply['Timestamp']);
|
||||
$instanceReply->set($tReply['Ticket'],$tReply['Content'],$tReply['Author']);
|
||||
$instanceAuthor = Ticket_User::constr_TUserId($tReply['Author']);
|
||||
$instanceAuthor->setExternId($tReply['ExternId']);
|
||||
$instanceAuthor->setPermission($tReply['Permission']);
|
||||
|
||||
$instanceContent = new Ticket_Content();
|
||||
$instanceContent->setTContentId($tReply['TContentId']);
|
||||
$instanceContent->setContent($tReply['Content']);
|
||||
|
||||
$instanceReply = new self();
|
||||
$instanceReply->setTReplyId($tReply['TReplyId']);
|
||||
$instanceReply->setTimestamp($tReply['Timestamp']);
|
||||
$instanceReply->setAuthor($instanceAuthor);
|
||||
$instanceReply->setTicket($ticket_id);
|
||||
$instanceReply->setContent($instanceContent);
|
||||
|
||||
$result[] = $instanceReply;
|
||||
|
|
|
@ -65,17 +65,11 @@ class Ticket_User{
|
|||
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
||||
|
||||
public function getPermission(){
|
||||
if ($this->permission == ""){
|
||||
$this->load_With_TUserId($this->tUserId);
|
||||
}
|
||||
return $this->permission;
|
||||
}
|
||||
|
||||
|
||||
public function getExternId(){
|
||||
if ($this->ExternId == ""){
|
||||
$this->load_With_TUserId($this->tUserId);
|
||||
}
|
||||
return $this->externId;
|
||||
}
|
||||
|
||||
|
@ -96,4 +90,9 @@ class Ticket_User{
|
|||
$this->externId = $id;
|
||||
}
|
||||
|
||||
public function setTUserId($id){
|
||||
$this->tUserId= $id;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -13,7 +13,12 @@ function show_ticket(){
|
|||
$entire_ticket = Ticket::getEntireTicket( $result['ticket_id']);
|
||||
$result['ticket_tId'] = $entire_ticket['ticket_obj']->getTId();
|
||||
$result['ticket_title'] = $entire_ticket['ticket_obj']->getTitle();
|
||||
$result['ticket_replies'] = Gui_Elements::make_table($entire_ticket['reply_array'], Array("getTReplyId","getContent()->getContent","getTimestamp"), Array("tReplyId","replyContent","timestamp"));
|
||||
$result['ticket_replies'] = Gui_Elements::make_table($entire_ticket['reply_array'], Array("getTReplyId","getContent()->getContent","getTimestamp","getAuthor()->getExternId","getAuthor()->getPermission"), Array("tReplyId","replyContent","timestamp","authorExtern","permission"));
|
||||
$i = 0;
|
||||
foreach( $result['ticket_replies'] as $reply){
|
||||
$result['ticket_replies'][$i]['author'] = WebUsers::getUsername($reply['authorExtern']);
|
||||
$i++;
|
||||
}
|
||||
return $result;
|
||||
|
||||
}else{
|
||||
|
|
|
@ -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-tag"></i> {$t_title}[ID#{$ticket_tId}] </h2>
|
||||
<h2><i class="icon-tags"></i> {$t_title}[ID#{$ticket_tId}] </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>
|
||||
|
@ -16,7 +16,13 @@
|
|||
{foreach from=$ticket_replies item=reply}
|
||||
<tr>
|
||||
<td>
|
||||
<p><span class="label label-info">[ID#{$reply.tReplyId}] {$reply.timestamp}</span> <span class="label label-warning"><strong>{$username}</span></strong></p>
|
||||
<p><span class="label label-info"><i class="icon-tag icon-white"></i> [ID#{$reply.tReplyId}] {$reply.timestamp}</span>
|
||||
{if $reply.permission eq '1'}
|
||||
<!-- <span class="label label-important"><strong></i>[User]:</strong></span>-->
|
||||
{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>
|
||||
<p><pre>{$reply.replyContent}</pre></p>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in a new issue