ticket_info class almost done

This commit is contained in:
Quitta 2013-08-27 19:08:10 +02:00
parent 71e40d50b1
commit 468655de0e
13 changed files with 552 additions and 0 deletions

View file

@ -0,0 +1,234 @@
<?php
class Ticket_Log{
private $tInfoId;
private $ticket;
private $shardid;
private $user_position;
private $view_position;
private $client_version;
private $patch_version;
private $server_tick;
private $connect_state;
private $local_address;
private $memory;
private $os;
private $processor;
private $cpu_id;
private $cpu_mask;
private $ht;
private $nel3d;
////////////////////////////////////////////Functions////////////////////////////////////////////////////
//Creates a log entry
public static function createTicketInfo($info_array) {
$dbl = new DBLayer("lib");
$query = "INSERT INTO ticket_log (Timestamp, Query, Ticket, Author) VALUES (now(), :query, :ticket, :author )";
$values = Array('ticket' => $ticket_id, 'author' => $author_id, 'query' => json_encode(array($action,$arg)));
$dbl->execute($query, $values);
}
//return constructed element based on TLogId
public static function constr_TInfoId( $id) {
$instance = new self();
$instance->setTInfoId($id);
return $instance;
}
////////////////////////////////////////////Methods////////////////////////////////////////////////////
public function __construct() {
}
//set values
public function set($values) {
$this->setTInfoId($values['TInfoId']);
$this->setTicket($values['Ticket']);
$this->setShardId($values['ShardId']);
$this->setUser_Position($values['UserPosition']);
$this->setView_Position($values['ViewPosition']);
$this->setClient_Version($values['ClientVersion']);
$this->setPatch_Version($values['PatchVersion']);
$this->setServer_Tick($values['ServerTick']);
$this->setConnect_State($values['ConnectState']);
$this->setLocal_Address($values['LocalAddress']);
$this->setMemory($values['Memory']);
$this->setOS($values['OS']);
$this->setProcessor($values['Processor']);
$this->setCPUId($values['CPUID']);
$this->setCPU_Mask($values['CpuMask']);
$this->setHT($values['HT']);
$this->setNel3D($values['NeL3D']);
}
//Load with tInfoId
public function load_With_TInfoId( $id) {
$dbl = new DBLayer("lib");
$statement = $dbl->execute("SELECT * FROM ticket_info WHERE TInfoId=:id", array('id' => $id));
$row = $statement->fetch();
$this->set($row);
}
//Load with ticket Id
public function load_With_TId( $id) {
$dbl = new DBLayer("lib");
$statement = $dbl->execute("SELECT * FROM ticket_info WHERE Ticket=:id", array('id' => $id));
$row = $statement->fetch();
$this->set($row);
}
////////////////////////////////////////////Getters////////////////////////////////////////////////////
public function getTInfoId(){
return $this->tInfoId;
}
public function getTicket(){
return $this->ticket;
}
public function getShardId(){
return $this->shardid;
}
public function getUser_Position(){
return $this->user_position;
}
public function getView_Position(){
return $this->view_position;
}
public function getClient_Version(){
return $this->client_version;
}
public function getPatch_Version(){
return $this->patch_version;
}
public function getServer_Tick(){
return $this->server_tick;
}
public function getConnect_State(){
return $this->connect_state;
}
public function getLocal_Address(){
return $this->local_address;
}
public function getMemory(){
return $this->memory;
}
public function getOS(){
return $this->os;
}
public function getProcessor(){
return $this->processor;
}
public function getCPUId(){
return $this->cpu_id;
}
public function getCPU_Mask(){
return $this->cpu_mask;
}
public function getHT(){
return $this->ht;
}
public function getNel3D(){
return $this->nel3d;
}
////////////////////////////////////////////Setters////////////////////////////////////////////////////
public function setTInfoId($id){
$this->tInfoId = $id;
}
public function setTicket($t){
$this->ticket = $t;
}
public function setShardId($s){
$this->shardid = $s;
}
public function setUser_Position($u){
$this->user_position = $u;
}
public function setView_Position($v){
$this->view_position = $v;
}
public function setClient_Version($c){
$this->client_version = $c;
}
public function setPatch_Version($p){
$this->patch_version = $p;
}
public function setServer_Tick($s){
$this->server_tick = $s;
}
public function setConnect_State($c){
$this->connect_state = $c;
}
public function setLocal_Address($l){
$this->local_address = $l;
}
public function setMemory($m){
$this->memory = $m;
}
public function setOS($o){
$this->os = $o;
}
public function setProcessor($p){
$this->processor = $p;
}
public function setCPUId($c){
$this->cpu_id = $c;
}
public function setCPU_Mask($c){
$this->cpu_mask = $c;
}
public function setHT($h){
$this->ht = $h;
}
public function setNel3D($n){
$this->nel3d = $n;
}
}

