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 ec34ceaa3..f8f9f10e3 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,6 +12,29 @@ class Ticket{ ////////////////////////////////////////////Functions//////////////////////////////////////////////////// + /*FUNCTION: getTicketTitlesOf() + * return all ticket of the given author's id. + * + */ + public static function getTicketsOf($author, $db_data) { + $dbl = new DBLayer($db_data); + $statement = $dbl->execute("SELECT * FROM ticket INNER JOIN ticket_user ON ticket.Author = ticket_user.TUserId and ticket_user.ExternId=:id", array('id' => $author)); + $row = $statement->fetchAll(); + $result = Array(); + foreach($row as $ticket){ + $instance = new self($db_data); + $instance->setTimestamp($ticket['Timestamp']); + $instance->setTitle($ticket['Title']); + $instance->setStatus($ticket['Status']); + $instance->setQueue($ticket['Queue']); + $instance->setTicket_Category($ticket['Ticket_Category']); + $instance->setAuthor($ticket['Author']); + $result[] = $instance; + } + return $result; + } + + /*FUNCTION: create_Ticket() * creates a ticket + first initial reply and fills in the content of it! * 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 7e802cee8..a0d9c9132 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 @@ -4,7 +4,7 @@ function show_user(){ //if logged in if(WebUsers::isLoggedIn()){ - if(WebUsers::isAdmin()){ + if( !isset($_GET['id']) || WebUsers::isAdmin() || $_GET['id'] == $_SESSION['id'] ){ if(isset($_GET['id'])){ $result['target_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT); @@ -19,6 +19,34 @@ function show_user(){ $result['country'] = $info['Country']; $result['gender'] = $info['Gender']; + 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++; + } + return $result; }else{ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl index 1316aca7d..32088c7b8 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl @@ -96,6 +96,7 @@
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_admin.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_admin.tpl index aaa625a7d..cd7bc60ad 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_admin.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_admin.tpl @@ -2,6 +2,7 @@ {block name=menu}Title | +Timestamp | +Category | +Status | +
---|---|---|---|
{$ticket.title} | +{$ticket.timestamp} | +{$ticket.category} | + +{$ticket.statusText} | +