Ejemplo n.º 1
0
    public function displayMultiple($map, $values)
    {
        if (empty($this->values)) {
            $this->load();
        }
        if (empty($values)) {
            $values = array();
        } else {
            if (is_string($values)) {
                $values = explode(',', $values);
            }
        }
        $config = hikashop_config();
        hikashop_loadJslib('otree');
        if (substr($map, -2) == '[]') {
            $map = substr($map, 0, -2);
        }
        $id = str_replace(array('[', ']'), array('_', ''), $map);
        $ret = '<div class="nameboxes" id="' . $id . '" onclick="window.oNameboxes[\'' . $id . '\'].focus(\'' . $id . '_text\');">';
        if (!empty($values)) {
            foreach ($values as $key) {
                if (isset($this->values[$key])) {
                    $name = $this->values[$key]->text;
                } else {
                    $name = JText::sprintf('UNKNOWN_PACK_X', $key);
                }
                $ret .= '<div class="namebox" id="' . $id . '_' . $key . '">' . '<input type="hidden" name="' . $map . '[]" value="' . $key . '"/>' . $name . ' <a class="closebutton" href="#" onclick="window.oNameboxes[\'' . $id . '\'].unset(this,\'' . $key . '\');window.oNamebox.cancelEvent();return false;"><span>X</span></a>' . '</div>';
            }
        }
        $ret .= '<div class="namebox" style="display:none;" id="' . $id . 'tpl">' . '<input type="hidden" name="{map}" value="{key}"/>{name}' . ' <a class="closebutton" href="#" onclick="window.oNameboxes[\'' . $id . '\'].unset(this,\'{key}\');window.oNamebox.cancelEvent();return false;"><span>X</span></a>' . '</div>';
        $ret .= '<div class="nametext">' . '<input id="' . $id . '_text" type="text" style="width:50px;min-width:60px" onfocus="window.oNameboxes[\'' . $id . '\'].focus(this);" onkeyup="window.oNameboxes[\'' . $id . '\'].search(this);" onchange="window.oNameboxes[\'' . $id . '\'].search(this);"/>' . '<span style="position:absolute;top:0px;left:-2000px;visibility:hidden" id="' . $id . '_span">span</span>' . '</div>';
        $data = array();
        foreach ($this->values as $key => $value) {
            if (empty($key)) {
                continue;
            }
            $data[$key] = $value->text;
        }
        $namebox_options = array('mode' => 'list', 'img_dir' => HIKASHOP_IMAGES, 'map' => $map, 'min' => $config->get('namebox_search_min_length', 3), 'multiple' => true);
        $ret .= '<div style="clear:both;float:none;"></div></div>
<div class="namebox-popup">
	<div id="' . $id . '_olist" style="display:none;" class="oList namebox-popup-content"></div>
</div>
<script type="text/javascript">
new window.oNamebox(
	\'' . $id . '\',
	' . json_encode($data) . ',
	' . json_encode($namebox_options) . '
);';
        if (!empty($values)) {
            $ret .= '
try{
	window.oNameboxes[\'' . $id . '\'].content.block(' . json_encode($values) . ');
}catch(e){}';
        }
        $ret .= '
</script>';
        return $ret;
    }
Ejemplo n.º 2
0
 protected function initialize()
 {
     if (self::$init === true) {
         return;
     }
     hikashop_loadJslib('opload');
     hikashop_loadJslib('jquery');
     self::$init = true;
 }
Ejemplo n.º 3
0
 public function galleryimage()
 {
     hikashop_loadJslib('otree');
     $app = JFactory::getApplication();
     $config = hikashop_config();
     $this->assignRef('config', $config);
     $this->paramBase = HIKASHOP_COMPONENT . '.' . $this->getName() . '.gallery';
     $uploadConfig = JRequest::getVar('uploadConfig', null);
     if (empty($uploadConfig) || !is_array($uploadConfig)) {
         return false;
     }
     $this->assignRef('uploadConfig', $uploadConfig);
     $uploader = JRequest::getCmd('uploader', '');
     $this->assignRef('uploader', $uploader);
     $field = JRequest::getCmd('field', '');
     $this->assignRef('field', $field);
     $uploadFolder = ltrim(JPath::clean(html_entity_decode($config->get('uploadfolder'))), DS);
     $uploadFolder = rtrim($uploadFolder, DS) . DS;
     $basePath = JPATH_ROOT . DS . $uploadFolder . DS;
     $pageInfo = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', 20, 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int');
     $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . '.search', 'search', '', 'string');
     $this->assignRef('pageInfo', $pageInfo);
     jimport('joomla.filesystem.folder');
     if (!JFolder::exists($basePath)) {
         JFolder::create($basePath);
     }
     $galleryHelper = hikashop_get('helper.gallery');
     $galleryHelper->setRoot($basePath);
     $this->assignRef('galleryHelper', $galleryHelper);
     $folder = str_replace('|', '/', JRequest::getString('folder', ''));
     $destFolder = rtrim($folder, '/\\');
     if (!$galleryHelper->validatePath($destFolder)) {
         $destFolder = '';
     }
     if (!empty($destFolder)) {
         $destFolder .= '/';
     }
     $this->assignRef('destFolder', $destFolder);
     $galleryOptions = array('filter' => '.*' . str_replace(array('.', '?', '*', '$', '^'), array('\\.', '\\?', '\\*', '$', '\\^'), $pageInfo->search) . '.*', 'offset' => $pageInfo->limit->start, 'length' => $pageInfo->limit->value);
     $this->assignRef('galleryOptions', $galleryOptions);
     $treeContent = $galleryHelper->getTreeList(null, $destFolder);
     $this->assignRef('treeContent', $treeContent);
     $dirContent = $galleryHelper->getDirContent($destFolder, $galleryOptions);
     $this->assignRef('dirContent', $dirContent);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($galleryHelper->filecount, $pageInfo->limit->start, $pageInfo->limit->value);
     $this->assignRef('pagination', $pagination);
 }
Ejemplo n.º 4
0
 function wizard()
 {
     $db = JFactory::getDBO();
     hikashop_setTitle(JText::_('HIKA_WIZARD'), 'config', 'update&task=wizard');
     if (!HIKASHOP_PHP5) {
         $bar =& JToolBar::getInstance('toolbar');
     } else {
         $bar = JToolBar::getInstance('toolbar');
     }
     $bar->appendButton('Link', 'hikashop', JText::_('HIKA_SKIP'), hikashop_completeLink('update&task=post_install&fromversion=&update=0'));
     $languagesCodes = array();
     $languagesNames = array();
     if (HIKASHOP_J25) {
         $db->setQuery('SELECT * FROM ' . hikashop_table('languages', false) . ' WHERE `published` = 1');
         $languages = $db->loadObjectList();
         foreach ($languages as $language) {
             $path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $language->lang_code . DS . $language->lang_code . '.com_hikashop.ini';
             if (!JFile::exists($path)) {
                 $languagesCodes[] = $language->lang_code;
                 $languagesNames[] = $language->title;
             }
         }
     }
     if (!empty($languagesCodes)) {
         $languageCodes = implode('_', $languagesCodes);
     }
     if (!empty($languagesNames)) {
         $languagesNames = implode(', ', $languagesNames);
     }
     $this->assignRef('languageCodes', $languageCodes);
     $this->assignRef('languageNames', $languagesNames);
     $fieldsClass = hikashop_get('class.field');
     $this->assignRef('fieldsClass', $fieldsClass);
     static $Itemid;
     if (isset($Itemid) && !empty($Itemid)) {
         $url_itemid = '&item_id=' . $Itemid;
     } else {
         $url_itemid = '';
     }
     $address = new stdClass();
     $extraFields = array();
     $extraFields['address'] = $fieldsClass->getFields('frontcomp', $address, 'address', 'update&task=state' . $url_itemid);
     $this->assignRef('extraFields', $extraFields);
     $this->assignRef('address', $address);
     $db->setQuery('SELECT * FROM ' . hikashop_table('currency') . ' WHERE 1 ORDER BY `currency_code`');
     $currencies = $db->loadObjectList();
     $this->assignRef('currencies', $currencies);
     hikashop_loadJslib('jquery');
     $app = JFactory::getApplication();
     $app->enqueueMessage(JText::_('WELCOME_WIZARD', 'success'));
 }
