Пример #1
0
 /**
  * Creates and  returns an ordered array of categories with catids as keys
  * and category name as values
  * 
  * @author Florian Voutzinos (adapted from vm 2)
  * @param int $cid virtuemart category id
  * @param int $level category level
  * @return array with virtuemart_category_id as $key and category_name as $value
  */
 public static function categoryListTree($cid = 0, $level = 0)
 {
     if (empty(self::$categoryTree)) {
         $cache =& JFactory::getCache();
         $cache->setCaching(1);
         $categoryTree = $cache->call(array('VmJcommentsHelperFormField', 'getCategoryTree'), $cid, $level);
         // parse the retuned string and form a nice array with categories id
         // as key and categories name as value
         $cats = explode(':', $categoryTree);
         $categories = explode(',', $cats[0]);
         $catIds = explode(',', $cats[1]);
         $categoryTree = array_combine($catIds, $categories);
         array_pop($categoryTree);
         self::$categoryTree = $categoryTree;
     }
     return self::$categoryTree;
 }