2015-08-24 20:22:07 +00:00
|
|
|
<?php
|
|
|
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
|
|
|
Vast Development Method
|
|
|
|
/-------------------------------------------------------------------------------------------------------/
|
|
|
|
|
2015-12-29 19:39:38 +00:00
|
|
|
@version 1.0.5
|
2016-03-05 22:57:11 +00:00
|
|
|
@build 5th March, 2016
|
2015-12-03 02:17:44 +00:00
|
|
|
@created 5th August, 2015
|
2015-08-24 20:22:07 +00:00
|
|
|
@package Demo
|
|
|
|
@subpackage view.html.php
|
|
|
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
|
|
|
@copyright Copyright (C) 2015. All Rights Reserved
|
|
|
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
|
|
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
|
|
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
|
|
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
|
|
|
|
|
|
|
/------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
|
|
|
// import Joomla view library
|
|
|
|
jimport('joomla.application.component.view');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Demo Import View
|
|
|
|
*/
|
|
|
|
class DemoViewImport extends JViewLegacy
|
2015-12-03 02:17:44 +00:00
|
|
|
{
|
2015-08-24 20:22:07 +00:00
|
|
|
protected $headerList;
|
|
|
|
protected $hasPackage = false;
|
|
|
|
protected $headers;
|
|
|
|
protected $hasHeader = 0;
|
|
|
|
protected $dataType;
|
2015-12-03 02:17:44 +00:00
|
|
|
|
2015-08-24 20:22:07 +00:00
|
|
|
public function display($tpl = null)
|
|
|
|
{
|
|
|
|
if ($this->getLayout() !== 'modal')
|
|
|
|
{
|
|
|
|
// Include helper submenu
|
|
|
|
DemoHelper::addSubmenu('import');
|
|
|
|
}
|
2015-12-03 02:17:44 +00:00
|
|
|
|
2015-08-24 20:22:07 +00:00
|
|
|
// Check for errors.
|
|
|
|
if (count($errors = $this->get('Errors'))){
|
|
|
|
JError::raiseError(500, implode('<br />', $errors));
|
|
|
|
return false;
|
2015-12-03 02:17:44 +00:00
|
|
|
}
|
|
|
|
|
2015-08-24 20:22:07 +00:00
|
|
|
$paths = new stdClass;
|
|
|
|
$paths->first = '';
|
|
|
|
$state = $this->get('state');
|
|
|
|
|
|
|
|
$this->paths = &$paths;
|
|
|
|
$this->state = &$state;
|
2015-12-03 02:17:44 +00:00
|
|
|
// get global action permissions
|
2015-08-24 20:22:07 +00:00
|
|
|
$this->canDo = DemoHelper::getActions('import');
|
2015-12-03 02:17:44 +00:00
|
|
|
|
2015-08-24 20:22:07 +00:00
|
|
|
// We don't need toolbar in the modal window.
|
|
|
|
if ($this->getLayout() !== 'modal')
|
|
|
|
{
|
|
|
|
$this->addToolbar();
|
|
|
|
$this->sidebar = JHtmlSidebar::render();
|
|
|
|
}
|
2015-12-03 02:17:44 +00:00
|
|
|
|
2015-08-24 20:22:07 +00:00
|
|
|
// get the session object
|
2015-12-03 02:17:44 +00:00
|
|
|
$session = JFactory::getSession();
|
2015-08-24 20:22:07 +00:00
|
|
|
// check if it has package
|
|
|
|
$this->hasPackage = $session->get('hasPackage', false);
|
|
|
|
$this->dataType = $session->get('dataType', false);
|
|
|
|
if($this->hasPackage && $this->dataType)
|
|
|
|
{
|
|
|
|
$this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true);
|
|
|
|
$this->headers = DemoHelper::getFileHeaders($this->dataType);
|
|
|
|
// clear the data type
|
|
|
|
$session->clear('dataType');
|
|
|
|
}
|
2015-12-03 02:17:44 +00:00
|
|
|
|
2015-08-24 20:22:07 +00:00
|
|
|
// Display the template
|
|
|
|
parent::display($tpl);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setting the toolbar
|
|
|
|
*/
|
2015-12-03 02:17:44 +00:00
|
|
|
protected function addToolBar()
|
|
|
|
{
|
2015-08-24 20:22:07 +00:00
|
|
|
JToolBarHelper::title(JText::_('COM_DEMO_IMPORT_TITLE'), 'upload');
|
|
|
|
JHtmlSidebar::setAction('index.php?option=com_demo&view=import');
|
2015-12-03 02:17:44 +00:00
|
|
|
|
2015-08-24 20:22:07 +00:00
|
|
|
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
|
|
|
{
|
|
|
|
JToolBarHelper::preferences('com_demo');
|
|
|
|
}
|
|
|
|
|
|
|
|
// set help url for this view if found
|
2015-12-03 02:17:44 +00:00
|
|
|
$help_url = DemoHelper::getHelpUrl('import');
|
|
|
|
if (DemoHelper::checkString($help_url))
|
|
|
|
{
|
|
|
|
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
|
|
|
|
}
|
2015-08-24 20:22:07 +00:00
|
|
|
}
|
|
|
|
}
|