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 new file mode 100644 index 000000000..ced3a5870 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/gui_elements.php @@ -0,0 +1,19 @@ +$function(); + $j++; + } + $i++; + } + return $result; + } + +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php index f8f9f10e3..d5fa58caa 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php @@ -23,6 +23,7 @@ class Ticket{ $result = Array(); foreach($row as $ticket){ $instance = new self($db_data); + $instance->setTId($ticket['TId']); $instance->setTimestamp($ticket['Timestamp']); $instance->setTitle($ticket['Title']); $instance->setStatus($ticket['Status']); @@ -124,6 +125,24 @@ class Ticket{ return $this->status; } + public function getStatusText(){ + $statusId = $this->getStatus(); + if ($statusId == 0){ + return "Waiting on support.."; + }else if($statusId == 1){ + return "Being handled.."; + }else if($statusId == 2){ + return "Closed"; + } + return "Error"; + } + + public function getCategoryName(){ + global $cfg; + $category = Ticket_Category::constr_TCategoryId($this->getTicket_Category(), $cfg['db']['lib']); + return $category->getName(); + } + public function getQueue(){ return $this->queue; } diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php index a0d9c9132..3051140e7 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php @@ -22,31 +22,8 @@ function show_user(){ global $cfg; $ticket_user = Ticket_User::constr_ExternId($result['target_id'],$cfg['db']['lib']); $ticketlist = Ticket::getTicketsOf($ticket_user->getTUserId(),$cfg['db']['lib']); - $i = 0; - $result['ticketlist'] = Array(); - foreach($ticketlist as $ticket){ - $result['ticketlist'][$i]['tId'] = $ticket->getTId(); - $result['ticketlist'][$i]['timestamp'] = $ticket->getTimestamp(); - $result['ticketlist'][$i]['title'] = $ticket->getTitle(); - - //get the status - $statusId = $ticket->getStatus(); - if ($statusId == 0){ - $status = "Waiting on support.."; - }else if($statusId == 1){ - $status = "Being handled.."; - }else if($statusId == 2){ - $status = "Closed"; - } - - $result['ticketlist'][$i]['statusText'] = $status; - $result['ticketlist'][$i]['status'] = $statusId; - //get the category - $category = Ticket_Category::constr_TCategoryId($ticket->getTicket_Category(), $cfg['db']['lib']); - $result['ticketlist'][$i]['category'] = $category->getName(); - $i++; - } + $result['ticketlist'] = Gui_Elements::make_table($ticketlist, Array("getTId","getTimestamp","getTitle","getStatus","getStatusText","getCategoryName"), Array("tId","timestamp","title","status","statusText","category")); return $result; }else{ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_user.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_user.tpl index 0b2a57c2b..314e36949 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_user.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_user.tpl @@ -90,6 +90,7 @@
ID | Title | Timestamp | Category | @@ -99,6 +100,7 @@
---|---|---|---|
{$ticket.tId} | {$ticket.title} | {$ticket.timestamp} | {$ticket.category} |