From 9ae290ca2e0f889598010db71f5d8fc17bac9d83 Mon Sep 17 00:00:00 2001 From: Quitta Date: Wed, 10 Jul 2013 02:41:03 +0200 Subject: [PATCH] Show_Ticket starts to work :) --- .../ams_lib/autoload/gui_elements.php | 20 ++++++++++++- .../ryzom_ams/ams_lib/autoload/ticket.php | 16 +++++++++- .../ams_lib/autoload/ticket_content.php | 2 +- .../ams_lib/autoload/ticket_reply.php | 29 +++++++++++++++++-- .../ryzom_ams/ams_lib/translations/en.ini | 1 + .../ryzom_ams/ams_lib/translations/fr.ini | 2 +- .../www/html/templates/createticket.tpl | 2 +- 7 files changed, 64 insertions(+), 8 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 e28e30531..1a7dfc27c 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 @@ -8,7 +8,25 @@ class Gui_Elements{ foreach($inputList as $element){ $j = 0; foreach($funcArray as $function){ - $result[$i][$fieldArray[$j]] = $element->$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 { + if($intermediate_result == NULL) { + $intermediate_result = $element->$fname(); + } else { + $intermediate_result = $intermediate_result->$fname(); + } + } + } + $result[$i][$fieldArray[$j]] = $intermediate_result; $j++; } $i++; 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 d5fa58caa..82b062a27 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 @@ -12,7 +12,19 @@ class Ticket{ ////////////////////////////////////////////Functions//////////////////////////////////////////////////// - /*FUNCTION: getTicketTitlesOf() + /*FUNCTION: getEntireTicket + * return all ticket of the given author's id. + * + */ + public static function getEntireTicket($id, $db_data) { + $ticket = new Ticket($db_data); + $ticket->load_With_TId($id); + $reply_array = Ticket_Reply::getRepliesOfTicket($id,$db_data); + return Array('ticket_obj' => $ticket,'reply_array' => $reply_array); + } + + + /*FUNCTION: getTicketTitlesOf * return all ticket of the given author's id. * */ @@ -58,6 +70,8 @@ class Ticket{ $ticket_reply->set($ticket_id, $content_id, $author); $ticket_reply->create(); + return $ticket_id; + } ////////////////////////////////////////////Methods//////////////////////////////////////////////////// diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_content.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_content.php index 62130d1d9..0555c513b 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_content.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_content.php @@ -58,7 +58,7 @@ class Ticket_Content{ public function getTContentId(){ - return $this->tContentId; + return nl2br($this->tContentId); } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php index 8f14a9f5f..2f46fd5b1 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php @@ -17,6 +17,29 @@ class Ticket_Reply{ return $instance; } + //return constructed element based on TCategoryId + public static function getRepliesOfTicket( $ticket_id, $db_data) { + $dbl = new DBLayer($db_data); + $statement = $dbl->execute("SELECT * FROM ticket_reply INNER JOIN ticket_content ON ticket_reply.Content = ticket_content.TContentId and ticket_reply.Ticket=:id", array('id' => $ticket_id)); + $row = $statement->fetchAll(); + $result = Array(); + foreach($row as $tReply){ + $instanceReply = new self($db_data); + $instanceReply->setTReplyId($tReply['TReplyId']); + $instanceReply->setTimestamp($tReply['Timestamp']); + $instanceReply->set($tReply['Ticket'],$tReply['Content'],$tReply['Author']); + + $instanceContent = new Ticket_Content($db_data); + $instanceContent->setTContentId($tReply['TContentId']); + $instanceContent->setContent($tReply['Content']); + + $instanceReply->setContent($instanceContent); + + $result[] = $instanceReply; + } + return $result; + } + ////////////////////////////////////////////Methods//////////////////////////////////////////////////// public function __construct($db_data) { @@ -26,9 +49,9 @@ class Ticket_Reply{ //Set ticket_reply object public function set($t,$c,$a){ - $this->ticket = $t; - $this->content = $c; - $this->author = $a; + $this->setTicket($t); + $this->setContent($c); + $this->setAuthor($a); } //create ticket by writing private data to DB. diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini index 858c3020f..f29098be5 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini @@ -20,6 +20,7 @@ name = "Name" email = "Email" action = "Action" +[show_ticket] [show_user] [createticket] diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini index 150a62c6b..35aaad5e5 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini @@ -21,7 +21,7 @@ email = "Email" action = "Action" [createticket] - +[show_ticket] [show_user] [error] diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/createticket.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/createticket.tpl index 0b2ad2813..bd0564932 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/createticket.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/createticket.tpl @@ -37,7 +37,7 @@
- +