# ticket queues, though moving away from this approach

--HG--
branch : quitta-gsoc-2013
hg/feature/sse2
Quitta 12 years ago
parent b64d27a427
commit 5a8f45f88c

@ -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,29 +7,25 @@ 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"){
switch ($result['queue_action']){ $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"));
case "all_open":
$queue->loadAllOpenTickets(); $i = 0;
break; foreach( $result['tickets'] as $ticket){
case "archive": $result['tickets'][$i]['author'] = WebUsers::getUsername($ticket['authorExtern']);
$queue->loadAllClosedTickets(); $i++;
break; }
} if(WebUsers::isAdmin()){
$result['isAdmin'] = "TRUE";
$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")); return $result;
}else{
$i = 0; //ERROR: Doesn't exist!
foreach( $result['tickets'] as $ticket){ $_SESSION['error_code'] = "404";
$result['tickets'][$i]['author'] = WebUsers::getUsername($ticket['authorExtern']); header("Location: index.php?page=error");
$i++; exit;
}
if(WebUsers::isAdmin()){
$result['isAdmin'] = "TRUE";
} }
return $result;
}else{ }else{
//ERROR: No access! //ERROR: No access!

Loading…
Cancel
Save