Ejemplo n.º 1
0
 /**
  * Get a list of categories from the SugarDepot
  * @param category_id   the category id of parent to obtain
  * @param filter        an array of filters to pass to limit the query
  * @return array        an array of categories for display on the client
  */
 function getCategories($category_id, $filter = array())
 {
     $nodes = array();
     $results = PackageManagerComm::getCategories($category_id, $filter);
     PackageManagerComm::errorCheck();
     if (!empty($results['categories'])) {
         foreach ($results['categories'] as $category) {
             $mycat = PackageManager::fromNameValueList($category);
             $nodes[] = array('id' => $mycat['id'], 'label' => $mycat['name'], 'description' => $mycat['description'], 'type' => 'cat', 'parent' => $mycat['parent_id']);
         }
     }
     return $nodes;
 }