khanat-opennel-code/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue_handler.php

62 lines
2.1 KiB
PHP
Raw Normal View History

<?php
class Ticket_Queue_Handler{
2013-08-05 20:35:22 +00:00
private $pagination;
private $queue;
function __construct() {
$this->queue = new Ticket_Queue();
}
2013-08-05 20:35:22 +00:00
public function getTickets($input, $user_id){
switch ($input){
case "all":
$this->queue->loadAllTickets();
break;
case "all_open":
$this->queue->loadAllOpenTickets();
break;
case "archive":
$this->queue->loadAllClosedTickets();
break;
case "not_assigned":
$this->queue->loadAllNotAssignedTickets();
break;
2013-07-21 13:38:22 +00:00
case "todo":
$this->queue->loadToDoTickets($user_id);
break;
case "create":
//set these with the createQueue function proceding the getTickets function
2013-07-21 13:38:22 +00:00
break;
default:
return "ERROR";
}
2013-08-06 04:07:49 +00:00
$this->pagination = new Pagination($this->queue->getQuery(),"lib",10,"Ticket",$this->queue->getParams());
$elemArray = $this->pagination->getElements();
if(!empty($elemArray)){
foreach( $elemArray as $element ){
$catInstance = new Ticket_Category();
$catInstance->load_With_TCategoryId($element->getTicket_Category());
$element->setTicket_Category($catInstance);
$userInstance = new Ticket_User();
$userInstance->load_With_TUserId($element->getAuthor());
$element->setAuthor($userInstance);
}
2013-08-05 20:35:22 +00:00
}
return $this->pagination->getElements();
2013-08-05 20:35:22 +00:00
}
public function getPagination(){
return $this->pagination;
}
public function createQueue($userid, $groupid, $what, $how, $who){
$this->queue->createQueue($userid, $groupid, $what, $how, $who);
}
}