コード例 #1
0
ファイル: category.php プロジェクト: bizanto/Hooked
 public function edit()
 {
     // disable menu
     YRequest::setVar('hidemainmenu', 1);
     // get request vars
     $cid = YRequest::getArray('cid.0', '', 'int');
     $edit = $cid > 0;
     // get category
     if ($edit) {
         $this->category = YTable::getInstance('category')->get($cid);
     } else {
         $this->category = new Category();
         $this->category->parent = 0;
     }
     // get category params
     $this->params = $this->category->getParams();
     // set toolbar items
     $text = $edit ? JText::_('Edit') : JText::_('New');
     $this->joomla->set('JComponentTitle', $this->application->getToolbarTitle(JText::_('Category') . ': ' . $this->category->name . ' <small><small>[ ' . $text . ' ]</small></small>'));
     JToolBarHelper::save();
     JToolBarHelper::custom('saveandnew', 'saveandnew', 'saveandnew', 'Save & New', false);
     JToolBarHelper::apply();
     JToolBarHelper::cancel('cancel', $edit ? 'Close' : 'Cancel');
     ZooHelper::toolbarHelp();
     // select published state
     $this->lists['select_published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $this->category->published);
     // get categories and exclude the current category
     $categories = $this->application->getCategories();
     unset($categories[$this->category->id]);
     // build category tree
     $list = CategoryHelper::buildTreeList(0, CategoryHelper::buildTree($this->application->id, $categories));
     $options = array(JHTML::_('select.option', '0', JText::_('Root')));
     foreach ($list as $item) {
         $options[] = JHTML::_('select.option', $item->id, '&nbsp;&nbsp;&nbsp;' . $item->treename);
     }
     // select parent category
     $this->lists['select_parent'] = JHTML::_('select.genericlist', $options, 'parent', 'class="inputbox" size="10"', 'value', 'text', $this->category->parent);
     // display view
     $this->getView()->setLayout('edit')->display();
 }
コード例 #2
0
ファイル: zoo.php プロジェクト: bizanto/Hooked
 public static function categoryList($application, $options, $name, $attribs = null, $key = 'value', $text = 'text', $selected = NULL, $idtag = false, $translate = false)
 {
     // set options
     if (is_array($options)) {
         reset($options);
     } else {
         $options = array($options);
     }
     // get category tree list
     $list = CategoryHelper::buildTreeList(0, $application->getCategoryTree(), array(), '-&nbsp;', '.&nbsp;&nbsp;&nbsp;', '&nbsp;&nbsp;');
     // create options
     foreach ($list as $category) {
         $options[] = JHTML::_('select.option', $category->id, $category->treename);
     }
     return JHTML::_('select.genericlist', $options, $name, $attribs, $key, $text, $selected, $idtag, $translate);
 }