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

--HG--
branch : quitta-gsoc-2013
This commit is contained in:
Quitta 2013-08-18 03:39:35 +02:00
parent f8d19762fe
commit f0f08fc374
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){ public static function make_table( $inputList, $funcArray ,$fieldArray){
$i = 0; $i = 0;
$result = Array(); $result = Array();
foreach($inputList as $element){ if(!empty($inputList)){
$j = 0; foreach($inputList as $element){
foreach($funcArray as $function){ $j = 0;
$fnames = explode('->', $function); foreach($funcArray as $function){
$intermediate_result = NULL; $fnames = explode('->', $function);
foreach($fnames as $fname) { $intermediate_result = NULL;
if(substr($fname, -2) == "()") { foreach($fnames as $fname) {
$fname = substr($fname, 0, strlen($fname)-2); if(substr($fname, -2) == "()") {
if($intermediate_result == NULL) { $fname = substr($fname, 0, strlen($fname)-2);
$intermediate_result = $element->$fname(); if($intermediate_result == NULL) {
$intermediate_result = $element->$fname();
} else {
$intermediate_result = $intermediate_result->$fname();
}
} else { } else {
$intermediate_result = $intermediate_result->$fname(); if($intermediate_result == NULL) {
} $intermediate_result = $element->$fname();
} else { } else {
if($intermediate_result == NULL) { $intermediate_result = $intermediate_result->$fname();
$intermediate_result = $element->$fname(); }
} else {
$intermediate_result = $intermediate_result->$fname();
} }
} }
$result[$i][$fieldArray[$j]] = $intermediate_result;
$j++;
} }
$result[$i][$fieldArray[$j]] = $intermediate_result; $i++;
$j++;
} }
$i++;
} }
return $result; return $result;
} }

View file

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

View file

@ -16,6 +16,12 @@ function show_queue(){
//Pagination Base Links //Pagination Base Links
$result['pagination_base_link'] = "index.php?page=show_queue&get=".$result['queue_view'] ; $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'])){ 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); $userid = filter_var($_GET['userid'], FILTER_SANITIZE_NUMBER_INT);
$groupid = filter_var($_GET['groupid'], 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_what'] = $what;
$result['prev_created_how'] = $how; $result['prev_created_how'] = $how;
$result['prev_created_who'] = $who; $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 an action is set
@ -57,10 +66,8 @@ function show_queue(){
$result['prev_created_what'] = $what; $result['prev_created_what'] = $what;
$result['prev_created_how'] = $how; $result['prev_created_how'] = $how;
$result['prev_created_who'] = $who; $result['prev_created_who'] = $who;
$result['getURL'] = $result['getURL'] . "&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who;
break; 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}> <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"> <select style="width: 140px;" name="userid">
{foreach from=$teamlist item=member} {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} {/foreach}
</select> </select>
</span> </span>
@ -108,13 +108,13 @@
</td> </td>
<td> <td>
{if $ticket.assigned eq 0} {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="ticket_id" value="{$ticket.tId}">
<input type="hidden" name="action" value="assignTicket"> <input type="hidden" name="action" value="assignTicket">
<button type="submit" class="btn btn-primary" ><i class="icon-flag icon-white"></i> Assign Ticket</button> <button type="submit" class="btn btn-primary" ><i class="icon-flag icon-white"></i> Assign Ticket</button>
</form> </form>
{else if $ticket.assigned eq $user_id} {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="ticket_id" value="{$ticket.tId}">
<input type="hidden" name="action" value="unAssignTicket"> <input type="hidden" name="action" value="unAssignTicket">
<button type="submit" class="btn btn-warning" ><i class="icon-remove icon-white"></i> Remove Assign</button> <button type="submit" class="btn btn-warning" ><i class="icon-remove icon-white"></i> Remove Assign</button>