Esempio n. 1
0
 /**
  * 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');
     }
 }
Esempio n. 2
0
 /**
  * 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);
 }
Esempio n. 4
0
 public function createNewSlider($data = array())
 {
     $result = array();
     $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) {
             $result['message'] = JText::_('JSN_EASYSLIDER_YOU_HAVE_REACHED_THE_LIMITATION_OF_3_SLIDERS_IN_FREE_EDITION', true);
             $result['error'] = true;
             return json_encode($result);
         }
     }
     try {
         $query = $this->_db->getQuery(true);
         // Insert columns.
         $columns = array('slider_title', 'published', 'access', 'slider_data');
         // Insert values.
         $values = array($this->_db->quote($data['slider_title']), $data['published'], $data['access'], $this->_db->quote($data['slider_data']));
         // Prepare the insert query.
         $query->insert($this->_db->quoteName('#__jsn_easyslider_sliders'))->columns($this->_db->quoteName($columns))->values(implode(',', $values));
         $this->_db->setQuery($query);
         $this->_db->execute();
         $sliderID = $this->_db->insertid();
         $result['message'] = JText::_('JSN_EASYSLIDER_INSERT_SUCCESSFULLY', true);
         //Update data successful
         $result['error'] = false;
         $result['slider_id'] = $sliderID;
         return json_encode($result);
     } catch (Exception $e) {
         // catch any database errors.
         $result['message'] = JText::_('JSN_EASYSLIDER_INSERT_UNSUCCESSFULLY', true);
         $result['error'] = true;
         return json_encode($result);
     }
 }
Esempio n. 5
0
 /**
  * Get List Item
  *
  * @return  void
  */
 public function getListSlider()
 {
     $objJSNEasySliderSliders = new JSNEasySliderSliders();
     $sliders = $objJSNEasySliderSliders->getSlidersWithoutState();
     jexit(json_encode($sliders));
 }
Esempio n. 6
0
 protected function getInput()
 {
     $definePath = JPATH_ROOT . '/administrator/components/com_easyslider/easyslider.defines.php';
     if (is_file($definePath)) {
         include_once $definePath;
     }
     $_app = JFactory::getApplication('admin');
     $_input = $_app->input;
     $pathOnly = JURI::root(true);
     $app = JFactory::getApplication();
     $script = '<script>var jQuery_bak = jQuery;</script>';
     //        !class_exists('JSNBaseHelper') OR JSNBaseHelper::loadAssets();
     if (JVERSION * 100 >= 300) {
         JSNHtmlAsset::addStyle(JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.9.0.custom.css');
         if (preg_match('/msie/i', $_SERVER['HTTP_USER_AGENT'])) {
             JSNHtmlAsset::addStyle(JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery.ui.1.9.0.ie.css');
         }
     } else {
         JSNHtmlAsset::addStyle(JSN_URL_ASSETS . '/3rd-party/bootstrap/css/bootstrap.min.css');
         JSNHtmlAsset::addStyle(JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.8.16.custom.css');
         if (preg_match('/msie/i', $_SERVER['HTTP_USER_AGENT'])) {
             JSNHtmlAsset::addStyle(JSN_URL_ASSETS . '/3rd-party/jquery-ui/css/ui-bootstrap/jquery-ui-1.8.16.ie.css');
         }
     }
     JSNHtmlAsset::addStyle(JSN_URL_ASSETS . '/joomlashine/css/jsn-gui.css');
     JSNHtmlAsset::addStyle(JSNES_ASSETS_URL . 'css/modal.css');
     JSNHtmlAsset::addStyle(JSNES_ASSETS_URL . 'css/modules.css');
     $script .= '<script type="text/javascript" src="' . JUri::root(true) . '/media/jui/js/jquery.min.js"></script>';
     $script .= '<script type="text/javascript" src="' . JSNES_PLG_JSNFRAMEWORK_SYSTEM_ASSETS_URL . '3rd-party/jquery-ui/js/jquery-ui-1.9.0.custom.min.js"></script>';
     $script .= '<script type="text/javascript" src="' . JSNES_ASSETS_URL . 'js/libs/modal.js"></script>';
     $script .= '<script type="text/javascript" src="' . JSNES_ASSETS_URL . 'js/modules.js"></script>';
     $script .= '<script type="text/javascript" src="' . $pathOnly . '/media/jui/js/jquery-noconflict.js"></script>';
     $script .= '<script>jQuery =  jQuery_bak;</script>';
     $objJSNEasySliderSliders = new JSNEasySliderSliders();
     $sliderID = 0;
     if (!is_null($id = $_input->get->get('id'))) {
         $data = $objJSNEasySliderSliders->getSliderModule($id);
         if ($data) {
             $data = json_decode($data);
             $sliderID = $data->slider_id;
         }
     } else {
         $sliderID = $app->getUserState('com_easyslider.add.slider_id');
     }
     //build the list of slider
     $html = $script . '<div id="jsn-slider-icon-warning">';
     $sliders = $objJSNEasySliderSliders->getSliders();
     $totalSliders = $objJSNEasySliderSliders->countSilderItems();
     $default = new stdClass();
     $default->slider_id = 0;
     $default->id = 0;
     $default->published = 0;
     $default->ordering = 0;
     $default->access = 1;
     $default->slider_title = '-- select slider --';
     $default->text = '-- select slider --';
     array_unshift($sliders, $default);
     $html .= JHTML::_('select.genericList', $sliders, $this->name, 'class="inputbox jsn-select-value"', 'id', 'text', $sliderID, $this->id);
     if (count($sliders)) {
         $html .= '<a href="javascript:void(0);" id="edit-slider" class="disabled"><i class="icon-pencil"></i></a>';
     } else {
         $html .= '<a href="javascript:void(0);" class="disabled"><i class="icon-pencil"></i></a>';
     }
     /*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' && $totalSliders !== false && $totalSliders >= 3) {
         $html .= '<a href="javascript:void(0);" onclick="alert(\'' . JText::_('JSN_EASYSLIDER_YOU_HAVE_REACHED_THE_LIMITATION_OF_3_SLIDERS_IN_FREE_EDITION', true) . '\')" id="new-slider"><i class="icon-plus"></i></a>';
     } else {
         $html .= '<a href="index.php?option=com_easyslider&view=slider&layout=edit" id="new-slider"><i class="icon-plus"></i></a>';
     }
     $html .= '</div>';
     return $html;
 }