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

--HG--
branch : quitta-gsoc-2013
hg/feature/sse2
Quitta 12 years ago
parent ba69c5939e
commit fca8eb1ced

@ -16,4 +16,13 @@ class Gui_Elements{
return $result; 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 //create array of category id & names
global $cfg; global $cfg;
$catArray = Ticket_Category::getAllCategories($cfg['db']['lib']); $catArray = Ticket_Category::getAllCategories($cfg['db']['lib']);
$result['category'] = Array(); $result['category'] = Gui_Elements::make_table_with_key_is_id($catArray, Array("getName"), "getTCategoryId" );
foreach($catArray as $catObj){
$result['category'][$catObj->getTCategoryId()] = $catObj->getName();
}
return $result; return $result;
}else{ }else{

Loading…
Cancel
Save