diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue.php
index 8751efbaa..ef0b15bd2 100644
--- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue.php
+++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue.php
@@ -39,6 +39,12 @@ class Ticket_Queue{
$this->params = array('user_id' => $user_id);
}
+ public function loadAssignedandWaiting($user_id){
+ $this->query = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User
+ WHERE (tu.ExternId = :user_id AND t.Status = 1)";
+ $this->params = array('user_id' => $user_id);
+ }
+
public function createQueue($userid, $groupid, $what, $how, $who){
if($who == "user"){
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 116473c07..142dc8912 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
@@ -59,4 +59,41 @@ class Ticket_Queue_Handler{
$this->queue->createQueue($userid, $groupid, $what, $how, $who);
}
+ //==================================================================================
+ //Info retrievers about ticket statistics
+
+ public static function getNrOfTicketsToDo($user_id){
+ $queueHandler = new Ticket_Queue_Handler();
+ $queueHandler->queue->loadToDoTickets($user_id);
+ $query = $queueHandler->queue->getQuery();
+ $params = $queueHandler->queue->getParams();
+ $dbl = new DBLayer("lib");
+ return $dbl->execute($query,$params)->rowCount();
+ }
+
+ public static function getNrOfTicketsAssignedWaiting($user_id){
+ $queueHandler = new Ticket_Queue_Handler();
+ $queueHandler->queue->loadAssignedandWaiting($user_id);
+ $query = $queueHandler->queue->getQuery();
+ $params = $queueHandler->queue->getParams();
+ $dbl = new DBLayer("lib");
+ return $dbl->execute($query,$params)->rowCount();
+ }
+
+ public static function getNrOfTickets(){
+ $queueHandler = new Ticket_Queue_Handler();
+ $queueHandler->queue->loadAllTickets();
+ $query = $queueHandler->queue->getQuery();
+ $params = $queueHandler->queue->getParams();
+ $dbl = new DBLayer("lib");
+ return $dbl->execute($query,$params)->rowCount();
+ }
+
+ public static function getNewestTicket(){
+ $dbl = new DBLayer("lib");
+ $statement = $dbl->executeWithoutParams("SELECT * FROM `ticket` ORDER BY `TId` DESC LIMIT 1 ");
+ $ticket = new Ticket();
+ $ticket->set($statement->fetch());
+ return $ticket;
+ }
}
\ No newline at end of file
diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/home.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/dashboard.tpl
similarity index 100%
rename from code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/home.tpl
rename to code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/dashboard.tpl
diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_user.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_user.tpl
index 83712192c..af2f23f07 100644
--- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_user.tpl
+++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_user.tpl
@@ -1,7 +1,5 @@
{extends file="layout.tpl"}
{block name=menu}
-
Dashboard |
- |
Profile |
|
Settings |
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 1af2c3e70..82d8c023a 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
@@ -1,7 +1,7 @@
; This is a sample configuration file
; Comments start with ';', as in php.ini
-[home]
+[dashboard]
home_title = "Introduction"
home_info = "Welcome to the Ryzom Core - Account Management System"
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 81f58af42..6e9a66ab0 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
@@ -1,7 +1,7 @@
; This is a sample configuration file
; Comments start with ';', as in php.ini
-[home]
+[dashboard]
home_title = "Presentation"
home_info = "Bienvenue sur le Ryzom Core - Account Management System"
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/dashboard.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/dashboard.php
new file mode 100644
index 000000000..752156c6c
--- /dev/null
+++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/dashboard.php
@@ -0,0 +1,35 @@
+getTUserId();
+ $result['nrToDo'] = Ticket_Queue_Handler::getNrOfTicketsToDo($_SESSION['ticket_user']->getTUserId());
+ $result['nrAssignedWaiting'] = Ticket_Queue_Handler::getNrOfTicketsAssignedWaiting($_SESSION['ticket_user']->getTUserId());
+ $result['nrTotalTickets'] = Ticket_Queue_Handler::getNrOfTickets();
+ $ticket = Ticket_Queue_Handler::getNewestTicket();
+ $result['newestTicketId'] = $ticket->getTId();
+ $result['newestTicketTitle'] = $ticket->getTitle();
+ $result['newestTicketAuthor'] = Ticket_User::get_username_from_id($ticket->getAuthor());
+ return $result;
+
+ }else{
+ //ERROR: No access!
+ $_SESSION['error_code'] = "403";
+ header("Location: index.php?page=error");
+ exit;
+
+ }
+
+ }else{
+ //ERROR: not logged in!
+ header("Location: index.php");
+ exit;
+ }
+
+
+}
\ No newline at end of file
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/index.php b/code/ryzom/tools/server/ryzom_ams/www/html/index.php
index 6ce06739e..b52ccce3b 100644
--- a/code/ryzom/tools/server/ryzom_ams/www/html/index.php
+++ b/code/ryzom/tools/server/ryzom_ams/www/html/index.php
@@ -8,7 +8,11 @@ session_start();
//Decide what page to load
if ( ! isset( $_GET["page"]) ){
if(isset($_SESSION['user'])){
- $page = 'home';
+ if(Ticket_User::isMod($_SESSION['ticket_user'])){
+ $page = 'dashboard';
+ }else{
+ $page = 'show_user';
+ }
}else{
//default page
$page = 'login';
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/dashboard.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/dashboard.tpl
new file mode 100644
index 000000000..5d593eb26
--- /dev/null
+++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/dashboard.tpl
@@ -0,0 +1,52 @@
+{block name=content}
+
+
+
+
+
+{/block}
+
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/home.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/home.tpl
deleted file mode 100644
index 6198b53a1..000000000
--- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/home.tpl
+++ /dev/null
@@ -1,53 +0,0 @@
-{block name=content}
-
-
-
-
-
-{/block}
-
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_user.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_user.tpl
index 8da6ca313..301af12b6 100644
--- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_user.tpl
+++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_user.tpl
@@ -1,8 +1,7 @@
{extends file="layout.tpl"}
{block name=menu}
- Dashboard
- Profile
+ Profile
Settings
Create New Ticket