mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
made the todo queue
--HG-- branch : quitta-gsoc-2013
This commit is contained in:
parent
fdef0d55dc
commit
46f2ad2274
5 changed files with 55 additions and 7 deletions
|
@ -24,6 +24,50 @@ class Ticket_Queue{
|
|||
$this->setQueue($rows);
|
||||
}
|
||||
|
||||
public function loadToDoTickets($user_id){
|
||||
|
||||
$dbl = new DBLayer("lib");
|
||||
|
||||
//first: find the tickets assigned to the user with status != waiting on user reply
|
||||
$statement = $dbl->execute("SELECT ticket . * FROM ticket LEFT JOIN assigned ON ticket.TId = assigned.Ticket WHERE assigned.User = :user_id",array('user_id' => $user_id));
|
||||
$assignedTo = $statement->fetchAll();
|
||||
|
||||
//second: find all non-assigned tickets forwarded to the support groups to which that user belongs
|
||||
//TODO
|
||||
|
||||
//third: find all not assigned tickets that aren't forwarded yet.
|
||||
//TODO: check if not forwarded to a group!
|
||||
$statement = $dbl->executeWithoutParams("SELECT ticket . * FROM ticket LEFT JOIN assigned ON ticket.TId = assigned.Ticket WHERE assigned.Ticket IS NULL");
|
||||
$notAssigned = $statement->fetchAll();
|
||||
|
||||
//forth: find all tickets assigned to someone else, not forwarded to a group or forwarded to a group you are a member from, with status == waiting on support and with timestamp of last reply > 1 day
|
||||
//TODO
|
||||
|
||||
//Now let's get them all together
|
||||
$allTogether = $assignedTo + $notAssigned;
|
||||
|
||||
//filter to only get unique ticket id's
|
||||
$this->setQueue(self::filter_tickets($allTogether));
|
||||
|
||||
}
|
||||
|
||||
//filters the array of tickets and returns unique tickets based on there TId
|
||||
static public function filter_tickets($ticketArray){
|
||||
$tmp = array ();
|
||||
foreach ($ticketArray as $ticket1){
|
||||
$found = false;
|
||||
foreach ($tmp as $ticket2){
|
||||
if($ticket1['TId'] == $ticket2['TId']){
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
if(! $found){
|
||||
$tmp[] = $ticket1;
|
||||
}
|
||||
}
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
public function getTickets(){
|
||||
return $this->queueElements;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class Ticket_Queue_Handler{
|
||||
|
||||
public static function getTickets($input){
|
||||
public static function getTickets($input, $user_id){
|
||||
|
||||
$queue = new Ticket_Queue();
|
||||
|
||||
|
@ -17,6 +17,9 @@ class Ticket_Queue_Handler{
|
|||
case "not_assigned":
|
||||
$queue->loadAllNotAssignedTickets();
|
||||
break;
|
||||
case "todo":
|
||||
$queue->loadToDoTickets($user_id);
|
||||
break;
|
||||
default:
|
||||
return "ERROR";
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@ not_assigned = "Open"
|
|||
success_assigned = "The ticket was successfully assigned!"
|
||||
success_unassigned = "The ticket was successfully unassigned!"
|
||||
ticket_not_existing = "That ticket doesn't exist!"
|
||||
already_assigned = "That ticket is already assigned to someone!"
|
||||
not_assigned = "That ticket isn't assigned to you!"
|
||||
ticket_already_assigned = "That ticket is already assigned to someone!"
|
||||
ticket_not_assigned = "That ticket isn't assigned to you!"
|
||||
|
||||
[show_sgroup]
|
||||
add_to_group_success = "The user has been added to the group!"
|
||||
|
|
|
@ -8,12 +8,13 @@ function show_queue(){
|
|||
if( Ticket_User::isMod($_SESSION['ticket_user'])){
|
||||
$result['queue_view'] = filter_var($_GET['get'], FILTER_SANITIZE_STRING);
|
||||
|
||||
$queueArray = Ticket_Queue_Handler::getTickets($result['queue_view']);
|
||||
$user_id = $_SESSION['ticket_user']->getTUserId();
|
||||
$queueArray = Ticket_Queue_Handler::getTickets($result['queue_view'], $user_id);
|
||||
|
||||
//if queue_view is a valid parameter value
|
||||
if ($queueArray != "ERROR"){
|
||||
|
||||
$user_id = $_SESSION['ticket_user']->getTUserId();
|
||||
|
||||
|
||||
if(isset($_POST['action'])){
|
||||
switch($_POST['action']){
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
</div>
|
||||
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "ALREADY_ASSIGNED"}
|
||||
<div class="alert alert-error">
|
||||
{$already_assigned}
|
||||
{$ticket_already_assigned}
|
||||
</div>
|
||||
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "NOT_ASSIGNED"}
|
||||
<div class="alert alert-error">
|
||||
{$not_assigned}
|
||||
{$ticket_not_assigned}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
|
Loading…
Reference in a new issue