Component-Builder/admin/compiler/joomla_3/JViewLegacy_import.php

99 lines
2.8 KiB
PHP
Raw Normal View History

2016-01-30 20:28:43 +00:00
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
2016-01-30 20:28:43 +00:00
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
###BOM###
// No direct access to this file
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED###
/**
* ###Component### Import View
*/
class ###Component###ViewImport extends JViewLegacy
{
protected $headerList;
protected $hasPackage = false;
protected $headers;
protected $hasHeader = 0;
protected $dataType;
public function display($tpl = null)
{
2016-01-30 20:28:43 +00:00
if ($this->getLayout() !== 'modal')
{
// Include helper submenu
###Component###Helper::addSubmenu('import');
}
$paths = new stdClass;
$paths->first = '';
$state = $this->get('state');
$this->paths = &$paths;
$this->state = &$state;
// get global action permissions
$this->canDo = ###Component###Helper::getActions('import');
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
}
// get the session object
$session = JFactory::getSession();
// 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 = ###Component###Helper::getFileHeaders($this->dataType);
// clear the data type
$session->clear('dataType');
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
2016-01-30 20:28:43 +00:00
// Display the template
parent::display($tpl);
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_###COMPONENT###_IMPORT_TITLE'), 'upload');
JHtmlSidebar::setAction('index.php?option=com_###component###&view=import');
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_###component###');
}
// set help url for this view if found
$help_url = ###Component###Helper::getHelpUrl('import');
if (###Component###Helper::checkString($help_url))
{
JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url);
}
2016-01-30 20:28:43 +00:00
}
}