Example #1
0
 /**
  * Returns category select list html string.
  *
  * @param Application $application The application object
  * @param array $options The options
  * @param string $name The hmtl name
  * @param string|array $attribs The html attributes
  * @param string $key
  * @param string $text
  * @param string $selected The selected value
  * @param string $idtag
  * @param boolean $translate
  * @param string $category The category id to build the select list for
  *
  * @return string category select list html
  * @since 2.0
  */
 public function categoryList($application, $options, $name, $attribs = null, $key = 'value', $text = 'text', $selected = NULL, $idtag = false, $translate = false, $category = 0, $prefix = '- ', $spacer = '.   ', $indent = '  ')
 {
     // set options
     settype($options, 'array');
     reset($options);
     // get category tree list
     $list = $this->app->tree->buildList($category, $application->getCategoryTree(), array(), $prefix, $spacer, $indent);
     // create options
     foreach ($list as $category) {
         $options[] = $this->_('select.option', $category->id, $category->treename);
     }
     return $this->_('zoo.genericlist', $options, $name, $attribs, $key, $text, $selected, $idtag, $translate);
 }
Example #2
0
 /**
  * Returns category select list html string.
  *
  * @param Application $application The application object
  * @param array $options The options
  * @param string $name The hmtl name
  * @param string|array $attribs The html attributes
  * @param string $key
  * @param string $text
  * @param string $selected The selected value
  * @param string $idtag
  * @param boolean $translate
  * @param string $category The category id to build the select list for
  *
  * @return string category select list html
  * @since 3.0.13
  */
 public function categoryList($application, $type = null, $root_cat = 0, $maxLevel = 9999, $hide_empty = false, $prefix = '- ', $spacer = '.   ')
 {
     // get tree list
     $cats = $this->app->tree->buildList($root_cat, $application->getCategoryTree(true, null, false), array(), $prefix, $spacer, '', 0, $maxLevel);
     // remove empty categories
     if ($hide_empty) {
         $cats = array_filter($cats, create_function('$category', 'return $category->totalItemCount();'));
     }
     return $cats;
 }