Ejemplo n.º 5
0
    function display($filter, $divName, &$parent, $datas = '')
    {
        $selected = parent::display($filter, $divName, $parent);
        if (!empty($selected) && !empty($selected[0])) {
            $values = parent::display($filter, $divName, $parent, '_values');
            if (!is_array($values)) {
                $values = explode(' - ', $values);
            }
            if ($filter->filter_deletable && $values[0] != 'none' && (isset($values[0]) && !in_array($selected[0], array(" ", '')))) {
                $html = parent::displayInList($filter, $divName, $values);
                return $html;
            }
        }
        $cursorStep = '';
        $html = '';
        $cursorMin = 0;
        $cursorMax = 1000;
        $cursorEffect = '';
        $cursorWidth = 'width:250px;';
        $float = '';
        $deleteButton = '';
        if (!empty($datas) && $filter->filter_dynamic) {
            $nameMax = 'max_' . $filter->filter_namekey;
            $nameMin = 'min_' . $filter->filter_namekey;
            $array = $datas['limits'];
            if (!empty($array->{$nameMax})) {
                $cursorMax = (double) $array->{$nameMax};
            } else {
                $cursorMax = 1000;
            }
            if (!empty($array->{$nameMin})) {
                $cursorMin = (double) $array->{$nameMin};
            } else {
                $cursorMin = 0;
            }
        }
        if ($cursorMin == 0 && $filter->filter_options['cursor_min'] != 'none' && isset($filter->filter_options['cursor_min']) && !in_array($filter->filter_options['cursor_min'], array(" ", ''))) {
            $cursorMin = $filter->filter_options['cursor_min'];
        }
        if ($cursorMax == 1000 && !empty($filter->filter_options['cursor_max'])) {
            $cursorMax = $filter->filter_options['cursor_max'];
        }
        $minVal = $cursorMin;
        $maxVal = $cursorMax;
        if (!empty($filter->filter_options['cursor_effect'])) {
            $cursorEffect = 'animate: true,';
        }
        if (!empty($filter->filter_options['cursor_width'])) {
            $cursorWidth = 'width:' . $filter->filter_options['cursor_width'] . 'px;';
        }
        if (!empty($filter->filter_options['cursor_step'])) {
            $cursorStep = 'step:' . $filter->filter_options['cursor_step'] . ',';
        }
        if (isset($values)) {
            if (is_array($values) && count($values) != 2) {
                $data =& $values[0];
            } else {
                $data =& $values;
            }
            if (isset($data) && (is_array($data) || !in_array($data, array(" ", '')))) {
                if (!is_array($data)) {
                    $data = explode(' - ', $data);
                }
                $minVal = (double) @$data[0];
                $maxVal = (double) @$data[1];
            }
        }
        if ($minVal > $maxVal) {
            $tmp = $maxVal;
            $maxVal = $minVal;
            $minVal = $tmp;
        }
        if ($cursorMin > $cursorMax) {
            $tmp = $cursorMax;
            $cursorMax = $cursorMin;
            $cursorMin = $tmp;
        }
        $onClick = '';
        if ($filter->filter_direct_application) {
            $onClick = 'document.getElementById(\'slider_' . $filter->filter_namekey . '_' . $divName . '\').value="";document.forms[\'hikashop_filter_form_' . $divName . '\'].submit();';
        }
        $currency = '';
        if ($filter->filter_data == 'price') {
            $currencyClass = hikashop_get('class.currency');
            $currencies = null;
            $crurency_id = hikashop_getCurrency();
            $currencies = $currencyClass->getCurrencies($crurency_id, $currencies);
            $format = $currencies[$crurency_id]->currency_format;
            if (strpos($format, '%n') !== false) {
                $currency .= ' ' . $currencies[$crurency_id]->currency_symbol;
            }
            if (strpos($format, '%i') !== false) {
                $currency .= ' ' . $currencies[$crurency_id]->currency_code;
            }
        }
        $js = '
if(!hkjQuery) window.hkjQuery = window.jQuery;
hkjQuery(document).ready(function(){
	hkjQuery("#slider_' . $filter->filter_namekey . '_' . $divName . '").prop(\'slide\',null).slider({
		' . $cursorEffect . '
		range: true,
		min: ' . $cursorMin . ',
		max: ' . $cursorMax . ',
		' . $cursorStep . '
		values: [' . $minVal . ', ' . $maxVal . '],
		slide: function( event, ui ) {
			hkjQuery( "#filter_' . $filter->filter_namekey . '_' . $divName . '_values" ).val(  ui.values[ 0 ] + " - " + ui.values[ 1 ] );
			hkjQuery( "#filter_' . $filter->filter_namekey . '_' . $divName . '" ).val(1);
			hkjQuery( "#filter_span_' . $filter->filter_namekey . '_' . $divName . '" ).html(  ui.values[ 0 ] + "' . $currency . ' - " + ui.values[ 1 ] + "' . $currency . '" );
		},
		change: function( event, ui ) {' . $onClick . '
		}
	});
	hkjQuery( "#filter_' . $filter->filter_namekey . '_' . $divName . '_values" ).val(  hkjQuery( "#slider_' . $filter->filter_namekey . '_' . $divName . '" ).slider( "values", 0 ) + " - " + hkjQuery( "#slider_' . $filter->filter_namekey . '_' . $divName . '" ).slider( "values", 1 ) );
	hkjQuery( "#filter_span_' . $filter->filter_namekey . '_' . $divName . '" ).html(  hkjQuery( "#slider_' . $filter->filter_namekey . '_' . $divName . '" ).slider( "values", 0 ) + "' . $currency . ' - " + hkjQuery( "#slider_' . $filter->filter_namekey . '_' . $divName . '" ).slider( "values", 1 ) + "' . $currency . '" );

	hkjQuery(\'#dialog_link, ul#icons li\').hover(
		function() { hkjQuery(this).addClass(\'ui-state-hover\'); },
		function() { hkjQuery(this).removeClass(\'ui-state-hover\'); }
	);
});';
        if (HIKASHOP_PHP5) {
            $doc = JFactory::getDocument();
        } else {
            $doc =& JFactory::getDocument();
        }
        $doc->addScriptDeclaration("\n<!--\n" . $js . "\n//-->\n");
        hikashop_loadJslib('jquery');
        hikashop_loadJslib('jquery-ui');
        $hasValue = '';
        if (!empty($selected) && $selected[0] == 1 && $values[0] != 'none' && (isset($data) && !in_array($data, array(" ", '')))) {
            $deleteButton = '  ' . parent::getDeleteButton($filter, $divName, '11', $html, '', true);
            $hasValue = '1';
        }
        if ($filter->filter_options['title_position'] == 'left') {
            $float = 'float:left;';
        }
        $html = '<div style="' . $cursorWidth . ' ' . $float . ' margin-top:10px; margin-bottom:10px;" id="slider_' . $filter->filter_namekey . '_' . $divName . '"></div>';
        $html = $this->cursorTitlePosition($filter, $html, $cursorWidth, $divName, $deleteButton, $hasValue);
        return $html;
    }
Ejemplo n.º 6
0
    function form()
    {
        $app = JFactory::getApplication();
        $doc = JFactory::getDocument();
        $fieldid = hikashop_getCID('field_id');
        $fieldsClass = hikashop_get('class.field');
        if (!empty($fieldid)) {
            $field = $fieldsClass->getField($fieldid);
            $data = null;
            $allFields = $fieldsClass->getFields('', $data, $field->field_table);
        } else {
            $field = new stdClass();
            if (hikashop_level(1)) {
                $field->field_table = $app->getUserStateFromRequest($this->paramBase . ".filter_table", 'filter_table', 'product', 'string');
            } else {
                $field->field_table = 'address';
            }
            $field->field_published = 1;
            $field->field_type = 'text';
            $field->field_backend = 1;
            $allFields = null;
        }
        $this->assignRef('allFields', $allFields);
        $fieldTitle = '';
        if (!empty($field->field_id)) {
            $fieldTitle = ' : ' . $field->field_namekey;
        }
        hikashop_setTitle(JText::_('FIELD') . $fieldTitle, 'field', 'field&task=edit&field_id=' . $fieldid);
        $jsDrop = '';
        if (HIKASHOP_BACK_RESPONSIVE && $app->isAdmin()) {
            $jsDrop = 'jQuery(input3).chosen();';
        }
        hikashop_loadJslib('jquery');
        $script = '
		function addLine() {
			window.hikashop.dupRow("hikashop_field_values_table_template", {
				"TITLE":"field_values[title][]",
				"VALUE":"field_values[value][]",
				"DISABLED":"field_values[disabled][]"
			})
		}

		function setVisible(value){
			if(value=="product" || value=="item" || value=="category"){
				document.getElementById(\'category_field\').style.display = "";
			}else{
				document.getElementById(\'category_field\').style.display = \'none\';
			}
		}';
        $doc->addScriptDeclaration($script);
        $this->toolbar = array('save', 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => 'field-form'));
        $this->assignRef('field', $field);
        $this->assignRef('fieldsClass', $fieldsClass);
        $fieldType = hikashop_get('type.fields');
        $this->assignRef('fieldtype', $fieldType);
        $zoneType = hikashop_get('type.zone');
        $this->assignRef('zoneType', $zoneType);
        $allowType = hikashop_get('type.allow');
        $this->assignRef('allowType', $allowType);
        $displayOptions = array();
        $this->assignRef('displayOptions', $displayOptions);
        if (hikashop_level(1)) {
            $tabletype = hikashop_get('type.table');
            $this->assignRef('tabletype', $tabletype);
        }
        if (hikashop_level(2)) {
            $limitParent = hikashop_get('type.limitparent');
            $this->assignRef('limitParent', $limitParent);
            if (!empty($field->field_options['product_id'])) {
                $product = hikashop_get('class.product');
                $element = $product->get($field->field_options['product_id']);
                $this->assignRef('element', $element);
            }
        }
        $categories = array();
        if (isset($this->field->field_categories)) {
            $this->field->field_categories = $this->field->field_categories;
            $this->categories = explode(",", $this->field->field_categories);
            unset($this->categories[0]);
            unset($this->categories[count($this->categories)]);
            if (!empty($this->categories)) {
                foreach ($this->categories as $k => $cat) {
                    if (!isset($categories[$k])) {
                        $categories[$k] = new stdClass();
                    }
                    $categories[$k]->category_id = $cat;
                }
                $db = JFactory::getDBO();
                $db->setQuery('SELECT * FROM ' . hikashop_table('category') . ' WHERE category_id IN (' . implode(',', $this->categories) . ')');
                $cats = $db->loadObjectList('category_id');
                foreach ($this->categories as $k => $cat) {
                    if (!empty($cats[$cat])) {
                        $categories[$k]->category_name = $cats[$cat]->category_name;
                    } else {
                        $categories[$k]->category_name = JText::_('CATEGORY_NOT_FOUND');
                    }
                }
            }
            $this->categories = $categories;
        }
        JHTML::_('behavior.modal');
        $popup = hikashop_get('helper.popup');
        $this->assignRef('popup', $popup);
        $nameboxType = hikashop_get('type.namebox');
        $this->assignRef('nameboxType', $nameboxType);
        JPluginHelper::importPlugin('hikashop');
        $dispatcher = JDispatcher::getInstance();
        $dispatcher->trigger('onCustomfieldEdit', array(&$field, &$this));
    }
Ejemplo n.º 7
0
    public function displayTree($id, $root = 0, $type = null, $displayRoot = false, $selectRoot = false, $openTo = null, $link = '')
    {
        hikashop_loadJslib('otree');
        if (empty($type)) {
            $type = array('product', 'manufacturer', 'vendor');
        }
        $ret = '';
        $ret .= '<div id="' . $id . '_otree" class="oTree"></div>
<script type="text/javascript">
var options = {rootImg:"' . HIKASHOP_IMAGES . '", showLoading:false};
var data = ' . $this->getData($type, $root, $displayRoot, $selectRoot, $openTo) . ';
var ' . $id . ' = new window.oTree("' . $id . '",options,callbackTree,data,false);
' . $id . '.addIcon("world","world.png");';
        if (!empty($link)) {
            $ret .= '
' . $id . '.callbackSelection = function(tree,id,previous) {
	var node = tree.get(id);
	if( !node.value || !node.name )
		return;
	if(node.value < 0) {
		var parentNode = tree.find(-node.value);
		tree.rem(node);
		callbackTree(tree, parentNode, null, previous);
		return;
	}';
            if (!is_null($openTo)) {
                $ret .= '
	if(node.value == ' . (int) $openTo . ')
		return;
';
            }
            $ret .= '
	window.location.href = \'' . $link . '&filter_id=\' + node.value;
};';
        }
        $ret .= '
' . $id . '.render(true);';
        if (!is_null($openTo)) {
            $ret .= '
var otoNode = ' . $id . '.find(' . (int) $openTo . ');
if(otoNode) {
	' . $id . '.oTo(otoNode);
	' . $id . '.sel(otoNode);
}
';
        }
        $ret .= '
function callbackTree(tree,node,ev,skip) {
	var o = window.Oby;
	o.xRequest(\'' . hikashop_completeLink('category&task=getTree&category_id=HIKAVALUE', false, false, true) . '\'.replace(\'HIKAVALUE\', node.value), null,
		function(xhr,params) {
			var json = o.evalJSON(xhr.responseText);
			if(json.length == 0)
				return tree.emptyDirectory(node);
			var s = json.length, n, values;
			if(skip !== undefined && skip) {
				values = {};
				for(var i = 0; i < node.children.length; i++) {
					var v = tree.get(node.children[i]);
					values[v.value] = true;
				}
			}
			for(var i = 0; i < s; i++) {
				n = json[i];
				if(skip == undefined || !values[n.value])
					tree.add(node.id, n.status, n.name, n.value, n.url, n.icon);
			}
			tree.update(node);
			if(tree.selectOnOpen) {
				n = tree.find(tree.selectOnOpen);
				if(n) tree.sel(n);
				tree.selectOnOpen = null;
			}
			if(skip !== undefined && skip) {
				delete values;
				tree.selectedNode = skip;
				tree.sel(skip);
			}
		},
		function(xhr, params) { tree.add(node.id, 0, "error"); tree.update(node); }
	);
	return false;
}
';
        $ret .= '
</script>';
        return $ret;
    }
Ejemplo n.º 8
0
<?php

/**
 * @package	HikaShop for Joomla!
 * @version	2.6.0
 * @author	hikashop.com
 * @copyright	(C) 2010-2015 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
hikashop_loadJslib('jquery');
$js = '';
$params = null;
$this->params->set('vote_type', 'product');
if (isset($this->element->main)) {
    $product_id = $this->element->main->product_id;
} else {
    $product_id = $this->element->product_id;
}
$this->params->set('vote_ref_id', $product_id);
$this->params->set('productlayout', 'show_tabular');
$layout_vote_mini = hikashop_getLayout('vote', 'mini', $this->params, $js);
$layout_vote_listing = hikashop_getLayout('vote', 'listing', $this->params, $js);
$layout_vote_form = hikashop_getLayout('vote', 'form', $this->params, $js);
$config =& hikashop_config();
$status_vote = $config->get('enable_status_vote');
$hide_specs = 1;
if ($this->element->product_manufacturer_id != 0 || $this->element->product_weight != 0 || $this->element->product_width != 0 || $this->element->product_height != 0 || $this->element->product_length != 0 || @$this->element->main->product_weight != 0 || @$this->element->main->product_width != 0 || @$this->element->main->product_height != 0 || @$this->element->main->product_length != 0) {
    $hide_specs = 0;
}
foreach ($this->fields as $fieldName => $oneExtraField) {
Ejemplo n.º 9
0
    public function display($map, $value, $mode = hikashopNameboxType::NAMEBOX_MULTIPLE, $type = '', $options = array())
    {
        if (empty($type)) {
            $type = $this->type;
        }
        if (empty($type)) {
            return '';
        }
        $this->load($type);
        if (!isset($this->types[$type])) {
            return '';
        }
        $typeConfig = $this->types[$type];
        $config = hikashop_config();
        $nameboxClass = $this->getClass($typeConfig['class']);
        if (empty($nameboxClass)) {
            return '';
        }
        hikashop_loadJslib('otree');
        if ($mode == hikashopNameboxType::NAMEBOX_MULTIPLE && isset($options['sort']) && $options['sort'] == true) {
            hikashop_loadJslib('jquery');
        }
        $id = rtrim(str_replace(array('"', "'", '\\', '[]', '[', ']', '.'), array('', '', '', '', '_', '', '_'), $map), '_');
        if (empty($id)) {
            $id = !empty($options['id']) ? $options['id'] : 'nb_' . uniqid();
        }
        $key = '';
        $default_text = !empty($options['default_text']) ? $options['default_text'] : 'HIKA_NONE';
        $name = '<em>' . JText::_($default_text) . '</em>';
        $cleanText = '<em>' . str_replace("'", "\\'", JText::_($default_text)) . '</em>';
        $fullLoad = true;
        list($elements, $values) = $nameboxClass->getNameboxData($typeConfig, $fullLoad, $mode, $value, null, $options);
        $displayFormat = '';
        if (!empty($typeConfig['displayFormat'])) {
            $displayFormat = $typeConfig['displayFormat'];
        }
        if (!empty($options['displayFormat'])) {
            $displayFormat = $options['displayFormat'];
        }
        $style = '';
        if (!empty($options['style'])) {
            $style = ' style="' . is_array($options['style']) ? implode(' ', $options['style']) : $options['style'] . '"';
        }
        if (!empty($typeConfig['mode']) && $typeConfig['mode'] == 'list' && empty($typeConfig['options']['olist']['table']) && !is_string(reset($elements))) {
            $n = $typeConfig['name'];
            foreach ($elements as &$element) {
                if (!empty($displayFormat)) {
                    $element = $this->getDisplayValue($element, $typeConfig, $options);
                } else {
                    $element = $element->{$n};
                }
            }
            unset($element);
        }
        $ret = '<div class="nameboxes" id="' . $id . '" onclick="window.oNameboxes[\'' . $id . '\'].focus(\'' . $id . '_text\');"' . $style . '>';
        if ($mode == hikashopNameboxType::NAMEBOX_SINGLE) {
            if (!empty($values)) {
                $key = $value;
                $v = $values;
                if (is_array($values)) {
                    $v = $values[$key];
                }
                $name = $this->getDisplayValue($v, $typeConfig, $options);
            }
            $delete = isset($options['delete']) && $options['delete'] == true;
            $ret .= '
	<div class="namebox" id="' . $id . '_namebox">
		<input type="hidden" name="' . $map . '" id="' . $id . '_valuehidden" value="' . $key . '"/><span id="' . $id . '_valuetext">' . $name . '</span>
		' . (!$delete ? '<a class="editbutton" href="#" onclick="return false;"><span>-</span></a>' : '<a class="closebutton" href="#" onclick="window.oNameboxes[\'' . $id . '\'].clean(this,\'' . $cleanText . '\');return false;"><span>X</span></a>') . '
	</div>
	<div class="nametext">
		<input id="' . $id . '_text" type="text" style="width:50px;min-width:60px" onfocus="window.oNameboxes[\'' . $id . '\'].focus(this);" onkeyup="window.oNameboxes[\'' . $id . '\'].search(this);" onchange="window.oNameboxes[\'' . $id . '\'].search(this);"/>
		<span style="position:absolute;top:0px;left:-2000px;visibility:hidden" id="' . $id . '_span">xxxxxx</span>
	</div>';
        } else {
            if (substr($map, -2) === '[]') {
                $map = substr($map, 0, -2);
            }
            if (!empty($values)) {
                $n = $typeConfig['name'];
                foreach ($values as $key => $name) {
                    $obj = null;
                    if (is_object($name)) {
                        $obj = $name;
                        if (!empty($displayFormat)) {
                            $name = $this->getDisplayValue($obj, $typeConfig, $options);
                        } else {
                            $name = $name->{$n};
                        }
                    }
                    $ret .= "\r\n" . '<div class="namebox" id="' . $id . '-' . $key . '">' . '<input type="hidden" name="' . $map . '[]" value="' . $key . '"/>' . $name . ' <a class="closebutton" href="#" onclick="window.oNameboxes[\'' . $id . '\'].unset(this,\'' . $key . '\');window.oNamebox.cancelEvent();return false;"><span>X</span></a>' . '</div>';
                }
            }
            $ret .= "\r\n" . '<div class="namebox" style="display:none;" id="' . $id . 'tpl">' . '<input type="hidden" name="{map}" value="{key}"/>{name}' . ' <a class="closebutton" href="#" onclick="window.oNameboxes[\'' . $id . '\'].unset(this,\'{key}\');window.oNamebox.cancelEvent();return false;"><span>X</span></a>' . '</div>';
            $ret .= "\r\n" . '<div class="nametext">' . '<input id="' . $id . '_text" type="text" style="width:50px;min-width:60px" onfocus="window.oNameboxes[\'' . $id . '\'].focus(this);" onkeyup="window.oNameboxes[\'' . $id . '\'].search(this);" onchange="window.oNameboxes[\'' . $id . '\'].search(this);"/>' . '<span style="position:absolute;top:0px;left:-2000px;visibility:hidden" id="' . $id . '_span">span</span>' . '</div>';
            if (!empty($options['force_data'])) {
                $ret .= '<input type="hidden" name="' . $map . '[]" value=""/>';
            }
        }
        if (isset($options['add']) && $options['add'] == true) {
            $ret .= '<div id="' . $id . '_add" style="display:none;float:right"><a href="#" onclick="return window.oNameboxes[\'' . $id . '\'].create(this);"><img src="' . HIKASHOP_IMAGES . 'plus.png" style="vertical-align:middle;margin:0px;padding:0px;" alt="+"/></a></div>';
            $ret .= '<div id="' . $id . '_loading" style="display:none;float:right"><img src="' . HIKASHOP_IMAGES . 'spinner.gif" style="vertical-align:middle;margin:0px;padding:0px;" alt="loading..."/></div>';
        }
        $ret .= "\r\n\t" . '<div style="clear:both;float:none;"></div></div>';
        $namebox_options = array('mode' => $typeConfig['mode'], 'img_dir' => HIKASHOP_IMAGES, 'map' => $map, 'min' => $config->get('namebox_search_min_length', 3));
        if ($mode == hikashopNameboxType::NAMEBOX_MULTIPLE && isset($options['sort']) && $options['sort'] == true) {
            $namebox_options['sort'] = true;
        }
        if (isset($options['add']) && $options['add'] == true && !empty($typeConfig['options']['add_url'])) {
            $namebox_options['add'] = true;
            $url = '' . $typeConfig['options']['add_url'];
            if (!empty($typeConfig['url_params'])) {
                foreach ($typeConfig['url_params'] as $k) {
                    $p = '';
                    if (isset($options['url_params'][$k])) {
                        $p = $options['url_params'][$k];
                    }
                    $url = str_replace('{' . $k . '}', $p, $url);
                }
            }
            $url .= '&' . hikashop_getFormToken() . '=1';
            if (substr($url, 0, 10) == 'index.php?') {
                $namebox_options['add_url'] = str_replace('&amp;', '&', JRoute::_($url));
            } else {
                $namebox_options['add_url'] = hikashop_completeLink($url, false, false, true);
            }
        }
        if ($mode == hikashopNameboxType::NAMEBOX_SINGLE) {
            $namebox_options['multiple'] = false;
            $namebox_options['default_text'] = '<em>' . JText::_($default_text) . '</em>';
        }
        if (isset($typeConfig['options'])) {
            foreach ($typeConfig['options'] as $k => $v) {
                if (isset($namebox_options[$k])) {
                    continue;
                }
                $namebox_options[$k] = $v;
            }
        }
        if (isset($namebox_options['olist']['table'])) {
            foreach ($namebox_options['olist']['table'] as $k => $v) {
                $namebox_options['olist']['table'][$k] = JText::_($v);
            }
        }
        if (!$fullLoad) {
            $url = '' . $typeConfig['url'];
            if (!empty($typeConfig['url_params'])) {
                foreach ($typeConfig['url_params'] as $k) {
                    $p = '';
                    if (isset($options['url_params'][$k])) {
                        $p = $options['url_params'][$k];
                    }
                    $url = str_replace('{' . $k . '}', $p, $url);
                }
            }
            if (strpos($url, '{displayFormat}') !== false) {
                $url = str_replace('{displayFormat}', $this->getDisplayFormatId($type, $displayFormat), $url);
            }
            $url .= '&search=HIKASEARCH';
            if (empty($typeConfig['mode']) || $typeConfig['mode'] == 'list') {
                if (empty($namebox_options['olist'])) {
                    $namebox_options['olist'] = array();
                }
                $namebox_options['olist']['gradientLoad'] = true;
                $url .= '&start=HIKASTART';
                $namebox_options['url_pagination'] = 'HIKASTART';
            }
            if (substr($url, 0, 10) == 'index.php?') {
                $namebox_options['url'] = str_replace('&amp;', '&', JRoute::_($url));
            } else {
                $namebox_options['url'] = hikashop_completeLink($url, false, false, true);
            }
            $namebox_options['url_keyword'] = 'HIKASEARCH';
        }
        if (isset($namebox_options['tree_url'])) {
            if (strpos($namebox_options['tree_url'], '{displayFormat}') !== false) {
                $namebox_options['tree_url'] = str_replace('{displayFormat}', $this->getDisplayFormatId($type, $displayFormat), $namebox_options['tree_url']);
            }
            if (substr($namebox_options['tree_url'], 0, 10) == 'index.php?') {
                $namebox_options['tree_url'] = str_replace('&amp;', '&', JRoute::_($namebox_options['tree_url']));
            } else {
                $namebox_options['tree_url'] = hikashop_completeLink($namebox_options['tree_url'], false, false, true);
            }
        }
        if (!empty($typeConfig['mode']) && $typeConfig['mode'] == 'tree') {
            $ret .= '
<div class="namebox-popup">
	<div id="' . $id . '_otree" style="display:none;" class="oTree namebox-popup-content"></div>
</div>
<script type="text/javascript">
new window.oNamebox(
	\'' . $id . '\',
	' . json_encode($elements) . ',
	' . json_encode($namebox_options) . '
);
</script>';
        } else {
            $ret .= '
<div class="namebox-popup">
	<div id="' . $id . '_olist" style="display:none;" class="oList namebox-popup-content"></div>
</div>
<script type="text/javascript">
new window.oNamebox(
	\'' . $id . '\',
	' . json_encode($elements) . ',
	' . json_encode($namebox_options) . '
);';
            if (!empty($values) && $mode == hikashopNameboxType::NAMEBOX_MULTIPLE) {
                $b = array();
                foreach ($values as $key => $name) {
                    $b[] = $key;
                }
                $ret .= '
try{
	window.oNameboxes[\'' . $id . '\'].content.block(' . json_encode($b) . ');
}catch(e){}';
            }
            $ret .= '
</script>';
        }
        return $ret;
    }
Ejemplo n.º 10
0
    public function displayButton($map, $values)
    {
        hikashop_loadJslib('otree');
        hikashop_loadJslib('jquery');
        $ret = '';
        if (empty($this->groups)) {
            $this->load();
        }
        $map = str_replace('"', '', $map);
        if (empty($this->id)) {
            $this->id = 'hikamarket_joomlaacl';
            $cpt = count($this->groups) - 1;
            $ret .= '<script type="text/javascript">
if(!window.aclMgr) window.aclMgr = {};
if(!window.aclMgr.trees) window.aclMgr.trees = {};
if(!window.aclMgr.data) window.aclMgr.data = {};
if(!window.aclMgr.popups) window.aclMgr.popups = {};
if(!window.aclMgr.cpt) window.aclMgr.cpt = {};
window.aclMgr.data["' . $this->id . '"] = ' . $this->getData($values) . ';
window.aclMgr.cpt["' . $this->id . '"] = ' . $cpt . ';
window.aclMgr.updateJoomlaAcl = function(el,id,tree_id) {
	var d = document, w = window, tree = d.getElementById(tree_id + "_otree"), e = d.getElementById(id), values = e.value;
	if(w.aclMgr.popups[id] && tree) {
		tree.style.display = "none";
		w.Oby.removeEvent(document, "click", w.aclMgr.popups[id]);
		w.aclMgr.popups[id] = false;
		return false;
	}
	if(!tree) {
		tree = d.createElement("div");
		tree.id = tree_id + "_otree";
		tree.style.position = "absolute";
		tree.style.display = "none";
		tree.className = "oTree acl-popup-content";
		d.body.appendChild(tree);
		w.aclMgr.trees[tree_id] = new w.oTree(tree_id,{rootImg:"' . HIKASHOP_IMAGES . 'otree/", showLoading:false, useSelection:false, checkbox:true},null,w.aclMgr.data[tree_id],true);
	}
	switch(values) {
		case "all":
			treevalues = "*";
			break;
		case "none":
			treevalues = "";
			break;
		default:
			treevalues = values.split(",");
			break;
	}
	w.aclMgr.trees[tree_id].callbackCheck = null;
	w.aclMgr.trees[tree_id].chks(treevalues, null, false);
	var p = jQuery(el).offset();
	if(tree.style.display != "none" && tree.style.top != ((p.top + el.offsetHeight) + "px")) {
		setTimeout(function(){
			w.aclMgr.updateJoomlaAcl(el,id,tree_id);
		}, 100);
		return false;
	}
	tree.style.top = (p.top + el.offsetHeight + 5) + "px";
	tree.style.left = (p.left + el.offsetWidth - 200) + "px";

	var f = function(evt) {
		if (!evt) var evt = window.event;
		var trg = (window.event) ? evt.srcElement : evt.target;
		while(trg != null) {
			if(trg == tree || trg == el)
				return;
			trg = trg.parentNode;
		}
		tree.style.display = "none";
		w.Oby.removeEvent(document, "click", f);
		w.aclMgr.popups[id] = false;
	};
	w.Oby.addEvent(document, "click", f);
	w.aclMgr.popups[id] = f;

	w.aclMgr.trees[tree_id].callbackCheck = function(treeObj, id, value) {
		var v = treeObj.getChk();
		if(v === false || v.length == 0) {
			e.value = "none";
		} else if( v.length > w.aclMgr.cpt[tree_id]) {
			e.value = "all";
		} else {
			e.value = "," + v.join(",") + ",";
		}
	};

	tree.style.display = "";
	return false;
};
</script>';
        }
        $id = str_replace(array('[', ']'), array('_', ''), $map);
        $ret .= '<a href="#" onclick="return window.aclMgr.updateJoomlaAcl(this, \'' . $id . '\', \'' . $this->id . '\');">' . '<img src="' . HIKASHOP_IMAGES . 'icons/icon-16-levels.png" title="' . JText::_('ACCESS_LEVEL') . '" />' . '</a><input type="hidden" id="' . $id . '" name="' . $map . '" value="' . $values . '" />';
        return $ret;
    }
Ejemplo n.º 11
0
 function show(&$field, $value, $class = 'hikashop_custom_file_link')
 {
     if ($class == 'admin_email') {
         return '<a target="_blank" class="' . $class . '" href="' . HIKASHOP_LIVE . 'administrator/index.php?option=com_hikashop&ctrl=order&task=download&field_table=' . $field->field_table . '&field_namekey=' . urlencode(base64_encode($field->field_namekey)) . '&name=' . urlencode(base64_encode($value)) . '">' . $value . '</a>';
     }
     if ($class == 'user_email') {
         if (@$field->guest_mode) {
             return $value;
         }
         $app = JFactory::getApplication();
         if (!$app->isAdmin()) {
             return '<a target="_blank" class="' . $class . '" href="' . hikashop_completeLink('order&task=download&field_table=' . $field->field_table . '&field_namekey=' . urlencode(base64_encode($field->field_namekey)) . '&name=' . urlencode(base64_encode($value))) . '">' . $value . '</a>';
         }
         return '<a target="_blank" class="' . $class . '" href="' . HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=order&task=download&field_table=' . $field->field_table . '&field_namekey=' . urlencode(base64_encode($field->field_namekey)) . '&name=' . urlencode(base64_encode($value)) . '">' . $value . '</a>';
     }
     hikashop_loadJslib('opload');
     if ($this->mode == 'image') {
         $thumbnail_x = 100;
         $thumbnail_y = 100;
         $thumbnails_params = '&thumbnail_x=' . $thumbnail_x . '&thumbnail_y=' . $thumbnail_y;
         return '<img class="' . $class . '" src="' . hikashop_completeLink('order&task=download&field_table=' . $field->field_table . '&field_namekey=' . urlencode(base64_encode($field->field_namekey)) . '&name=' . urlencode(base64_encode($value)) . $thumbnails_params) . '" alt="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '" />';
     }
     return '<a target="_blank" class="' . $class . '" href="' . hikashop_completeLink('order&task=download&field_table=' . $field->field_table . '&field_namekey=' . urlencode(base64_encode($field->field_namekey)) . '&name=' . urlencode(base64_encode($value))) . '">' . $value . '</a>';
 }
Ejemplo n.º 12
0
 public function useselection()
 {
     $users = JRequest::getVar('cid', array(), '', 'array');
     $rows = array();
     $data = '';
     $confirm = JRequest::getVar('confirm', true);
     $singleSelection = JRequest::getVar('single', false);
     $elemStruct = array('user_email', 'user_cms_id', 'name', 'username', 'email');
     if (!empty($users)) {
         JArrayHelper::toInteger($users);
         $db = JFactory::getDBO();
         $query = 'SELECT a.*, b.* FROM ' . hikashop_table('user') . ' AS a LEFT JOIN ' . hikashop_table('users', false) . ' AS b ON a.user_cms_id = b.id WHERE a.user_id IN (' . implode(',', $users) . ')';
         $db->setQuery($query);
         $rows = $db->loadObjectList();
         if (!empty($rows)) {
             $data = array();
             foreach ($rows as $v) {
                 $d = '{id:' . $v->user_id;
                 foreach ($elemStruct as $s) {
                     if ($s == 'id') {
                         continue;
                     }
                     $d .= ',' . $s . ':\'' . str_replace('"', '\'', $v->{$s}) . '\'';
                 }
                 $data[] = $d . '}';
             }
             if (!$singleSelection) {
                 $data = '[' . implode(',', $data) . ']';
             } else {
                 $data = $data[0];
                 $rows = $rows[0];
             }
         }
     }
     $this->assignRef('rows', $rows);
     $this->assignRef('data', $data);
     $this->assignRef('confirm', $confirm);
     $this->assignRef('singleSelection', $singleSelection);
     if ($confirm == true) {
         hikashop_loadJslib('mootools');
         $js = 'window.hikashop.ready( function(){window.top.hikashop.submitBox(' . $data . ');});';
         $doc = JFactory::getDocument();
         $doc->addScriptDeclaration($js);
     }
 }
Ejemplo n.º 13
0
    function form()
    {
        $massaction_id = hikashop_getCID('massaction_id');
        $class = hikashop_get('class.massaction');
        if (!empty($massaction_id)) {
            $element = $class->get($massaction_id, true);
            $task = 'edit';
        } else {
            $element = new stdClass();
            $element->massaction_published = 1;
            $element->massaction_table = 'product';
            $task = 'add';
        }
        hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&massaction_id=' . $massaction_id);
        $this->toolbar = array(array('name' => 'confirm', 'check' => false, 'msg' => JText::_('PROCESS_WARNING'), 'icon' => 'upload', 'alt' => JText::_('PROCESS'), 'task' => 'process'), '|', 'save', array('name' => 'save2new', 'display' => version_compare(JVERSION, '1.7', '>=')), 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form'));
        $this->assignRef('element', $element);
        $translation = false;
        $transHelper = hikashop_get('helper.translation');
        if ($transHelper && $transHelper->isMulti()) {
            $translation = true;
            $transHelper->load('hikashop_massaction', @$element->massaction_id, $element);
            jimport('joomla.html.pane');
            $config =& hikashop_config();
            $multilang_display = $config->get('multilang_display', 'tabs');
            if ($multilang_display == 'popups') {
                $multilang_display = 'tabs';
            }
            $tabs = hikashop_get('helper.tabs');
            $this->assignRef('tabs', $tabs);
            $this->assignRef('transHelper', $transHelper);
        }
        $toggle = hikashop_get('helper.toggle');
        $this->assignRef('toggle', $toggle);
        $this->assignRef('translation', $translation);
        $tables = array();
        JPluginHelper::importPlugin('hikashop');
        $dispatcher = JDispatcher::getInstance();
        $dispatcher->trigger('onMassactionTableLoad', array(&$tables));
        $loadedData = $element;
        foreach ($tables as $k => $table) {
            $tables[$k]->triggers = array();
            $tables[$k]->triggers_html = array();
            $dispatcher->trigger('onMassactionTableTriggersLoad', array(&$tables[$k], &$tables[$k]->triggers, &$tables[$k]->triggers_html, &$loadedData));
            $tables[$k]->filters = array();
            $tables[$k]->filters_html = array();
            $dispatcher->trigger('onMassactionTableFiltersLoad', array(&$tables[$k], &$tables[$k]->filters, &$tables[$k]->filters_html, &$loadedData));
            $tables[$k]->actions = array();
            $tables[$k]->actions_html = array();
            $dispatcher->trigger('onMassactionTableActionsLoad', array(&$tables[$k], &$tables[$k]->actions, &$tables[$k]->actions_html, &$loadedData));
            $table->typevaluesTriggers = array();
            $table->typevaluesFilters = array();
            $table->typevaluesActions = array();
            $table->typevaluesTriggers[] = JHTML::_('select.option', '', JText::_('TRIGGER_SELECT'));
            $table->typevaluesFilters[] = JHTML::_('select.option', '', JText::_('FILTER_SELECT'));
            $table->typevaluesActions[] = JHTML::_('select.option', '', JText::_('ACTION_SELECT'));
            foreach ($tables[$k]->triggers as $oneType => $oneName) {
                $table->typevaluesTriggers[] = JHTML::_('select.option', $oneType, $oneName);
            }
            foreach ($tables[$k]->filters as $oneType => $oneName) {
                $table->typevaluesFilters[] = JHTML::_('select.option', $oneType, $oneName);
            }
            foreach ($tables[$k]->actions as $oneType => $oneName) {
                $table->typevaluesActions[] = JHTML::_('select.option', $oneType, $oneName);
            }
        }
        $this->assignRef('tables', $tables);
        $this->assignRef('loadedData', $loadedData);
        $js = "\r\n\r\n\t\t\tfunction updateMassAction(type,table,filterNum){\r\n\t\t\t\tvar w = window, d = w.document, currentFilterType = d.getElementById(type+table+'type'+filterNum).value;\r\n\t\t\t\tif(!currentFilterType){\r\n\t\t\t\t\td.getElementById(table+type+'area_'+filterNum).innerHTML = '';\r\n\t\t\t\t\tif(type=='filter') d.getElementById(table+'countresult_'+filterNum).innerHTML = '';\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tvar filterArea = table+type+'__num__'+currentFilterType;\r\n\t\t\t\tif(d.getElementById(filterArea))\r\n\t\t\t\t\t\tw.Oby.updateElem( d.getElementById(table+type+'area_'+filterNum), d.getElementById(filterArea).innerHTML.replace(/__num__/g,filterNum));\r\n\t\t\t\telse d.getElementById(table+type+'area_'+filterNum).innerHTML = '';\r\n\t\t\t}\r\n\r\n\t\t\t";
        $js .= "\r\n\t\t\tvar numTriggers = {};\r\n\t\t\tvar numFilters = {};\r\n\t\t\tvar numActions = {};\r\n\t\t\tvar triggerId = {};\r\n\t\t\tvar filterId = {};\r\n\t\t\tvar actionId = {};\r\n\t\t";
        foreach ($tables as $k => $table) {
            if (empty($loadedData->massaction_triggers) || $table->table != $loadedData->massaction_table) {
                $js .= "numTriggers['" . $table->table . "'] = 1;";
                $js .= "triggerId['" . $table->table . "'] = 1;";
            } else {
                $triggerId = max(array_keys($loadedData->massaction_triggers));
                if (!is_int($triggerId)) {
                    $triggerId = 1;
                } else {
                    $triggerId++;
                }
                $countTrigger = 1;
                foreach ($loadedData->massaction_triggers as $trigger) {
                    if (is_int($k)) {
                        $countTrigger++;
                    }
                }
                $js .= "numTriggers['" . $table->table . "'] = " . $countTrigger . ";";
                $js .= "triggerId['" . $table->table . "'] = " . $triggerId . ";";
            }
            if (empty($loadedData->massaction_filters) || $table->table != $loadedData->massaction_table) {
                $js .= "numFilters['" . $table->table . "'] = 1;";
                $js .= "filterId['" . $table->table . "'] = 1;";
            } else {
                $filterId = max(array_keys($loadedData->massaction_filters));
                if (!is_int($filterId)) {
                    $filterId = 1;
                } else {
                    $filterId++;
                }
                $countFilter = 1;
                foreach ($loadedData->massaction_filters as $k => $filter) {
                    if (is_int($k)) {
                        $countFilter++;
                    }
                }
                $js .= "numFilters['" . $table->table . "'] = " . $countFilter . ";";
                $js .= "filterId['" . $table->table . "'] = " . $filterId . ";";
            }
            if (empty($loadedData->massaction_actions) || $table->table != $loadedData->massaction_table) {
                $js .= "numActions['" . $table->table . "'] = 0;";
                $js .= "actionId['" . $table->table . "'] = 0;";
            } else {
                $actionId = max(array_keys($loadedData->massaction_actions));
                if (!is_int($actionId)) {
                    $actionId = 0;
                } else {
                    $actionId++;
                }
                $countAction = 0;
                foreach ($loadedData->massaction_actions as $k => $action) {
                    if (is_int($k)) {
                        $countAction++;
                    }
                }
                $js .= "numActions['" . $table->table . "'] = " . $countAction . ";";
                $js .= "actionId['" . $table->table . "'] = " . $actionId . ";";
            }
        }
        $js .= "\r\n\t\t\t\tfunction addHikaMassAction(table,type){\r\n\t\t\t\t\tvar newdiv = document.createElement('div');\r\n\t\t\t\t\tif(type=='filter'){\r\n\t\t\t\t\t\tvar count=numFilters[table]-1;\r\n\t\t\t\t\t\tvar theId=filterId[table];\r\n\t\t\t\t\t}else if(type=='trigger'){\r\n\t\t\t\t\t\tvar count=numTriggers[table];\r\n\t\t\t\t\t\tvar theId=triggerId[table];\r\n\t\t\t\t\t}else if(type=='action'){\r\n\t\t\t\t\t\tvar count=numActions[table];\r\n\t\t\t\t\t\tvar theId=actionId[table];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tnewdiv.id = table+type+theId;\r\n\t\t\t\t\tnewdiv.className = 'plugarea';\r\n\t\t\t\t\tnewdiv.innerHTML = '';\r\n\t\t\t\t\tif(count > 0) newdiv.innerHTML += '" . JText::_('HIKA_AND') . "';\r\n\t\t\t\t\tnewdiv.innerHTML += document.getElementById(table+'_'+type+'s_original').innerHTML.replace(/__num__/g, theId);\r\n\t\t\t\t\tif(document.getElementById('all'+table+type+'s')){\r\n\t\t\t\t\t\tdocument.getElementById('all'+table+type+'s').appendChild(newdiv);\r\n\t\t\t\t\t\tupdateMassAction(type,table,theId);\r\n\t\t\t\t\t\tif(type=='filter'){\r\n\t\t\t\t\t\t\tnumFilters[table]++;\r\n\t\t\t\t\t\t\tfilterId[table]++;\r\n\t\t\t\t\t\t}else if(type=='trigger'){\r\n\t\t\t\t\t\t\tnumTriggers[table]++;\r\n\t\t\t\t\t\t\ttriggerId[table]++;\r\n\t\t\t\t\t\t}else if(type=='action'){\r\n\t\t\t\t\t\t\tnumActions[table]++;\r\n\t\t\t\t\t\t\tactionId[table]++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t";
        if (HIKASHOP_J30) {
            $js .= '
				function refreshSelect(table,type, id){
					if(type=="filter"){
						var count=filterId[table];
					}else if(type=="trigger"){
						var count=triggerId[table];
					}else if(type=="action"){
						var count=actionId[table];
					}
					if(id!=-1){
						var count = id;
					}else{
						count=count-1;
					}
				}
			';
        } else {
            $js .= 'function refreshSelect(table,type, id){}';
        }
        if (!HIKASHOP_J16) {
            $js .= 'function submitbutton(pressbutton){
						if (pressbutton != \'save\') {
							submitform( pressbutton );
							return;
						}';
        } else {
            $js .= 'Joomla.submitbutton = function(pressbutton) {
						if (pressbutton != \'save\') {
							Joomla.submitform(pressbutton,document.adminForm);
							return;
						}';
        }
        if (!HIKASHOP_J16) {
            $js .= "submitform( pressbutton );";
        } else {
            $js .= "Joomla.submitform(pressbutton,document.adminForm);";
        }
        $js .= "}";
        $js .= "\r\n\t\t\t\tfunction countresults(table,num){\r\n\t\t\t\t\tdocument.getElementById(table+'countresult_'+num).innerHTML = '<span class=\"onload\"></span>';\r\n\t\t\t\t\tvar form = document.id('adminForm');\r\n\t\t\t\t\tvar data = form.toQueryString();\r\n\t\t\t\t\tdata += '&task=countresults&ctrl=massaction';\r\n\t\t\t\t\ttry{\r\n\t\t\t\t\t\tnew Ajax('index.php?option=com_hikashop&tmpl=component&ctrl=massaction&task=countresults&table='+table+'&num='+num,{\r\n\t\t\t\t\t\t\tmethod: 'post',\r\n\t\t\t\t\t\t\tdata: data,\r\n\t\t\t\t\t\t\tupdate: document.getElementById(table+'countresult_'+num)\r\n\t\t\t\t\t\t}).request();\r\n\t\t\t\t\t}catch(err){\r\n\t\t\t\t\t\tnew Request({\r\n\t\t\t\t\t\t\tmethod: 'post',\r\n\t\t\t\t\t\t\tdata: data,\r\n\t\t\t\t\t\t\turl: 'index.php?option=com_hikashop&tmpl=component&ctrl=massaction&task=countresults&table='+table+'&num='+num,\r\n\t\t\t\t\t\t\tonSuccess: function(responseText, responseXML) {\r\n\t\t\t\t\t\t\t\tdocument.getElementById(table+'countresult_'+num).innerHTML = responseText;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}).send();\r\n\t\t\t\t\t}\r\n\t\t\t\t}";
        if (!isset($loadedData->massaction_table)) {
            $currentTable = 'product';
        } else {
            $currentTable = $loadedData->massaction_table;
        }
        $js .= '
		var currentoption = \'' . $currentTable . '\';
		function updateData(newoption){
			document.getElementById(currentoption).style.display = "none";
			document.getElementById(newoption).style.display = \'block\';
			currentoption = newoption;
		}';
        if (!HIKASHOP_PHP5) {
            $doc =& JFactory::getDocument();
        } else {
            $doc = JFactory::getDocument();
        }
        if (!empty($_POST['html_results'])) {
            $html_results = $_POST['html_results'];
        }
        $this->assignRef('html_results', $html_results);
        $doc->addScriptDeclaration($js);
        hikashop_loadJslib('mootools');
    }
Ejemplo n.º 14
0
 public function variant()
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $ctrl = '';
     $this->paramBase = HIKASHOP_COMPONENT . '.' . $this->getName() . '.edit';
     JHTML::_('behavior.tooltip');
     $config = hikashop_config();
     $this->assignRef('config', $config);
     $product_id = hikashop_getCID('variant_id');
     $product_parent_id = JRequest::getInt('product_id');
     $productClass = hikashop_get('class.product');
     $editing_variant = true;
     $this->assignRef('editing_variant', $editing_variant);
     $main_currency = $config->get('main_currency', 1);
     $this->assignRef('main_currency_id', $main_currency);
     $this->loadRef(array('toggleClass' => 'helper.toggle', 'currencyClass' => 'class.currency', 'popup' => 'helper.popup', 'quantityType' => 'type.quantity', 'uploaderType' => 'type.uploader', 'imageHelper' => 'helper.image', 'currencyType' => 'type.currency', 'weight' => 'type.weight', 'volume' => 'type.volume', 'characteristicType' => 'type.characteristic'));
     if (!empty($product_id)) {
         $product = $productClass->getRaw($product_id, true);
         if ((int) $product->product_parent_id != (int) $product_parent_id) {
             return false;
         }
         $product->main = $productClass->get($product_parent_id);
         $product->product_tax_id = $product->main->product_tax_id;
         $query = 'SELECT * FROM ' . hikashop_table('file') . ' WHERE file_ref_id = ' . (int) $product_id . ' AND file_type=\'product\' ORDER BY file_ordering, file_id';
         $db->setQuery($query);
         $product->images = $db->loadObjectList();
         $query = 'SELECT * FROM ' . hikashop_table('file') . ' WHERE file_ref_id = ' . (int) $product_id . ' AND file_type=\'file\' ORDER BY file_ordering, file_id';
         $db->setQuery($query);
         $product->files = $db->loadObjectList('file_id');
         $query = 'SELECT * FROM ' . hikashop_table('price') . ' WHERE price_product_id = ' . (int) $product_id;
         $db->setQuery($query);
         $product->prices = $db->loadObjectList();
         $query = 'SELECT v.*, c.* FROM ' . hikashop_table('variant') . ' AS v ' . ' INNER JOIN ' . hikashop_table('characteristic') . ' as c ON v.variant_characteristic_id = c.characteristic_id ' . ' WHERE characteristic_parent_id > 0 AND variant_product_id = ' . (int) $product_id;
         $db->setQuery($query);
         $characteristic_values = $db->loadObjectList('characteristic_parent_id');
         if (!empty($characteristic_values) && count($characteristic_values)) {
             $query = 'SELECT * FROM ' . hikashop_table('characteristic') . ' WHERE characteristic_id IN (' . implode(',', array_keys($characteristic_values)) . ') OR characteristic_parent_id IN (' . implode(',', array_keys($characteristic_values)) . ') ' . ' ORDER BY characteristic_parent_id ASC';
             $db->setQuery($query);
             $characteristics = $db->loadObjectList();
             $product->characteristics = array();
             foreach ($characteristics as $c) {
                 $charac_pid = (int) $c->characteristic_parent_id == 0 ? (int) $c->characteristic_id : (int) $c->characteristic_parent_id;
                 if (!isset($product->characteristics[$charac_pid])) {
                     $product->characteristics[$charac_pid] = new stdClass();
                     $product->characteristics[$charac_pid]->values = array();
                 }
                 if ((int) $c->characteristic_parent_id == 0) {
                     foreach ($c as $k => $v) {
                         $product->characteristics[$charac_pid]->{$k} = $v;
                     }
                 } else {
                     $product->characteristics[$charac_pid]->values[(int) $c->characteristic_id] = $c->characteristic_value;
                 }
             }
             foreach ($characteristic_values as $k => $v) {
                 $product->characteristics[$k]->default_id = (int) $v->characteristic_id;
             }
         }
     }
     if (!empty($product->product_tax_id)) {
         $main_tax_zone = explode(',', $config->get('main_tax_zone', ''));
         if (count($main_tax_zone)) {
             $main_tax_zone = array_shift($main_tax_zone);
         }
     }
     if (!empty($product->prices)) {
         foreach ($product->prices as $key => $price) {
             if (empty($price->price_value)) {
                 unset($product->prices[$key]);
             }
         }
         if (!empty($product->product_tax_id)) {
             foreach ($product->prices as &$price) {
                 $price->price_value_with_tax = $this->currencyClass->getTaxedPrice($price->price_value, $main_tax_zone, $product->product_tax_id);
             }
         } else {
             foreach ($product->prices as $key => $price) {
                 $price->price_value_with_tax = $price->price_value;
             }
         }
     }
     if (empty($product->prices)) {
         $obj = new stdClass();
         $obj->price_value = 0;
         $obj->price_value_with_tax = 0;
         $obj->price_currency_id = $main_currency;
         $product->prices = array($obj);
     }
     $editor = hikashop_get('helper.editor');
     $editor->setEditor($config->get('editor', ''));
     $editor->id = 'product_variant_editors_' . time();
     $editor->name = 'product_variant_description';
     $editor->content = $product->product_description;
     $editor->height = 200;
     $this->assignRef('editor', $editor);
     if (!isset($product->product_quantity) || $product->product_quantity < 0) {
         $product->product_quantity = JText::_('UNLIMITED');
     }
     if (!isset($product->product_max_per_order) || $product->product_max_per_order <= 0) {
         $product->product_max_per_order = JText::_('UNLIMITED');
     }
     $this->assignRef('product', $product);
     if (hikashop_level(2)) {
         hikashop_loadJslib('otree');
         $joomlaAcl = hikashop_get('type.joomla_acl');
         $this->assignRef('joomlaAcl', $joomlaAcl);
     }
     $translationHelper = hikashop_get('helper.translation');
     if ($translationHelper && $translationHelper->isMulti()) {
         $translationHelper->load('hikashop_product', @$product->product_id, $product);
         $this->assignRef('translationHelper', $translationHelper);
     }
     $main_currency = (int) $config->get('main_currency');
     $this->currencyType->load($main_currency);
     $currencies = $this->currencyType->currencies;
     $this->assignRef('currencies', $currencies);
     $default_currency = $this->currencyType->currencies[$main_currency];
     $this->assignRef('default_currency', $default_currency);
     $fieldsClass = hikashop_get('class.field');
     $fields = $fieldsClass->getFields('backend', $product, 'product', 'field&task=state');
     $null = array();
     $fieldsClass->addJS($null, $null, $null);
     $fieldsClass->jsToggle($fields, $product, 0);
     $this->assignRef('fieldsClass', $fieldsClass);
     $this->assignRef('fields', $fields);
     return true;
 }
Ejemplo n.º 15
0
<?php

/**
 * @package	HikaShop for Joomla!
 * @version	2.6.1
 * @author	hikashop.com
 * @copyright	(C) 2010-2016 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
if (!function_exists('curl_init')) {
    echo '<tr><td colspan="2"><strong>The PayJunction payment plugin needs the CURL library installed but it seems that it is not available on your server. Please contact your web hosting to set it up.</strong></td></tr>';
}
hikashop_loadJslib('mootools');
?>
<tr>
	<td class="key">
		<label for="data[payment][payment_params][login]">
			API Login
		</label>
	</td>
	<td>
		<input type="text" name="data[payment][payment_params][login]" value="<?php 
echo @$this->element->payment_params->login;
?>
" />
	</td>
</tr>
<tr>
	<td class="key">
		<label for="data[payment][payment_params][password]">
Ejemplo n.º 16
0
 public function customer_set()
 {
     $users = JRequest::getVar('cid', array(), '', 'array');
     $closePopup = JRequest::getInt('finalstep', 0);
     if ($closePopup) {
         $formData = JRequest::getVar('data', array(), '', 'array');
         $users = array((int) $formData['order']['order_user_id']);
     }
     $rows = array();
     $data = '';
     $singleSelection = true;
     //JRequest::getVar('single', false);
     $order_id = JRequest::getInt('order_id', 0);
     $elemStruct = array('user_email', 'user_cms_id', 'name', 'username', 'email');
     $set_address = JRequest::getInt('set_user_address', 0);
     if (!empty($users)) {
         JArrayHelper::toInteger($users);
         $db = JFactory::getDBO();
         $query = 'SELECT a.*, b.* FROM ' . hikashop_table('user') . ' AS a LEFT JOIN ' . hikashop_table('users', false) . ' AS b ON a.user_cms_id = b.id WHERE a.user_id IN (' . implode(',', $users) . ')';
         $db->setQuery($query);
         $rows = $db->loadObjectList();
         if (!empty($rows)) {
             $data = array();
             foreach ($rows as $v) {
                 $d = '{id:' . $v->user_id;
                 foreach ($elemStruct as $s) {
                     if ($s == 'id') {
                         continue;
                     }
                     $d .= ',' . $s . ':\'' . str_replace('"', '\'', $v->{$s}) . '\'';
                 }
                 if ($set_address && $singleSelection) {
                     $d .= ',updates:[\'billing\',\'shipping\',\'history\']';
                 }
                 $data[] = $d . '}';
             }
             if (!$singleSelection) {
                 $data = '[' . implode(',', $data) . ']';
             } else {
                 $data = $data[0];
                 $rows = $rows[0];
             }
         }
     }
     $this->assignRef('rows', $rows);
     $this->assignRef('data', $data);
     $this->assignRef('singleSelection', $singleSelection);
     $this->assignRef('order_id', $order_id);
     if ($closePopup) {
         hikashop_loadJslib('mootools');
         $js = 'window.hikashop.ready( function(){window.parent.hikashop.submitBox(' . $data . ');});';
         $doc = JFactory::getDocument();
         $doc->addScriptDeclaration($js);
     }
 }