public function display($tpl = null) { // Give a warning if no categories are configured SimplelistsHelper::checkCategories(); // Fetch the item automatically $this->fetchItem(true); // Modify the item a bit $this->item->image_default_folder = COM_SIMPLELISTS_DIR; $this->item->image_default_uri = COM_SIMPLELISTS_BASEURL; $this->item->picture_folder = $this->item->image_default_folder; $this->item->picture_uri = $this->item->image_default_uri; $this->item->picture_path = null; if (!empty($this->item->picture)) { $this->item->picture_path = JPATH_SITE . DS . $this->item->picture; $this->item->picture_uri = str_replace(DS, '/', $this->item->picture); $this->item->picture_folder = dirname($this->item->picture_uri); } // Add extra filtering lists $defaultCategory = $this->item->id == 0 ? (int) $this->getFilter('category_id', null, null, 'com_simplelists_items_') : null; $categories_params = array('item_id' => $this->item->id, 'multiple' => 1, 'current' => $defaultCategory); $this->lists['categories'] = SimplelistsHTML::selectCategories('categories[]', $categories_params); // Construct the modal boxes $modal = array(); $modal['picture'] = 'index.php?option=com_simplelists&view=files&tmpl=component&type=picture&current=' . $this->item->picture; if ($this->item->picture) { $modal['picture'] .= '&folder=' . $this->item->picture_folder; } $this->assignRef('modal', $modal); // Construct the slider-panel jimport('joomla.html.pane'); $pane =& JPane::getInstance('sliders'); $this->assignRef('pane', $pane); // Include extra JavaScript $this->addJs('mootools-cookie.js'); $this->addJs('view-browser.js'); // Load the plugins $link_plugins = SimplelistsPluginHelper::getPlugins('simplelistslink'); $this->assignRef('link_plugins', $link_plugins); // Add extra stuff JHTML::_('behavior.tooltip'); JHTML::_('behavior.modal', 'a.modal-button'); parent::display($tpl); }
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); }