can display the dashboard html atm

This commit is contained in:
Quitta 2013-09-04 17:44:43 +02:00
parent 213000c5c8
commit fd368bb123
10 changed files with 285 additions and 13 deletions

View file

@ -69,10 +69,10 @@ $ALLOW_UNKNOWN = true ;
$CREATE_RING = true ; $CREATE_RING = true ;
// site paths definitions // site paths definitions
$AMS_LIB = dirname( dirname( __FILE__ ) ) . '/ams_lib'; $AMS_LIB = dirname( __FILE__ ) . '/ams_lib';
$AMS_TRANS = $AMS_LIB . '/translations'; $AMS_TRANS = $AMS_LIB . '/translations';
$AMS_CACHEDIR = $AMS_LIB . '/cache'; $AMS_CACHEDIR = $AMS_LIB . '/cache';
$SITEBASE = dirname( __FILE__ ) . '/html/' ; $SITEBASE = dirname( __FILE__ );
$WEBPATH ='http://localhost:40917' ; $WEBPATH ='http://localhost:40917' ;
//defines the default language //defines the default language

View file

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

@ -14,6 +14,10 @@ ini_set('display_errors', 'on');
ini_set('display_startup_errors', TRUE); ini_set('display_startup_errors', TRUE);
global $TOS_URL; global $TOS_URL;
global $AMS_LIB;
global $SITEBASE;
global $AMS_TRANS;
global $DEFAULT_LANGUAGE;
global $cfg; global $cfg;
require 'ams_lib/libinclude.php'; require 'ams_lib/libinclude.php';
@ -257,7 +261,8 @@ function _ams_handler()
} }
}else{ }else{
//default page //default page
$page = 'login'; header("Location: user/login");
exit;
} }
}else{ }else{
$page = $_GET["page"]; $page = $_GET["page"];
@ -266,14 +271,17 @@ function _ams_handler()
//perform an action in case one is specified //perform an action in case one is specified
//else check if a php page is included in the inc folder, else just set page to the get param //else check if a php page is included in the inc folder, else just set page to the get param
if ( isset( $_POST["function"] ) ){ if ( isset( $_POST["function"] ) ){
require( "func/" . $_POST["function"] . ".php" ); $filename = dirname( __FILE__ ).'/func/' . $_POST["function"] . '.php';
$return = $_POST["function"](); if(is_file($filename)){
require($filename);
$return = $_POST["function"]();
}
}else{ }else{
$filename = 'inc/' . $page . '.php'; $filename = dirname( __FILE__ ).'/inc/' . $page . '.php';
if(is_file($filename)){ if(is_file($filename)){
require_once($filename); require_once($filename);
$return = $page(); $return = $page();
} }
} }
//add username to the return array in case logged in. //add username to the return array in case logged in.
@ -295,8 +303,8 @@ function _ams_handler()
$return['no_visible_elements'] = 'FALSE'; $return['no_visible_elements'] = 'FALSE';
} }
return $page; //return $page;
//helpers :: loadTemplate( $page , $return ); return helpers :: loadTemplate( $page , $return, true);
} }
@ -341,7 +349,7 @@ function _collect_login($nids, $collection)
//handle successful ingame login //handle successful ingame login
$_SESSION['user'] = $result['name']; $_SESSION['user'] = $result['name'];
$_SESSION['id'] = WebUsers::getId($result['name']); $_SESSION['id'] = WebUsers::getId($result['name']);
$_SESSION['ticket_user'] = Ticket_User::constr_ExternId($_SESSION['id']); $_SESSION['ticket_user'] = serialize(Ticket_User::constr_ExternId($_SESSION['id']));
if ($account = user_load( $_SESSION['id'])) { if ($account = user_load( $_SESSION['id'])) {
global $user; global $user;

View file

@ -0,0 +1,77 @@
{block name=content}
<table width="100%">
<tr>
<td width="25%">
<a data-original-title="{$nrAssignedWaiting} Assigned to you and waiting for support!" data-rel="tooltip" class="well span3 top-block"
href="ams/?page=show_queue&get=create&userid={$user_id}&groupid=1&what=waiting_for_support&how=assigned&who=user">
<div style="text-align:center;">Tickets Waiting for Direct Action:
<font color="red">{$nrAssignedWaiting}</font></div>
</a>
</td>
<td width="25%">
<a data-original-title="{$nrToDo} Tickets Todo." data-rel="tooltip" class="well span3 top-block" href="ams/?page=show_queue&get=todo">
<div style="text-align:center;">Tickets Todo:
<font color="red">{$nrToDo}</font></div>
</a>
</td>
<td width="25">
<a data-original-title="By {$newestTicketAuthor}" data-rel="tooltip" class="well span3 top-block" href="ams/?page=show_ticket&id={$newestTicketId}">
<div style="text-align:center;">Newest Ticket:
<font color="red">{$newestTicketTitle}</font></div>
</a>
</td>
<td width="25%">
<a data-original-title="{$nrTotalTickets} tickets in total" data-rel="tooltip" class="well span3 top-block" href="ams/?page=show_queue&get=all">
<div style="text-align:center;">Total amount of Tickets:
<font color="red">{$nrTotalTickets}</font></div>
</a>
</td>
</tr>
</table>
<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>
<p>This is the GSOC project of Daan Janssens mentored by Matthew Lagoe.</p>
<p>The features as admin covered in this project are:</p>
<ul>
<li>Manage user accounts</li>
<li>Make users moderator or admin</li>
<li>browse user's tickets</li>
<li>Create a new ticket for a specific user as admin</li>
<li>Create a new support group (and link an email to it)</li>
<li>Add mods to support groups</li>
<li>Assign ticket to you</li>
<li>Forward ticket to a support group</li>
<li>Add hidden messages to a ticket only viewable by other mods</li>
<li>Browse ticket queues or create one dynamically</li>
<li>Sync changes after the game server is back up after being down for a while</li>
<li>Browse the log of a ticket</li>
<li>Browse additional info sent along when a ticket is created ingame</li>
<li>All the above can be done while ingame too</li>
</ul>
<div class="clearfix"></div>
</div>
</div>
</div>
{/block}

View file

@ -0,0 +1,2 @@
{block name=content}{/block}

View file

@ -0,0 +1,2 @@
{extends file="layout.tpl"}

View file

@ -0,0 +1,3 @@
{extends file="layout.tpl"}

View file

@ -0,0 +1 @@
{extends file="layout.tpl"}

View file

@ -0,0 +1,142 @@
{block name=content}
<div class="row-fluid sortable ui-sortable">
<div class="box span9">
<div class="box-header well" data-original-title="">
<h2><i class="icon-user"></i> Profile of {$target_name}</h2>
<div class="box-icon">
<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">
<div class="row-fluid">
<legend>Info</legend>
<table class="table table-striped" >
<tbody>
<tr >
<td><strong>Email:</strong></td>
<td>{$mail}</td>
</tr>
<tr >
<td><strong>Role:</strong></td>
<td>
{if $userPermission eq 1}<span class="label label-success">User</span>{/if}
{if $userPermission eq 2}<span class="label label-warning">Moderator</span>{/if}
{if $userPermission eq 3}<span class="label label-important">Admin</span>{/if}
</td>
</tr>
{if $firstName neq ""}
<tr>
<td><strong>Firstname:</strong></td>
<td>{$firstName}</td>
</tr>
{/if}
{if $lastName neq ""}
<tr>
<td><strong>LastName:</strong></td>
<td>{$lastName}</td>
</tr>
{/if}
{if $country neq ""}
<tr>
<td><strong>Country:</strong></td>
<td>{$country}</td>
</tr>
{/if}
{if $gender neq 0}
<tr>
<td><strong>Gender:</strong></td>
{if $gender eq 1}
<td><strong>♂</strong></td>
{else if $gender eq 2}
<td><strong>♀</strong></td>
{/if}
</tr>
{/if}
</tbody>
</table>
</div>
</div>
</div><!--/span-->
<div class="box span3">
<div class="box-header well" data-original-title="">
<h2><i class="icon-th"></i>Actions</h2>
<div class="box-icon">
<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">
<div class="row-fluid">
<div class="btn-group">
<button class="btn btn-primary btn-large dropdown-toggle" data-toggle="dropdown">Actions<span class="caret"></span></button>
<ul class="dropdown-menu">
<li class="divider"></li>
<li><a href="index.php?page=settings&id={$target_id}">Edit User</a></li>
<li><a href="index.php?page=createticket&user_id={$target_id}">Send Ticket</a></li>
<li class="divider"></li>
{if isset($isAdmin) and $isAdmin eq 'TRUE' and $target_id neq 1}
{if $userPermission eq 1}
<li><a href="index.php?page=change_permission&user_id={$target_id}&value=2">Make Moderator</a></li>
<li><a href="index.php?page=change_permission&user_id={$target_id}&value=3">Make Admin</a></li>
{else if $userPermission eq 2 }
<li><a href="index.php?page=change_permission&user_id={$target_id}&value=1">Demote to User</a></li>
<li><a href="index.php?page=change_permission&user_id={$target_id}&value=3">Make Admin</a></li>
{else if $userPermission eq 3 }
<li><a href="index.php?page=change_permission&user_id={$target_id}&value=1">Demote to User</a></li>
<li><a href="index.php?page=change_permission&user_id={$target_id}&value=2">Demote to Moderator</a></li>
{/if}
<li class="divider"></li>
{/if}
</ul>
</div>
</div>
</div>
</div><!--/span-->
</div><!--/row-->
<div class="row-fluid sortable ui-sortable">
<div class="box span9">
<div class="box-header well" data-original-title="">
<h2><i class="icon-tag"></i> Tickets of {$target_name}</h2>
<div class="box-icon">
<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">
<div class="row-fluid">
<legend>Tickets</legend>
<table class="table table-striped table-bordered bootstrap-datatable datatable">
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Timestamp</th>
<th>Category</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{foreach from=$ticketlist item=ticket}
<tr>
<td>{$ticket.tId}</td>
<td><a href ="index.php?page=show_ticket&id={$ticket.tId}">{$ticket.title}</a></td>
<td class="center"><i>{$ticket.timestamp}</i></td>
<td class="center">{$ticket.category}</td>
<td class="center"><span class="label {if $ticket.status eq 0}label-success{else if $ticket.status eq 1}label-warning{else if $ticket.status eq 2}label-important{/if}">{if $ticket.status eq 0} <i class="icon-exclamation-sign icon-white"></i>{/if} {$ticket.statusText}</span></td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div><!--/span-->
</div><!--/row-->
{/block}

View file

@ -0,0 +1,2 @@
-Remove full path in autoload functions
-Make Permission www dependend, so it can be implemented in drupal with hook_permission();