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);
 }
Beispiel #2
0
 /**
  * Method to prepare the content for display
  *
  * @param string $tpl
  * @return null
  */
 public function showForm($tpl = null)
 {
     // Fetch this item
     $this->fetchItem();
     // Build extra lists
     $this->lists['store'] = $this->getFieldStore($this->item->type, $this->item->name);
     // Initialize the form-file
     $file = JPATH_ADMINISTRATOR . '/components/com_magebridge/models/store.xml';
     // Prepare the params-form
     $params = YireoHelper::toRegistry($this->item->params)->toArray();
     $params_form = JForm::getInstance('params', $file);
     $params_form->bind(array('params' => $params));
     $this->params_form = $params_form;
     // Prepare the actions-form
     $actions = YireoHelper::toRegistry($this->item->actions)->toArray();
     $actions_form = JForm::getInstance('actions', $file);
     JPluginHelper::importPlugin('magebridgestore');
     JFactory::getApplication()->triggerEvent('onMageBridgeStorePrepareForm', array(&$actions_form, (array) $this->item));
     $actions_form->bind(array('actions' => $actions));
     $this->actions_form = $actions_form;
     // Check for a previous connector-value
     if (!empty($this->item->connector)) {
         $plugin = JPluginHelper::getPlugin('magebridgestore', $this->item->connector);
         if (empty($plugin)) {
             $plugin_warning = JText::sprintf('COM_MAGEBRIDGE_STORE_PLUGIN_WARNING', $this->item->connector);
             JError::raiseWarning(500, $plugin_warning);
         }
     }
     parent::display($tpl);
 }