/** * Configure the linkbar * * @param string $vName The name of the active view * * @return void */ public static function addSubmenu($vName) { if (JFactory::getApplication()->input->getCmd('tmpl', null) == null) { // Get 5 most-recent sliders $objJSNEasySliderSliders = new JSNEasySliderSliders(); $sliders = $objJSNEasySliderSliders->getSlidersWithoutState(5); JSNMenuHelper::addEntry('sliders', 'JSN_MENU_SLIDERS', '', $vName == 'sliders', 'administrator/components/com_easyslider/assets/images/icons-16/icon-items.png', 'sub-menu'); JSNMenuHelper::addEntry('configuration', 'JSN_MENU_CONFIGURATION_AND_MAINTENANCE', '', $vName == 'maintenance' or $vName == 'configuration', 'administrator/components/com_easyslider/assets/images/icons-16/icon-configuration.png', 'sub-menu'); JSNMenuHelper::addEntry('about', 'JSN_MENU_ABOUT', 'index.php?option=com_easyslider&view=about', $vName == 'about', 'administrator/components/com_easyslider/assets/images/icons-16/icon-about.png', 'sub-menu'); // Declare 2nd-level menu sliders for 'sliders' entry JSNMenuHelper::addEntry('slider-new', JText::_('JSN_EASYSLIDER_CREATE_NEW_SLIDER', true), 'index.php?option=com_easyslider&view=slider&layout=edit', false, '', 'sub-menu.sliders'); JSNMenuHelper::addSeparator('sub-menu.sliders'); if ($sliders) { JSNMenuHelper::addEntry('recent-sliders', JText::_('JSN_EASYSLIDER_RECENT_SLIDERS', true), '', false, '', 'sub-menu.sliders'); foreach ($sliders as $slider) { JSNMenuHelper::addEntry('slider-' . $slider->slider_id, $slider->slider_title, 'index.php?option=com_easyslider&view=slider&layout=edit&slider_id=' . $slider->slider_id, false, '', 'sub-menu.sliders.recent-sliders'); } } JSNMenuHelper::addEntry('all-sliders', JText::_('JSN_EASYSLIDER_ALL_SLIDERS', true), 'index.php?option=com_easyslider&view=sliders', false, '', 'sub-menu.sliders'); // Declare 2nd-level menu sliders for 'configuration' entry JSNMenuHelper::addEntry('global-params', JText::_('JSN_EASYSLIDER_ALL_GLOBAL_PARAMETERS', true), 'index.php?option=com_easyslider&view=configuration&s=configuration&g=configs', false, '', 'sub-menu.configuration'); JSNMenuHelper::addEntry('messages', JText::_('JSN_EASYSLIDER_ALL_GLOBAL_MESSAGES', true), 'index.php?option=com_easyslider&view=configuration&s=configuration&g=msgs', false, '', 'sub-menu.configuration'); JSNMenuHelper::addEntry('languages', JText::_('JSN_EASYSLIDER_ALL_GLOBAL_LANGUAGES', true), 'index.php?option=com_easyslider&view=configuration&s=configuration&g=langs', false, '', 'sub-menu.configuration'); JSNMenuHelper::addEntry('update', JText::_('JSN_EASYSLIDER_ALL_GLOBAL_PRODUCT_UPDATE', true), 'index.php?option=com_easyslider&view=configuration&s=configuration&g=update', false, '', 'sub-menu.configuration'); JSNMenuHelper::addEntry('maintenance', JText::_('JSN_EASYSLIDER_ALL_GLOBAL_PRODUCT_MAINTENANCE', true), '', false, '', 'sub-menu.configuration'); // Declare 3rd-level menu sliders for 'maintenance' entry JSNMenuHelper::addEntry('data', JText::_('JSN_EASYSLIDER_ALL_GLOBAL_PRODUCT_DATA', true), 'index.php?option=com_easyslider&view=configuration&s=maintenance&g=data', false, '', 'sub-menu.configuration.maintenance'); JSNMenuHelper::addEntry('permissions', JText::_('JSN_EASYSLIDER_ALL_GLOBAL_PERMISSIONS', true), 'index.php?option=com_easyslider&view=configuration&s=maintenance&g=permissions', false, '', 'sub-menu.configuration.maintenance'); // Render the sub-menu JSNMenuHelper::render('sub-menu'); } }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise an Exception object. */ function display($tpl = null) { // Get config parameters $config = JSNConfigHelper::get(); $session = JFactory::getSession(); $objJSNEasySliderSliders = new JSNEasySliderSliders(); $totalSliders = $objJSNEasySliderSliders->countSilderItems(); $layout = $this->getLayout(); $this->totalSliders = $totalSliders; /*Check if it is FREE edition then show warning message to alert that FREE edition only allows create maximum of 3 sliders*/ $this->edition = defined('JSN_EASYSLIDER_EDITION') ? JSN_EASYSLIDER_EDITION : "free"; if (strtolower($this->edition) == 'free') { if ($totalSliders !== false && $totalSliders >= 3) { if ($layout == 'default') { JFactory::getApplication()->enqueueMessage(JText::_('JSN_EASYSLIDER_YOU_HAVE_REACHED_THE_LIMITATION_OF_3_SLIDERS_IN_FREE_EDITION'), 'warning'); } } } if ($session->has('JSN_EASYSLIDER_BACKUP_OLD_DATA_PATH') && (string) $session->get('JSN_EASYSLIDER_BACKUP_OLD_DATA_PATH') != '') { JFactory::getApplication()->enqueueMessage('The data backup file of version 1.x.x has been created from the update process. You can download it <a href="' . JUri::root() . str_replace(JPATH_ROOT . '/', '', (string) $session->get('JSN_EASYSLIDER_BACKUP_OLD_DATA_PATH')) . '"><strong>here<strong></a>', 'notice'); } // Set the toolbar JToolbarHelper::title(JText::_('JSN_EASYSLIDER_SLIDERS')); // Add toolbar menu JToolbarHelper::addNew('slider.add', 'JSN_EASYSLIDER_CREATE_NEW'); JToolbarHelper::editList('slider.edit', 'JTOOLBAR_EDIT'); JToolbarHelper::custom('sliders.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true); JToolbarHelper::divider(); JToolbarHelper::publish('sliders.publish'); JToolbarHelper::unpublish('sliders.unpublish'); JToolbarHelper::divider(); JToolbarHelper::deleteList('JSN_EASYSLIDER_CONFIRM_DELETE', 'sliders.delete', 'JTOOLBAR_DELETE'); // JToolbarHelper::preferences(); // JToolbarHelper::help(); JToolbarHelper::custom('', ' jsnes-import fa fa-download', ' jsnes-import fa fa-download', 'JSN_EASYSLIDER_IMPORT'); JToolbarHelper::custom('', ' jsnes-export fa fa-upload', ' jsnes-export fa fa-upload', 'JSN_EASYSLIDER_EXPORT'); JToolbarHelper::divider(); JSNEasySliderHelper::addToolbarMenu(); // Set the submenu // JSNEasySliderHelper::addSubmenu('sliders'); // Get messages $msgs = ''; if (!$config->get('disable_all_messages')) { $msgs = JSNUtilsMessage::getList('SLIDERS'); $msgs = count($msgs) ? JSNUtilsMessage::showMessages($msgs) : ''; } $this->sliders = $objJSNEasySliderSliders->getSlidersWithoutState(); // Assign variables for rendering $this->msgs = $msgs; $this->objJSNEasySliderSliders = $objJSNEasySliderSliders; // Add assets JSNEasySliderHelper::addAssets(); $this->_addAssets(); // Display the template parent::display($tpl); }
/** * Get List Item * * @return void */ public function getListSlider() { $objJSNEasySliderSliders = new JSNEasySliderSliders(); $sliders = $objJSNEasySliderSliders->getSlidersWithoutState(); jexit(json_encode($sliders)); }