From e0d9ff8628c70e9dc249f707c35c8bd177e0b457 Mon Sep 17 00:00:00 2001 From: Quitta Date: Sun, 18 Aug 2013 03:39:35 +0200 Subject: [PATCH] fixed dirty error in queue's that didn't allow me to assing/unassign after creating a queue --- .../ams_lib/autoload/gui_elements.php | 42 ++++++++++--------- .../ams_lib/autoload/ticket_queue_handler.php | 20 +++++---- .../ryzom_ams/www/html/inc/show_queue.php | 15 +++++-- .../www/html/templates/show_queue.tpl | 6 +-- 4 files changed, 48 insertions(+), 35 deletions(-) diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/gui_elements.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/gui_elements.php index cb932afe5..e9748fc04 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/gui_elements.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/gui_elements.php @@ -5,31 +5,33 @@ class Gui_Elements{ public static function make_table( $inputList, $funcArray ,$fieldArray){ $i = 0; $result = Array(); - foreach($inputList as $element){ - $j = 0; - foreach($funcArray as $function){ - $fnames = explode('->', $function); - $intermediate_result = NULL; - foreach($fnames as $fname) { - if(substr($fname, -2) == "()") { - $fname = substr($fname, 0, strlen($fname)-2); - if($intermediate_result == NULL) { - $intermediate_result = $element->$fname(); + if(!empty($inputList)){ + foreach($inputList as $element){ + $j = 0; + foreach($funcArray as $function){ + $fnames = explode('->', $function); + $intermediate_result = NULL; + foreach($fnames as $fname) { + if(substr($fname, -2) == "()") { + $fname = substr($fname, 0, strlen($fname)-2); + if($intermediate_result == NULL) { + $intermediate_result = $element->$fname(); + } else { + $intermediate_result = $intermediate_result->$fname(); + } } else { - $intermediate_result = $intermediate_result->$fname(); - } - } else { - if($intermediate_result == NULL) { - $intermediate_result = $element->$fname(); - } else { - $intermediate_result = $intermediate_result->$fname(); + if($intermediate_result == NULL) { + $intermediate_result = $element->$fname(); + } else { + $intermediate_result = $intermediate_result->$fname(); + } } } + $result[$i][$fieldArray[$j]] = $intermediate_result; + $j++; } - $result[$i][$fieldArray[$j]] = $intermediate_result; - $j++; + $i++; } - $i++; } return $result; } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue_handler.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue_handler.php index 8930a0651..116473c07 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue_handler.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue_handler.php @@ -33,15 +33,19 @@ class Ticket_Queue_Handler{ default: return "ERROR"; } + $this->pagination = new Pagination($this->queue->getQuery(),"lib",10,"Ticket",$this->queue->getParams()); - foreach( $this->pagination->getElements() 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); + $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); + } } return $this->pagination->getElements(); diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_queue.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_queue.php index 0d057e7e4..513c5f52f 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_queue.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_queue.php @@ -16,6 +16,12 @@ function show_queue(){ //Pagination Base Links $result['pagination_base_link'] = "index.php?page=show_queue&get=".$result['queue_view'] ; + //form url to keep the getters constant + $result['getURL'] = "index.php?page=show_queue&get=" . $result['queue_view']; + if(isset($_GET['pagenum'])){ + $result['getURL'] = $result['getURL'] . "&pagenum=".$_GET['pagenum']; + } + if(isset($_GET['get']) && ($_GET['get'] == "create") && isset($_GET['userid']) && isset($_GET['groupid']) && isset($_GET['what']) && isset($_GET['how']) && isset($_GET['who'])){ $userid = filter_var($_GET['userid'], FILTER_SANITIZE_NUMBER_INT); $groupid = filter_var($_GET['groupid'], FILTER_SANITIZE_NUMBER_INT); @@ -29,6 +35,9 @@ function show_queue(){ $result['prev_created_what'] = $what; $result['prev_created_how'] = $how; $result['prev_created_who'] = $who; + + $result['getURL'] = $result['getURL'] . "&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who; + } //if an action is set @@ -57,10 +66,8 @@ function show_queue(){ $result['prev_created_what'] = $what; $result['prev_created_how'] = $how; $result['prev_created_who'] = $who; - - - - + $result['getURL'] = $result['getURL'] . "&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who; + break; } diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_queue.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_queue.tpl index 179767589..6cb2069fa 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_queue.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_queue.tpl @@ -34,7 +34,7 @@ @@ -108,13 +108,13 @@ {if $ticket.assigned eq 0} -
+
{else if $ticket.assigned eq $user_id} -
+