View file

@ -10,6 +10,7 @@
<tr> <tr>
{if isset($isMod) and $isMod eq "TRUE"}<td valign="middle" nowrap><a href="index.php?page=show_ticket_log&id={$ticket_tId}">Show Ticket Log</a></td>{/if} {if isset($isMod) and $isMod eq "TRUE"}<td valign="middle" nowrap><a href="index.php?page=show_ticket_log&id={$ticket_tId}">Show Ticket Log</a></td>{/if}
<td valign="middle" nowrap><a href="index.php?page=createticket&user_id={$ticket_author}">Send Other Ticket</a></td> <td valign="middle" nowrap><a href="index.php?page=createticket&user_id={$ticket_author}">Send Other Ticket</a></td>
<td valign="middle" nowrap><a href="index.php?page=show_ticket_info&id={$ticket_tId}">Show Additional Info</a></td>
</tr> </tr>
</table> </table>
</td> </td>

View file

@ -0,0 +1,96 @@
{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-tag"></i> <a href="index.php?page=show_ticket&id={$ticket_id}">[#{$ticket_id}] {$ticket_title}</a> </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>Additional Info </legend>
<form id="changeTicket" class="form-vertical" method="post" action="index.php">
<table class="table table-bordered table-condensed " >
<tr>
<td><strong>Shard ID: </strong>{$shard_id}</td>
</tr>
<tr>
<td><strong>User Position: </strong>{$user_position}</td>
<tr>
<td><strong>View Position: </strong>{$view_position}</td>
</tr>
<tr>
<td><strong>client_version: </strong> {$client_version}</td>
</tr>
<tr>
<td><strong>patch_version: </strong>{$patch_version}</td>
</tr>
<tr>
<td><strong>memory: </strong>{$memory}</td>
</tr>
<tr>
<td><strong>server_tick: </strong>{$server_tick}</td>
</tr>
<tr>
<td><strong>connect_state: </strong>{$connect_state}</td>
</tr>
<tr>
<td><strong>local_address: </strong>{$local_address}</td>
</tr>
<tr>
<td><strong>os: </strong>{$os}</td>
</tr>
<tr>
<td><strong>processor: </strong>{$processor}</td>
</tr>
<tr>
<td><strong>cpu_id: </strong>{$cpu_id}</td>
</tr>
<tr>
<td><strong>cpu_mask: </strong>{$cpu_mask}</td>
</tr>
<tr>
<td><strong>ht: </strong>{$ht}</td>
</tr>
<tr>
<td><strong>nel3d: </strong>{$nel3d}</td>
</tr>
</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">
<legend style="margin-bottom:9px;">Actions</legend>
<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>
{if isset($isMod) and $isMod eq "TRUE"}<li><a href="index.php?page=show_ticket_log&id={$ticket_id}">Show Ticket Log</a></li>{/if}
<li><a href="index.php?page=createticket&user_id={$ticket_author}">Send Other Ticket</a></li>
<li><a href="index.php?page=show_ticket&id={$ticket_id}">Show Ticket</a></li>
<li class="divider"></li>
</ul>
</div>
</div>
</div>
</div>
</div><!--/row-->
{/block}

View file

@ -65,6 +65,8 @@ group_size_error = "The name has to be between 4-20 chars and the tag between 2-
[createticket] [createticket]
[show_ticket_info]
[show_ticket_log] [show_ticket_log]
[show_reply] [show_reply]

View file

@ -62,6 +62,8 @@ group_size_error = "le nom doit etre 4-20 chars et le tag 2-4!"
[createticket] [createticket]
[show_ticket_info]
[show_reply] [show_reply]
[show_ticket_log] [show_ticket_log]

View file

@ -2,6 +2,7 @@
function login(){ function login(){
if ( helpers :: check_if_game_client () ){ if ( helpers :: check_if_game_client () ){
//check if you are logged in ingame.
$result = Helpers::check_login_ingame(); $result = Helpers::check_login_ingame();
if( $result != "FALSE"){ if( $result != "FALSE"){
//handle successful login //handle successful login

View file

@ -0,0 +1,52 @@
<?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->getAuthor() == $_SESSION['ticket_user']->getTUserId()) || Ticket_User::isMod($_SESSION['ticket_user'] )){
$result['ticket_title'] = $target_ticket->getTitle();
$result['ticket_author'] = $target_ticket->getAuthor();
$result['shard_id'] = $_GET['ShardId'];
$result['user_position'] = $_GET['UserPosition'];
$result['view_position'] = $_GET['ViewPosition'];
$result['client_version'] = $_GET['ClientVersion'];
$result['patch_version'] = $_GET['PatchVersion'];
$result['server_tick'] = $_GET['ServerTick'];
$result['connect_state'] = $_GET['ConnectState'];
$result['local_address'] = $_GET['LocalAddress'];
$result['memory'] = $_GET['Memory'];
$result['os'] = $_GET['OS'];
$result['processor'] = $_GET['Processor'];
$result['cpu_id'] = $_GET['CPUID'];
$result['cpu_mask'] = $_GET['CpuMask'];
$result['ht'] = $_GET['HT'];
$result['nel3d'] = $_GET['NeL3D'];
if(Ticket_User::isMod($_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;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 194 KiB

View file

@ -379,6 +379,39 @@
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE NO ACTION) ON UPDATE NO ACTION)
ENGINE = InnoDB; ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `" . $cfg['db']['lib']['name'] ."`.`ticket_info`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_info` ;
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_info` (
`TInfoId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`Ticket` INT UNSIGNED NOT NULL ,
`ShardId` INT NULL ,
`UserPosition` VARCHAR(65) NULL ,
`ViewPosition` VARCHAR(65) NULL ,
`ClientVersion` VARCHAR(65) NULL ,
`PatchVersion` VARCHAR(65) NULL ,
`ServerTick` VARCHAR(40) NULL ,
`ConnectState` VARCHAR(40) NULL ,
`LocalAddress` VARCHAR(60) NULL ,
`Memory` VARCHAR(60) NULL ,
`OS` VARCHAR(70) NULL ,
`Processor` VARCHAR(70) NULL ,
`CPUID` VARCHAR(50) NULL ,
`CpuMask` VARCHAR(50) NULL ,
`HT` VARCHAR(65) NULL ,
`NeL3D` VARCHAR(70) NULL ,
PRIMARY KEY (`TInfoId`) ,
INDEX `fk_ticket_info_ticket1` (`Ticket` ASC) ,
CONSTRAINT `fk_ticket_info_ticket1`
FOREIGN KEY (`Ticket` )
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ticket` (`TId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;

View file

@ -335,6 +335,39 @@ CREATE TABLE IF NOT EXISTS `mydb`.`email` (
ENGINE = InnoDB; ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`ticket_info`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`ticket_info` ;
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_info` (
`TInfoId` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`Ticket` INT UNSIGNED NOT NULL ,
`ShardId` INT NULL ,
`UserPosition` VARCHAR(65) NULL ,
`ViewPosition` VARCHAR(65) NULL ,
`ClientVersion` VARCHAR(65) NULL ,
`PatchVersion` VARCHAR(65) NULL ,
`ServerTick` VARCHAR(40) NULL ,
`ConnectState` VARCHAR(40) NULL ,
`LocalAddress` VARCHAR(60) NULL ,
`Memory` VARCHAR(60) NULL ,
`OS` VARCHAR(70) NULL ,
`Processor` VARCHAR(70) NULL ,
`CPUID` VARCHAR(50) NULL ,
`CpuMask` VARCHAR(50) NULL ,
`HT` VARCHAR(65) NULL ,
`NeL3D` VARCHAR(70) NULL ,
PRIMARY KEY (`TInfoId`) ,
INDEX `fk_ticket_info_ticket1` (`Ticket` ASC) ,
CONSTRAINT `fk_ticket_info_ticket1`
FOREIGN KEY (`Ticket` )
REFERENCES `mydb`.`ticket` (`TId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE; SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;

View file

@ -224,6 +224,7 @@
<li class="divider"></li> <li class="divider"></li>
{if isset($isMod) and $isMod eq "TRUE"}<li><a href="index.php?page=show_ticket_log&id={$ticket_tId}">Show Ticket Log</a></li>{/if} {if isset($isMod) and $isMod eq "TRUE"}<li><a href="index.php?page=show_ticket_log&id={$ticket_tId}">Show Ticket Log</a></li>{/if}
<li><a href="index.php?page=createticket&user_id={$ticket_author}">Send Other Ticket</a></li> <li><a href="index.php?page=createticket&user_id={$ticket_author}">Send Other Ticket</a></li>
<li><a href="index.php?page=show_ticket_info&id={$ticket_tId}">Show ticket Info</a></li>
<li class="divider"></li> <li class="divider"></li>
</ul> </ul>
</div> </div>

View file

@ -0,0 +1,97 @@
{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-tag"></i> <a href="index.php?page=show_ticket&id={$ticket_id}">[#{$ticket_id}] {$ticket_title}</a> </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>Additional Info </legend>
<form id="changeTicket" class="form-vertical" method="post" action="index.php">
<table class="table table-bordered table-condensed " >
<tr>
<td><strong>Shard ID: </strong>{$shard_id}</td>
</tr>
<tr>
<td><strong>User Position: </strong>{$user_position}</td>
<tr>
<td><strong>View Position: </strong>{$view_position}</td>
</tr>
<tr>
<td><strong>client_version: </strong> {$client_version}</td>
</tr>
<tr>
<td><strong>patch_version: </strong>{$patch_version}</td>
</tr>
<tr>
<td><strong>memory: </strong>{$memory}</td>
</tr>
<tr>
<td><strong>server_tick: </strong>{$server_tick}</td>
</tr>
<tr>
<td><strong>connect_state: </strong>{$connect_state}</td>
</tr>
<tr>
<td><strong>local_address: </strong>{$local_address}</td>
</tr>
<tr>
<td><strong>os: </strong>{$os}</td>
</tr>
<tr>
<td><strong>processor: </strong>{$processor}</td>
</tr>
<tr>
<td><strong>cpu_id: </strong>{$cpu_id}</td>
</tr>
<tr>
<td><strong>cpu_mask: </strong>{$cpu_mask}</td>
</tr>
<tr>
<td><strong>ht: </strong>{$ht}</td>
</tr>
<tr>
<td><strong>nel3d: </strong>{$nel3d}</td>
</tr>
</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">
<legend style="margin-bottom:9px;">Actions</legend>
<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>
{if isset($isMod) and $isMod eq "TRUE"}<li><a href="index.php?page=show_ticket_log&id={$ticket_id}">Show Ticket Log</a></li>{/if}
<li><a href="index.php?page=createticket&user_id={$ticket_author}">Send Other Ticket</a></li>
<li><a href="index.php?page=show_ticket&id={$ticket_id}">Show Ticket</a></li>
<li class="divider"></li>
</ul>
</div>
</div>
</div>
</div>
</div><!--/row-->
{/block}