Beispiel #1
0
 function display($tpl = null)
 {
     //initialise variables
     $mainframe = JFactory::getApplication();
     $option = JRequest::getVar('option');
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.modal');
     //add css and submenu to document
     $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css');
     if (FLEXI_J30GE) {
         $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css');
     } else {
         if (FLEXI_J16GE) {
             $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css');
         } else {
             $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css');
         }
     }
     $permission = FlexicontentHelperPerm::getPerm();
     if (!$permission->CanTemplates) {
         $mainframe->redirect('index.php?option=com_flexicontent', JText::_('FLEXI_NO_ACCESS'));
     }
     // Get User's Global Permissions
     $perms = FlexicontentHelperPerm::getPerm();
     //Create Submenu
     FLEXISubmenu('CanTemplates');
     // Create document/toolbar titles
     $doc_title = JText::_('FLEXI_TEMPLATES');
     $site_title = $document->getTitle();
     JToolBarHelper::title($doc_title, 'templates');
     $document->setTitle($doc_title . ' - ' . $site_title);
     // Create the toolbar
     //JToolBarHelper::Back();
     if ($perms->CanConfig) {
         //JToolBarHelper::divider(); JToolBarHelper::spacer();
         $session = JFactory::getSession();
         $fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent');
         $_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940;
         $fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent');
         $_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550;
         JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration');
     }
     $tmpldirectory = JPATH_COMPONENT_SITE . DS . 'templates' . DS;
     $source = JRequest::getString('source', '');
     $dest = $source ? flexicontent_upload::sanitizedir($tmpldirectory, $source) : '';
     //Get data from the model
     $rows = $this->get('Data');
     //assign data to template
     $this->assignRef('rows', $rows);
     $this->assignRef('user', $user);
     $this->assignRef('tmpldirectory', $tmpldirectory);
     $this->assignRef('source', $source);
     $this->assignRef('dest', $dest);
     parent::display($tpl);
 }
 /**
  * Method to duplicate a template folder
  *
  * @access	public
  * @return	boolean	true on success
  * @since	1.5
  */
 function duplicate($source, $dest)
 {
     jimport('joomla.filesystem.folder');
     $path = JPATH_COMPONENT_SITE . DS . 'templates' . DS;
     $dest = $dest ? flexicontent_upload::sanitizedir($path, $dest) : '';
     if (!$source || !$dest) {
         return false;
     }
     if (!JFolder::copy($source, $dest, $path)) {
         return false;
     }
     return true;
 }
 function display($tpl = null)
 {
     // ********************
     // Initialise variables
     // ********************
     $app = JFactory::getApplication();
     $jinput = $app->input;
     $option = $jinput->get('option', '', 'cmd');
     $view = $jinput->get('view', '', 'cmd');
     $cparams = JComponentHelper::getParams('com_flexicontent');
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     $document = JFactory::getDocument();
     // **************************
     // Add css and js to document
     // **************************
     flexicontent_html::loadFramework('select2');
     //JHTML::_('behavior.tooltip');
     $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH);
     $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH);
     // *****************************
     // Get user's global permissions
     // *****************************
     $perms = FlexicontentHelperPerm::getPerm();
     if (!$perms->CanTemplates) {
         $app->redirect('index.php?option=com_flexicontent', JText::_('FLEXI_NO_ACCESS'));
     }
     // ************************
     // Create Submenu & Toolbar
     // ************************
     // Create Submenu (and also check access to current view)
     FLEXISubmenu('CanTemplates');
     // Create document/toolbar titles
     $doc_title = JText::_('FLEXI_TEMPLATES');
     $site_title = $document->getTitle();
     JToolBarHelper::title($doc_title, 'templates');
     $document->setTitle($doc_title . ' - ' . $site_title);
     // Create the toolbar
     $appsman_path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'appsman';
     if (file_exists($appsman_path)) {
         $btn_icon = 'icon-download';
         $btn_name = 'download';
         $btn_task = 'appsman.exportxml';
         $extra_js = " var f=document.getElementById('adminForm'); f.elements['view'].value='appsman'; jQuery('<input>').attr({type: 'hidden', name: 'table', value: 'flexicontent_templates'}).appendTo(jQuery(f));";
         flexicontent_html::addToolBarButton('Export now', $btn_name, $full_js = '', $msg_alert = '', $msg_confirm = 'Export now as XML', $btn_task, $extra_js, $btn_list = false, $btn_menu = true, $btn_confirm = true, $btn_class = "btn-warning", $btn_icon);
         $btn_icon = 'icon-box-add';
         $btn_name = 'box-add';
         $btn_task = 'appsman.addtoexport';
         $extra_js = " var f=document.getElementById('adminForm'); f.elements['view'].value='appsman'; jQuery('<input>').attr({type: 'hidden', name: 'table', value: 'flexicontent_templates'}).appendTo(jQuery(f));";
         flexicontent_html::addToolBarButton('Add to export', $btn_name, $full_js = '', $msg_alert = '', $msg_confirm = 'Add to export list', $btn_task, $extra_js, $btn_list = false, $btn_menu = true, $btn_confirm = true, $btn_class = "btn-warning", $btn_icon);
     }
     //JToolBarHelper::Back();
     if ($perms->CanConfig) {
         //JToolBarHelper::divider(); JToolBarHelper::spacer();
         $session = JFactory::getSession();
         $fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent');
         $_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940;
         $fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent');
         $_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550;
         JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration');
     }
     $tmpldirectory = JPATH_COMPONENT_SITE . DS . 'templates' . DS;
     $source = JRequest::getString('source', '');
     $dest = $source ? flexicontent_upload::sanitizedir($tmpldirectory, $source) : '';
     //Get data from the model
     $rows = $this->get('Data');
     // Get layout data
     /*$tmpl	= flexicontent_tmpl::getTemplates();
     		foreach($rows as $row) {
     			$row->item_layout = @ $tmpl->items->{$row->name};
     			$row->category_layout = @ $tmpl->category->{$row->name};
     		}*/
     //assign data to template
     $this->assignRef('rows', $rows);
     $this->assignRef('user', $user);
     $this->assignRef('tmpldirectory', $tmpldirectory);
     $this->assignRef('source', $source);
     $this->assignRef('dest', $dest);
     $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null;
     parent::display($tpl);
 }