git-svn-id: https://192.168.0.254/svn/Proyectos.FundacionLQDVI_WebCongresos/trunk@2 94ccb1af-fd9d-d947-8d90-7f70ea60afc8
117 lines
3.2 KiB
PHP
117 lines
3.2 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.view' );
|
|
|
|
require_once( JPATH_COMPONENT.DS.'helpers'.DS.'parms.php' );
|
|
|
|
class Sql2excelViewPre extends JView
|
|
{
|
|
|
|
function display($tpl = null)
|
|
{
|
|
// Workbook ID
|
|
$wb_id = JRequest::getVar( 'id', 0, 'get', 'int' );
|
|
|
|
JHTML::stylesheet( 'preview.css', 'components/com_sql2excel/assets/css/' );
|
|
|
|
$document = &JFactory::getDocument();
|
|
$document->addScript('components/com_sql2excel/assets/js/preview.js');
|
|
|
|
if ( (int) $wb_id > 0 ) {
|
|
global $mainframe;
|
|
$cmpParms = Sql2excelParms::getParms();
|
|
|
|
//$previewdlbutton = $cmpParms->get('previewdlbutton',1);
|
|
$previewdlbutton = Sql2excelParms::get($cmpParms,'previewdlbutton', 1);
|
|
|
|
$model =& $this->getModel();
|
|
$ws = $model->getWorksheets((int) $wb_id);
|
|
|
|
|
|
if ( count($ws) >= 1 ) {
|
|
|
|
// WB Preview DL Button Setting
|
|
$wbDLbtn = $ws[0]->preview_dl_btn;
|
|
if ( $wbDLbtn == 'Show' || ( $wbDLbtn == 'Global' && $previewdlbutton ) ) {
|
|
$dlButton = 1;
|
|
} else {
|
|
$dlButton = 0;
|
|
}
|
|
|
|
// Add AJAX Javascript for tabs
|
|
$document =& JFactory::getDocument();
|
|
$document->addScript('components/com_sql2excel/assets/js/cba2.js');
|
|
|
|
$this->assignRef('worksheets',$ws);
|
|
$wbTitle = $ws[0]->wbtitle;
|
|
$this->assignRef('wbtitle',$wbTitle);
|
|
|
|
$this->assignRef('wb_id',$wb_id);
|
|
|
|
|
|
// User Parameters
|
|
$wbParmsHTML = '';
|
|
$wbHiddenParms = '';
|
|
$wbParmVars = '';
|
|
$wbParmVarsAdd = '';
|
|
$nrWbParms = 0;
|
|
$wbRefresh = '';
|
|
$wbValidate = '';
|
|
$wbParms = $model->getWorkbookParms($wb_id);
|
|
if ( is_array($wbParms) ) {
|
|
$wbParmsHTML = $wbParms[0];
|
|
$wbParmVars = $wbParms[1];
|
|
$wbParmVarsAdd = $wbParms[2];
|
|
$wbHiddenParms = $wbParms[3];
|
|
$nrWbParms = $wbParms[4];
|
|
$wbRefresh = $wbParms[5];
|
|
$wbValidate = $wbParms[6];
|
|
$wbMultiTicks = $wbParms[7];
|
|
}
|
|
|
|
$dlformat =1;
|
|
$downloadlabel = JText::_( 'Download Spreadsheet');
|
|
if ( isset($ws[0]->dlformat) ) {
|
|
$dlformat = $ws[0]->dlformat;
|
|
}
|
|
if ( $dlformat == 3 || ( $dlformat == 1 && Sql2excelParms::get($cmpParms,'dlformat', '2') == 3 ) ) {
|
|
$downloadlabel = JText::_( 'Download CSV');
|
|
}
|
|
elseif ( $dlformat == 4 || ( $dlformat == 1 && Sql2excelParms::get($cmpParms,'dlformat', '2') == 4 ) ) {
|
|
$downloadlabel = JText::_( 'View');
|
|
|
|
}
|
|
|
|
$this->assignRef('wbParmsHTML',$wbParmsHTML);
|
|
$this->assignRef('wbHiddenParms',$wbHiddenParms);
|
|
$this->assignRef('wbParmVars',$wbParmVars);
|
|
$this->assignRef('wbParmVarsAdd',$wbParmVarsAdd);
|
|
$this->assignRef('nrWbParms',$nrWbParms);
|
|
$this->assignRef('wbRefresh',$wbRefresh);
|
|
$this->assignRef('wbValidate',$wbValidate);
|
|
$this->assignRef('wbMultiTicks',$wbMultiTicks);
|
|
$this->assignRef('downloadlabel',$downloadlabel);
|
|
$this->assignRef('show_dl_button',$dlButton);
|
|
|
|
} else {
|
|
JError::raiseError( 500, JText::_( 'No data' ) );
|
|
}
|
|
} else {
|
|
JError::raiseError( 500, JText::_( 'Invalid Workbook ID' ) );
|
|
}
|
|
|
|
|
|
|
|
|
|
parent::display($tpl);
|
|
}
|
|
}
|