mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 01:26:30 +00:00
ticket queue base added
This commit is contained in:
parent
34c688ee27
commit
ea80798bd0
9 changed files with 183 additions and 12 deletions
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
class Ticket_Queue{
|
||||
|
||||
private $queueElements;
|
||||
|
||||
public function loadAllOpenTickets(){
|
||||
$dbl = new DBLayer("lib");
|
||||
$statement = $dbl->executeWithoutParams("SELECT * FROM ticket INNER JOIN ticket_user ON ticket.Author = ticket_user.TUserId and ticket.Status!=3");
|
||||
$rows = $statement->fetchAll();
|
||||
$this->setQueue($rows);
|
||||
}
|
||||
|
||||
public function loadAllClosedTickets(){
|
||||
$dbl = new DBLayer("lib");
|
||||
$statement = $dbl->executeWithoutParams("SELECT * FROM ticket INNER JOIN ticket_user ON ticket.Author = ticket_user.TUserId and ticket.Status=3");
|
||||
$rows = $statement->fetchAll();
|
||||
$this->setQueue($rows);
|
||||
}
|
||||
|
||||
public function getTickets(){
|
||||
return $this->queueElements;
|
||||
}
|
||||
|
||||
protected function setQueue($rows){
|
||||
|
||||
$result = Array();
|
||||
foreach($rows as $ticket){
|
||||
$instance = new Ticket();
|
||||
$instance->setTId($ticket['TId']);
|
||||
$instance->setTimestamp($ticket['Timestamp']);
|
||||
$instance->setTitle($ticket['Title']);
|
||||
$instance->setStatus($ticket['Status']);
|
||||
$instance->setQueue($ticket['Queue']);
|
||||
|
||||
$catInstance = new Ticket_Category();
|
||||
$catInstance->load_With_TCategoryId($ticket['Ticket_Category']);
|
||||
$instance->setTicket_Category($catInstance);
|
||||
|
||||
$userInstance = new Ticket_User();
|
||||
$userInstance->load_With_TUserId($ticket['Author']);
|
||||
$instance->setAuthor($userInstance);
|
||||
|
||||
$result[] = $instance;
|
||||
}
|
||||
$this->queueElements = $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -29,6 +29,8 @@ t_send = "Send reply"
|
|||
|
||||
[show_user]
|
||||
|
||||
[show_queue]
|
||||
|
||||
[createticket]
|
||||
|
||||
[show_ticket_log]
|
||||
|
|
|
@ -29,6 +29,8 @@ t_send = "Envoyer la reponse"
|
|||
|
||||
[show_user]
|
||||
|
||||
[show_queue]
|
||||
|
||||
[createticket]
|
||||
|
||||
[show_reply]
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
function show_queue(){
|
||||
|
||||
//if logged in & queue id is given
|
||||
if(WebUsers::isLoggedIn() && isset($_GET['get'])){
|
||||
if( WebUsers::isAdmin()){
|
||||
$result['queue_action'] = filter_var($_GET['get'], FILTER_SANITIZE_STRING);
|
||||
|
||||
$queue = new Ticket_Queue();
|
||||
|
||||
switch ($result['queue_action']){
|
||||
case "all_open":
|
||||
$queue->loadAllOpenTickets();
|
||||
break;
|
||||
case "archive":
|
||||
$queue->loadAllClosedTickets();
|
||||
break;
|
||||
}
|
||||
|
||||
$queueArray = $queue->getTickets();
|
||||
$result['tickets'] = Gui_Elements::make_table($queueArray, Array("getTId","getTitle","getTimestamp","getAuthor()->getExternId","getTicket_Category()->getName","getStatus","getStatusText"), Array("tId","title","timestamp","authorExtern","category","status","statusText"));
|
||||
|
||||
$i = 0;
|
||||
foreach( $result['tickets'] as $ticket){
|
||||
$result['tickets'][$i]['author'] = WebUsers::getUsername($ticket['authorExtern']);
|
||||
$i++;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
|
@ -30,7 +30,7 @@ function show_ticket(){
|
|||
}
|
||||
if(WebUsers::isAdmin()){
|
||||
$result['isAdmin'] = "TRUE";
|
||||
$result['statusList'] = Ticket::getStatusArray();
|
||||
//$result['statusList'] = Ticket::getStatusArray();
|
||||
}
|
||||
return $result;
|
||||
|
||||
|
|
|
@ -4,13 +4,11 @@ function show_ticket_log(){
|
|||
|
||||
//if logged in
|
||||
if(WebUsers::isLoggedIn() && isset($_GET['id'])){
|
||||
|
||||
$result['ticket_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
|
||||
$target_ticket = new Ticket();
|
||||
$target_ticket->load_With_TId($result['ticket_id']);
|
||||
|
||||
if(($target_ticket->getAuthor() == $_SESSION['ticket_user']->getTUserId()) || WebUsers::isAdmin() ){
|
||||
|
||||
//only allow admins to browse the log!
|
||||
if(WebUsers::isAdmin() ){
|
||||
$result['ticket_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
|
||||
$target_ticket = new Ticket();
|
||||
$target_ticket->load_With_TId($result['ticket_id']);
|
||||
$result['ticket_title'] = $target_ticket->getTitle();
|
||||
$ticket_logs = Ticket_Log::getLogsOfTicket( $result['ticket_id']);
|
||||
$log_action_array = Ticket_Log::getActionTextArray();
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=show_user"><i class="icon-user"></i><span class="hidden-tablet"> Profile</span></a></li>
|
||||
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=settings"><i class="icon-cog"></i><span class="hidden-tablet"> Settings</span></a></li>
|
||||
<li class="nav-header hidden-tablet">Admin</li>
|
||||
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=libuserlist"><i class="icon-th-list"></i><span class="hidden-tablet"> Liblist</span></a></li>
|
||||
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=userlist"><i class="icon-th-list"></i><span class="hidden-tablet"> UserList</span></a></li>
|
||||
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=userlist"><i class="icon-th-list"></i><span class="hidden-tablet"> Users</span></a></li>
|
||||
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=show_queue&get=all_open"><i class="icon-th-list"></i><span class="hidden-tablet"> Queues</span></a></li>
|
||||
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=libuserlist"><i class="icon-th-list"></i><span class="hidden-tablet"> Syncing</span></a></li>
|
||||
<li class="nav-header hidden-tablet">Actions</li>
|
||||
<li style="margin-left: -2px;"><a href="?page=logout"><i class="icon-off"></i><span class="hidden-tablet"> Logout </span></a></li>
|
||||
|
||||
{/block}
|
||||
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
{block name=content}
|
||||
<div class="row-fluid sortable ui-sortable">
|
||||
<div class="box span9">
|
||||
<div class="box-header well" data-original-title="">
|
||||
<h2><i class="icon-tag"></i> Ticket Queue {$queue_action}</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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<div class="row-fluid">
|
||||
<legend>Tickets</legend>
|
||||
<table class="table table-striped table-bordered bootstrap-datatable datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Title</th>
|
||||
<th>Timestamp</th>
|
||||
<th>Category</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$tickets item=ticket}
|
||||
<tr>
|
||||
<td>{$ticket.tId}</td>
|
||||
<td><a href ="index.php?page=show_ticket&id={$ticket.tId}">{$ticket.title}</a></td>
|
||||
<td class="center"><i>{$ticket.timestamp}</i></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}">{if $ticket.status eq 0} <i class="icon-exclamation-sign icon-white"></i>{/if} {$ticket.statusText}</span></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--/span-->
|
||||
|
||||
<div class="box span3">
|
||||
<div class="box-header well" data-original-title="">
|
||||
<h2><i class="icon-th"></i>Actions</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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<div class="row-fluid">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary btn-large dropdown-toggle" data-toggle="dropdown">Actions<span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="divider"></li>
|
||||
<li><a href="index.php?page=show_queue&get=all_open">All open tickets</a></li>
|
||||
<li><a href="index.php?page=show_queue&get=archive">Ticket Archive</a></li>
|
||||
<li class="divider"></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--/span-->
|
||||
</div><!--/row-->
|
||||
{/block}
|
||||
|
|
@ -181,7 +181,7 @@
|
|||
<button class="btn btn-primary btn-large dropdown-toggle" data-toggle="dropdown">Actions<span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="divider"></li>
|
||||
<li><a href="index.php?page=show_ticket_log&id={$ticket_tId}">Show Ticket Log</a></li>
|
||||
{if isset($isAdmin) and $isAdmin eq "TRUE"}<li><a href="index.php?page=show_ticket_log&id={$ticket_tId}">Show Ticket Log</a></li>{/if}
|
||||
<li><a href="index.php?page=createticket&user_id={$target_id}">Send Other Ticket</a></li>
|
||||
<li class="divider"></li>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in a new issue