make_table_with_key_is_id function added to replace and use for like filling the category array, I guess it will be used in the future for a lot of different things
This commit is contained in:
parent
306357d552
commit
3dbf4a63ce
2 changed files with 10 additions and 5 deletions
|
@ -16,4 +16,13 @@ class Gui_Elements{
|
|||
return $result;
|
||||
}
|
||||
|
||||
public static function make_table_with_key_is_id( $inputList, $funcArray, $idFunction){
|
||||
$result = Array();
|
||||
foreach($inputList as $element){
|
||||
foreach($funcArray as $function){
|
||||
$result[$element->$idFunction()] = $element->$function();
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
|
@ -29,11 +29,7 @@ function createticket(){
|
|||
//create array of category id & names
|
||||
global $cfg;
|
||||
$catArray = Ticket_Category::getAllCategories($cfg['db']['lib']);
|
||||
$result['category'] = Array();
|
||||
foreach($catArray as $catObj){
|
||||
$result['category'][$catObj->getTCategoryId()] = $catObj->getName();
|
||||
}
|
||||
|
||||
$result['category'] = Gui_Elements::make_table_with_key_is_id($catArray, Array("getName"), "getTCategoryId" );
|
||||
return $result;
|
||||
|
||||
}else{
|
||||
|
|
Loading…
Reference in a new issue