mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-14 11:19:07 +00:00
ticket reply show correct username, this was harder then expected
This commit is contained in:
parent
9b37a2426c
commit
002bf2abff
4 changed files with 28 additions and 14 deletions
|
@ -19,19 +19,23 @@ class Ticket_Reply{
|
||||||
//return constructed element based on TCategoryId
|
//return constructed element based on TCategoryId
|
||||||
public static function getRepliesOfTicket( $ticket_id) {
|
public static function getRepliesOfTicket( $ticket_id) {
|
||||||
$dbl = new DBLayer("lib");
|
$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();
|
$row = $statement->fetchAll();
|
||||||
$result = Array();
|
$result = Array();
|
||||||
foreach($row as $tReply){
|
foreach($row as $tReply){
|
||||||
$instanceReply = new self();
|
$instanceAuthor = Ticket_User::constr_TUserId($tReply['Author']);
|
||||||
$instanceReply->setTReplyId($tReply['TReplyId']);
|
$instanceAuthor->setExternId($tReply['ExternId']);
|
||||||
$instanceReply->setTimestamp($tReply['Timestamp']);
|
$instanceAuthor->setPermission($tReply['Permission']);
|
||||||
$instanceReply->set($tReply['Ticket'],$tReply['Content'],$tReply['Author']);
|
|
||||||
|
|
||||||
$instanceContent = new Ticket_Content();
|
$instanceContent = new Ticket_Content();
|
||||||
$instanceContent->setTContentId($tReply['TContentId']);
|
$instanceContent->setTContentId($tReply['TContentId']);
|
||||||
$instanceContent->setContent($tReply['Content']);
|
$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);
|
$instanceReply->setContent($instanceContent);
|
||||||
|
|
||||||
$result[] = $instanceReply;
|
$result[] = $instanceReply;
|
||||||
|
|
|
@ -65,17 +65,11 @@ class Ticket_User{
|
||||||
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
////////////////////////////////////////////Getters////////////////////////////////////////////////////
|
||||||
|
|
||||||
public function getPermission(){
|
public function getPermission(){
|
||||||
if ($this->permission == ""){
|
|
||||||
$this->load_With_TUserId($this->tUserId);
|
|
||||||
}
|
|
||||||
return $this->permission;
|
return $this->permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getExternId(){
|
public function getExternId(){
|
||||||
if ($this->ExternId == ""){
|
|
||||||
$this->load_With_TUserId($this->tUserId);
|
|
||||||
}
|
|
||||||
return $this->externId;
|
return $this->externId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,4 +90,9 @@ class Ticket_User{
|
||||||
$this->externId = $id;
|
$this->externId = $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setTUserId($id){
|
||||||
|
$this->tUserId= $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -13,7 +13,12 @@ function show_ticket(){
|
||||||
$entire_ticket = Ticket::getEntireTicket( $result['ticket_id']);
|
$entire_ticket = Ticket::getEntireTicket( $result['ticket_id']);
|
||||||
$result['ticket_tId'] = $entire_ticket['ticket_obj']->getTId();
|
$result['ticket_tId'] = $entire_ticket['ticket_obj']->getTId();
|
||||||
$result['ticket_title'] = $entire_ticket['ticket_obj']->getTitle();
|
$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;
|
return $result;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -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-tag"></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">
|
||||||
<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>
|
||||||
|
@ -16,7 +16,13 @@
|
||||||
{foreach from=$ticket_replies item=reply}
|
{foreach from=$ticket_replies item=reply}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<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>
|
<p><pre>{$reply.replyContent}</pre></p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in a new issue