fixed dirty error in queue's that didn't allow me to assing/unassign after creating a queue

This commit is contained in:
Quitta 2013-08-18 03:39:35 +02:00
parent 83d4a89e46
commit e0d9ff8628
4 changed files with 48 additions and 35 deletions

View file

@ -5,31 +5,33 @@ class Gui_Elements{
public static function make_table( $inputList, $funcArray ,$fieldArray){
$i = 0;
$result = Array();
foreach($inputList as $element){
$j = 0;
foreach($funcArray as $function){
$fnames = explode('->', $function);
$intermediate_result = NULL;
foreach($fnames as $fname) {
if(substr($fname, -2) == "()") {
$fname = substr($fname, 0, strlen($fname)-2);
if($intermediate_result == NULL) {
$intermediate_result = $element->$fname();
if(!empty($inputList)){
foreach($inputList as $element){
$j = 0;
foreach($funcArray as $function){
$fnames = explode('->', $function);
$intermediate_result = NULL;
foreach($fnames as $fname) {
if(substr($fname, -2) == "()") {
$fname = substr($fname, 0, strlen($fname)-2);
if($intermediate_result == NULL) {
$intermediate_result = $element->$fname();
} else {
$intermediate_result = $intermediate_result->$fname();
}
} else {
$intermediate_result = $intermediate_result->$fname();
}
} else {
if($intermediate_result == NULL) {
$intermediate_result = $element->$fname();
} else {
$intermediate_result = $intermediate_result->$fname();
if($intermediate_result == NULL) {
$intermediate_result = $element->$fname();
} else {
$intermediate_result = $intermediate_result->$fname();
}
}
}
$result[$i][$fieldArray[$j]] = $intermediate_result;
$j++;
}
$result[$i][$fieldArray[$j]] = $intermediate_result;
$j++;
$i++;
}
$i++;
}
return $result;
}

View file

@ -33,15 +33,19 @@ class Ticket_Queue_Handler{
default:
return "ERROR";
}
$this->pagination = new Pagination($this->queue->getQuery(),"lib",10,"Ticket",$this->queue->getParams());
foreach( $this->pagination->getElements() as $element ){
$catInstance = new Ticket_Category();
$catInstance->load_With_TCategoryId($element->getTicket_Category());
$element->setTicket_Category($catInstance);
$userInstance = new Ticket_User();
$userInstance->load_With_TUserId($element->getAuthor());
$element->setAuthor($userInstance);
$elemArray = $this->pagination->getElements();
if(!empty($elemArray)){
foreach( $elemArray as $element ){
$catInstance = new Ticket_Category();
$catInstance->load_With_TCategoryId($element->getTicket_Category());
$element->setTicket_Category($catInstance);
$userInstance = new Ticket_User();
$userInstance->load_With_TUserId($element->getAuthor());
$element->setAuthor($userInstance);
}
}
return $this->pagination->getElements();

View file

@ -16,6 +16,12 @@ function show_queue(){
//Pagination Base Links
$result['pagination_base_link'] = "index.php?page=show_queue&get=".$result['queue_view'] ;
//form url to keep the getters constant
$result['getURL'] = "index.php?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);
@ -29,6 +35,9 @@ function show_queue(){
$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
@ -57,10 +66,8 @@ function show_queue(){
$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;
}

View file

@ -34,7 +34,7 @@
<span id="userList" {if $prev_created_who eq "user"}style="display:inline;"{else if $prev_created_who eq "support_group"}style="display:none;"{else}style="display:inline;"{/if}>
<select style="width: 140px;" name="userid">
{foreach from=$teamlist item=member}
<option value="{$member.tUserId}" {if $prev_created_userid eq $member.tUserId}selected="selected"{else if $user_id eq $member.tUserId}selected="selected"{/if}>{$member.name}</option>
<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>
@ -108,13 +108,13 @@
</td>
<td>
{if $ticket.assigned eq 0}
<form id="assign_ticket" class="form-vertical" method="post" action="" style="margin:0px 0px 0px;">
<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="" style="margin:0px 0px 0px;">
<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>