mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-06 23:39:06 +00:00
# ticket queues, though moving away from this approach
This commit is contained in:
parent
ea80798bd0
commit
af2986ff01
4 changed files with 59 additions and 23 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
class Ticket_Queue{
|
class Ticket_Queue{
|
||||||
|
|
||||||
private $queueElements;
|
protected $queueElements;
|
||||||
|
|
||||||
public function loadAllOpenTickets(){
|
public function loadAllOpenTickets(){
|
||||||
$dbl = new DBLayer("lib");
|
$dbl = new DBLayer("lib");
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
class Ticket_Queue_csr extends Ticket_Queue{
|
||||||
|
|
||||||
|
public function loadAllNewCsrTickets(){
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->executeWithoutParams("SELECT ticket . * FROM ticket LEFT JOIN assigned ON ticket.TId = assigned.Ticket WHERE assigned.Ticket IS NULL");
|
||||||
|
$rows = $statement->fetchAll();
|
||||||
|
$this->setQueue($rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Ticket_Queue_Handler{
|
||||||
|
|
||||||
|
public static function getTickets($input,$permission){
|
||||||
|
switch($permission){
|
||||||
|
case 2:
|
||||||
|
$queue = new Ticket_Queue_Csr();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
// $queue = new Ticket_Queue_Dev();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($input){
|
||||||
|
case "all_open":
|
||||||
|
$queue->loadAllOpenTickets();
|
||||||
|
break;
|
||||||
|
case "archive":
|
||||||
|
$queue->loadAllClosedTickets();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return "ERROR";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $queue->getTickets();
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,30 +7,26 @@ function show_queue(){
|
||||||
if( WebUsers::isAdmin()){
|
if( WebUsers::isAdmin()){
|
||||||
$result['queue_action'] = filter_var($_GET['get'], FILTER_SANITIZE_STRING);
|
$result['queue_action'] = filter_var($_GET['get'], FILTER_SANITIZE_STRING);
|
||||||
|
|
||||||
$queue = new Ticket_Queue();
|
$queueArray = Ticket_Queue_Handler::getTickets($result['queue_action'],2);
|
||||||
|
if ($queueArray != "ERROR"){
|
||||||
|
$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"));
|
||||||
|
|
||||||
switch ($result['queue_action']){
|
$i = 0;
|
||||||
case "all_open":
|
foreach( $result['tickets'] as $ticket){
|
||||||
$queue->loadAllOpenTickets();
|
$result['tickets'][$i]['author'] = WebUsers::getUsername($ticket['authorExtern']);
|
||||||
break;
|
$i++;
|
||||||
case "archive":
|
}
|
||||||
$queue->loadAllClosedTickets();
|
if(WebUsers::isAdmin()){
|
||||||
break;
|
$result['isAdmin'] = "TRUE";
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}else{
|
||||||
|
//ERROR: Doesn't exist!
|
||||||
|
$_SESSION['error_code'] = "404";
|
||||||
|
header("Location: index.php?page=error");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$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{
|
}else{
|
||||||
//ERROR: No access!
|
//ERROR: No access!
|
||||||
$_SESSION['error_code'] = "403";
|
$_SESSION['error_code'] = "403";
|
||||||
|
|
Loading…
Reference in a new issue