" method="post" name="hikashop_form" id="hikashop_form" enctype="multipart/form-data"> <table width="100%"> <tr> <?php if (empty($this->element->file_path)) { ?> <td class="key"> <label for="files"><?php echo JText::_('HIKA_IMAGE'); ?> </label> </td> <td> <input type="file" name="files[]" size="30" /> <?php echo JText::sprintf('MAX_UPLOAD', hikashop_bytes(ini_get('upload_max_filesize')) > hikashop_bytes(ini_get('post_max_size')) ? ini_get('post_max_size') : ini_get('upload_max_filesize')); ?> </td> <?php } else { ?> <td class="key"> <label for="files"><?php echo JText::_('HIKA_IMAGE'); ?> </label> </td> <td><?php $image = $this->imageHelper->getThumbnail($this->element->file_path, array(100, 100), array('default' => true)); ?> <img src="<?php
function display($field, $value, $map, $inside, $options = '', $test = false, $allFields = null, $allValues = null) { $html = ''; if (!empty($value)) { $html .= $this->show($field, $value, 'hikashop_custom_file_upload_link'); } $map = str_replace('.', '_', $field->field_table) . '_' . $field->field_namekey; $html .= parent::display($field, $value, $map, $inside, $options, $test, $allFields, $allValues); $html .= '<span class="hikashop_custom_file_upload_message">' . JText::sprintf('MAX_UPLOAD', hikashop_bytes(ini_get('upload_max_filesize')) > hikashop_bytes(ini_get('post_max_size')) ? ini_get('post_max_size') : ini_get('upload_max_filesize')) . '</span>'; return $html; }
private function processOptions(&$options, $mode = 'image') { $t = hikashop_getFormToken(); if (!empty($options['uploader'])) { $params = ''; if (!empty($options['vars'])) { $options['formData'] = $options['vars']; $options['formData'][$t] = 1; foreach ($options['vars'] as $k => $v) { $params .= '&' . urlencode($k) . '=' . urlencode($v); } } if (!empty($options['upload'])) { if (empty($options['upload_base_url'])) { $options['uploadUrls'] = array(0 => hikashop_completeLink('upload&task=' . $mode . '&uploader=' . $options['uploader'][0] . '&field=' . $options['uploader'][1] . $params . '&' . $t . '=1', true), 1 => hikashop_completeLink('upload&task=upload&upload=' . $mode . '&uploader=' . $options['uploader'][0] . '&field=' . $options['uploader'][1], true, false, true)); } else { $options['uploadUrls'] = array(0 => JRoute::_($options['upload_base_url'] . '&task=' . $mode . '&uploader=' . $options['uploader'][0] . '&field=' . $options['uploader'][1] . $params . '&' . $t . '=1&tmpl=component'), 1 => str_replace('&', '&', JRoute::_($options['upload_base_url'] . '&task=upload&upload=' . $mode . '&uploader=' . $options['uploader'][0] . '&field=' . $options['uploader'][1] . '&tmpl=component'))); } } if (!empty($options['gallery']) && $mode == 'image') { if (empty($options['upload_base_url'])) { $options['browseUrl'] = hikashop_completeLink('upload&task=galleryimage&uploader=' . $options['uploader'][0] . '&field=' . $options['uploader'][1] . $params, true); } else { $options['browseUrl'] = JRoute::_($options['upload_base_url'] . '&task=galleryimage&uploader=' . $options['uploader'][0] . '&field=' . $options['uploader'][1] . $params . '&tmpl=component'); } } } if (empty($options['classes'])) { $options['classes'] = array('mainDiv' => 'hikashop_main_' . $mode . '_div'); } if (!isset($options['classes']['mainDiv'])) { $options['classes']['mainDiv'] = ''; } if (!isset($options['classes']['firstImg'])) { $options['classes']['firstImg'] = 'hikashop_upload_imagethumb_main'; } if (!isset($options['classes']['otherImg'])) { $options['classes']['otherImg'] = 'hikashop_upload_imagethumb_small'; } if (!isset($options['classes']['contentClass'])) { $options['classes']['contentClass'] = ''; } if (empty($options['classes']['btn_upload'])) { $options['classes']['btn_upload'] = 'hika_upload_btn'; } if (empty($options['classes']['btn_add'])) { $options['classes']['btn_add'] = 'hika_add_btn'; } $maxSize = min(hikashop_bytes(ini_get('upload_max_filesize')), hikashop_bytes(ini_get('post_max_size'))); if (empty($options['maxSize'])) { $options['maxSize'] = $maxSize; } else { $size = (int) $options['maxSize']; if ('' . $size != $options['maxSize']) { $size = hikashop_bytes($options['maxSize']); } $options['maxSize'] = min($size, $maxSize); } if (empty($options['uploadUrls'])) { $options['uploadUrls'] = null; } if (empty($options['browseUrl'])) { $options['browseUrl'] = null; } if (empty($options['text'])) { $options['text'] = ''; } if (!empty($options['formData']) && !is_string($options['formData'])) { $options['formData'] = json_encode($options['formData']); } else { $options['formData'] = '{\'' . $t . '\':1}'; } }
function onMassactionTableFiltersLoad(&$table, &$filters, &$filters_html, &$loadedData) { $db = JFactory::getDBO(); $operators = hikashop_get('type.operators'); $cid = hikashop_getCID(); $tables = array(); $custom = ''; $type = 'filter'; $massactionClass = hikashop_get('class.massaction'); if (empty($loadedData->massaction_filters)) { $loadedData->massaction_filters = array(); } switch ($table->table) { case 'product': $tables = array('product', 'price', 'category', 'characteristic', 'product_related', 'product_option'); $filters['productType'] = JText::_('PRODUCT_TYPE'); $loadedData->massaction_filters['__num__'] = new stdClass(); $loadedData->massaction_filters['__num__']->type = 'product'; $loadedData->massaction_filters['__num__']->data = array(); $loadedData->massaction_filters['__num__']->name = 'productType'; $loadedData->massaction_filters['__num__']->data['type'] = 'all'; $loadedData->massaction_filters['__num__']->html = ''; foreach ($loadedData->massaction_filters as $key => &$value) { if ($value->name != 'productType' || $table->table != $loadedData->massaction_table && is_int($key)) { continue; } $value->type = 'product'; $product = hikashop_get('type.product'); $product->onchange = 'countresults(\'' . $table->table . '\',' . $key . ');'; $output = $product->display('filter[' . $table->table . '][' . $key . '][productType][type]', $value->data['type'], 'chzn-done not-processed'); $filters_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output); } $filters['csvImport'] = JText::_('CSV_IMPORT'); $loadedData->massaction_filters['__num__'] = new stdClass(); $loadedData->massaction_filters['__num__']->type = 'product'; $loadedData->massaction_filters['__num__']->data = array(); $loadedData->massaction_filters['__num__']->name = 'csvImport'; $loadedData->massaction_filters['__num__']->data['path'] = ''; $loadedData->massaction_filters['__num__']->data['pathType'] = ''; $loadedData->massaction_filters['__num__']->data['type'] = ''; $loadedData->massaction_filters['__num__']->html = ''; foreach ($loadedData->massaction_filters as $key => &$value) { if ($value->name != 'csvImport' || $table->table != $loadedData->massaction_table && is_int($key)) { continue; } $value->type = 'product'; $data = $value->data; if ($data['type'] == 'in' || empty($data['type'])) { $typeIn1 = ' selected="selected" '; $typeIn2 = ''; } else { $typeIn2 = ' selected="selected" '; $typeIn1 = ''; } $checked = ''; if (isset($data['save'])) { $checked = 'checked="checked"'; } $output = '<select class="chzn-done not-processed" name="filter[' . $table->table . '][' . $key . '][csvImport][type]" onchange="countresults(\'' . $table->table . '\',' . $key . ')"><option value="in" ' . $typeIn1 . '>' . JText::_('IN_CSV') . '</option><option value="out" ' . $typeIn2 . '>' . JText::_('NOT_IN_CSV') . '</option></select>'; $output .= '<select class="chzn-done not-processed" name="filter[' . $table->table . '][' . $key . '][csvImport][pathType]" id="productfilter' . $key . 'csvImport_pathType" onchange="hikashop_switchmode(this,' . $key . ');"><option value="upload">' . JText::_('HIKA_FILE_MODE_UPLOAD') . '</option><option value="path" selected="selected">' . JText::_('HIKA_FILE_MODE_PATH') . '</option></select>'; $output .= '<span id="productfilter' . $key . 'csvImport_path"><input onchange="countresults(\'' . $table->table . '\',' . $key . ')" type="input" value="' . $data['path'] . '" size="50" id="productfilter' . $key . 'csvImport_path_value" name="filter[' . $table->table . '][' . $key . '][csvImport][path]"/><input type="button" value="' . JText::_('VERIFY_FILE') . '" onclick="hikashop_verifycsvcolumns(' . $key . ');"/></span>'; $output .= '<span id="productfilter' . $key . 'csvImport_upload" style="display: none;"><input onchange="countresults(\'' . $table->table . '\',' . $key . ')" type="file" size="50" id="productfilter' . $key . 'csvImport_upload" name="filter_' . $table->table . '_' . $key . '_csvImport_upload"/>'; $output .= '<span id="productfilter' . $key . 'csvImport_txt">' . JText::sprintf('MAX_UPLOAD', hikashop_bytes(ini_get('upload_max_filesize')) > hikashop_bytes(ini_get('post_max_size')) ? ini_get('post_max_size') : ini_get('upload_max_filesize')) . '</span></span>'; $output .= '<br/><input type="checkbox" value="1" id="importCsvSave" name="filter[' . $table->table . '][' . $key . '][csvImport][save]" ' . $checked . '/><label for="importCsvSave">' . JText::_('SAVE_ON_CSV_IMPORT_MASSACTION') . '</label>'; $output .= '<div id="productfilter' . $key . 'csvImport_verify"></div>'; $filters_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output); } break; case 'category': $tables = array('category', 'parent_category'); $filters['categoryType'] = JText::_('CATEGORY_TYPE'); $loadedData->massaction_filters['__num__'] = new stdClass(); $loadedData->massaction_filters['__num__']->type = 'category'; $loadedData->massaction_filters['__num__']->data = array(); $loadedData->massaction_filters['__num__']->name = 'categoryType'; $loadedData->massaction_filters['__num__']->data['type'] = 'all'; $loadedData->massaction_filters['__num__']->html = ''; foreach ($loadedData->massaction_filters as $key => &$value) { if ($value->name != 'categoryType' || $table->table != $loadedData->massaction_table && is_int($key)) { continue; } $value->type = 'category'; $category = hikashop_get('type.category'); $category->onchange = 'countresults(\'' . $table->table . '\',' . $key . ');'; $output = $category->display('filter[' . $table->table . '][' . $key . '][categoryType][type]', $value->data['type']); $filters_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output); } break; case 'order': $tables = array('order', 'order_product', 'address', 'user'); $filters['orderStatus'] = JText::_('ORDER_STATUS'); $loadedData->massaction_filters['__num__'] = new stdClass(); $loadedData->massaction_filters['__num__']->type = 'order'; $loadedData->massaction_filters['__num__']->data = array(); $loadedData->massaction_filters['__num__']->name = 'orderStatus'; $loadedData->massaction_filters['__num__']->html = ''; $db->setQuery('SELECT `category_name` FROM ' . hikashop_table('category') . ' WHERE `category_type` = ' . $db->quote('status') . ' AND `category_name` != ' . $db->quote('order status')); if (!HIKASHOP_J25) { $orderStatuses = $db->loadResultArray(); } else { $orderStatuses = $db->loadColumn(); } foreach ($loadedData->massaction_filters as $key => &$value) { if (!isset($value->data['type'])) { $value->data['type'] = 'all'; } if ($value->name != 'orderStatus' || $table->table != $loadedData->massaction_table && is_int($key)) { continue; } $value->type = 'order'; $output = '<select class="chzn-done not-processed" name="filter[' . $table->table . '][' . $key . '][orderStatus][type]" onchange="countresults(\'' . $table->table . '\',' . $key . ')">'; if (is_array($orderStatuses)) { foreach ($orderStatuses as $orderStatus) { $selected = ''; if ($orderStatus == $value->data['type']) { $selected = 'selected="selected"'; } $output .= '<option value="' . $orderStatus . '" ' . $selected . '>' . JText::_($orderStatus) . '</option>'; } } $output .= '</select>'; $filters_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output); } $filters['totalPurchase'] = JText::_('USER_TOTAL_PURCHASE'); $loadedData->massaction_filters['__num__'] = new stdClass(); $loadedData->massaction_filters['__num__']->type = 'order'; $loadedData->massaction_filters['__num__']->data = array(); $loadedData->massaction_filters['__num__']->name = 'totalPurchase'; $loadedData->massaction_filters['__num__']->html = ''; $totalTypes = array('orderQty' => 'ORDER_TOTAL_QUANTITY', 'orderAmount' => 'ORDER_TOTAL_AMOUNT', 'productTotal' => 'PRODUCT_TOTAL_QUANTITY'); foreach ($loadedData->massaction_filters as $key => &$value) { if (!isset($value->data['type'])) { $value->data['type'] = 'orderQty'; } if (!isset($value->data['operator'])) { $value->data['operator'] = '='; } if (!isset($value->data['value'])) { $value->data['value'] = ''; } if ($value->name != 'totalPurchase' || $table->table != $loadedData->massaction_table && is_int($key)) { continue; } $value->type = 'order'; $output = '<select class="chzn-done not-processed" name="filter[' . $table->table . '][' . $key . '][totalPurchase][type]" onchange="countresults(\'' . $table->table . '\',' . $key . ')">'; if (is_array($totalTypes)) { foreach ($totalTypes as $selectKey => $selectValue) { $selected = ''; if ($selectKey == $value->data['type']) { $selected = 'selected="selected"'; } $output .= '<option value="' . $selectKey . '" ' . $selected . '>' . JText::_($selectValue) . '</option>'; } } $output .= '</select>'; $cOperators = array('=', '!=', '>', '<', '>=', '<='); $output .= '<select class="chzn-done not-processed" name="filter[' . $table->table . '][' . $key . '][totalPurchase][operator]" onchange="countresults(\'' . $table->table . '\',\'' . $key . '\')">'; foreach ($cOperators as $cOperator) { $selected = ''; if ($cOperator == $value->data['operator']) { $selected = 'selected="selected"'; } $output .= '<option value="' . $cOperator . '" ' . $selected . '>' . JText::_($cOperator) . '</option>'; } $output .= '</select>'; $output .= ' <input class="inputbox" type="text" name="filter[' . $table->table . '][' . $key . '][totalPurchase][value]" size="50" value="' . $value->data['value'] . '" onchange="countresults(\'' . $table->table . '\',\'' . $key . '\')" />'; $filters_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output); } break; case 'user': $tables = array('user', 'address'); $filters['haveDontHave'] = JText::_('HAVE_DONT_HAVE'); $loadedData->massaction_filters['__num__'] = new stdClass(); $loadedData->massaction_filters['__num__']->type = 'user'; $loadedData->massaction_filters['__num__']->data = array('have' => 'have', 'type' => '', 'order_status' => 'created'); $loadedData->massaction_filters['__num__']->name = 'haveDontHave'; $loadedData->massaction_filters['__num__']->html = ''; $db->setQuery('SELECT `category_name` FROM ' . hikashop_table('category') . ' WHERE `category_type` = ' . $db->quote('status') . ' AND `category_name` != ' . $db->quote('order status')); if (!HIKASHOP_J25) { $orderStatuses = $db->loadResultArray(); } else { $orderStatuses = $db->loadColumn(); } foreach ($loadedData->massaction_filters as $key => &$value) { if ($value->name != 'haveDontHave' || $table->table != $loadedData->massaction_table && is_int($key)) { continue; } $value->type = 'user'; $output = '<select class="chzn-done not-processed" name="filter[' . $table->table . '][' . $key . '][haveDontHave][have]" id="userfilter' . $key . 'haveDontHavetype" onchange="countresults(\'' . $table->table . '\',' . $key . ')">'; $datas = array('have' => 'HAVE', 'donthave' => 'DONT_HAVE'); $display = 'style="display: none;"'; foreach ($datas as $k => $data) { $selected = ''; if ($k == $value->data['have']) { $selected = 'selected="selected"'; } if ($value->data['have'] == 'order_status') { $display = ''; } $output .= '<option value="' . $k . '" ' . $selected . '>' . JText::_('' . $data . '') . '</option>'; } $output .= '</select>'; $output .= '<select class="chzn-done not-processed" name="filter[' . $table->table . '][' . $key . '][haveDontHave][type]" id="userfilter' . $key . 'haveDontHavetype" onchange="showSubSelect(this.value,' . $key . '); countresults(\'' . $table->table . '\',' . $key . ')">'; $datas = array('order' => 'HIKASHOP_ORDER', 'order_status' => 'ORDER_STATUS', 'address' => 'ADDRESS'); $display = 'style="display: none;"'; foreach ($datas as $k => $data) { $selected = ''; if ($k == $value->data['type']) { $selected = 'selected="selected"'; } if ($value->data['type'] == 'order_status') { $display = ''; } $output .= '<option value="' . $k . '" ' . $selected . '>' . JText::_('' . $data . '') . '</option>'; } $output .= '</select>'; $output .= '<select class="chzn-done not-processed" id="userfilter' . $key . 'haveDontHaveorderStatus" ' . $display . ' name="filter[' . $table->table . '][' . $key . '][haveDontHave][order_status]" onchange="countresults(\'' . $table->table . '\',' . $key . ')">'; if (is_array($orderStatuses)) { foreach ($orderStatuses as $orderStatus) { $selected = ''; if ($orderStatus == $value->data['order_status']) { $selected = 'selected="selected"'; } $output .= '<option value="' . $orderStatus . '" ' . $selected . '>' . JText::_($orderStatus) . '</option>'; } } $output .= '</select>'; $output .= '<input type="hidden" id="userfilter' . $key . 'haveDontHavehide" name="filter[' . $table->table . '][' . $key . '][haveDontHave][show]" value="0"/>'; $filters_html['haveDontHave'] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output); } $filters_html['haveDontHave'] .= ' <script type="text/javascript"> var d = document; var hide = d.getElementById(\'userfilter' . $key . 'haveDontHavehide\').value; if(hide != 0){d.getElementById(hide).style.display = \'inline-block\';} function showSubSelect(type, k){ if(type == \'order_status\'){ d.getElementById(\'userfilter\'+k+\'haveDontHaveorderStatus\').style.display = \'inline-block\'; d.getElementById(\'userfilter\'+k+\'haveDontHavehide\').value = \'userfilter\'+k+\'haveDontHaveorderStatus\'; }else{ d.getElementById(\'userfilter\'+k+\'haveDontHaveorderStatus\').style.display = \'none\'; d.getElementById(\'userfilter\'+k+\'haveDontHavehide\').value = \'0\'; } } </script> '; break; case 'address': $tables = array('address', 'user'); break; } if (version_compare(JVERSION, '3.0', '<')) { $fieldsTable = $db->getTableFields('#__hikashop_user'); $hkUsers = reset($fieldsTable); $fieldsTable = $db->getTableFields('#__users'); $jUsers = reset($fieldsTable); } else { $hkUsers = $db->getTableColumns('#__hikashop_user'); $jUsers = $db->getTableColumns('#__users'); } ksort($hkUsers); ksort($jUsers); $loadedData->massaction_filters['__num__'] = new stdClass(); $loadedData->massaction_filters['__num__']->type = $table->table; $loadedData->massaction_filters['__num__']->data = array(); $loadedData->massaction_filters['__num__']->data['type'] = ''; $loadedData->massaction_filters['__num__']->data['operator'] = ''; $loadedData->massaction_filters['__num__']->data['value'] = ''; $loadedData->massaction_filters['__num__']->name = ''; $loadedData->massaction_filters['__num__']->html = ''; foreach ($loadedData->massaction_filters as $key => &$value) { if (!isset($value->data['type'])) { $value->data['type'] = ''; } if (!isset($value->data['operator'])) { $value->data['operator'] = '='; } if (!isset($value->data['value'])) { $value->data['value'] = ''; } if (!isset($value->data['address'])) { $value->data['address'] = ''; } if (!empty($tables)) { if (!is_array($tables)) { $tables = array($tables); } foreach ($tables as $relatedTable) { $column = $relatedTable . 'Column'; $loadedData->massaction_filters['__num__']->name = $column; $filters[$column] = JText::_('' . strtoupper($relatedTable) . '_COLUMN'); if ($relatedTable == 'product_option') { $relatedTable = 'product_related'; } if ($relatedTable == 'parent_category') { $relatedTable = 'category'; } if (version_compare(JVERSION, '3.0', '<')) { $fieldsTable = $db->getTableFields('#__hikashop_' . $relatedTable); $fields = reset($fieldsTable); } else { $fields = $db->getTableColumns('#__hikashop_' . $relatedTable); } ksort($fields); $typeField = array(); if (!empty($fields)) { foreach ($fields as $oneField => $fieldType) { $typeField[] = JHTML::_('select.option', $oneField, $oneField); } } $user = '******' . $table->table . '][' . $key . '][userColumn][type]" onchange="countresults(\'' . $table->table . '\',' . $key . ')" >'; $user .= '<optgroup label="HIKA_USER">'; foreach ($hkUsers as $key2 => $hkUser) { $tmpVal = str_replace('hk_user.', '', $value->data['type']); if ($key2 == $tmpVal) { $user .= '<option value="hk_user.' . $key2 . '" selected="selected">' . $key2 . '</option>'; } else { $user .= '<option value="hk_user.' . $key2 . '">' . $key2 . '</option>'; } } $user .= '</optgroup>'; $user .= '<optgroup label="JOOMLA_USER">'; foreach ($jUsers as $key2 => $jUser) { $tmpVal = str_replace('joomla_user.', '', $value->data['type']); if ($key2 == $tmpVal) { $user .= '<option value="joomla_user.' . $key2 . '" selected="selected">' . $key2 . '</option>'; } else { $user .= '<option value="joomla_user.' . $key2 . '">' . $key2 . '</option>'; } } $user .= '</optgroup>'; $user .= '</select>'; switch ($table->table) { case 'product': if ($relatedTable == 'characteristic') { $db->setQuery('SELECT * FROM ' . hikashop_table('characteristic') . ' WHERE characteristic_parent_id = 0'); $characteristics = $db->loadObjectList(); if (is_array($characteristics)) { $custom = '<select class="chzn-done not-processed" name="filter[' . $table->table . '][' . $key . '][characteristicColumn][type]" onchange="countresults(' . $table->table . ',' . $key . ')" >'; foreach ($characteristics as $charact) { $selected = ''; if ($charact->characteristic_value == $value->data['type']) { $selected = 'selected="selected"'; } $custom .= '<option value="' . $charact->characteristic_value . '" ' . $selected . '>' . $charact->characteristic_value . '</option>'; } $custom .= '</select>'; } } elseif (in_array($relatedTable, array('product_related', 'product_option'))) { if (version_compare(JVERSION, '3.0', '<')) { $fieldsTable = $db->getTableFields('#__hikashop_product'); $fields = reset($fieldsTable); } else { $fields = $db->getTableColumns('#__hikashop_product'); } ksort($fields); $typeField = array(); if (!empty($fields)) { foreach ($fields as $oneField => $fieldType) { $typeField[] = JHTML::_('select.option', $oneField, $oneField); } } $custom = JHTML::_('select.genericlist', $typeField, "filter[" . $table->table . "][{$key}][" . $column . "][type]", 'class="inputbox chzn-done not-processed" onchange="countresults(\'' . $table->table . '\',' . $key . ')" size="1"', 'value', 'text', $value->data['type']); } else { $custom = ''; } break; case 'category': $custom = ''; break; case 'order': if ($relatedTable == 'address') { $datas = array('both' => 'DISPLAY_BOTH', 'bill' => 'HIKASHOP_BILLING_ADDRESS', 'ship' => 'HIKASHOP_SHIPPING_ADDRESS'); $custom = '<select class="chzn-done not-processed" onchange="countresults(\'' . $table->table . '\',' . $key . ')" name="filter[' . $table->table . '][' . $key . '][addressColumn][address]" >'; foreach ($datas as $k => $data) { $selected = ''; if ($k == $value->data['address']) { $selected = 'selected="selected"'; } $custom .= '<option value="' . $k . '" ' . $selected . '>' . JText::sprintf('' . $data . '') . '</option>'; } $custom .= '</select>'; } elseif ($relatedTable == 'user') { $custom = $user; } else { $custom = ''; } break; case 'user': if ($relatedTable == 'user') { $custom = $user; } else { $custom = ''; } break; case 'address': if ($relatedTable == 'user') { $custom = $user; } else { $custom = ''; } break; } if ($value->name != $column || $table->table != $loadedData->massaction_table && is_int($key)) { continue; } $value->type = $relatedTable; $output = $custom; if (!in_array($relatedTable, array('characteristic', 'product_related', 'user'))) { $output .= JHTML::_('select.genericlist', $typeField, "filter[" . $table->table . "][" . $key . "][" . $column . "][type]", 'class="inputbox chzn-done not-processed" onchange="countresults(\'' . $table->table . '\',\'' . $key . '\')" size="1"', 'value', 'text', $value->data['type']); } $output .= $operators->display('filter[' . $table->table . '][' . $key . '][' . $column . '][operator]" onchange="countresults(\'' . $table->table . '\',\'' . $key . '\')"', $value->data['operator'], "chzn-done not-processed"); $output .= ' <input class="inputbox" type="text" name="filter[' . $table->table . '][' . $key . '][' . $column . '][value]" size="50" value="' . $value->data['value'] . '" onchange="countresults(\'' . $table->table . '\',\'' . $key . '\')" />'; $filters_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output); } } } $loadedData->massaction_filters['__num__'] = new stdClass(); $loadedData->massaction_filters['__num__']->name = 'limit'; $loadedData->massaction_filters['__num__']->type = $table->table; $loadedData->massaction_filters['__num__']->data = array(); $loadedData->massaction_filters['__num__']->data['start'] = '0'; $loadedData->massaction_filters['__num__']->data['value'] = '500'; $loadedData->massaction_filters['__num__']->html = ''; foreach ($loadedData->massaction_filters as $key => &$value) { if ($value->name != 'limit' || $table->table != $loadedData->massaction_table && is_int($key)) { continue; } $value->type = $table->table; if (!isset($value->data['start'])) { $value->data['start'] = 0; } if (!isset($value->data['value'])) { $value->data['value'] = 500; } $output = '<div id="' . $table->table . 'filter' . $key . 'limit">' . JText::_('HIKA_START') . ' : <input type="text" name="filter[' . $table->table . '][' . $key . '][limit][start]" value="' . $value->data['start'] . '" /> ' . JText::_('VALUE') . ' : <input type="text" name="filter[' . $table->table . '][' . $key . '][limit][value]" value="' . $value->data['value'] . '"/>' . '</div>'; $filters_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output); } $filters['ordering'] = JText::_('ORDERING'); $loadedData->massaction_filters['__num__'] = new stdClass(); $loadedData->massaction_filters['__num__']->name = 'ordering'; $loadedData->massaction_filters['__num__']->type = $table->table; $loadedData->massaction_filters['__num__']->data = array(); $loadedData->massaction_filters['__num__']->data['value'] = ''; $loadedData->massaction_filters['__num__']->html = ''; foreach ($loadedData->massaction_filters as $key => &$value) { if ($value->name != 'ordering' || $table->table != $loadedData->massaction_table && is_int($key)) { continue; } $value->type = $table->table; if (!isset($value->data['value'])) { $value->data['value'] = $table->table . '_id'; } if (version_compare(JVERSION, '3.0', '<')) { $fieldsTable = $db->getTableFields('#__hikashop_' . $table->table); $fields = reset($fieldsTable); } else { $fields = $db->getTableColumns('#__hikashop_' . $table->table); } ksort($fields); if (!isset($value->data['value'])) { $value->data['value'] = $table->table . '_id'; } $output = '<div id="' . $table->table . 'filter' . $key . 'ordering">' . JText::_('VALUE') . ' : '; $output .= '<select class="chzn-done not-processed" name="filter[' . $table->table . '][' . $key . '][ordering][value]">'; foreach ($fields as $field => $fieldType) { $selected = ''; if ($value->data['value'] == $field) { $selected = 'selected="selected"'; } $output .= '<option value="' . $field . '" ' . $selected . '>' . $field . '</option>'; } $output .= '</select></div>'; $filters_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output); } $filters['direction'] = JText::_('MASSACTION_ORDERING_DIRECTION'); $loadedData->massaction_filters['__num__'] = new stdClass(); $loadedData->massaction_filters['__num__']->name = 'direction'; $loadedData->massaction_filters['__num__']->type = $table->table; $loadedData->massaction_filters['__num__']->data = array(); $loadedData->massaction_filters['__num__']->data['value'] = ''; $loadedData->massaction_filters['__num__']->html = ''; foreach ($loadedData->massaction_filters as $key => &$value) { if ($value->name != 'direction' || $table->table != $loadedData->massaction_table && is_int($key)) { continue; } $value->type = $table->table; if (!isset($value->data['value'])) { $value->data['value'] = 'ASC'; } $output = '<div id="' . $table->table . 'filter' . $key . 'direction">' . JText::_('VALUE') . ' : <select class="chzn-done not-processed" name="filter[' . $table->table . '][' . $key . '][direction][value]">'; $values = array('ASC', 'DESC'); foreach ($values as $oneValue) { $selected = ''; if ($value->data['value'] == $oneValue) { $selected = 'selected="selected"'; } $output .= '<option value="' . $oneValue . '" ' . $selected . '>' . $oneValue . '</option>'; } $output .= '</select>' . '</div>'; $filters_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output); } if (hikashop_level(2)) { if (in_array($table->table, array('product', 'category'))) { $filters['accessLevel'] = JText::_('ACCESS_LEVEL'); } else { $filters['accessLevel'] = JText::_('USER_WITH_ACL'); } $loadedData->massaction_filters['__num__'] = new stdClass(); $loadedData->massaction_filters['__num__']->name = 'accessLevel'; $loadedData->massaction_filters['__num__']->type = $table->table; $loadedData->massaction_filters['__num__']->data = array(); $loadedData->massaction_filters['__num__']->data['type'] = ''; $loadedData->massaction_filters['__num__']->data['group'] = ''; $loadedData->massaction_filters['__num__']->html = ''; if (!HIKASHOP_J16) { $acl = JFactory::getACL(); $groups = $acl->get_group_children_tree(null, 'USERS', false); } else { $db = JFactory::getDBO(); $db->setQuery('SELECT a.*, a.title as text, a.id as value FROM #__usergroups AS a ORDER BY a.lft ASC'); $groups = $db->loadObjectList('id'); foreach ($groups as $id => $group) { if (isset($groups[$group->parent_id])) { $groups[$id]->level = intval(@$groups[$group->parent_id]->level) + 1; $groups[$id]->text = str_repeat('- - ', $groups[$id]->level) . $groups[$id]->text; } } } $inoperator = hikashop_get('type.operatorsin'); foreach ($loadedData->massaction_filters as $key => &$value) { if ($value->name != 'accessLevel' || $table->table != $loadedData->massaction_table && is_int($key)) { continue; } $value->type = $table->table; $inoperator->js = 'onchange="countresults(\'' . $table->table . '\',' . $key . ')"'; $output = $inoperator->display("filter[" . $table->table . "][{$key}][accessLevel][type]", $value->data['type'], 'chzn-done not-processed') . ' ' . JHTML::_('select.genericlist', $groups, "filter[" . $table->table . "][{$key}][accessLevel][group]", 'class="inputbox chzn-done not-processed" size="1" onchange="countresults(\'' . $table->table . '\',' . $key . ')"', 'value', 'text', $value->data['group']); $filters_html[$value->name] = $massactionClass->initDefaultDiv($value, $key, $type, $table->table, $loadedData, $output); } } ?> <script type="text/javascript"> function hikashop_verifycsvcolumns(k){ var target = "productfilter"+k+"csvImport_verify"; var url = "<?php echo hikashop_completeLink('massaction&task=displayassociate&tmpl=component', false, false, true); ?> "; var data = "cid=<?php echo hikashop_getCID(); ?> ¤t_filter="+k+"&csv_path=" + encodeURIComponent(document.getElementById("productfilter"+k+"csvImport_path_value").value); if(data != ""){ window.Oby.xRequest(url, {update: target, mode: "POST", data: data}); } } function hikashop_switchmode(el,k) { var d = document, v = el.value, modes = ['upload','path'], e = null; for(var i = 0; i < modes.length; i++) { mode = modes[i]; e = d.getElementById('productfilter'+k+'csvImport_'+mode); if(!e) continue; if(v == mode) { e.style.display = ''; } else { e.style.display = 'none'; } if(v != 'upload'){ d.getElementById('productfilter'+k+'csvImport_path').style.display = ''; d.getElementById('productfilter'+k+'csvImport_upload').style.display = 'none'; }else{ d.getElementById('productfilter'+k+'csvImport_path').style.display = 'none'; d.getElementById('productfilter'+k+'csvImport_upload').style.display = ''; } } } </script> <?php }
function form() { $mail_name = JRequest::getString('mail_name'); $mailClass = hikashop_get('class.mail'); $data = true; $mail = $mailClass->get($mail_name, $data); if (empty($mail)) { $config =& hikashop_config(); $mail->from_name = $config->get('from_name'); $mail->from_email = $config->get('from_email'); $mail->reply_name = $config->get('reply_name'); $mail->reply_email = $config->get('reply_email'); $mail->subject = ''; $mail->html = 1; $mail->published = 1; $mail->body = ''; $mail->altbody = ''; $mail->preload = ''; $mail->mail = $mail_name; $mail->email_log_published = 1; } $tabs = hikashop_get('helper.tabs'); $values = new stdClass(); $values->maxupload = hikashop_bytes(ini_get('upload_max_filesize')) > hikashop_bytes(ini_get('post_max_size')) ? ini_get('post_max_size') : ini_get('upload_max_filesize'); $toggleClass = hikashop_get('helper.toggle'); $js = ' function updateEditor(htmlvalue){ if(htmlvalue == "0"){window.document.getElementById("htmlfieldset").style.display = "none"}else{window.document.getElementById("htmlfieldset").style.display = "block"; } } window.addEvent("load", function(){ updateEditor(' . $mail->html . '); });'; $script = ' function addFileLoader(){ var divfile=window.document.getElementById("loadfile"); var input = document.createElement("input"); input.type = "file"; input.size = "30"; input.name = "attachments[]"; divfile.appendChild(document.createElement("br")); divfile.appendChild(input); } function submitbutton(pressbutton){ if (pressbutton == "cancel") { submitform( pressbutton ); return; } if(window.document.getElementById("subject").value.length < 2){alert("' . JText::_('ENTER_SUBJECT', true) . '"); return false;} submitform(pressbutton); } '; if (!HIKASHOP_PHP5) { $doc =& JFactory::getDocument(); } else { $doc = JFactory::getDocument(); } $doc->addScriptDeclaration($js . $script); if (JRequest::getString('tmpl') != 'component') { $this->toolbar = array('save', 'apply', 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form')); hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=edit&mail_name=' . $mail_name); } $this->assignRef('toggleClass', $toggleClass); $this->assignRef('values', $values); $this->assignRef('mail_name', $mail_name); $this->assignRef('mail', $mail); $this->assignRef('tabs', $tabs); $editor = hikashop_get('helper.editor'); $this->assignRef('editor', $editor); }