dashboard added that shows the newest ticket, the amount of tickets in your todo list and tickets waiting on YOUR response

This commit is contained in:
Quitta 2013-08-29 05:01:47 +02:00
parent 600b016e1d
commit a86f192c84
11 changed files with 138 additions and 60 deletions

View file

@ -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"){

View file

@ -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;
}
}

View file

@ -1,7 +1,5 @@
{extends file="layout.tpl"}
{block name=menu}
<td height="25" valign="middle" nowrap><a class="ajax-link" href="index.php"><h5> Dashboard</h5></a></td>
<td width="3"></td>
<td height="25" valign="middle" nowrap><a class="ajax-link" href="index.php?page=show_user"><h5> Profile</h5></a></td>
<td width="3"></td>
<td height="25" valign="middle" nowrap><a class="ajax-link" href="index.php?page=settings"><h5> Settings</h5></a></td>

View file

@ -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"

View file

@ -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"

View file

@ -0,0 +1,35 @@
<?php
function dashboard(){
//if logged in
if(WebUsers::isLoggedIn()){
//is Mod
if(ticket_user::isMod($_SESSION['ticket_user'])){
$result['user_id'] = $_SESSION['ticket_user']->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;
}
}

View file

@ -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';

View file

@ -0,0 +1,52 @@
{block name=content}
<div class="sortable row-fluid ui-sortable">
<a data-original-title="{$nrAssignedWaiting} Assigned to you and waiting for support!" data-rel="tooltip" class="well span3 top-block"
href="index.php?page=show_queue&get=create&userid={$user_id}&groupid=1&what=waiting_for_support&how=assigned&who=user">
<span class="icon32 icon-blue icon-alert"></span>
<div>Tickets Waiting for Direct Action</div>
<span class="notification red">{$nrAssignedWaiting}</span>
</a>
<a data-original-title="{$nrToDo} Tickets Todo." data-rel="tooltip" class="well span3 top-block" href="index.php?page=show_queue&get=todo">
<span class="icon32 icon-blue icon-tag"></span>
<div>Tickets Todo</div>
<span class="notification red">{$nrToDo}</span>
</a>
<a data-original-title="By {$newestTicketAuthor}" data-rel="tooltip" class="well span3 top-block" href="index.php?page=show_ticket&id={$newestTicketId}">
<span class="icon32 icon-blue icon-flag"></span>
<div>Newest Ticket</div>
<span class="notification blue">{$newestTicketTitle}</span>
</a>
<a data-original-title="{$nrTotalTickets} tickets in total" data-rel="tooltip" class="well span3 top-block" href="index.php?page=show_queue&get=all">
<span class="icon32 icon-blue icon-archive"></span>
<div>Total amount of Tickets</div>
<span class="notification blue">{$nrTotalTickets}</span>
</a>
</div>
<div class="row-fluid">
<div class="box span12">
<div class="box-header well">
<h2><i class="icon-info-sign"></i> {$home_title}</h2>
<div class="box-icon">
<a href="#" class="btn btn-round" onclick="javascript:show_help('intro');return false;"><i class="icon-info-sign"></i></a>
<a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<div class="box-content">
<p><strong>{$home_info}</strong></p>
<div class="clearfix"></div>
</div>
</div>
</div>
{/block}

View file

@ -1,53 +0,0 @@
{block name=content}
<div class="sortable row-fluid ui-sortable">
<a data-original-title="6 new members." data-rel="tooltip" class="well span3 top-block" href="#">
<span class="icon32 icon-red icon-user"></span>
<div>Total Members</div>
<div>507</div>
<span class="notification">6</span>
</a>
<a data-original-title="4 new pro members." data-rel="tooltip" class="well span3 top-block" href="#">
<span class="icon32 icon-color icon-star-on"></span>
<div>Pro Members</div>
<div>228</div>
<span class="notification green">4</span>
</a>
<a data-original-title="$34 new sales." data-rel="tooltip" class="well span3 top-block" href="#">
<span class="icon32 icon-color icon-cart"></span>
<div>Sales</div>
<div>$13320</div>
<span class="notification yellow">$34</span>
</a>
<a data-original-title="12 new messages." data-rel="tooltip" class="well span3 top-block" href="#">
<span class="icon32 icon-color icon-envelope-closed"></span>
<div>Messages</div>
<div>25</div>
<span class="notification red">12</span>
</a>
</div>
<div class="row-fluid">
<div class="box span12">
<div class="box-header well">
<h2><i class="icon-info-sign"></i> {$home_title}</h2>
<div class="box-icon">
<a href="#" class="btn btn-round" onclick="javascript:show_help('intro');return false;"><i class="icon-info-sign"></i></a>
<a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<div class="box-content">
<p><strong>{$home_info}</strong></p>
<div class="clearfix"></div>
</div>
</div>
</div>
{/block}

View file

@ -1,8 +1,7 @@
{extends file="layout.tpl"}
{block name=menu}
<li class="nav-header hidden-tablet">Main</li>
<li style="margin-left: -2px;" class="active"><a class="ajax-link" href="index.php"><i class="icon-home"></i><span class="hidden-tablet"> Dashboard</span></a></li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=show_user"><i class="icon-user"></i><span class="hidden-tablet"> Profile</span></a></li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=show_user"><i class="icon-user"></i><span class="hidden-tablet">Profile</span></a></li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=settings"><i class="icon-cog"></i><span class="hidden-tablet"> Settings</span></a></li>
<li class="nav-header hidden-tablet">Actions</li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=createticket"><i class="icon-pencil"></i><span class="hidden-tablet">Create New Ticket</span></a></li>