231 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			231 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * @version		6.2.6 tabulizer $
 | |
|  * @package		tabulizer
 | |
|  * @copyright	Copyright © 2011 - All rights reserved.
 | |
|  * @license		GNU/GPL
 | |
|  * @author		Dimitrios Mourloukos
 | |
|  * @author mail	info@alterora.gr
 | |
|  * @website		www.tabulizer.com
 | |
|  * 
 | |
|  */
 | |
| 
 | |
| 
 | |
| // no direct access
 | |
| defined('_JEXEC') or die('Restricted access');
 | |
| 
 | |
| jimport( 'joomla.application.component.view' );
 | |
| 
 | |
| class tabulizerViewRulesetarchives extends JViewLegacy
 | |
| {
 | |
| 	function __construct(){
 | |
| 		// add tabulizer CSS to override form styling
 | |
| 		$doc= JFactory::getDocument();
 | |
| 		$cssfile = TabulizerPath::getURLPath('tabulizer.css', 'admin_css');		
 | |
| 		$doc->addStyleSheet($cssfile);
 | |
| 		
 | |
| 		parent::__construct();		
 | |
| 	}
 | |
| 
 | |
| 	function display($tpl = null){
 | |
|         $jinput = JFactory::getApplication()->input;
 | |
| 		$option = $jinput->getCmd('option');
 | |
|         $return_urls = null;
 | |
| 		
 | |
| 		$model = $this->getModel();
 | |
| 		$ruleset_archives = $model->getRulesetArchives();						
 | |
| 		$ruleset_conflicts = $model->getRulesetConflicts();					
 | |
| 		$model->getReturnURLs($return_urls);
 | |
|         $pagination = $model->getPagination();
 | |
| 		
 | |
| 		$this->assignRef('ruleset_archives', $ruleset_archives);
 | |
| 		$this->assignRef('ruleset_conflicts', $ruleset_conflicts);
 | |
| 		$this->assignRef('return_urls', $return_urls);
 | |
| 		$this->assignRef('pagination', $pagination);
 | |
| 				
 | |
| 		parent::display($tpl);
 | |
| 	}			
 | |
| 	
 | |
| 	function displayUserPreferences($tpl = null) {		
 | |
| 		$model = $this->getModel();
 | |
| 		$user_preferences = $model->getUserPreferences();
 | |
|         $return_urls = null;
 | |
| 
 | |
| 		$model->getReturnURLs($return_urls);
 | |
| 		
 | |
| 		$lists = array();	
 | |
| 		
 | |
| 		// column separator
 | |
| 		$options = TabulizerUtils::getSeparatorListLabels();
 | |
| 		$lists['column_separator'] = TabulizerForm::getSelectCtrl('column_separator',$user_preferences['column_separator'],$options);
 | |
| 		
 | |
| 		// column enclosure
 | |
| 		$options = array(ENCLOSURE_NONE=>JText::_('COM_TABULIZER_NO_ENCLOSURE'),
 | |
| 				ENCLOSURE_DOUBLE_QUOTES=>JText::_('COM_TABULIZER_DOUBLE_QUOTES_ENCLOSURE'),  
 | |
| 				ENCLOSURE_SINGLE_QUOTES=>JText::_('COM_TABULIZER_SINGLE_QUOTES_ENCLOSURE'));
 | |
| 		$lists['column_enclosure'] = TabulizerForm::getSelectCtrl('column_enclosure',$user_preferences['column_enclosure'],$options);
 | |
| 		
 | |
| 		// column consistency
 | |
| 		$options = array(1=>JText::_('COM_TABULIZER_COLUMN_CONSISTENCY_STRICT'),
 | |
| 				0=>JText::_('COM_TABULIZER_COLUMN_CONSISTENCY_LOOSE'));
 | |
| 		$lists['column_consistency'] = TabulizerForm::getSelectCtrl('column_consistency',$user_preferences['column_consistency'],$options);
 | |
| 
 | |
|         // when retabulize, remove leftovers
 | |
|         $options = array(1=>JText::_('COM_TABULIZER_YES'),
 | |
|             0=>JText::_('COM_TABULIZER_NO'));
 | |
|         $lists['retabulize_remove_leftovers'] = TabulizerForm::getSelectCtrl('retabulize_remove_leftovers',$user_preferences['retabulize_remove_leftovers'],$options);
 | |
| 		
 | |
| 		// ruleset archives and names
 | |
| 		TabulizerPath::requireLib('ruleset','admin');				
 | |
| 		$rs = new Ruleset();
 | |
| 		$ruleset_archive_options = array(0=>JText::_('COM_TABULIZER_NONE'));
 | |
| 		$ruleset_name_options = array();
 | |
| 		$archive_to_rulesets = '';
 | |
| 
 | |
| 		$ruleset_archives = $rs->loadRulesets(null, 0, 0, $total_count);
 | |
| 		if ($total_count) {
 | |
| 			$ruleset_archives = $rs->getRulesets(null, 0, 0, $total_count);
 | |
| 			foreach ($ruleset_archives as $ruleset_archive) {
 | |
| 				$ruleset_archive_options[$ruleset_archive['filename']] = $ruleset_archive['title'];
 | |
| 				if (!empty($ruleset_archive['rulesets'])) {
 | |
| 					$archive_to_ruleset_entries = array();
 | |
| 					foreach ($ruleset_archive['rulesets'] as $ruleset_name => $ruleset) {
 | |
| 						if ($user_preferences['ruleset_archive'] == $ruleset_archive['filename']) {
 | |
| 							$ruleset_name_options[$ruleset['name']] = $ruleset['title'];
 | |
| 						}
 | |
| 						$archive_to_ruleset_entries[] = '"'.$ruleset['name'].'": "'.htmlspecialchars($ruleset['title'],ENT_COMPAT,'UTF-8'). '"';
 | |
| 					}					
 | |
| 					if (!empty($archive_to_ruleset_entries)) $archive_to_rulesets .= '		archive_to_rulesets["'.$ruleset_archive['filename'].'"] = {'.implode(',',$archive_to_ruleset_entries).'};' . "\n";
 | |
| 				}
 | |
| 			}
 | |
| 		}
 | |
| 		if (empty($ruleset_name_options)) $ruleset_name_options = array(0=>JText::_('COM_TABULIZER_NONE'));						
 | |
| 		$this->assignRef('archive_to_rulesets', $archive_to_rulesets);						
 | |
| 		
 | |
| 		$lists['ruleset_archive'] = TabulizerForm::getSelectCtrl('ruleset_archive', $user_preferences['ruleset_archive'], $ruleset_archive_options, array('onchange'=>'TabulizerUpdateRulesetArchive(this)', 'class'=>'ds_param_wide'));
 | |
| 		
 | |
| 		$lists['ruleset_name'] = TabulizerForm::getSelectCtrl('ruleset_name', $user_preferences['ruleset_name'], $ruleset_name_options, array('class'=>'ds_param_wide'));
 | |
| 
 | |
|         // Excel reading
 | |
|         $lists['excel_font_color'] = TabulizerForm::getCheckboxCtrl('excel_font_color',1,$user_preferences['excel_font_color']);
 | |
|         $lists['excel_background_color'] = TabulizerForm::getCheckboxCtrl('excel_background_color',1,$user_preferences['excel_background_color']);
 | |
|         $lists['excel_font_size'] = TabulizerForm::getCheckboxCtrl('excel_font_size',1,$user_preferences['excel_font_size']);
 | |
|         $lists['excel_font_bold'] = TabulizerForm::getCheckboxCtrl('excel_font_bold',1,$user_preferences['excel_font_bold']);
 | |
|         $lists['excel_font_italic'] = TabulizerForm::getCheckboxCtrl('excel_font_italic',1,$user_preferences['excel_font_italic']);
 | |
|         $lists['excel_font_strikethrough'] = TabulizerForm::getCheckboxCtrl('excel_font_strikethrough',1,$user_preferences['excel_font_strikethrough']);
 | |
|         $lists['excel_font_underline'] = TabulizerForm::getCheckboxCtrl('excel_font_underline',1,$user_preferences['excel_font_underline']);
 | |
|         $lists['excel_font_superscript'] = TabulizerForm::getCheckboxCtrl('excel_font_superscript',1,$user_preferences['excel_font_superscript']);
 | |
|         $lists['excel_font_subscript'] = TabulizerForm::getCheckboxCtrl('excel_font_subscript',1,$user_preferences['excel_font_subscript']);
 | |
| 
 | |
|         // Datasources
 | |
|         $lists['datasources_display_warning'] = TabulizerForm::getCheckboxCtrl('datasources_display_warning',1,$user_preferences['datasources_display_warning']);
 | |
|         $lists['datasources_refresh_keyphrase'] = TabulizerForm::getInputCtrl('datasources_refresh_keyphrase', $user_preferences['datasources_refresh_keyphrase']);
 | |
|         if (!empty($user_preferences['datasources_refresh_keyphrase'])) {
 | |
|             $refresh_url = JURI::root().'index.php?option=com_tabulizer&task=refreshDataSources&keyphrase='.$user_preferences['datasources_refresh_keyphrase'];
 | |
|             $lists['datasources_refresh_keyphrase'] .= '<span class="cache_tip">'.JText::_('COM_TABULIZER_DATASOURCES_REFRESH_URL').': '.$refresh_url.'</span>';
 | |
|         }
 | |
| 
 | |
|         // Archive Help
 | |
|         $options = array('none'=>JText::_('COM_TABULIZER_ARCHIVE_HELP_DISPLAY_NONE'),'text'=>JText::_('COM_TABULIZER_ARCHIVE_HELP_DISPLAY_TEXT'),'html'=>JText::_('COM_TABULIZER_ARCHIVE_HELP_DISPLAY_HTML'));
 | |
|         $lists['archive_help_display'] = TabulizerForm::getSelectCtrl('archive_help_display',$user_preferences['archive_help_display'],$options);
 | |
| 
 | |
|         // Email cloaking auto disable
 | |
|         $lists['email_cloaking_auto_disable'] = TabulizerForm::getCheckboxCtrl('email_cloaking_auto_disable',1,$user_preferences['email_cloaking_auto_disable']);
 | |
| 
 | |
|         // Safe mode
 | |
|         $lists['safe_mode_enabled'] = TabulizerForm::getCheckboxCtrl('safe_mode_enabled',1,$user_preferences['safe_mode_enabled']);
 | |
| 
 | |
|         // Pagination
 | |
|         $lists['pagination_length_menu'] = TabulizerForm::getInputCtrl('pagination_length_menu', $user_preferences['pagination_length_menu']);
 | |
| 		
 | |
| 		// JQuery libraries support
 | |
| 		$options = array(0=>JText::_('COM_TABULIZER_NO'), 1=>JText::_('COM_TABULIZER_YES'));
 | |
| 		$lists['jquery_include'] = TabulizerForm::getSelectCtrl('jquery_include', $user_preferences['jquery_include'], $options);
 | |
| 		$lists['jqplot_include'] = TabulizerForm::getSelectCtrl('jqplot_include', $user_preferences['jqplot_include'], $options);		
 | |
| 		$lists['datatable_include'] = TabulizerForm::getSelectCtrl('datatable_include', $user_preferences['datatable_include'], $options);
 | |
|         $lists['scroll_library_enabled'] = TabulizerForm::getCheckboxCtrl('scroll_library_enabled', '1', $user_preferences['scroll_library_enabled']);
 | |
|         $lists['scroll_library_name'] = TabulizerForm::getHiddenCtrl('scroll_library_name', empty($user_preferences['scroll_library_name'])?'nicescroll':$user_preferences['scroll_library_name']);
 | |
|         $lists['scroll_library_options'] = TabulizerForm::getInputCtrl('scroll_library_options', $user_preferences['scroll_library_options']);
 | |
|         $lists['scroll_library_adjust_datatables'] = TabulizerForm::getCheckboxCtrl('scroll_library_adjust_datatables', '1', $user_preferences['scroll_library_adjust_datatables']);
 | |
| 				
 | |
| 		$this->assignRef('lists', $lists);				
 | |
| 		$this->assignRef('return_urls', $return_urls);
 | |
| 		
 | |
| 		parent::display($tpl);
 | |
| 	}
 | |
| 
 | |
|     function displayUserPermissions($tpl = null) {
 | |
|         $model = $this->getModel();
 | |
|         $user_permissions = $model->getAccessPermissions();
 | |
|         $return_urls = null;
 | |
| 
 | |
|         $model->getReturnURLs($return_urls);
 | |
| 
 | |
|         $lists = array();
 | |
| 
 | |
|         $role_options = array('administrator' => JText::_('COM_TABULIZER_ROLE_ADMINISTRATOR'),
 | |
|             'editor' => JText::_('COM_TABULIZER_ROLE_EDITOR'),
 | |
|             'author' => JText::_('COM_TABULIZER_ROLE_AUTHOR'),
 | |
|             'contributor' => JText::_('COM_TABULIZER_ROLE_CONTRIBUTOR'),
 | |
|             'subscriber' => JText::_('COM_TABULIZER_ROLE_SUBSCRIBER'));
 | |
| 
 | |
|         $capabilities = array('ruleset-use' => JText::_('COM_TABULIZER_RULESET_USE_PERMISSION_LABEL'),
 | |
|             'ruleset-view' => JText::_('COM_TABULIZER_RULESET_VIEW_PERMISSION_LABEL'),
 | |
|             'ruleset-edit' => JText::_('COM_TABULIZER_RULESET_EDIT_PERMISSION_LABEL'),
 | |
|             'ruleset-import' => JText::_('COM_TABULIZER_RULESET_IMPORT_PERMISSION_LABEL'),
 | |
|             'ruleset-export' => JText::_('COM_TABULIZER_RULESET_EXPORT_PERMISSION_LABEL'),
 | |
|             'data-source-view' => JText::_('COM_TABULIZER_DATA_SOURCE_VIEW_PERMISSION_LABEL'),
 | |
|             'data-source-edit' => JText::_('COM_TABULIZER_DATA_SOURCE_EDIT_PERMISSION_LABEL'),
 | |
|             'data-source-import' => JText::_('COM_TABULIZER_DATA_SOURCE_IMPORT_PERMISSION_LABEL'),
 | |
|             'data-source-export' => JText::_('COM_TABULIZER_DATA_SOURCE_EXPORT_PERMISSION_LABEL'),
 | |
|             'data-import' => JText::_('COM_TABULIZER_DATA_IMPORT_PERMISSION_LABEL'));
 | |
| 
 | |
|         foreach ($capabilities as $key => $label) {
 | |
|             $lists[$key] = array('value'=> TabulizerForm::getSelectCtrlMultiple($key,$user_permissions[$key],$role_options), 'label'=>$label);
 | |
|         }
 | |
| 
 | |
|         $this->assignRef('lists', $lists);
 | |
|         $this->assignRef('return_urls', $return_urls);
 | |
| 
 | |
|         parent::display($tpl);
 | |
|     }
 | |
| 	
 | |
| 	function displayStatus($tpl = null) {		
 | |
| 		$model = $this->getModel();
 | |
| 		$status = $model->getStatus();
 | |
|         $return_urls = null;
 | |
| 
 | |
| 		$model->getReturnURLs($return_urls);
 | |
| 		
 | |
| 		$this->assignRef('status', $status);
 | |
| 		$this->assignRef('return_urls', $return_urls);
 | |
| 		
 | |
| 		parent::display($tpl);
 | |
| 	}
 | |
| 	
 | |
| 	function displayExport($tpl = null) {		
 | |
| 		$model = $this->getModel();
 | |
| 		$css_code = $model->getRulesetArchivesSkeletonCSSCode();
 | |
|         $return_urls = null;
 | |
| 
 | |
| 		$model->getReturnURLs($return_urls);
 | |
| 
 | |
| 		$this->assignRef('css_code', $css_code);
 | |
| 		$this->assignRef('return_urls', $return_urls);
 | |
| 		
 | |
| 		parent::display($tpl);
 | |
| 	}
 | |
| 	
 | |
| 	function displayImport($tpl = null) {		
 | |
| 		$model = $this->getModel();
 | |
|         $return_urls = null;
 | |
| 
 | |
| 		$model->getReturnURLs($return_urls);
 | |
| 		
 | |
| 		$this->assignRef('return_urls', $return_urls);
 | |
| 			
 | |
| 		parent::display($tpl);		
 | |
| 	}
 | |
| 	
 | |
| }
 | |
| ?>
 |