<?php
/**
* @package HikaShop for Joomla!
* @version 1.4.3
* @author hikashop.com
* @copyright (C) 2010 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?>
<?php
class ImportViewImport extends JView{
var $ctrl= 'import';
var $icon = 'generic';
function display($tpl = null){
$this->paramBase = HIKASHOP_COMPONENT.'.'.$this->getName();
$function = $this->getLayout();
if(method_exists($this,$function)) $this->$function();
parent::display($tpl);
}
function show(){
$app =& JFactory::getApplication();
$pageInfo = null;
$config =& hikashop::config();
hikashop::setTitle(JText::_('IMPORT'),$this->icon,$this->ctrl.'&task=show');
$bar = & JToolBar::getInstance('toolbar');
JToolBarHelper::custom('import', 'upload', '',JText::_('IMPORT'), false);
JToolBarHelper::divider();
$bar->appendButton( 'Pophelp',$this->ctrl);
$bar->appendButton( 'Link', 'hikashop', JText::_('HIKASHOP_CPANEL'), hikashop::completeLink('dashboard') );
$importData = array();
$import = null;
$import->text = JText::_('PRODUCTS_FROM_CSV');
$import->key = 'file';
$importData[] = $import;
$textArea = null;
$textArea->text = JText::_('PRODUCTS_FROM_TEXTAREA');
$textArea->key = 'textarea';
$importData[] = $textArea;
if(hikashop::level(2)){
$folder = null;
$folder->text = JText::_('PRODUCTS_FROM_FOLDER');
$folder->key = 'folder';
$importData[] = $folder;
}
JPluginHelper::importPlugin( 'hikashop' );
$dispatcher =& JDispatcher::getInstance();
$dispatcher->trigger( 'onDisplayImport', array( & $importData) );
$this->assignRef('importData',$importData);
$importValues = array();
foreach($importData as $data){
if(!empty($data->key)){
$importValues[] = JHTML::_('select.option', $data->key,$data->text);
}
}
$this->assignRef('importValues',$importValues);
$importFolders = array(JHTML::_('select.option', 'images',JText::_('HIKA_IMAGES')),JHTML::_('select.option', 'files',JText::_('HIKA_FILES')));
$this->assignRef('importFolders',$importFolders);
$js = '
var currentoption = \'file\';
function updateImport(newoption){
document.getElementById(currentoption).style.display = "none";
document.getElementById(newoption).style.display = \'block\';
currentoption = newoption;
}
var currentoptionFolder = \'images\';
function updateImportFolder(newoption){
document.getElementById(currentoptionFolder).style.display = "none";
document.getElementById(newoption).style.display = \'block\';
currentoptionFolder = newoption;
}';
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration( $js );
JHTML::_('behavior.modal');
}
}