fixed error in time elapsed function and removed the queue structure, one queue class would suffice I guess

--HG--
branch : quitta-gsoc-2013
This commit is contained in:
Quitta 2013-07-19 23:36:34 +02:00
parent f922b14e30
commit 9d90043a76
6 changed files with 17 additions and 24 deletions

View file

@ -45,8 +45,7 @@ class Gui_Elements{
}
public static function time_elapsed_string($ptime){
$ptime = strtotime($ptime);
$ptime = DateTime::createFromFormat('m-d-Y H:i:s', $ptime)->getTimestamp();
$etime = time() - $ptime;

View file

@ -3,6 +3,13 @@ class Ticket_Queue{
protected $queueElements;
public function loadAllNotAssignedTickets(){
$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);
}
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");

View file

@ -1,11 +0,0 @@
<?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);
}
}

View file

@ -2,16 +2,10 @@
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;
}
public static function getTickets($input){
$queue = new Ticket_Queue();
switch ($input){
case "all_open":
@ -20,6 +14,9 @@ class Ticket_Queue_Handler{
case "archive":
$queue->loadAllClosedTickets();
break;
case "not_assigned":
$queue->loadAllNotAssignedTickets();
break;
default:
return "ERROR";
}

View file

@ -7,7 +7,7 @@ function show_queue(){
if( Ticket_User::isMod($_SESSION['ticket_user'])){
$result['queue_action'] = filter_var($_GET['get'], FILTER_SANITIZE_STRING);
$queueArray = Ticket_Queue_Handler::getTickets($result['queue_action'],2);
$queueArray = Ticket_Queue_Handler::getTickets($result['queue_action']);
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"));

View file

@ -55,6 +55,7 @@
<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><a href="index.php?page=show_queue&get=not_assigned">Not Assigned Tickets</a></li>
<li class="divider"></li>
</ul>
</div>