889 lines
31 KiB
PHP
889 lines
31 KiB
PHP
|
|
<?php
|
||
|
|
/*
|
||
|
|
* @component SQL 2 Excel Component
|
||
|
|
* @copyright Copyright (C) Joomla-R-Us, joomla-r-us.com
|
||
|
|
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3
|
||
|
|
*/
|
||
|
|
|
||
|
|
// No direct access
|
||
|
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||
|
|
|
||
|
|
jimport('joomla.application.component.model');
|
||
|
|
|
||
|
|
require_once( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_sql2excel'.DS.'helpers'.DS.'sql2excel.php' );
|
||
|
|
|
||
|
|
class Sql2excelModelSqlexcelsettings extends JModel
|
||
|
|
{
|
||
|
|
var $_wbID;
|
||
|
|
var $_wbData;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Constructor that retrieves the ID from the request
|
||
|
|
*/
|
||
|
|
function __construct()
|
||
|
|
{
|
||
|
|
parent::__construct();
|
||
|
|
|
||
|
|
$array = JRequest::getVar('cid', 0, '', 'array');
|
||
|
|
$this->setId((int)$array[0]);
|
||
|
|
}
|
||
|
|
|
||
|
|
function setId($id)
|
||
|
|
{
|
||
|
|
// Set id and wipe data
|
||
|
|
$this->_wbID = $id;
|
||
|
|
$this->_wbData = null;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get list of Worksheets
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getWorksheetList($id, $width)
|
||
|
|
{
|
||
|
|
if ( $width == '' ) { $width = 300; };
|
||
|
|
|
||
|
|
// Get list of sections
|
||
|
|
$db = & JFactory::getDBO();
|
||
|
|
if ( $id == 0 ) {
|
||
|
|
$query = " SELECT ID AS value, CONCAT(ID, ' : ', TITLE, ' : ', sheetname ) AS text " .
|
||
|
|
' FROM #__sql2excel_worksheets ' .
|
||
|
|
' ORDER BY ID';
|
||
|
|
} else {
|
||
|
|
$query = " SELECT ID AS value, CONCAT(ID, ' : ', TITLE, ' : ', sheetname ) AS text " .
|
||
|
|
' FROM #__sql2excel_worksheets ' .
|
||
|
|
' WHERE ID NOT IN ( SELECT ws_id AS ID
|
||
|
|
FROM #__sql2excel_worksheet2book
|
||
|
|
WHERE wb_id=' . $id . ') ' .
|
||
|
|
' ORDER BY ID';
|
||
|
|
|
||
|
|
}
|
||
|
|
$this->_db->setQuery( $query );
|
||
|
|
$workSheets = JHTML::_( 'select.genericlist',
|
||
|
|
$db->loadObjectList(),
|
||
|
|
'available_worksheets',
|
||
|
|
'class="inputbox" style="width: ' . $width . 'px" size="20" onDblClick="addWS();"',
|
||
|
|
'value',
|
||
|
|
'text');
|
||
|
|
return $workSheets;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get list of Worksheets for a Workbook
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getSelWorksheetList($currWBid, $width)
|
||
|
|
{
|
||
|
|
if ( $width == '' ) { $width = 300; };
|
||
|
|
|
||
|
|
// Get list of sections
|
||
|
|
$db = & JFactory::getDBO();
|
||
|
|
$query = " SELECT a.ID AS value, CONCAT(a.ID, ' : ', a.TITLE, ' : ', a.sheetname ) AS text " .
|
||
|
|
' FROM #__sql2excel_worksheets a, #__sql2excel_worksheet2book b' .
|
||
|
|
' WHERE a.id = b.ws_id AND b.wb_id=' . $currWBid .
|
||
|
|
' ORDER BY b.ordering';
|
||
|
|
$this->_db->setQuery( $query );
|
||
|
|
$workSheets = JHTML::_( 'select.genericlist',
|
||
|
|
$db->loadObjectList(),
|
||
|
|
'selected_worksheets',
|
||
|
|
'class="inputbox" style="width: ' . $width . 'px" size="20" onDblClick="remWS();"',
|
||
|
|
'value',
|
||
|
|
'text');
|
||
|
|
|
||
|
|
return $workSheets;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get data
|
||
|
|
* @return object with data
|
||
|
|
*/
|
||
|
|
function &getData()
|
||
|
|
{
|
||
|
|
|
||
|
|
// Load the data
|
||
|
|
if (empty( $this->_wbData )) {
|
||
|
|
$query = ' SELECT * FROM #__sql2excel_workbooks ' .
|
||
|
|
' WHERE id = '.$this->_wbID;
|
||
|
|
$this->_db->setQuery( $query );
|
||
|
|
$this->_wbData = $this->_db->loadObject();
|
||
|
|
}
|
||
|
|
if (!$this->_wbData) {
|
||
|
|
$sql2excel = new stdClass();
|
||
|
|
$sql2excel->id = 0;
|
||
|
|
$sql2excel->title = null;
|
||
|
|
$sql2excel->link_title = null;
|
||
|
|
$sql2excel->filename = null;
|
||
|
|
$sql2excel->section = null;
|
||
|
|
$sql2excel->category = null;
|
||
|
|
$sql2excel->published = 1;
|
||
|
|
$sql2excel->checked_out = 0;
|
||
|
|
$sql2excel->checked_out_time = null;
|
||
|
|
$sql2excel->created = null;
|
||
|
|
$sql2excel->access = 0;
|
||
|
|
$sql2excel->count = 0;
|
||
|
|
$sql2excel->ordering = 0;
|
||
|
|
$sql2excel->parms = null;
|
||
|
|
$sql2excel->parms_prompt = 1;
|
||
|
|
$sql2excel->description = null;
|
||
|
|
$sql2excel->keywords = null;
|
||
|
|
$sql2excel->cache = 'Global';
|
||
|
|
$this->_wbData = $sql2excel;
|
||
|
|
}
|
||
|
|
return $this->_wbData;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get list Excel Writer types
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getExcelWriter($name, $selected)
|
||
|
|
{
|
||
|
|
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'auto', JText::_( 'Auto detect'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '2000_utf8', JText::_( 'Excel 97/2000 - UTF8'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '2000_limited', JText::_( 'Excel 97/2000 - Limited Character Set Support'));
|
||
|
|
$typesOpt = JHTML::_( 'select.genericlist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get list of Extra Cells in Preview settings
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getExtraCellsPreview($name, $selected)
|
||
|
|
{
|
||
|
|
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'Show', JText::_( 'Yes'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'Hide', JText::_( 'No'));
|
||
|
|
$typesOpt = JHTML::_( 'select.radiolist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get list of Workbook Cache types
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getFileTypes($name, $selected)
|
||
|
|
{
|
||
|
|
$mytypes[] = JHTML::_('select.option', '3', JText::_( '.csv'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '4', JText::_( '.htm'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '2', JText::_( '.xls'));
|
||
|
|
|
||
|
|
$typesOpt = JHTML::_( 'select.genericlist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get list of Formulas in Preview settings
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getFormulasPreview($name, $selected)
|
||
|
|
{
|
||
|
|
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'Show', JText::_( 'Show Full Formula Syntax'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'Label', JText::_( 'Show #FORMULA Label'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'Hide', JText::_( 'Hide'));
|
||
|
|
$typesOpt = JHTML::_( 'select.genericlist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get CRLF settings for XLS
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getCRLFoptionsXLS($name, $selected)
|
||
|
|
{
|
||
|
|
$mytypes[] = JHTML::_('select.option', '0', JText::_('Do Nothing'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '1', JText::_('Convert to Space'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '2', JText::_('Convert to \n'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '3', JText::_('Convert to ||'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '4', JText::_('Convert to <br>'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '5', JText::_('Remove'));
|
||
|
|
$typesOpt = JHTML::_( 'select.genericlist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get CRLF settings for CSV
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getCRLFoptionsCSV($name, $selected)
|
||
|
|
{
|
||
|
|
$mytypes[] = JHTML::_('select.option', '1', JText::_('Convert to Space'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '3', JText::_('Convert to ||'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '4', JText::_('Convert to <br>'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '5', JText::_('Remove'));
|
||
|
|
$typesOpt = JHTML::_( 'select.genericlist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get CRLF settings for HTM
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getCRLFoptionsHTM($name, $selected)
|
||
|
|
{
|
||
|
|
$mytypes[] = JHTML::_('select.option', '0', JText::_('Do Nothing'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '1', JText::_('Convert to Space'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '2', JText::_('Convert to \n'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '3', JText::_('Convert to ||'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '4', JText::_('Convert to <br>'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '5', JText::_('Remove'));
|
||
|
|
$typesOpt = JHTML::_( 'select.genericlist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get Section List Ordering Options
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getSectionListOrdering($name, $selected, $includeDate = false)
|
||
|
|
{
|
||
|
|
|
||
|
|
$mytypes[] = JHTML::_('select.option', '1', JText::_( 'Ordering ASC'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '2', JText::_( 'Ordering DESC'));
|
||
|
|
|
||
|
|
if ( $includeDate ) {
|
||
|
|
$mytypes[] = JHTML::_('select.option', '3', JText::_( 'Link / Title ASC'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '4', JText::_( 'Link / Title DESC'));
|
||
|
|
} else {
|
||
|
|
$mytypes[] = JHTML::_('select.option', '3', JText::_( 'Title ASC'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '4', JText::_( 'Title DESC'));
|
||
|
|
}
|
||
|
|
if ( $includeDate ) {
|
||
|
|
$mytypes[] = JHTML::_('select.option', '5', JText::_( 'Created ASC'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '6', JText::_( 'Created DESC'));
|
||
|
|
}
|
||
|
|
$mytypes[] = JHTML::_('select.option', '7', JText::_( 'Id ASC'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '8', JText::_( 'Id DESC'));
|
||
|
|
|
||
|
|
$typesOpt = JHTML::_( 'select.genericlist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get Section List Ordering Options
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getSectionListLinkOpt($name, $selected)
|
||
|
|
{
|
||
|
|
|
||
|
|
$mytypes[] = JHTML::_('select.option', '1', JText::_( 'Link Title'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '2', JText::_( 'Title'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '3', JText::_( 'Filename'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '4', JText::_( 'Link Title : [Filename]'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '5', JText::_( 'Title : [Filename]'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '6', JText::_( 'Filename : Title'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '7', JText::_( 'Filename : Link Title'));
|
||
|
|
$typesOpt = JHTML::_( 'select.genericlist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get list of Preview Modes
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getPreviewModes($name, $selected)
|
||
|
|
{
|
||
|
|
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'popup', JText::_( 'New Window - No Template'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'popupwt', JText::_( 'New Window - With Template'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'inline', JText::_( 'Same Window - No Template'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'inlinewt', JText::_( 'Same Window - With Template'));
|
||
|
|
$typesOpt = JHTML::_( 'select.genericlist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get list of Date Modes
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getDateMode($name, $selected)
|
||
|
|
{
|
||
|
|
|
||
|
|
$mytypes[] = JHTML::_('select.option', '0', JText::_( 'Server Date/Time'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '1', JText::_( 'Joomla Date/Time'));
|
||
|
|
$typesOpt = JHTML::_( 'select.genericlist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get list of Preview Modes
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getDescriptionOpts($name, $selected)
|
||
|
|
{
|
||
|
|
|
||
|
|
$mytypes[] = JHTML::_('select.option', '0', JText::_( 'None'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '1', JText::_( 'Top'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '2', JText::_( 'Bottom'));
|
||
|
|
$typesOpt = JHTML::_( 'select.genericlist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get default Help Tab
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getDefaultHelpTab($name, $selected)
|
||
|
|
{
|
||
|
|
|
||
|
|
$mytypes[] = JHTML::_('select.option', '0', JText::_('Do not set'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '1', JText::_('Help'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '2', JText::_('Tables'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '3', JText::_('Syntax / Errors'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', '4', JText::_('Explain'));
|
||
|
|
|
||
|
|
|
||
|
|
$typesOpt = JHTML::_( 'select.genericlist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get list of Theme Options
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getThemeOpts($name, $selected )
|
||
|
|
{
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-aquamarine-simple3d', JText::_( 'Aquamarine Simple3D'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-beige', JText::_( 'Beige'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-black', JText::_( 'Black'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-black-grad', JText::_( 'Black Gradient'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-blue-grad', JText::_( 'Blue Gradient'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-blue-bold', JText::_( 'Blue Bold'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-bluebubbles', JText::_( 'Blue Bubbles'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-brown-grad', JText::_( 'Brown Gradient'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-chocolate', JText::_( 'Chocolate'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-dark', JText::_( 'Dark'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-darkgrey-simple3d', JText::_( 'Dark Grey Simple3D'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-darkorange', JText::_( 'Dark Orange'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-darkseagreen', JText::_( 'Dark Sea Green'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-grey', JText::_( 'Grey'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-greytile', JText::_( 'Grey Tile'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-gold-grad', JText::_( 'Gold Gradient'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-green2-grad', JText::_( 'Green Gradient 2'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-greenyellow-simple3d', JText::_( 'GreenYellow Simple3D'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-joomlablue', JText::_( 'Joomla Blue'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-lightgrey-simple3d', JText::_( 'Light Grey Simple3D'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-lightpurpleblue', JText::_( 'Light Purple Blue'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-metal1', JText::_( 'Metal 1'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-metal2', JText::_( 'Metal 2'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-midnight', JText::_( 'Midnight'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-mossgreen', JText::_( 'Moss Green'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-neon-bold', JText::_( 'Neon Bold'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-olive', JText::_( 'Olive'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-orange-pattern', JText::_( 'Orange Pattern'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-orange-simple3d', JText::_( 'Orange Simple3D'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-orchid-simple3d', JText::_( 'Orchid Simple3D'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-purple', JText::_( 'Purple'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-purple-ripple', JText::_( 'Purple Ripple'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-purple-simple3d', JText::_( 'Purple Simple3D'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-red-bold', JText::_( 'Red Bold'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-red-pattern', JText::_( 'Red Pattern'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-red-simple3d', JText::_( 'Red Simple3D'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-silver', JText::_( 'Silver'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-silver-grad', JText::_( 'Silver Gradient'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-skyblue', JText::_( 'Sky Blue'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-slateblue', JText::_( 'Slate Blue'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-tealblue', JText::_( 'Teal Blue'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-thistle', JText::_( 'Thistle'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-transparent', JText::_( 'Transparent'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-grey-underline', JText::_( 'Transparent Underline'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-turquoise-grad', JText::_( 'Turquoise Gradient'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-velvet', JText::_( 'Velvet'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-whitesmoke', JText::_( 'White Smoke'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-yellow-pattern', JText::_( 'Yellow Pattern'));
|
||
|
|
|
||
|
|
$typesOpt = JHTML::_( 'select.genericlist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to get list of Button Options
|
||
|
|
* @return select list (html)
|
||
|
|
*/
|
||
|
|
function getButtonOpts($name, $selected, $dlpreview)
|
||
|
|
{
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-aquamarine-simple3d-button', JText::_( 'Aquamarine Simple3D Button'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-beige', JText::_( 'Beige'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-black', JText::_( 'Black'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-black-grad', JText::_( 'Black Gradient'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-blue-grad', JText::_( 'Blue Gradient'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-blue-bold', JText::_( 'Blue Bold'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-bluebubbles', JText::_( 'Blue Bubbles'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-brown-grad', JText::_( 'Brown Gradient'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-chocolate', JText::_( 'Chocolate'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-dark', JText::_( 'Dark'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-darkgrey-simple3d-button', JText::_( 'Dark Grey Simple3D Button'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-darkorange', JText::_( 'Dark Orange'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-darkseagreen', JText::_( 'Dark Sea Green'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-green-button', JText::_( 'Green Button'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-green-grad', JText::_( 'Green Gradient'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-green2-grad', JText::_( 'Green Gradient 2'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-greenyellow-simple3d-button', JText::_( 'GreenYellow Simple3D Button'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-gold-grad', JText::_( 'Gold Gradient'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-grey', JText::_( 'Grey'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-greytile', JText::_( 'Grey Tile'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-joomlablue', JText::_( 'Joomla Blue'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-lightgrey-simple3d-button', JText::_( 'Light Grey Simple3D Button'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-lightpurpleblue', JText::_( 'Light Purple Blue'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-metal1', JText::_( 'Metal 1'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-metal2', JText::_( 'Metal 2'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-midnight', JText::_( 'Midnight'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-mossgreen', JText::_( 'Moss Green'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-neon-bold', JText::_( 'Neon Bold'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-olive', JText::_( 'Olive'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-orange-pattern', JText::_( 'Orange Pattern'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-orange-simple3d-button', JText::_( 'Orange Simple3D Button'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-orchid-simple3d-button', JText::_( 'Orchid Simple3D Button'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-purple', JText::_( 'Purple'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-purple-button', JText::_( 'Purple Button'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-purple-grad', JText::_( 'Purple Gradient'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-purple-simple3d-button', JText::_( 'Purple Simple3D Button'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-red-bold', JText::_( 'Red Bold'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-red-pattern', JText::_( 'Red Pattern'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-red-simple3d-button', JText::_( 'Red Simple3D Button'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-silver', JText::_( 'Silver'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-silver-grad', JText::_( 'Silver Gradient'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-skyblue', JText::_( 'Sky Blue'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-slateblue', JText::_( 'Slate Blue'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-tealblue', JText::_( 'Teal Blue'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-thistle', JText::_( 'Thistle'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-transparent', JText::_( 'Transparent'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-transparent-dotted', JText::_( 'Transparent Dotted'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-turquoise-grad', JText::_( 'Turquoise Gradient'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-velvet', JText::_( 'Velvet'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-whitesmoke', JText::_( 'White Smoke'));
|
||
|
|
$mytypes[] = JHTML::_('select.option', 'sql2excel-'.$dlpreview.'-yellow-pattern', JText::_( 'Yellow Pattern'));
|
||
|
|
|
||
|
|
$typesOpt = JHTML::_( 'select.genericlist',
|
||
|
|
$mytypes,
|
||
|
|
$name,
|
||
|
|
'class="inputbox" size="1"',
|
||
|
|
'value',
|
||
|
|
'text',
|
||
|
|
$selected );
|
||
|
|
return $typesOpt;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to check if a workbook is checked out or not
|
||
|
|
*
|
||
|
|
* @access public
|
||
|
|
* @return boolean True if it is checked out
|
||
|
|
*/
|
||
|
|
function isCheckedOut( $uid=0 ) {
|
||
|
|
if ($this->_loadData()) {
|
||
|
|
if ($uid) {
|
||
|
|
return ($this->_wbData->checked_out && $this->_wbData->checked_out != $uid);
|
||
|
|
} else {
|
||
|
|
return $this->_wbData->checked_out;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to checkin a workbook
|
||
|
|
*
|
||
|
|
* @access public
|
||
|
|
* @return boolean True on success
|
||
|
|
*/
|
||
|
|
function checkin() {
|
||
|
|
if ($this->_wbID ) {
|
||
|
|
$cattable = & $this->getTable();
|
||
|
|
if(! $cattable->checkin($this->_wbID)) {
|
||
|
|
$this->setError('<p>Checkin failed!</p><p>' . $this->_db->getErrorMsg());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to checkout a workbook
|
||
|
|
*
|
||
|
|
* @access public
|
||
|
|
* @return boolean True on success
|
||
|
|
*/
|
||
|
|
function checkout($uid = null) {
|
||
|
|
if ($this->_wbID )
|
||
|
|
{
|
||
|
|
// Make sure we have a user id to checkout the article with
|
||
|
|
if (is_null($uid)) {
|
||
|
|
$user =& JFactory::getUser();
|
||
|
|
$uid = $user->get('id');
|
||
|
|
}
|
||
|
|
// Lets get to it and checkout the thing...
|
||
|
|
$cattable = & $this->getTable();
|
||
|
|
if(!$cattable->checkout($uid, $this->_wbID)) {
|
||
|
|
$this->setError('<p>Checkout failed!</p><p>' . $this->_db->getErrorMsg() );
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to move workbook up or down
|
||
|
|
*
|
||
|
|
* @access public
|
||
|
|
* @return boolean True on success
|
||
|
|
*/
|
||
|
|
function move($direction) {
|
||
|
|
$row =& $this->getTable();
|
||
|
|
if (!$row->load($this->_wbID)) {
|
||
|
|
$this->setError($this->_db->getErrorMsg());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
if (!$row->move( $direction, ' published >= 0 ' )) {
|
||
|
|
$this->setError($this->_db->getErrorMsg());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to copy workbook(s)
|
||
|
|
*
|
||
|
|
* @access public
|
||
|
|
* @return boolean True on success
|
||
|
|
*/
|
||
|
|
function copy($cid = array())
|
||
|
|
{
|
||
|
|
if (count( $cid ))
|
||
|
|
{
|
||
|
|
$db = & JFactory::getDBO();
|
||
|
|
JArrayHelper::toInteger($cid);
|
||
|
|
foreach ( $cid as $wbID ) {
|
||
|
|
$query = 'INSERT INTO #__sql2excel_workbooks '
|
||
|
|
. '(`title`,`link_title`,`filename`,`section`,`category`,`created`,`access`,`ordering`,`parms`, `parms_prompt`, `description`,`keywords`, `cache` ) '
|
||
|
|
. 'SELECT CONCAT(title,\' - ' . JText::_( 'Copy') . '\') as `title`,`link_title`,`filename`,`section`,`category`, now() as `created`, `access`,`ordering`,`parms`, `parms_prompt`,`description`,`keywords`, `cache` '
|
||
|
|
. 'FROM #__sql2excel_workbooks '
|
||
|
|
. 'WHERE ID=' . $wbID;
|
||
|
|
$db->setQuery( $query );
|
||
|
|
if (!$db->query()) {
|
||
|
|
$this->setError($db->getErrorMsg());
|
||
|
|
return false;
|
||
|
|
} else {
|
||
|
|
$newid = $db->insertid();
|
||
|
|
$query = 'INSERT INTO #__sql2excel_worksheet2book '
|
||
|
|
. '(`wb_id`,`ws_id`,`ordering`) '
|
||
|
|
. 'SELECT \'' . $newid . '\' as `wb_id`,`ws_id`,`ordering` '
|
||
|
|
. 'FROM #__sql2excel_worksheet2book '
|
||
|
|
. 'WHERE wb_id=' . $wbID;
|
||
|
|
$db->setQuery( $query );
|
||
|
|
if (!$db->query()) {
|
||
|
|
$this->setError($db->getErrorMsg());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return $newid;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to publish workbook(s)
|
||
|
|
*
|
||
|
|
* @access public
|
||
|
|
* @return boolean True on success
|
||
|
|
*/
|
||
|
|
function publish($cid = array(), $publish = 1)
|
||
|
|
{
|
||
|
|
$user =& JFactory::getUser();
|
||
|
|
|
||
|
|
if (count( $cid ))
|
||
|
|
{
|
||
|
|
JArrayHelper::toInteger($cid);
|
||
|
|
$cids = implode( ',', $cid );
|
||
|
|
|
||
|
|
$query = 'UPDATE #__sql2excel_workbooks'
|
||
|
|
. ' SET published = '. (int) $publish
|
||
|
|
. ' WHERE id IN ( '.$cids.' )';
|
||
|
|
$this->_db->setQuery( $query );
|
||
|
|
if (!$this->_db->query()) {
|
||
|
|
$this->setError($this->_db->getErrorMsg());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to reorder the categories
|
||
|
|
*
|
||
|
|
* @access public
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
function saveorder($cid = array(), $order) {
|
||
|
|
$row =& $this->getTable();
|
||
|
|
$total = count( $cid );
|
||
|
|
|
||
|
|
// update ordering values
|
||
|
|
for( $i=0; $i < $total; $i++ )
|
||
|
|
{
|
||
|
|
$row->load( (int) $cid[$i] );
|
||
|
|
if ($row->ordering != $order[$i]) {
|
||
|
|
$row->ordering = $order[$i];
|
||
|
|
if (!$row->store()) {
|
||
|
|
JError::raiseError(500, $db->getErrorMsg() );
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
$row->reorder( );
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to store a record
|
||
|
|
*
|
||
|
|
* @access public
|
||
|
|
* @return boolean True on success
|
||
|
|
*/
|
||
|
|
function store($data)
|
||
|
|
{
|
||
|
|
|
||
|
|
$db = & JFactory::getDBO();
|
||
|
|
$keys = array_keys($data);
|
||
|
|
foreach ($keys as $key) {
|
||
|
|
if ( $key != 'task' && $key != 'controller' && $key != 'option' && strlen($key) < 30 ) {
|
||
|
|
$query = 'UPDATE #__sql2excel_settings SET `value`=' . $db->Quote($data[$key]) . ' WHERE `param`=' . $db->Quote( $key);
|
||
|
|
$db->setQuery($query);
|
||
|
|
$db->query();
|
||
|
|
echo $query;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to update item access
|
||
|
|
*
|
||
|
|
* @access public
|
||
|
|
* @return boolean True on success
|
||
|
|
*/
|
||
|
|
function accessmenu($id, $access)
|
||
|
|
{
|
||
|
|
global $mainframe;
|
||
|
|
$row =& $this->getTable();
|
||
|
|
$row->load($id);
|
||
|
|
$row->id = $id;
|
||
|
|
$row->access = $access;
|
||
|
|
if ( !$row->check() ) {
|
||
|
|
$this->setError($this->_db->getErrorMsg());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
if ( !$row->store() ) {
|
||
|
|
$this->setError($this->_db->getErrorMsg());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to delete record(s)
|
||
|
|
*
|
||
|
|
* @access public
|
||
|
|
* @return boolean True on success
|
||
|
|
*/
|
||
|
|
function delete()
|
||
|
|
{
|
||
|
|
$cids = JRequest::getVar( 'cid', array(0), 'post', 'array' );
|
||
|
|
|
||
|
|
$row =& $this->getTable();
|
||
|
|
|
||
|
|
if (count( $cids )) {
|
||
|
|
foreach($cids as $cid) {
|
||
|
|
if (!$row->delete( $cid )) {
|
||
|
|
$this->setError( $row->getErrorMsg() );
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to retrieve current workbook record
|
||
|
|
*
|
||
|
|
* @access Private
|
||
|
|
* @return boolean True on success
|
||
|
|
*/
|
||
|
|
function _getData() {
|
||
|
|
if (empty($this->_wbData)) {
|
||
|
|
$query = 'SELECT p.* '.
|
||
|
|
' FROM #__sql2excel_workbooks' .
|
||
|
|
' WHERE id = ' . (int) $this->_wbID;
|
||
|
|
$this->_db->setQuery($query);
|
||
|
|
$this->_wbData = $this->_db->loadObject();
|
||
|
|
return (boolean) $this->_wbData;
|
||
|
|
}
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Method to export Settings to XML
|
||
|
|
*
|
||
|
|
* @access public
|
||
|
|
* @return XML filename if success, false otherwise
|
||
|
|
*/
|
||
|
|
function exportXML()
|
||
|
|
{
|
||
|
|
$config =& JFactory::getConfig();
|
||
|
|
$tmpPath = $config->getValue( 'config.tmp_path' );
|
||
|
|
$xmlFN = $tmpPath . DS. 'sql2excel.xml';
|
||
|
|
$file= fopen($xmlFN, "w");
|
||
|
|
|
||
|
|
if ( $file ) {
|
||
|
|
$sql2excelVer = Sql2excelControlPanel::getVersion('?');
|
||
|
|
$_xml ="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
|
||
|
|
$_xml .="<settings>\r\n";
|
||
|
|
$_xml .="\t<component>SQL 2 Excel Pro</component>\r\n";
|
||
|
|
$_xml .="\t<version>" . $sql2excelVer . "</version>\r\n";
|
||
|
|
$query = 'SELECT * FROM #__sql2excel_settings';
|
||
|
|
$this->_db->setQuery( $query );
|
||
|
|
$settings = $this->_db->loadObjectList();
|
||
|
|
foreach ( $settings as $setting) {
|
||
|
|
$value = str_replace( "\r\n", "@~@", $setting->value );
|
||
|
|
$value = str_replace("\n", "@~@", $value);
|
||
|
|
if ( $value == 'Array' ) { $value = ''; }
|
||
|
|
$_xml .="\t<" . $setting->param . "><![CDATA[" . $value . "]]></" . $setting->param . ">\r\n";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
$_xml .="</settings>\r\n";
|
||
|
|
fwrite($file, $_xml);
|
||
|
|
fclose($file);
|
||
|
|
|
||
|
|
// Feed XML file to browser
|
||
|
|
header ("Content-type: octet/stream");
|
||
|
|
header ("Content-disposition: attachment; filename=sql2excelsettings.xml");
|
||
|
|
header ("Content-Length: ".filesize($xmlFN));
|
||
|
|
readfile($xmlFN);
|
||
|
|
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|