Creating tickets, browsing the profile, replying on tickets and forwarding them is possible!

This commit is contained in:
Quitta 2013-09-05 02:31:29 +02:00
parent ea9e022a60
commit bfeb583c46
12 changed files with 651 additions and 123 deletions

View file

@ -17,15 +17,15 @@ class WebUsers extends Users{
} }
public function set($values){ public function set($values){
$this->uId = $values['UId']; $this->uId = $values['uid'];
$this->login = $values['Login']; $this->login = $values['name'];
$this->email = $values['Email']; $this->email = $values['mail'];
$this->firstname = $values['FirstName']; //$this->firstname = $values['FirstName'];
$this->lastname = $values['LastName']; //$this->lastname = $values['LastName'];
$this->gender = $values['Gender']; //$this->gender = $values['Gender'];
$this->country = $values['Country']; //$this->country = $values['Country'];
$this->receiveMail = $values['ReceiveMail']; //$this->receiveMail = $values['ReceiveMail'];
$this->language = $values['Language']; //$this->language = $values['Language'];
} }
/** /**
@ -72,8 +72,8 @@ class WebUsers extends Users{
//returns te id for a given username //returns te id for a given username
public static function getId($username){ public static function getId($username){
$row = db_query("SELECT * FROM {users} WHERE name = :name", array(':name' => $username))->fetchField(); $row = db_query("SELECT * FROM {users} WHERE name = :name", array(':name' => $username))->fetchAssoc();
return $row['UId']; return $row['uid'];
} }
//returns te id for a given username //returns te id for a given username
@ -93,20 +93,17 @@ class WebUsers extends Users{
} }
public function getUsername(){ public function getUsername(){
$dbw = new DBLayer("web");
if(! isset($this->login) || $this->login == ""){ if(! isset($this->login) || $this->login == ""){
$statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId)); $row = db_query("SELECT * FROM {users} WHERE uid = :id", array(':id' => $this->uId))->fetchAssoc();
$row = $statement->fetch(); $this->set($row);
$this->set($row);
} }
return $this->login; return $this->login;
} }
public function getEmail(){ public function getEmail(){
$dbw = new DBLayer("web");
if(! isset($this->email) || $this->email == ""){ if(! isset($this->email) || $this->email == ""){
$statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId)); $row = db_query("SELECT * FROM {users} WHERE uid = :id", array(':id' => $this->uId))->fetchAssoc();
$row = $statement->fetch();
$this->set($row); $this->set($row);
} }
return $this->email; return $this->email;

View file

@ -0,0 +1,52 @@
<?php
function create_ticket(){
//if logged in
if(WebUsers::isLoggedIn() && isset($_SESSION['ticket_user'])){
if(isset($_POST['target_id'])){
//if target_id is the same as session id or is admin
if( ($_POST['target_id'] == $_SESSION['id']) || Ticket_User::isMod(unserialize($_SESSION['ticket_user'])) ){
$category = filter_var($_POST['Category'], FILTER_SANITIZE_NUMBER_INT);
$title = filter_var($_POST['Title'], FILTER_SANITIZE_STRING);
$content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING);
try{
if($_POST['target_id'] == $_SESSION['id']){
$author = unserialize($_SESSION['ticket_user'])->getTUserId();
}else{
$author= Ticket_User::constr_ExternId($_POST['target_id'])->getTUserId();
}
$ticket_id = Ticket::create_Ticket($title, $content, $category, $author, unserialize($_SESSION['ticket_user'])->getTUserId(),0, $_POST);
header("Location: index.php?page=show_ticket&id=".$ticket_id);
exit;
}catch (PDOException $e) {
//ERROR: LIB DB is not online!
print_r($e);
exit;
header("Location: index.php");
exit;
}
}else{
//ERROR: permission denied!
$_SESSION['error_code'] = "403";
header("Location: index.php?page=error");
exit;
}
}else{
//ERROR: The form was not filled in correclty
header("Location: index.php?page=create_ticket");
exit;
}
}else{
//ERROR: user is not logged in
header("Location: index.php");
exit;
}
}

View file

@ -0,0 +1,54 @@
<?php
function reply_on_ticket(){
//if logged in
if(WebUsers::isLoggedIn() && isset($_POST['ticket_id'])){
$ticket_id = filter_var($_POST['ticket_id'], FILTER_SANITIZE_NUMBER_INT);
$target_ticket = new Ticket();
$target_ticket->load_With_TId($ticket_id);
if(($target_ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId()) || Ticket_User::isMod(unserialize($_SESSION['ticket_user'])) ){
try{
$author = unserialize($_SESSION['ticket_user'])->getTUserId();
if(isset($_POST['Content'])){
$content = $_POST['Content'];
}else{
$content="";
}
$hidden = 0;
if(isset($_POST['hidden']) && Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){
$hidden = 1;
}
Ticket::createReply($content, $author, $ticket_id, $hidden);
if(isset($_POST['ChangeStatus']) && isset($_POST['ChangePriority']) && Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){
$newStatus = filter_var($_POST['ChangeStatus'], FILTER_SANITIZE_NUMBER_INT);
$newPriority = filter_var($_POST['ChangePriority'], FILTER_SANITIZE_NUMBER_INT);
Ticket::updateTicketStatusAndPriority($ticket_id,$newStatus, $newPriority, $author);
}
header("Location: ams?page=show_ticket&id=".$ticket_id);
exit;
}catch (PDOException $e) {
//ERROR: LIB DB is not online!
print_r($e);
//header("Location: index.php");
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,46 @@
<?php
function createticket(){
//if logged in
if(WebUsers::isLoggedIn()){
//in case user_id-GET param set it's value as target_id, if no user_id-param is given, use the session id.
if(isset($_GET['user_id'])){
if(($_GET['user_id'] != $_SESSION['id']) && ( ! ticket_user::isMod(unserialize($_SESSION['ticket_user']))) ){
//ERROR: No access!
$_SESSION['error_code'] = "403";
header("Location: index.php?page=error");
exit;
}else{
//if user_id is given, then set it as the target_id
$result['target_id'] = filter_var($_GET['user_id'], FILTER_SANITIZE_NUMBER_INT);
}
}else{
//set session_id as target_id
$result['target_id'] = $_SESSION['id'];
}
if(Helpers::check_if_game_client()){
//get all additional info, which is needed for adding the extra info page
$result[] = $_GET;
$result['ingame'] = true;
}
//create array of category id & names
$catArray = Ticket_Category::getAllCategories();
$result['category'] = Gui_Elements::make_table_with_key_is_id($catArray, Array("getName"), "getTCategoryId" );
return $result;
}else{
//ERROR: not logged in!
header("Location: index.php");
exit;
}
}

View file

@ -0,0 +1,84 @@
<?php
function show_ticket(){
//if logged in
if(WebUsers::isLoggedIn() && isset($_GET['id'])){
$result['user_id'] = unserialize($_SESSION['ticket_user'])->getTUserId();
$result['ticket_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
$target_ticket = new Ticket();
$target_ticket->load_With_TId($result['ticket_id']);
if(Ticket_User::isMod(unserialize($_SESSION['ticket_user'] ))){
if(isset($_POST['action'])){
switch($_POST['action']){
case "forward":
$ticket_id = filter_var($_POST['ticket_id'], FILTER_SANITIZE_NUMBER_INT);
$group_id = filter_var($_POST['group'], FILTER_SANITIZE_NUMBER_INT);
$result['ACTION_RESULT'] = Ticket::forwardTicket($result['user_id'], $ticket_id, $group_id);
break;
case "assignTicket":
$ticket_id = filter_var($_POST['ticket_id'], FILTER_SANITIZE_NUMBER_INT);
$result['ACTION_RESULT'] = Ticket::assignTicket($result['user_id'] , $ticket_id);
break;
case "unAssignTicket":
$ticket_id = filter_var($_POST['ticket_id'], FILTER_SANITIZE_NUMBER_INT);
$result['ACTION_RESULT'] = Ticket::unAssignTicket($result['user_id'], $ticket_id);
break;
}
}
}
if(($target_ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId()) || Ticket_User::isMod(unserialize($_SESSION['ticket_user']) )){
$show_as_admin = false;
if(Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){
$show_as_admin = true;
}
$entire_ticket = Ticket::getEntireTicket( $result['ticket_id'],$show_as_admin);
Ticket_Log::createLogEntry($result['ticket_id'],unserialize($_SESSION['ticket_user'])->getTUserId(), 3);
$result['ticket_tId'] = $entire_ticket['ticket_obj']->getTId();
$result['ticket_forwardedGroupName'] = $entire_ticket['ticket_obj']->getForwardedGroupName();
$result['ticket_forwardedGroupId'] = $entire_ticket['ticket_obj']->getForwardedGroupId();
$result['ticket_title'] = $entire_ticket['ticket_obj']->getTitle();
$result['ticket_timestamp'] = $entire_ticket['ticket_obj']->getTimestamp();
$result['ticket_status'] = $entire_ticket['ticket_obj']->getStatus();
$result['ticket_author'] = $entire_ticket['ticket_obj']->getAuthor();
$result['ticket_prioritytext'] = $entire_ticket['ticket_obj']->getPriorityText();
$result['ticket_priorities'] = Ticket::getPriorityArray();
$result['ticket_priority'] = $entire_ticket['ticket_obj']->getPriority();
$result['ticket_statustext'] = $entire_ticket['ticket_obj']->getStatusText();
$result['ticket_lastupdate'] = Gui_Elements::time_elapsed_string(Ticket::getLatestReply($result['ticket_id'])->getTimestamp());
$result['ticket_category'] = $entire_ticket['ticket_obj']->getCategoryName();
$webUser = new WebUsers(Assigned::getUserAssignedToTicket($result['ticket_tId']));
$result['ticket_assignedToText'] = $webUser->getUsername();
$result['ticket_assignedTo'] = Assigned::getUserAssignedToTicket($result['ticket_tId']);
$result['ticket_replies'] = Gui_Elements::make_table($entire_ticket['reply_array'], Array("getTReplyId","getContent()->getContent","getTimestamp","getAuthor()->getExternId","getAuthor()->getPermission","getHidden"), Array("tReplyId","replyContent","timestamp","authorExtern","permission","hidden"));
$i = 0;
foreach( $result['ticket_replies'] as $reply){
$webReplyUser = new WebUsers($reply['authorExtern']);
$result['ticket_replies'][$i]['author'] = $webReplyUser->getUsername();
$i++;
}
if(Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){
$result['isMod'] = "TRUE";
$result['statusList'] = Ticket::getStatusArray();
$result['sGroups'] = Gui_Elements::make_table_with_key_is_id(Support_Group::getAllSupportGroups(), Array("getName"), "getSGroupId" );
}
$result['hasInfo'] = $target_ticket->hasInfo();
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

@ -0,0 +1,44 @@
<?php
function show_user(){
//if logged in
if(WebUsers::isLoggedIn()){
if( !isset($_GET['id']) || Ticket_User::isMod(unserialize($_SESSION['ticket_user'])) || $_GET['id'] == $_SESSION['id'] ){
if(isset($_GET['id'])){
$result['target_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
}else{
$result['target_id'] = $_SESSION['id'];
}
$webUser = new WebUsers($result['target_id']);
$result['target_name'] = $webUser->getUsername();
$result['mail'] = $webUser->getEmail();
//$info = $webUser->getInfo();
//$result['firstName'] = $info['FirstName'];
//$result['lastName'] = $info['LastName'];
//$result['country'] = $info['Country'];
//$result['gender'] = $info['Gender'];
$ticket_user = Ticket_User::constr_ExternId($result['target_id']);
$result['userPermission'] = $ticket_user->getPermission();
if(Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))){
$result['isAdmin'] = "TRUE";
}
$ticketlist = Ticket::getTicketsOf($ticket_user->getTUserId());
$result['ticketlist'] = Gui_Elements::make_table($ticketlist, Array("getTId","getTimestamp","getTitle","getStatus","getStatusText","getStatusText","getCategoryName"), Array("tId","timestamp","title","status","statustext","statusText","category"));
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

@ -248,6 +248,8 @@ function ryzommanage_block_view($delta = '')
} }
function _ams_handler() function _ams_handler()
{ {
@ -547,7 +549,20 @@ function top_bar()
$userId = $user->uid; $userId = $user->uid;
if (user_is_logged_in()) { if (user_is_logged_in()) {
// Logged in user // Logged in user
return "<div class='ryzomuserbar'>Notepad | Mail | Wiki | Profile | Craft Recipe-Book | Occupations | News/Events | <a href='/user/".$userId."/edit'>Account</a> | <a href='/user/logout'>Logout</a></div>"; //check permission, if user
if(ticket_user::isMod(unserialize($_SESSION['ticket_user']))){
return "<div class='ryzomuserbar'><a href='ams?page=show_user&id=".$userId."'>Profile</a> |
<a href='ams?page=createticket&id=".$userId."'>Create Ticket</a> |
<a href='/user/".$userId."/edit'>Settings</a> | <a href='ams?page=userlist".$userId."'>Users</a> |
<a href='ams?page=show_queue&get=todo'>Queues</a> |
<a href='ams?page=sgroup_list'>Support Groups</a> | <a href='/user/logout'>Logout</a></div>";
}else{
return "<div class='ryzomuserbar'><a href='ams?page=show_user&id=".$userId."'>Profile</a> |
<a href='ams?page=createticket&id=".$userId."'>Create Ticket</a> |
<a href='/user/".$userId."/edit'>Settings</a> | <a href='/user/logout'>Logout</a></div>";
}
} else { } else {
return drupal_get_form('login_form'); return drupal_get_form('login_form');
// Not logged in // Not logged in
@ -1002,3 +1017,59 @@ function ryzommanage_help($path, $arg) {
break; break;
} }
} }
function ryzommanage_enable() {
// Check if our field is not already created.
if (!field_info_field('firstname')) {
$field = array(
'field_name' => 'firstname',
'type' => 'text',
);
field_create_field($field);
// Create the instance on the bundle.
$instance = array(
'field_name' => 'firstname',
'entity_type' => 'user',
'label' => 'First Name',
'bundle' => 'user',
// If you don't set the "required" property then the field wont be required by default.
'required' => FALSE,
'settings' => array(
// Here you inform either or not you want this field showing up on the registration form.
),
'widget' => array(
'type' => 'textfield',
'weight' => '1',
),
);
field_create_instance($instance);
}
if (!field_info_field('secondname')) {
$field = array(
'field_name' => 'secondname',
'type' => 'text',
);
field_create_field($field);
// Create the instance on the bundle.
$instance = array(
'field_name' => 'secondname',
'entity_type' => 'user',
'label' => 'Second Name',
'bundle' => 'user',
// If you don't set the "required" property then the field wont be required by default.
'required' => FALSE,
'settings' => array(
// Here you inform either or not you want this field showing up on the registration form.
),
'widget' => array(
'type' => 'textfield',
'weight' => '1',
),
);
field_create_instance($instance);
}
}

View file

@ -0,0 +1,38 @@
{block name=content}
<h2>Create a new Ticket</h2>
<form id="changePassword" method="post" action="ams?page=createticket&id={$target_id}">
<table>
<tr>
<td>
<label>Title</label>
<input type="text" size="60" id="Title" name="Title">
</td>
</tr>
<tr>
<td>
<label>Category</label>
<select name="Category">
{foreach from=$category key=k item=v}
<option value="{$k}">{$v}</option>
{/foreach}
</select>
</td>
</tr>
<tr>
<td>
<label>Description</label>
<textarea rows="12" id="Content" style="width: 90%;" name="Content"></textarea>
</td>
</tr>
<tr>
<td>
<input type="hidden" name="function" value="create_ticket">
<input type="hidden" name="target_id" value="{$target_id}">
<button type="submit">Send Ticket</button>
</td>
</tr>
</table>
</form>
{/block}

View file

@ -5,27 +5,27 @@
<tr> <tr>
<td width="25%"> <td width="25%">
<a data-original-title="{$nrAssignedWaiting} Assigned to you and waiting for support!" data-rel="tooltip" class="well span3 top-block" <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"> 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: <div style="text-align:center;">Tickets Waiting for Direct Action:
<font color="red">{$nrAssignedWaiting}</font></div> <font color="red">{$nrAssignedWaiting}</font></div>
</a> </a>
</td> </td>
<td width="25%"> <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"> <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: <div style="text-align:center;">Tickets Todo:
<font color="red">{$nrToDo}</font></div> <font color="red">{$nrToDo}</font></div>
</a> </a>
</td> </td>
<td width="25"> <td width="25">
<a data-original-title="By {$newestTicketAuthor}" data-rel="tooltip" class="well span3 top-block" href="ams/?page=show_ticket&id={$newestTicketId}"> <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: <div style="text-align:center;">Newest Ticket:
<font color="red">{$newestTicketTitle}</font></div> <font color="red">{$newestTicketTitle}</font></div>
</a> </a>
</td> </td>
<td width="25%"> <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"> <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: <div style="text-align:center;">Total amount of Tickets:
<font color="red">{$nrTotalTickets}</font></div> <font color="red">{$nrTotalTickets}</font></div>
</a> </a>

View file

@ -0,0 +1,188 @@
{block name=content}
<h1><u>Title</u>: {$ticket_title} [ID#{$ticket_tId}] </h1>
<table>
<tr>
{if isset($isMod) and $isMod eq "TRUE"}
<td>
Ticket Assigning:
{if $ticket_assignedTo eq 0}
<form id="assign_ticket" class="form-vertical" method="post" action="" >
<input type="hidden" name="ticket_id" value="{$ticket_tId}">
<input type="hidden" name="action" value="assignTicket">
<button type="submit">Assign Ticket</button>
</form>
{else if $ticket_assignedTo eq $user_id}
<form id="assign_ticket" class="form-vertical" method="post" action="" >
<input type="hidden" name="ticket_id" value="{$ticket_tId}">
<input type="hidden" name="action" value="unAssignTicket">
<button type="submit">Remove Assign</button>
</form>
{/if}
</td>
<td>
Forward to Group:
<form id="forward" class="form-vertical" method="post" action="">
<select name="group">
<option></option>
{foreach from=$sGroups key=k item=v}
<option value="{$k}">{$v}</option>
{/foreach}
</select>
<input type="hidden" name="ticket_id" value="{$ticket_tId}">
<input type="hidden" name="action" value="forward">
<button type="submit">Forward</button>
</form>
</td>
{/if}
{if isset($isMod) and $isMod eq "TRUE"}<td><a href="ams?page=show_ticket_log&id={$ticket_tId}">Show Ticket Log</a></td>{/if}
<td><a href="ams?page=createticket&user_id={$ticket_author}">Send Other Ticket</a></td>
{if $hasInfo}<td><a href="ams?page=show_ticket_info&id={$ticket_tId}">Show ticket Info</a></td>{/if}
</tr>
</table>
{if isset($ACTION_RESULT) and $ACTION_RESULT eq "SUCCESS_ASSIGNED"}
<font color="green">
<p>{$success_assigned}</p>
</font>
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "SUCCESS_UNASSIGNED"}
<font color="green">
<p>{$success_unassigned}</p>
</font>
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "TICKET_NOT_EXISTING"}
<font color="red">
<p>{$ticket_not_existing}</p>
</font>
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "ALREADY_ASSIGNED"}
<font color="red">
<p>{$ticket_already_assigned}</p>
</font>
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "NOT_ASSIGNED"}
<font color="red">
<p>{$ticket_not_assigned}</p>
</font>
{/if}
{if isset($ACTION_RESULT) and $ACTION_RESULT eq "INVALID_SGROUP"}
<font color="red">
<p>{$invalid_sgroup}</p>
</font>
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "TICKET_NOT_EXISTING"}
<font color="red">
<p>{$ticket_not_existing}</p>
</font>
{else if isset($ACTION_RESULT) and $ACTION_RESULT eq "SUCCESS_FORWARDED"}
<font color="green">
<p>{$success_forwarded}</p>
</font>
{/if}
<form id="changeTicket" method="post" action="ams?page=show_ticket&id={$ticket_tId}">
<table width=100%>
<tr>
<td width=33%><strong>Original Submitted: </strong>{$ticket_timestamp}</td>
<td width=33%><strong>Last Updated: </strong>{$ticket_lastupdate}</td>
<td width=33%><strong>Status: </strong>{if $ticket_status neq 3}<font color="green">Open</font>{/if} <font color="{if $ticket_status eq 0}orange{else if $ticket_status eq 1}green{else if $ticket_status eq 3}red{/if}"><strong>{$ticket_statustext}</strong></font></td>
</tr>
<tr>
<td width=33%><strong>Category: </strong>{$ticket_category}</td>
<td width=33%><strong>Priority: </strong>{$ticket_prioritytext}</td>
<td width=33%><strong>Support Group: </strong>
<span class="label label-info">
{if $ticket_forwardedGroupName eq "0"}
<i>{$public_sgroup}</i>
{else}
<a href="index.php?page=show_sgroup&id={$ticket_forwardedGroupId}">{$ticket_forwardedGroupName}</a>
{/if}
</span>
</td>
</tr>
<tr>
<td width=33%><strong>Assigned To: </strong>{if $ticket_assignedTo neq ""} <a href="index.php?page=show_user&id={$ticket_assignedTo}">{$ticket_assignedToText}</a> {else}<i> {$not_assigned}</i> {/if}</td>
<td width=33%></td>
<td width=33%></td>
</tr>
</table>
<table class="table table-bordered" >
<tbody>
{foreach from=$ticket_replies item=reply}
<tr>
<td>
<p>
<font color="blue"> {$reply.timestamp}</font>
{if $reply.permission eq '1'}
<span class="label label-success"><strong>{if isset($isMod) and $isMod eq "TRUE"} <a href="index.php?page=show_user&id={$reply.authorExtern}"> {$reply.author}{else} {$reply.author} {/if}</a></strong></span>
{else if $reply.permission gt '1'}
<span class="label label-warning"><strong>{if isset($isMod) and $isMod eq "TRUE"} <a href="index.php?page=show_user&id={$reply.authorExtern}">{$reply.author}{else} {$reply.author} {/if}</a></strong></span>
{/if}
</p>
<p><pre{if $reply.permission gt '1'} {if $reply.hidden eq 0} style="background-color:rgb(248, 200, 200);"{else if $reply.hidden eq 1}style="background-color:rgb(207, 254, 255);"{/if}{/if}> {if $reply.hidden eq 1}<i>{/if}{$reply.replyContent}{if $reply.hidden eq 1}</i>{/if}</pre></p>
</td>
</tr>
{/foreach}
{if $ticket_status eq 3}
<tr>
<td>
<p><pre style="background-color:rgb(255, 230, 153);">Ticket is closed.</pre></p>
</td>
</tr>
{/if}
<tr>
<td>
<form id="reply" class="form-vertical" method="post" action="ams?page=show_ticket&id={$ticket_tId}">
{if $ticket_status neq 3}
<legend>{$t_reply}:</legend>
<label>{$t_fill}</label>
<textarea rows="6" class="span12" style="width: 90%;" id="Content" name="Content"></textarea>
{if isset($isMod) and $isMod eq "TRUE"}
<label>Options</label>
<input type="checkbox" name="hidden">Hide reply for user.
{/if}
{/if}
</td>
</tr>
<tr>
<td>
{if isset($isMod) and $isMod eq "TRUE"}
<div style="display: inline-block;">
<label>Change status to</label>
<select name="ChangeStatus">
{foreach from=$statusList key=k item=v}
<option value="{$k}">{$v}</option>
{/foreach}
</select>
</div>
<div style="display: inline-block; margin-left:10px;"">
<label>Change priority to</label>
<select name="ChangePriority">
{foreach from=$ticket_priorities key=k item=v}
<option value="{$k}" {if $k eq $ticket_priority}selected="selected"{/if}>{$v}</option>
{/foreach}
</select>
</div>
{/if}
</td>
</tr>
<tr>
<td>
<input type="hidden" name="function" value="reply_on_ticket">
<input type="hidden" name="ticket_id" value="{$ticket_id}">
<button type="submit" class="btn btn-primary" >{$t_send}</button>
</form>
</td>
</tr>
</tbody>
</table>
{/block}

View file

@ -1,17 +1,8 @@
{block name=content} {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> <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> <table >
<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> <tbody>
<tr > <tr >
<td><strong>Email:</strong></td> <td><strong>Email:</strong></td>
@ -21,96 +12,60 @@
<tr > <tr >
<td><strong>Role:</strong></td> <td><strong>Role:</strong></td>
<td> <td>
{if $userPermission eq 1}<span class="label label-success">User</span>{/if} {if $userPermission eq 1}<font color="green">User</font>{/if}
{if $userPermission eq 2}<span class="label label-warning">Moderator</span>{/if} {if $userPermission eq 2}<font color="orange">Moderator</font>{/if}
{if $userPermission eq 3}<span class="label label-important">Admin</span>{/if} {if $userPermission eq 3}<font color="red">Admin</font>{/if}
</td> </td>
</tr> </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> </tbody>
</table> </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> <h2><i class="icon-th"></i>Actions</h2>
<div class="box-icon"> <table width="100%">
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a> <tr>
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a> <td width="25%">
</div> <a href="ams?page=settings&id={$target_id}">Edit User</a>
</div> </td>
<div class="box-content"> <td width="25%">
<div class="row-fluid"> <a href="ams?page=createticket&user_id={$target_id}">Send Ticket</a>
<div class="btn-group"> </td>
<button class="btn btn-primary btn-large dropdown-toggle" data-toggle="dropdown">Actions<span class="caret"></span></button> {if isset($isAdmin) and $isAdmin eq 'TRUE' and $target_id neq 1}
<ul class="dropdown-menu"> {if $userPermission eq 1}
<li class="divider"></li> <td width="25%">
<li><a href="index.php?page=settings&id={$target_id}">Edit User</a></li> <a href="ams?page=change_permission&user_id={$target_id}&value=2">Make Moderator</a>
<li><a href="index.php?page=createticket&user_id={$target_id}">Send Ticket</a></li> </td>
<li class="divider"></li> <td width="25%">
{if isset($isAdmin) and $isAdmin eq 'TRUE' and $target_id neq 1} <a href="ams?page=change_permission&user_id={$target_id}&value=3">Make Admin</a>
{if $userPermission eq 1} </td>
<li><a href="index.php?page=change_permission&user_id={$target_id}&value=2">Make Moderator</a></li> {else if $userPermission eq 2 }
<li><a href="index.php?page=change_permission&user_id={$target_id}&value=3">Make Admin</a></li> <td width="25%">
{else if $userPermission eq 2 } <a href="ams?page=change_permission&user_id={$target_id}&value=1">Demote to User</a>
<li><a href="index.php?page=change_permission&user_id={$target_id}&value=1">Demote to User</a></li> </td>
<li><a href="index.php?page=change_permission&user_id={$target_id}&value=3">Make Admin</a></li> <td width="25%">
{else if $userPermission eq 3 } <a href="ams?page=change_permission&user_id={$target_id}&value=3">Make Admin</a>
<li><a href="index.php?page=change_permission&user_id={$target_id}&value=1">Demote to User</a></li> </td>
<li><a href="index.php?page=change_permission&user_id={$target_id}&value=2">Demote to Moderator</a></li> {else if $userPermission eq 3 }
<td width="25%">
<a href="ams?page=change_permission&user_id={$target_id}&value=1">Demote to User</a>
</td>
<td width="25%">
<a href="ams?page=change_permission&user_id={$target_id}&value=2">Demote to Moderator</a>
</td>
{/if}
{/if} {/if}
<li class="divider"></li> </tr>
{/if} </table>
</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> <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> <legend>Tickets</legend>
<table class="table table-striped table-bordered bootstrap-datatable datatable"> <table>
<thead> <thead>
<tr> <tr>
<th>ID</th> <th>ID</th>
@ -124,7 +79,7 @@
{foreach from=$ticketlist item=ticket} {foreach from=$ticketlist item=ticket}
<tr> <tr>
<td>{$ticket.tId}</td> <td>{$ticket.tId}</td>
<td><a href ="index.php?page=show_ticket&id={$ticket.tId}">{$ticket.title}</a></td> <td><a href ="ams?page=show_ticket&id={$ticket.tId}">{$ticket.title}</a></td>
<td class="center"><i>{$ticket.timestamp}</i></td> <td class="center"><i>{$ticket.timestamp}</i></td>
<td class="center">{$ticket.category}</td> <td class="center">{$ticket.category}</td>
@ -134,9 +89,7 @@
</tbody> </tbody>
</table> </table>
</div>
</div>
</div><!--/span-->
</div><!--/row-->
{/block} {/block}

View file

@ -1,2 +1,3 @@
-Remove full path in autoload functions -Remove full path in autoload functions
-Make Permission www dependend, so it can be implemented in drupal with hook_permission(); -Make Permission www dependend, so it can be implemented in drupal with hook_permission();
-in helpers make_folders mkdir($value); should be drupal_mkdir();