show queue works and show ticket info, I think all outgame aspects are covered now!

This commit is contained in:
Quitta 2013-09-06 04:52:37 +02:00
parent 4691242d4d
commit d267e60514
6 changed files with 467 additions and 1 deletions

View file

@ -73,7 +73,7 @@ $AMS_LIB = dirname( __FILE__ ) . '/ams_lib';
$AMS_TRANS = $AMS_LIB . '/translations';
$AMS_CACHEDIR = $AMS_LIB . '/cache';
$SITEBASE = dirname( __FILE__ );
$WEBPATH ='http://localhost:40917' ;
$WEBPATH ='http://localhost:40917/drupal/sites/all/modules/ryzommanage/' ;
//defines the default language
$DEFAULT_LANGUAGE = 'en';

View file

@ -0,0 +1,129 @@
<?php
function show_queue(){
//if logged in & queue id is given
if(WebUsers::isLoggedIn() && isset($_GET['get'])){
if( Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){
//the default queue you want to see.
$result['queue_view'] = filter_var($_GET['get'], FILTER_SANITIZE_STRING);
$user_id = unserialize($_SESSION['ticket_user'])->getTUserId();
$queueArray = array();
$queue_handler = new Ticket_Queue_handler();
//Pagination Base Links
$result['pagination_base_link'] = "ams?page=show_queue&get=".$result['queue_view'] ;
//form url to keep the getters constant
$result['getURL'] = "ams?page=show_queue&get=" . $result['queue_view'];
if(isset($_GET['pagenum'])){
$result['getURL'] = $result['getURL'] . "&pagenum=".$_GET['pagenum'];
}
if(isset($_GET['get']) && ($_GET['get'] == "create") && isset($_GET['userid']) && isset($_GET['groupid']) && isset($_GET['what']) && isset($_GET['how']) && isset($_GET['who'])){
$userid = filter_var($_GET['userid'], FILTER_SANITIZE_NUMBER_INT);
$groupid = filter_var($_GET['groupid'], FILTER_SANITIZE_NUMBER_INT);
$what = filter_var($_GET['what'], FILTER_SANITIZE_STRING);
$how = filter_var($_GET['how'], FILTER_SANITIZE_STRING);
$who = filter_var($_GET['who'], FILTER_SANITIZE_STRING);
$queue_handler->CreateQueue($userid, $groupid, $what, $how, $who);
$result['pagination_base_link'] = "ams?page=show_queue&get=create&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who;
$result['prev_created_userid'] = $userid;
$result['prev_created_groupid'] = $groupid;
$result['prev_created_what'] = $what;
$result['prev_created_how'] = $how;
$result['prev_created_who'] = $who;
$result['getURL'] = $result['getURL'] . "&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who;
}
//if an action is set
if(isset($_POST['action'])){
switch($_POST['action']){
case "assignTicket":
$ticket_id = filter_var($_POST['ticket_id'], FILTER_SANITIZE_NUMBER_INT);
$result['ACTION_RESULT'] = Ticket::assignTicket($user_id, $ticket_id);
break;
case "unAssignTicket":
$ticket_id = filter_var($_POST['ticket_id'], FILTER_SANITIZE_NUMBER_INT);
$result['ACTION_RESULT'] = Ticket::unAssignTicket($user_id, $ticket_id);
break;
case "create_queue":
$userid = filter_var($_POST['userid'], FILTER_SANITIZE_NUMBER_INT);
$groupid = filter_var($_POST['groupid'], FILTER_SANITIZE_NUMBER_INT);
$what = filter_var($_POST['what'], FILTER_SANITIZE_STRING);
$how = filter_var($_POST['how'], FILTER_SANITIZE_STRING);
$who = filter_var($_POST['who'], FILTER_SANITIZE_STRING);
$queue_handler->CreateQueue($userid, $groupid, $what, $how, $who);
$result['pagination_base_link'] = "ams?page=show_queue&get=create&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who;
$result['prev_created_userid'] = $userid;
$result['prev_created_groupid'] = $groupid;
$result['prev_created_what'] = $what;
$result['prev_created_how'] = $how;
$result['prev_created_who'] = $who;
$result['getURL'] = $result['getURL'] . "&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who;
break;
}
}
$queueArray = $queue_handler->getTickets($result['queue_view'], $user_id);
//pagination
$result['links'] = $queue_handler->getPagination()->getLinks(5);
$result['lastPage'] = $queue_handler->getPagination()->getLast();
$result['currentPage'] = $queue_handler->getPagination()->getCurrent();
//if queue_view is a valid parameter value
if ($queueArray != "ERROR"){
$result['tickets'] = Gui_Elements::make_table($queueArray, Array("getTId","getTitle","getTimestamp","getAuthor()->getExternId","getTicket_Category()->getName","getStatus","getStatusText","getAssigned","getForwardedGroupName","getForwardedGroupId"), Array("tId","title","timestamp","authorExtern","category","status","statusText","assigned","forwardedGroupName","forwardedGroupId"));
$i = 0;
foreach( $result['tickets'] as $ticket){
$web_author = new WebUsers($ticket['authorExtern']);
$result['tickets'][$i]['author'] = $web_author->getUsername();
$web_assigned = new WebUsers($ticket['assigned']);
$result['tickets'][$i]['assignedText'] = $web_assigned->getUsername();
$result['tickets'][$i]['timestamp_elapsed'] = Gui_Elements::time_elapsed_string($ticket['timestamp']);
$i++;
}
$result['user_id'] = unserialize($_SESSION['ticket_user'])->getTUserId();
//Queue creator field info
$result['grouplist'] = Gui_Elements::make_table(Support_Group::getGroups(), Array("getSGroupId","getName"), Array("sGroupId","name"));
$result['teamlist'] = Gui_Elements::make_table(Ticket_User::getModsAndAdmins(), Array("getTUserId","getExternId"), Array("tUserId","externId"));
$i = 0;
foreach( $result['teamlist'] as $member){
$web_teammember = new Webusers($member['externId']);
$result['teamlist'][$i]['name'] = $web_teammember->getUsername();
$i++;
}
return $result;
}else{
//ERROR: Doesn't exist!
$_SESSION['error_code'] = "404";
header("Location: ams?page=error");
exit;
}
}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

@ -0,0 +1,53 @@
<?php
function show_ticket_info(){
//if logged in
if(WebUsers::isLoggedIn() && isset($_GET['id'])){
$result['ticket_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
$target_ticket = new Ticket();
$target_ticket->load_With_TId($result['ticket_id']);
if( $target_ticket->hasInfo() && (($target_ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId()) || Ticket_User::isMod(unserialize($_SESSION['ticket_user']) ))){
$result['ticket_title'] = $target_ticket->getTitle();
$result['ticket_author'] = $target_ticket->getAuthor();
$ticket_info = new Ticket_Info();
$ticket_info->load_With_Ticket($result['ticket_id']);
$result['shard_id'] = $ticket_info->getShardId();
$result['user_position'] = $ticket_info->getUser_Position();
$result['view_position'] = $ticket_info->getView_Position();
$result['client_version'] = $ticket_info->getClient_Version();
$result['patch_version'] = $ticket_info->getPatch_Version();
$result['server_tick'] = $ticket_info->getServer_Tick();
$result['connect_state'] = $ticket_info->getConnect_State();
$result['local_address'] = $ticket_info->getLocal_Address();
$result['memory'] = $ticket_info->getMemory();
$result['os'] = $ticket_info->getOS();
$result['processor'] = $ticket_info->getProcessor();
$result['cpu_id'] = $ticket_info->getCPUId();
$result['cpu_mask'] = $ticket_info->getCPU_Mask();
$result['ht'] = $ticket_info->getHT();
$result['nel3d'] = $ticket_info->getNel3D();
$result['user_id'] = $ticket_info->getUser_Id();
global $WEBPATH;
$result['WEBPATH'] = $WEBPATH;
if(Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){
$result['isMod'] = "TRUE";
}
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

@ -22,6 +22,7 @@ global $cfg;
global $TICKET_LOGGING;
global $TIME_FORMAT;
global $TICKET_MAILING_SUPPORT;
global $WEBPATH;
require 'ams_lib/libinclude.php';
spl_autoload_register('__autoload');

View file

@ -0,0 +1,204 @@
{block name=content}
<h1>Ticket Queue {$queue_view}</h1>
<table>
<tr>
<td>
<table>
<tr>
<td width=20%><a href="ams?page=show_queue&get=todo">Todo tickets</a></td>
<td width=20%><a href="ams?page=show_queue&get=all">All tickets</a></td>
<td width=20%><a href="ams?page=show_queue&get=all_open">All open tickets</a></td>
<td width=20%><a href="ams?page=show_queue&get=archive">Ticket Archive</a></td>
<td width=20%><a href="ams?page=show_queue&get=not_assigned">Not Assigned Tickets</a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<form id="create_queue" class="form-vertical" method="post" action="ams?page=show_queue&get=create" style="margin:0px 0px 0px;">
<table>
<tr>
<td>
<table width=100%>
<tr>
<td>
Show
</td>
<td>
<select name="what">
<option value="all" {if isset($prev_created_what) and $prev_created_what eq "all"}selected="selected"{/if}>all</option>
<option value="waiting_for_support" {if isset($prev_created_what) and $prev_created_what eq "waiting_for_support"}selected="selected"{/if}>waiting for support</option>
<option value="waiting_for_users" {if isset($prev_created_what) and $prev_created_what eq "waiting_for_users"}selected="selected"{/if}>waiting for user</option>
<option value="closed" {if isset($prev_created_what) and $prev_created_what eq "closed"}selected="selected"{/if}>closed</option>
</select>
</td>
<td>
tickets
</td>
<td>
<select name="how">
<option value="assigned" {if isset($prev_created_how) and $prev_created_how eq "assigned"}selected="selected"{/if}>assigned</option>
<option value="not_assigned" {if isset($prev_created_how) and $prev_created_how eq "not_assigned"}selected="selected"{/if}>not assigned</option>
</select>
</td>
<td>
to
</td>
<td>
<select name="who" onchange="aimedforwhochanged(this.value);">
<option value="user" {if isset($prev_created_who) and $prev_created_who eq "user"}selected="selected"{/if}>user</option>
<option value="support_group" {if isset($prev_created_who) and $prev_created_who eq "support_group"}selected="selected"{/if}>support group</option>
</select>
</td>
<td>
<span id="userList" {if isset($prev_created_who) and $prev_created_who eq "user"}style="display:inline;"{else if isset($prev_created_who) and $prev_created_who eq "support_group"}style="display:none;"{else}style="display:inline;"{/if}>
<select name="userid">
{foreach from=$teamlist item=member}
<option value="{$member.tUserId}" {if isset($prev_created_userid)} {if $prev_created_userid eq $member.tUserId}selected="selected"{/if}{else if $user_id eq $member.tUserId}selected="selected"{/if}>{$member.name}</option>
{/foreach}
</select>
</span>
</td>
<td>
<span id="supportGroupList" {if isset($prev_created_who) and $prev_created_who eq "user"}style="display:none;"{else if isset($prev_created_who) and $prev_created_who eq "support_group"}style="display:inline;"{else}style="display:none;"{/if}>
<select name="groupid">
{foreach from=$grouplist item=group}
<option value="{$group.sGroupId}" {if isset($prev_created_groupid) and $prev_created_groupid eq $group.sGroupId}selected="selected"{/if}>{$group.name}</option>
{/foreach}
</select>
</span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<input type="hidden" name="action" value="create_queue">
<button type="submit" style="bottom:4px; position:relative;">View</button>
</td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td>
{if isset($ACTION_RESULT) and $ACTION_RESULT eq "SUCCESS_ASSIGNED"}
<font color="green">
{$success_assigned}
</font>
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "SUCCESS_UNASSIGNED"}
<font color="green">
{$success_unassigned}
</font>
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "TICKET_NOT_EXISTING"}
<font color="red">
{$ticket_not_existing}
</font>
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "ALREADY_ASSIGNED"}
<font color="red">
{$ticket_already_assigned}
</font>
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "NOT_ASSIGNED"}
<font color="red">
{$ticket_not_assigned}
</font>
{/if}
</td>
</tr>
<tr>
<td>
<table width=100%>
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Assigned</th>
<th>Timestamp</th>
<th>Category</th>
<th>Status</th>
<th>SupportGroup</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{foreach from=$tickets item=ticket}
<tr>
<td>{$ticket.tId}</td>
<td><a href ="ams?page=show_ticket&id={$ticket.tId}">{$ticket.title}</a></td>
<td>{if $ticket.assignedText neq ""} <a href="ams?page=show_user&id={$ticket.assigned}">{$ticket.assignedText} {else}<i> {$not_assigned}</i> {/if}</td>
<td class="center"><span title="{$ticket.timestamp_elapsed}" data-rel="tooltip" data-placement="right">{$ticket.timestamp}</span></td>
<td class="center">{$ticket.category}</td>
<td class="center"><font color=" {if $ticket.status eq 0}green{else if $ticket.status eq 1}orange{else if $ticket.status eq 3}red{/if}"> {$ticket.statusText}</font></td>
<td class="center">
{if $ticket.forwardedGroupName eq "0"}
<i>{$public_sgroup}</i>
{else}
<span class="label label-info"><a href="ams?page=show_sgroup&id={$ticket.forwardedGroupId}">{$ticket.forwardedGroupName}</a></span>
{/if}
</td>
<td>
{if $ticket.assigned eq 0}
<form id="assign_ticket" class="form-vertical" method="post" action="{$getURL}" style="margin:0px 0px 0px;">
<input type="hidden" name="ticket_id" value="{$ticket.tId}">
<input type="hidden" name="action" value="assignTicket">
<button type="submit" class="btn btn-primary" ><i class="icon-flag icon-white"></i> Assign Ticket</button>
</form>
{else if $ticket.assigned eq $user_id}
<form id="assign_ticket" class="form-vertical" method="post" action="{$getURL}" style="margin:0px 0px 0px;">
<input type="hidden" name="ticket_id" value="{$ticket.tId}">
<input type="hidden" name="action" value="unAssignTicket">
<button type="submit" class="btn btn-warning" ><i class="icon-remove icon-white"></i> Remove Assign</button>
</form>
{/if}
</td>
</tr>
{/foreach}
</tbody>
</table>
<center>
<a href="{$pagination_base_link}&pagenum=1">&laquo;</a> |
{foreach from=$links item=link}
<a href="{$pagination_base_link}&pagenum={$link}">{if $link == $currentPage}<u>{/if}{$link}{if $link == $currentPage}</u>{/if}</a> |
{/foreach}
<a href="{$pagination_base_link}&pagenum={$lastPage}">&raquo;</a>
</center>
</td>
</tr>
</table>
<!----- /javascript for this page -->
<script type="text/javascript">
function aimedforwhochanged(value)
{
if (value == "user")
{
//hide the supportGroupList span
var elem = document.getElementById("supportGroupList");
elem.style.display="none";
var elem2 = document.getElementById("userList");
elem2.style.display="inline";
}
else if(value == "support_group")
{
//hide the userList span
var elem = document.getElementById("supportGroupList");
elem.style.display= "inline";
var elem2 = document.getElementById("userList");
elem2.style.display="none";
}
}
</script>
{/block}

View file

@ -0,0 +1,79 @@
{block name=content}
<h1><a href="ams?page=show_ticket&id={$ticket_id}">[#{$ticket_id}] {$ticket_title}</a> </h1>
<h2>Actions</h2>
<table width=100%>
<tr>
{if isset($isMod) and $isMod eq "TRUE"}<td width=33%><a href="ams?page=show_ticket_log&id={$ticket_id}">Show Ticket Log</a></td>{/if}
<td width=33%><a href="ams?page=createticket&user_id={$ticket_author}">Send Other Ticket</a></td>
<td width=33%><a href="ams?page=show_ticket&id={$ticket_id}">Show Ticket</a></td>
</tr>
</table>
<h2>Additional Info </h2>
<table>
<tr>
<td><center><strong> Ingame related </strong></center></td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/shard.png"/><strong> Shard ID: </strong>{$shard_id}</td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/user.png"/><strong> User_Id: </strong>{$user_id}</td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/position.png"/><strong> User Position: </strong>{$user_position}</td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/view.png"/><strong> View Position: </strong>{$view_position}</td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/client.png"/><strong> Client_Version: </strong> {$client_version}</td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/patch.png"/><strong> Patch_Version: </strong>{$patch_version}</td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/server.png"/><strong> Server_Tick: </strong>{$server_tick}</td>
</tr>
<tr class="alert alert-info">
<td><center><strong> Hardware & Software related </strong></center></td>
</tr>
<tr>
<td><strong><img src="{$WEBPATH}/ams_lib/img/info/memory.png"/> Memory: </strong>{$memory}</td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/processor.png"/><strong> Processor: </strong>{$processor}</td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/cpuid.png"/><strong> Cpu_Id: </strong>{$cpu_id}</td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/mask.png"/><strong> Cpu_Mask: </strong>{$cpu_mask}</td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/ht.png"/><strong> HT: </strong>{$ht}</td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/os.png"/><strong> OS: </strong>{$os}</td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/nel.png"/><strong> NeL3D: </strong>{$nel3d}</td>
</tr>
<tr class="alert alert-info">
<td><center><strong> Network related </strong></center></td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/connect.png"/><strong> Connect_State: </strong>{$connect_state}</td>
</tr>
<tr>
<td><img src="{$WEBPATH}/ams_lib/img/info/local.png"/><strong> Local_Address: </strong>{$local_address}</td>
</tr>
</table>
{/block}