/** * Display method * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ public function display($tpl = null) { // Get config parameters $config = JSNConfigHelper::get(); // Set the toolbar JToolbarHelper::title(JText::_('JSN_EASYSLIDER_CONFIGURATION_SETTING')); // Add toolbar menu JSNEasySliderHelper::addToolbarMenu(); // Set the submenu JSNEasySliderHelper::addSubmenu('maintenance'); // Get messages $msgs = ''; if (!$config->get('disable_all_messages')) { $msgs = JSNUtilsMessage::getList('CONFIGURATION'); $msgs = count($msgs) ? JSNUtilsMessage::showMessages($msgs) : ''; } // Assign variables for rendering $this->msgs = $msgs; if (!empty($_GET['g']) && $_GET['g'] == 'data') { echo JSNHtmlAsset::loadScript('jsn/data', array('language' => array('JSN_EXTFW_GENERAL_CLOSE' => JText::_('JSN_EXTFW_GENERAL_CLOSE'))), true); } // Add assets JSNEasySliderHelper::addAssets(); $this->_addAssets(); // Display the template parent::display($tpl); }
/** * Method for display page. * * @param boolean $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) { // Set the toolbar JToolBarHelper::title(JText::_('JSN_EASYSLIDER_UPDATE_PRODUCT')); // Add assets JSNEasySliderHelper::addAssets(); // Display the template parent::display($tpl); }
/** * 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); }
/** * Method for display page. * * @param boolean $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) { try { $this->state = $this->get('State'); $this->slider = $this->get('Item'); $this->form = $this->get('Form'); } catch (Exception $e) { throw $e; } $config = JSNConfigHelper::get(); // Get input object $input = JFactory::getApplication()->input; if (empty($this->slider->slider_id)) { $objJSNEasySliderSliders = new JSNEasySliderSliders(); $totalSliders = $objJSNEasySliderSliders->countSilderItems(); /*Check if it is FREE edition then show warning message to alert that FREE edition only allows create maximum of 3 sliders*/ $edition = defined('JSN_EASYSLIDER_EDITION') ? JSN_EASYSLIDER_EDITION : "free"; if (strtolower($edition) == 'free') { if ($totalSliders !== false && $totalSliders >= 3) { JFactory::getApplication()->redirect('index.php?option=com_easyslider&view=sliders'); return false; } } } // Setup toolbar $input->set('hidemainmenu', true); // Get messages $msgs = ''; if (!$config->get('disable_all_messages')) { $msgs = JSNUtilsMessage::getList('SLIDER'); $msgs = count($msgs) ? JSNUtilsMessage::showMessages($msgs) : ''; } // Assign variables for rendering $this->assignRef('msgs', $msgs); // Set the toolbar JToolBarHelper::title(JText::_('JSN_EASYSLIDER_EDIT_PRODUCT')); // Add assets JSNEasySliderHelper::addAssets(); $this->objUtils = new JSNEasySliderUtils(); // Display the template parent::display($tpl); }
/** * launch Adapter * * @return boolean */ function launchAdapter() { $app = JFactory::getApplication(); $input = $app->input; $type = $input->getCmd('type'); $sliderId = $input->getInt('slider_id'); $app->setUserState('com_easyslider.add.slider_id', $sliderId); switch ($type) { case 'module': $moduleInfo = JSNEasySliderHelper::getModuleInfo(); $link = 'index.php?option=com_modules&task=module.add&eid=' . $moduleInfo->extension_id; $this->setRedirect($link); break; case 'menu': $componetInfo = JSNEasySliderHelper::getComponentInfo(); $data['type'] = 'component'; $data['title'] = ''; $data['alias'] = ''; $data['note'] = ''; $data['link'] = 'index.php?option=com_easyslider&view=slider'; $data['published'] = '1'; $data['access'] = '1'; $data['menutype'] = $input->getCmd('menutype'); $data['parent_id'] = '1'; $data['browserNav'] = '0'; $data['home'] = '0'; $data['language'] = '*'; $data['template_style_id'] = '0'; $data['slider_id'] = '0'; $data['component_id'] = $componetInfo->extension_id; $app->setUserState('com_menus.edit.slider.data', $data); $app->setUserState('com_menus.edit.slider.type', 'component'); $app->setUserState('com_menus.edit.slider.link', 'index.php?option=com_easyslider&view=slider'); $link = 'index.php?option=com_menus&view=slider&layout=edit'; $this->setRedirect($link); break; default: break; } return true; }
/** * Display method * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ function display($tpl = null) { // Get config parameters $config = JSNConfigHelper::get(); // Set the toolbar JToolbarHelper::title(JText::_('JSN_EASYSLIDER_ABOUT_TITLE')); // Add toolbar menu JSNEasySliderHelper::addToolbarMenu(); // Set the submenu JSNEasySliderHelper::addSubmenu('about'); // Get messages $msgs = ''; if (!$config->get('disable_all_messages')) { $msgs = JSNUtilsMessage::getList('ABOUT'); $msgs = count($msgs) ? JSNUtilsMessage::showMessages($msgs) : ''; } // Assign variables for rendering $this->assignRef('msgs', $msgs); // Add assets JSNEasySliderHelper::addAssets(); // Display the template parent::display($tpl); }
/** * Method to duplicate slider. * * @param array &$pks An array of primary key IDs. * * @return boolean True if successful. */ public function duplicate(&$pks) { // Initialise variables. $user = JFactory::getUser(); $db = $this->getDbo(); // Access checks. if (!$user->authorise('core.create', 'com_easyslider')) { throw new Exception(JText::_('JERROR_CORE_CREATE_NOT_PERMITTED')); } $table = $this->getTable(); $checkEditionLimit = true; foreach ($pks as $pk) { $edition = defined('JSN_EASYSLIDER_EDITION') ? JSN_EASYSLIDER_EDITION : "free"; if (strtolower($edition) == 'free') { $dataListSlider = JSNEasySliderHelper::getSliders(); if (count($dataListSlider) >= 3) { $checkEditionLimit = false; } } if ($checkEditionLimit) { if ($table->load($pk, true)) { // Reset the id to create a new record $table->slider_id = 0; $m = null; if (preg_match('#\\((\\d+)\\)$#', $table->slider_title, $m)) { $table->slider_title = preg_replace('#\\(\\d+\\)$#', '(' . ($m[1] + 1) . ')', $table->slider_title); } else { $table->slider_title .= ' (2)'; } $table->published = 0; $table->access = 1; if (!$table->check() || !$table->store()) { throw new Exception($table->getError()); } } else { throw new Exception($table->getError()); } } } if (!$checkEditionLimit) { $msg = JText::sprintf('JSN_EASYSLIDER_YOU_HAVE_REACHED_THE_LIMITATION_OF_3_SLIDER_IN_FREE_EDITION', 0) . ' <a class="jsn-link-action" href="index.php?option=com_easyslider&view=upgrade">' . JText::_("JSN_EASYSLIDER_UPGRADE_EDITION") . '</a>'; throw new Exception($msg); } return true; }