コード例 #1
0
ファイル: html.php プロジェクト: renekreijveld/SimpleLists
 /**
  * Method to set the current category
  *
  * @access    public
  * @param    int ID of current item 
  * @param    int ID of parent category
  * @return    string HTML output
  */
 public function getCurrentCategory($categories, $item_id = 0)
 {
     // If there is no current item yet and we only have one category, select it
     if ($item_id == 0) {
         if (count($categories) == 1) {
             $current = $categories;
         } else {
             $application = JFactory::getApplication();
             $option = JRequest::getCmd('option');
             $id = $application->getUserStateFromRequest($option . 'filter_category_id', 'filter_category_id', 0, 'int');
             $current = SimplelistsHelper::getCategory($id);
         }
         // Fetch the categories currently selected with the item
     } else {
         $current = SimplelistsHelper::getCategories($item_id);
     }
     return $current;
 }
コード例 #2
0
 public function display($tpl = null)
 {
     // Set extra toolbar items for the page
     JToolBarHelper::preferences('com_simplelists', '480');
     //JToolBarHelper::help( 'screen.simplelist' );
     // Preliminary check to see if any categories have been configured yet
     SimplelistsHelper::checkCategories();
     // Automatically fetch items, total and pagination - and assign them to the template
     $this->fetchItems();
     // Prepare data for each simplelists item
     foreach ($this->items as $index => $item) {
         $item->categories = SimplelistsHelper::getCategories($item->id);
         $item->edit_link = JRoute::_('index.php?option=com_simplelists&view=item&task=edit&cid[]=' . $item->id);
         $this->items[$index] = $item;
     }
     // build list of categories
     $category_id_params = array('current' => $this->getFilter('category_id'), 'javascript' => 1, 'nullvalue' => 1);
     $this->lists['category_id'] = SimplelistsHTML::selectCategories('filter_category_id', $category_id_params);
     $this->lists['link_type'] = SimplelistsHTML::selectLinkType($this->getFilter('link_type'));
     parent::display($tpl);
 }