本文整理汇总了PHP中Currency::getSign方法的典型用法代码示例。如果您正苦于以下问题:PHP Currency::getSign方法的具体用法?PHP Currency::getSign怎么用?PHP Currency::getSign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Currency
的用法示例。
在下文中一共展示了Currency::getSign方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayForm
public function displayForm($isMainTab = true)
{
global $currentIndex;
parent::displayForm();
if (!($obj = $this->loadObject(true))) {
return;
}
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
echo '
<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post">
' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . '
<fieldset><legend><img src="../img/t/AdminRangePrice.gif" />' . $this->l('Price ranges') . '</legend>
<label>' . $this->l('Carrier') . '</label>
<div class="margin-form">
<select name="id_carrier">';
$carriers = Carrier::getCarriers((int) Configuration::get('PS_LANG_DEFAULT'), true, false, false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
$id_carrier = Tools::getValue('id_carrier', $obj->id_carrier);
foreach ($carriers as $carrier) {
echo '<option value="' . (int) $carrier['id_carrier'] . '"' . ($carrier['id_carrier'] == $id_carrier ? ' selected="selected"' : '') . '>' . $carrier['name'] . '</option><sup>*</sup>';
}
echo '
</select>
<p class="clear">' . $this->l('Carrier to which this range will be applied') . '</p>
</div>
<label>' . $this->l('From:') . ' </label>
<div class="margin-form">
' . $currency->getSign('left') . '<input type="text" size="4" name="delimiter1" value="' . htmlentities($this->getFieldValue($obj, 'delimiter1'), ENT_COMPAT, 'UTF-8') . '" />' . $currency->getSign('right') . '<sup>*</sup>
<p class="clear">' . $this->l('Range start (included)') . '</p>
</div>
<label>' . $this->l('To:') . ' </label>
<div class="margin-form">
' . $currency->getSign('left') . '<input type="text" size="4" name="delimiter2" value="' . htmlentities($this->getFieldValue($obj, 'delimiter2'), ENT_COMPAT, 'UTF-8') . '" />' . $currency->getSign('right') . '<sup>*</sup>
<p class="clear">' . $this->l('Range end (excluded)') . '</p>
</div>
<div class="margin-form">
<input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" />
</div>
<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
</fieldset>
</form>';
}
示例2: _displayForm
//.........这里部分代码省略.........
echo '<input type="radio" name="' . $key . '" id="' . $key . $cValue . '_on" value="' . (int) $cValue . '"' . ($cValue == $val ? ' checked="checked"' : '') . (isset($field['js'][$cValue]) ? ' ' . $field['js'][$cValue] : '') . ' /><label class="t" for="' . $key . $cValue . '_on"> ' . $cKey . '</label><br />';
}
echo '<br />';
break;
case 'image':
echo '
<table cellspacing="0" cellpadding="0" width="100%" style="text-align:left;">
<tr>';
if ($name == 'themes') {
echo '
<td colspan="' . sizeof($field['list']) . '">
<b>' . $this->l('In order to use a new theme, please follow these steps:', get_class()) . '</b>
<ul>
<li>' . $this->l('Import your theme using this module:', get_class()) . ' <a href="index.php?tab=AdminModules&token=' . Tools::getAdminTokenLite('AdminModules') . '&filtername=themeinstallator" style="text-decoration: underline;">' . $this->l('Theme installer', get_class()) . '</a></li>
<li>' . $this->l('When your theme is imported, please select the theme on this page', get_class()) . '</li>
</ul>
</td>
</tr>
<tr>
';
}
$i = 0;
foreach ($field['list'] as $theme) {
echo '<td class="center" style="width: 180px; padding:0px 20px 20px 0px;">
<input type="radio" name="' . $key . '" id="' . $key . '_' . $theme['name'] . '_on" style="vertical-align: text-bottom;" value="' . $theme['name'] . '"' . (_THEME_NAME_ == $theme['name'] ? 'checked="checked"' : '') . ' />
<label class="t" for="' . $key . '_' . $theme['name'] . '_on"> ' . Tools::strtolower($theme['name']) . '</label>
<br />
<label class="t" for="' . $key . '_' . $theme['name'] . '_on">
<img src="../themes/' . $theme['name'] . '/preview.jpg" alt="' . Tools::strtolower($theme['name']) . '">
</label>
</td>';
if (isset($field['max']) and ($i + 1) % $field['max'] == 0) {
echo '</tr><tr>';
}
$i++;
}
echo '</tr>
</table>';
break;
case 'price':
$default_currency = new Currency((int) Configuration::get("PS_CURRENCY_DEFAULT"));
echo $default_currency->getSign('left') . '<input type="' . $field['type'] . '" size="' . (isset($field['size']) ? (int) $field['size'] : 5) . '" name="' . $key . '" value="' . ($field['type'] == 'password' ? '' : htmlentities($val, ENT_COMPAT, 'UTF-8')) . '" />' . $default_currency->getSign('right') . ' ' . $this->l('(tax excl.)');
break;
case 'textLang':
foreach ($languages as $language) {
echo '
<div id="' . $key . '_' . $language['id_lang'] . '" style="margin-bottom:8px; display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left; vertical-align: top;">
<input type="text" size="' . (isset($field['size']) ? (int) $field['size'] : 5) . '" name="' . $key . '_' . $language['id_lang'] . '" value="' . htmlentities($this->getVal($confValues, $key . '_' . $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
</div>';
}
$this->displayFlags($languages, $defaultLanguage, $divLangName, $key);
break;
case 'file':
if (isset($field['thumb']) and $field['thumb'] and $field['thumb']['pos'] == 'before') {
echo '<img src="' . $field['thumb']['file'] . '" alt="' . $field['title'] . '" title="' . $field['title'] . '" /><br />';
}
echo '<input type="file" name="' . $key . '" />';
break;
case 'textarea':
echo '<textarea name=' . $key . ' cols="' . $field['cols'] . '" rows="' . $field['rows'] . '">' . htmlentities($val, ENT_COMPAT, 'UTF-8') . '</textarea>';
break;
case 'container':
echo '<div id="' . $key . '">';
break;
case 'container_end':
echo (isset($field['content']) === true ? $field['content'] : '') . '</div>';
break;
case 'maintenance_ip':
echo '<input type="text"' . (isset($field['id']) === true ? ' id="' . $field['id'] . '"' : '') . ' size="' . (isset($field['size']) ? (int) $field['size'] : 5) . '" name="' . $key . '" value="' . ($field['type'] == 'password' ? '' : htmlentities($val, ENT_COMPAT, 'UTF-8')) . '" />' . (isset($field['next']) ? ' ' . strval($field['next']) : '') . ' <a href="#" class="button" onclick="addRemoteAddr(); return false;">' . $this->l('Add my IP') . '</a>';
break;
case 'limit':
echo '<input type="text" size="' . (isset($field['size']) ? (int) $field['size'] : 5) . '" name="' . $key . '" value="' . ($field['type'] == 'password' ? '' : htmlentities($val, ENT_COMPAT, 'UTF-8')) . '" /> MB';
break;
case 'text':
default:
echo '<input type="' . $field['type'] . '"' . (isset($field['id']) === true ? ' id="' . $field['id'] . '"' : '') . ' size="' . (isset($field['size']) ? (int) $field['size'] : 5) . '" name="' . $key . '" value="' . ($field['type'] == 'password' ? '' : htmlentities($val, ENT_COMPAT, 'UTF-8')) . '" />' . (isset($field['next']) ? ' ' . strval($field['next']) : '');
}
echo (isset($field['required']) and $field['required'] and !in_array($field['type'], array('image', 'radio'))) ? ' <sup>*</sup>' : '';
echo isset($field['desc']) ? '<p style="clear:both">' . ((isset($field['thumb']) and $field['thumb'] and $field['thumb']['pos'] == 'after') ? '<img src="' . $field['thumb']['file'] . '" alt="' . $field['title'] . '" title="' . $field['title'] . '" style="float:left;" />' : '') . $field['desc'] . '</p>' : '';
if (!in_array($field['type'], array('image', 'radio', 'container', 'container_end')) or isset($field['show'])) {
echo '</div></div>';
}
}
/* End of specific div for e-mails settings */
if (get_class($this) == 'Adminemails') {
echo '<script type="text/javascript">if (getE(\'PS_MAIL_METHOD2_on\').checked) getE(\'smtp\').style.display = \'block\'; else getE(\'smtp\').style.display = \'none\';</script></div>';
}
if (!is_writable(PS_ADMIN_DIR . '/../config/settings.inc.php') and $name == 'themes') {
echo '<p><img src="../img/admin/warning.gif" alt="" /> ' . $this->l('if you change the theme, the settings.inc.php file must be writable (CHMOD 755 / 777)') . '</p>';
}
echo ' <div align="center" style="margin-top: 20px;">
<input type="submit" value="' . $this->l(' Save ', 'AdminPreferences') . '" name="submit' . ucfirst($name) . $this->table . '" class="button" />
</div>
' . ($required ? '<div class="small"><sup>*</sup> ' . $this->l('Required field', 'AdminPreferences') . '</div>' : '') . '
</fieldset>
</form>';
if (get_class($this) == 'AdminPreferences') {
echo '<script type="text/javascript">changeCMSActivationAuthorization();</script>';
}
}
示例3: hookAdminOrder
public function hookAdminOrder($params)
{
global $smarty, $cookie;
$error = 0;
$order = new Order((int) $params['id_order']);
if (!Validate::isLoadedObject($order)) {
die(Tools::displayError());
}
if ($order->module != $this->name) {
return false;
}
$disposition = Disposition::getByCartId((int) $order->id_cart);
if (!$disposition) {
// No disposition = Order paid
return false;
}
// check disposition state
$res = PrepaidServicesAPI::getSerialNumbers($this->getAPIConfiguration($disposition['currency']), Configuration::get($this->prefix . 'MERCHANT_ID_' . $disposition['currency']), $disposition['mtid'], $disposition['currency']);
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
// if the disposition is not "active"
if ($res[5] != PrepaidServicesAPI::DISPOSITION_DISPOSED && $res[5] != PrepaidServicesAPI::DISPOSITION_DEBITED) {
$smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment));
return $this->display($this->module_dir . '/' . $this->name, 'disposition-error.tpl');
}
if (Tools::isSubmit('acceptPayment')) {
$amount = Tools::getValue('ps_amount');
if (isset($amount) && !empty($amount) && $amount <= $res[3] && $amount > 0) {
if (!$this->_acceptPayment($order, $disposition, $currency->getSign('right'), $amount)) {
$error = 1;
}
} else {
$error = 2;
}
$query_string = $error ? self::changeQueryStringParameter($_SERVER['QUERY_STRING'], 'pp_error', (int) $error) : self::removeQueryStringParameter($_SERVER['QUERY_STRING'], 'pp_error');
Tools::redirectAdmin(Tools::safeOutput($_SERVER['PHP_SELF']) . '?' . $query_string);
} elseif (Tools::isSubmit('releasePayment')) {
if (!$this->_releasePayment($order, $disposition)) {
$error = 1;
}
$query_string = $error ? self::changeQueryStringParameter($_SERVER['QUERY_STRING'], 'pp_error', (int) $error) : $_SERVER['QUERY_STRING'];
Tools::redirectAdmin(Tools::safeOutput($_SERVER['PHP_SELF']) . '?' . $query_string);
}
$error_msg = '';
if (Tools::getIsset('pp_error')) {
$error_msg = $this->_getErrorMsgFromErrorCode(Tools::getValue('pp_error'));
}
$smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']) . '?' . $_SERVER['QUERY_STRING'], 'payment_name' => $order->payment, 'error' => $error_msg, 'currency' => $currency->getSign('right'), 'amount' => $res[3]));
return $this->display($this->module_dir . '/' . $this->name, $this->name . '-accept-payment.tpl');
}
示例4: hookAdminOrder
public function hookAdminOrder($params)
{
if (Tools::isSubmit('submitPayPalCapture')) {
if ($capture_amount = Tools::getValue('totalCaptureMoney')) {
if ($capture_amount = PaypalCapture::parsePrice($capture_amount)) {
if (Validate::isFloat($capture_amount)) {
$capture_amount = Tools::ps_round($capture_amount, '6');
$ord = new Order((int) $params['id_order']);
$cpt = new PaypalCapture();
if ($capture_amount > Tools::ps_round(0, '6') && Tools::ps_round($cpt->getRestToPaid($ord), '6') >= $capture_amount) {
$complete = false;
if ($capture_amount > Tools::ps_round((double) $ord->total_paid, '6')) {
$capture_amount = Tools::ps_round((double) $ord->total_paid, '6');
$complete = true;
}
if ($capture_amount == Tools::ps_round($cpt->getRestToPaid($ord), '6')) {
$complete = true;
}
$this->_doCapture($params['id_order'], $capture_amount, $complete);
}
}
}
}
} elseif (Tools::isSubmit('submitPayPalRefund')) {
$this->_doTotalRefund($params['id_order']);
}
$admin_templates = array();
if ($this->isPayPalAPIAvailable()) {
if ($this->_needValidation((int) $params['id_order'])) {
$admin_templates[] = 'validation';
}
if ($this->_needCapture((int) $params['id_order'])) {
$admin_templates[] = 'capture';
}
if ($this->_canRefund((int) $params['id_order'])) {
$admin_templates[] = 'refund';
}
}
if (count($admin_templates) > 0) {
$order = new Order((int) $params['id_order']);
$currency = new Currency($order->id_currency);
$cpt = new PaypalCapture();
$cpt->id_order = (int) $order->id;
if (version_compare(_PS_VERSION_, '1.5', '>=')) {
$order_state = $order->current_state;
} else {
$order_state = OrderHistory::getLastOrderState($order->id);
}
$this->context->smarty->assign(array('authorization' => (int) Configuration::get('PAYPAL_OS_AUTHORIZATION'), 'base_url' => _PS_BASE_URL_ . __PS_BASE_URI__, 'module_name' => $this->name, 'order_state' => $order_state, 'params' => $params, 'id_currency' => $currency->getSign(), 'rest_to_capture' => Tools::ps_round($cpt->getRestToPaid($order), '6'), 'list_captures' => $cpt->getListCaptured(), 'ps_version' => _PS_VERSION_));
foreach ($admin_templates as $admin_template) {
$this->_html .= $this->fetchTemplate('/views/templates/admin/admin_order/' . $admin_template . '.tpl');
$this->_postProcess();
$this->_html .= '</fieldset>';
}
}
return $this->_html;
}
示例5: displayFormFees
public function displayFormFees()
{
global $currentIndex;
$carrierArray = array();
$id_carrier = Tools::getValue('id_carrier');
$carriers = Carrier::getCarriers((int) Configuration::get('PS_LANG_DEFAULT'), true, false, false, NULL, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
foreach ($carriers as $carrier) {
if (!$carrier['is_free']) {
$carrierArray[] = array('id' => $carrier['id_carrier'], 'display' => '<option value="' . (int) $carrier['id_carrier'] . '"' . ($carrier['id_carrier'] == $id_carrier ? ' selected="selected"' : '') . '>' . $carrier['name'] . '</option>');
}
}
if (count($carrierArray)) {
if (!$id_carrier) {
$id_carrier = (int) $carrierArray[0]['id'];
}
$carrierSelected = new Carrier($id_carrier);
}
echo '<br /><br />
<h2>' . $this->l('Fees by carrier, geographical zone, and ranges') . '</h2>
<form action="' . $currentIndex . '&token=' . $this->token . '" id="fees" name="fees" method="post">
<fieldset>
<legend><img src="../img/admin/delivery.gif" />' . $this->l('Fees') . '</legend>';
if (!count($carrierArray)) {
echo $this->l('You only have free carriers, there is no need to configure your delivery prices.');
} else {
echo '<b>' . $this->l('Carrier:') . ' </b>
<select name="id_carrier2" onchange="document.fees.submit();">';
foreach ($carrierArray as $carrierOption) {
echo $carrierOption['display'];
}
echo '
</select><br />
<table class="table space" cellpadding="0" cellspacing="0">
<tr>
<th>' . $this->l('Zone / Range') . '</th>';
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$rangeObj = $carrierSelected->getRangeObject();
$rangeTable = $carrierSelected->getRangeTable();
$suffix = $carrierSelected->getRangeSuffix();
$rangeIdentifier = 'id_' . $rangeTable;
$ranges = $rangeObj->getRanges($id_carrier);
$delivery = Carrier::getDeliveryPriceByRanges($rangeTable, $id_carrier);
foreach ($delivery as $deliv) {
$deliveryArray[$deliv['id_zone']][$deliv['id_carrier']][$deliv[$rangeIdentifier]] = $deliv['price'];
}
if (!$carrierSelected->is_free) {
foreach ($ranges as $range) {
echo '<th style="font-size: 11px;">' . (double) $range['delimiter1'] . $suffix . ' ' . $this->l('to') . ' ' . (double) $range['delimiter2'] . $suffix . '</th>';
}
}
echo '</tr>';
$zones = $carrierSelected->getZones();
if (sizeof($ranges) && !$carrierSelected->is_free) {
if (sizeof($zones) > 1) {
echo '
<tr>
<th style="height: 30px;">' . $this->l('All') . '</th>';
foreach ($ranges as $range) {
echo '<td class="center">' . $currency->getSign('left') . '<input type="text" id="fees_all_' . $range[$rangeIdentifier] . '" onchange="this.value = this.value.replace(/,/g, \'.\');" onkeyup="if ((event.keyCode||event.which) != 9){ spreadFees(' . $range[$rangeIdentifier] . ') }" style="width: 45px;" />' . $currency->getSign('right') . '</td>';
}
echo '</tr>';
}
foreach ($zones as $zone) {
echo '
<tr>
<th style="height: 30px;">' . $zone['name'] . '</th>';
foreach ($ranges as $range) {
if (isset($deliveryArray[$zone['id_zone']][$id_carrier][$range[$rangeIdentifier]])) {
$price = $deliveryArray[$zone['id_zone']][$id_carrier][$range[$rangeIdentifier]];
} else {
$price = '0.00';
}
echo '<td class="center">' . $currency->getSign('left') . '<input type="text" class="fees_' . $range[$rangeIdentifier] . '" onchange="this.value = this.value.replace(/,/g, \'.\');" name="fees_' . $zone['id_zone'] . '_' . $range[$rangeIdentifier] . '" onkeyup="clearAllFees(' . $range[$rangeIdentifier] . ')" value="' . $price . '" style="width: 45px;" />' . $currency->getSign('right') . '</td>';
}
echo '
</tr>';
}
}
echo '<tr>
<td colspan="' . (sizeof($ranges) + 1) . '" class="center" style="border-bottom: none; height: 40px;">
<input type="hidden" name="submitFees' . $this->table . '" value="1" />';
if (sizeof($ranges) && !$carrierSelected->is_free) {
echo ' <input type="submit" value="' . $this->l(' Save ') . '" class="button" />';
} elseif ($carrierSelected->is_free) {
echo $this->l('This is a free carrier');
} else {
echo $this->l('No ranges set for this carrier');
}
echo '
</td>
</tr>';
echo '
</table>
<p>' . $this->l('Prices do not include tax.') . '</p>';
}
echo '
</fieldset>
<input type="hidden" name="id_carrier" value="' . $id_carrier . '" />
</form>';
}
示例6: _displayForm
/**
* Display configuration form
*
* @params string $name Form name
* @params array $fields Fields settings
*
* @global string $currentIndex Current URL in order to keep current Tab
*/
protected function _displayForm($name, $fields, $tabname, $size, $icon)
{
global $currentIndex;
$defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
$languages = Language::getLanguages();
$confValues = $this->getConf($fields, $languages);
$divLangName = $this->getDivLang($fields);
$required = false;
echo '
<script type="text/javascript">
id_language = Number(' . $defaultLanguage . ');
</script>
<form action="' . $currentIndex . '&submit' . $name . $this->table . '=1&token=' . $this->token . '" method="post" class="' . $size . '" enctype="multipart/form-data">
<fieldset><legend><img src="../img/admin/' . strval($icon) . '.gif" />' . $tabname . '</legend>';
foreach ($fields as $key => $field) {
/* Specific line for e-mails settings */
if (get_class($this) == 'Adminemails' and $key == 'PS_MAIL_SERVER') {
echo '<div id="smtp" style="display: ' . ((isset($confValues['PS_MAIL_METHOD']) and $confValues['PS_MAIL_METHOD'] == 2) ? 'block' : 'none') . ';">';
}
if (isset($field['required']) and $field['required']) {
$required = true;
}
$val = $this->getVal($confValues, $key);
if (!in_array($field['type'], array('image', 'radio', 'container', 'container_end')) or isset($field['show'])) {
echo '<div style="clear: both; padding-top:15px;">' . ($field['title'] ? '<label >' . $field['title'] . '</label>' : '') . '<div class="margin-form" style="padding-top:5px;">';
}
/* Display the appropriate input type for each field */
switch ($field['type']) {
case 'select':
echo '
<select name="' . $key . '"' . (isset($field['js']) === true ? ' onchange="' . $field['js'] . '"' : '') . (isset($field['id']) === true ? ' id="' . $field['id'] . '"' : '') . '>';
foreach ($field['list'] as $k => $value) {
echo '<option value="' . (isset($value['cast']) ? $value['cast']($value[$field['identifier']]) : $value[$field['identifier']]) . '"' . ($val == $value[$field['identifier']] ? ' selected="selected"' : '') . '>' . $value['name'] . '</option>';
}
echo '
</select>';
break;
case 'bool':
echo '<label class="t" for="' . $key . '_on"><img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" /></label>
<input type="radio" name="' . $key . '" id="' . $key . '_on" value="1"' . ($val ? ' checked="checked"' : '') . (isset($field['js']['on']) ? $field['js']['on'] : '') . ' />
<label class="t" for="' . $key . '_on"> ' . $this->l('Yes') . '</label>
<label class="t" for="' . $key . '_off"><img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" style="margin-left: 10px;" /></label>
<input type="radio" name="' . $key . '" id="' . $key . '_off" value="0" ' . (!$val ? 'checked="checked"' : '') . (isset($field['js']['off']) ? $field['js']['off'] : '') . '/>
<label class="t" for="' . $key . '_off"> ' . $this->l('No') . '</label>';
break;
case 'radio':
foreach ($field['choices'] as $cValue => $cKey) {
echo '<input type="radio" name="' . $key . '" id="' . $key . $cValue . '_on" value="' . intval($cValue) . '"' . ($cValue == $val ? ' checked="checked"' : '') . (isset($field['js'][$cValue]) ? ' ' . $field['js'][$cValue] : '') . ' /><label class="t" for="' . $key . $cValue . '_on"> ' . $cKey . '</label><br />';
}
echo '<br />';
break;
case 'image':
echo '
<table cellspacing="0" cellpadding="0">
<tr>';
$i = 0;
foreach ($field['list'] as $theme) {
echo '<td class="center" style="width: 180px; padding:0px 20px 20px 0px;">
<input type="radio" name="' . $key . '" id="' . $key . '_' . $theme['name'] . '_on" style="vertical-align: text-bottom;" value="' . $theme['name'] . '"' . (_THEME_NAME_ == $theme['name'] ? 'checked="checked"' : '') . ' />
<label class="t" for="' . $key . '_' . $theme['name'] . '_on"> ' . Tools::strtolower($theme['name']) . '</label>
<br />
<label class="t" for="' . $key . '_' . $theme['name'] . '_on">
<img src="../themes/' . $theme['name'] . '/preview.jpg" alt="' . Tools::strtolower($theme['name']) . '">
</label>
</td>';
if (isset($field['max']) and ($i + 1) % $field['max'] == 0) {
echo '</tr><tr>';
}
$i++;
}
echo '</tr>
</table>';
break;
case 'price':
$default_currency = new Currency(intval(Configuration::get("PS_CURRENCY_DEFAULT")));
echo $default_currency->getSign('left') . '<input type="' . $field['type'] . '" size="' . (isset($field['size']) ? intval($field['size']) : 5) . '" name="' . $key . '" value="' . ($field['type'] == 'password' ? '' : htmlentities($val, ENT_COMPAT, 'UTF-8')) . '" />' . $default_currency->getSign('right');
break;
case 'textLang':
foreach ($languages as $language) {
echo '
<div id="' . $key . '_' . $language['id_lang'] . '" style="margin-bottom:8px; display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left; vertical-align: top;">
<input type="text" name="' . $key . '_' . $language['id_lang'] . '" value="' . htmlentities($this->getVal($confValues, $key . '_' . $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
</div>';
}
$this->displayFlags($languages, $defaultLanguage, $divLangName, $key);
break;
case 'file':
if (isset($field['thumb']) and $field['thumb'] and $field['thumb']['pos'] == 'before') {
echo '<img src="' . $field['thumb']['file'] . '" alt="' . $field['title'] . '" title="' . $field['title'] . '" /><br />';
}
echo '<input type="file" name="' . $key . '" />';
break;
//.........这里部分代码省略.........
示例7: displayFormFees
public function displayFormFees()
{
global $currentIndex;
echo '<br /><br />
<h2>' . $this->l('Fees by carrier, geographical zone, and ranges') . '</h2>
<form action="' . $currentIndex . '&token=' . $this->token . '" id="fees" name="fees" method="post" class="width2">
<fieldset>
<legend><img src="../img/admin/delivery.gif" />' . $this->l('Fees') . '</legend>
<b>' . $this->l('Carrier:') . ' </b>
<select name="id_carrier2" onchange="document.fees.submit();">';
$carriers = Carrier::getCarriers(intval(Configuration::get('PS_LANG_DEFAULT')));
$id_carrier = Tools::getValue('id_carrier') ? intval(Tools::getValue('id_carrier')) : intval($carriers[0]['id_carrier']);
$carrierSelected = new Carrier($id_carrier);
foreach ($carriers as $carrier) {
echo '<option value="' . intval($carrier['id_carrier']) . '"' . ($carrier['id_carrier'] == $id_carrier ? ' selected="selected"' : '') . '>' . $carrier['name'] . '</option>';
}
echo '
</select><br />
<table class="table space" cellpadding="0" cellspacing="0">
<tr>
<th>' . $this->l('Zone / Range') . '</th>';
$shipping_method = intval(Configuration::get('PS_SHIPPING_METHOD'));
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$rangeObj = $shipping_method ? new RangeWeight() : new RangePrice();
$rangeTable = $shipping_method ? 'range_weight' : 'range_price';
$rangeIdentifier = 'id_' . $rangeTable;
$ranges = $rangeObj->getRanges($id_carrier);
$suffix = $shipping_method ? Configuration::get('PS_WEIGHT_UNIT') : $currency->sign;
$delivery = Carrier::getDeliveryPriceByRanges($rangeTable);
foreach ($delivery as $deliv) {
$deliveryArray[$deliv['id_zone']][$deliv['id_carrier']][$deliv[$rangeIdentifier]] = $deliv['price'];
}
foreach ($ranges as $range) {
echo '<th style="font-size: 11px;">' . floatval($range['delimiter1']) . $suffix . ' ' . $this->l('to') . ' ' . floatval($range['delimiter2']) . $suffix . '</th>';
}
echo '</tr>';
$zones = Zone::getZones(true);
if (sizeof($ranges)) {
foreach ($zones as $zone) {
if (!$carrierSelected->getZone($zone['id_zone'])) {
continue;
}
echo '
<tr>
<th style="height: 30px;">' . $zone['name'] . '</th>';
foreach ($ranges as $range) {
if (isset($deliveryArray[$zone['id_zone']][$id_carrier][$range[$rangeIdentifier]])) {
$price = $deliveryArray[$zone['id_zone']][$id_carrier][$range[$rangeIdentifier]];
} else {
$price = '0.00';
}
echo '<td class="center">' . $currency->getSign('left') . '<input type="text" name="fees_' . $zone['id_zone'] . '_' . $range[$rangeIdentifier] . '" value="' . $price . '" style="width: 45px;" />' . $currency->getSign('right') . '</td>';
}
echo '
</tr>';
}
}
echo '
<tr>
<td colspan="' . (sizeof($ranges) + 1) . '" class="center" style="border-bottom: none; height: 40px;">
<input type="hidden" name="submitFees' . $this->table . '" value="1" />
';
if (sizeof($ranges)) {
echo ' <input type="submit" value="' . $this->l(' Save ') . '" class="button" />';
} else {
echo $this->l('No ranges set for this carrier');
}
echo '
</td>
</tr>';
echo '
</table>
<p>' . $this->l('Prices are tax excluded.') . '</p>
</fieldset>
<input type="hidden" name="id_carrier" value="' . $id_carrier . '" />
</form>';
}
示例8: displayMassSeoSearchForm
protected function displayMassSeoSearchForm()
{
$id_search = Tools::getValue('id_search');
$search = AdvancedSearchClass::getSearch($id_search, false, false);
$criterions_groups_indexed = AdvancedSearchClass::getCriterionsGroupsIndexedForSEO($id_search, $this->_cookie->id_lang);
$this->_startForm(array('id' => 'seoMassSearchForm'));
$this->_displayTitle($this->l('Massive add of products pages'));
$this->_showInfo($this->l('Select your criteria'));
$this->_html .= '<div id="seoSearchPanelCriteriaTabs">
<ul>';
foreach ($criterions_groups_indexed as $key => $criterions_group_indexed) {
$this->_html .= '<li><a href="#seoSearchPanelCriteriaTabs-' . $key . '">' . htmlentities($criterions_group_indexed['name'], ENT_COMPAT, 'UTF-8') . '</a></li>';
}
$this->_html .= '</ul>';
foreach ($criterions_groups_indexed as $key => $criterions_group_indexed) {
$this->_html .= '<div id="seoSearchPanelCriteriaTabs-' . $key . '" class="seoSearchPanelCriteriaTabsContent" style="height:150px;overflow:auto;text-align:left;">';
$this->_html .= '<input type="hidden" name="id_criterion_group" value="' . (int) $criterions_group_indexed['id_criterion_group'] . '" style="margin-left:4px;" /><input type="checkbox" value="0" style="margin-left:4px;" onclick="enableAllCriterion4MassSeo(this);" /> <small>' . $this->l('Check all') . '</small><br /><br />';
$this->_html .= '<ul class="ui-helper-reset ui-sortable">';
if ($criterions_group_indexed['range'] == 1) {
if ($criterions_group_indexed['criterion_group_type'] == 'price') {
$default_currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$criterions_group_indexed['range_sign'] = $default_currency->sign;
$rangeSignLeft = $default_currency->getSign('left');
$rangeSignRight = $default_currency->getSign('right');
} else {
$rangeSignLeft = '';
$rangeSignRight = ' ' . $criterions_group_indexed['range_sign'];
}
$ranges = explode(',', $criterions_group_indexed['range_interval']);
$criterions = array();
foreach ($ranges as $krange => $range) {
$rangeUp = isset($ranges[$krange + 1]) ? $ranges[$krange + 1] : '';
$range1 = $range . '-' . $rangeUp;
$range2 = ($rangeUp ? $this->l('From') : $this->l('More than')) . ' ' . $rangeSignLeft . $range . $rangeSignRight . ($rangeUp ? ' ' . $this->l('to') . ' ' . $rangeSignLeft . $rangeUp . $rangeSignRight : '');
$selected_criteria_groups_type = AdvancedSearchClass::getCriterionGroupsTypeAndDisplay($id_search, array($criterions_group_indexed['id_criterion_group']));
$criterions[] = array('id_criterion' => $range1, 'value' => $range2);
}
if ($criterions && sizeof($criterions)) {
foreach ($criterions as $row) {
$this->_html .= '<li class="ui-state-default massSeoSearchCriterion" id="criterion_' . $criterions_group_indexed['id_criterion_group'] . '_' . $row['id_criterion'] . '" title="' . htmlentities($row['value'], ENT_COMPAT, 'UTF-8') . '" onclick="enableCriterion4MassSeo(this);">';
$this->_html .= '<input type="checkbox" name="criteria[' . (int) $criterions_group_indexed['id_criterion_group'] . '][]" value="' . $criterions_group_indexed['id_criterion_group'] . '_' . $row['id_criterion'] . '" onclick="enableCriterion4MassSeo($jqPm( this ).parent(\'li\'));" /> ';
$this->_html .= htmlentities($row['value'], ENT_COMPAT, 'UTF-8');
$this->_html .= '</li>';
}
}
} elseif ($criterions_group_indexed['criterion_group_type'] == 'price') {
$default_currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$price_range = AdvancedSearchClass::getPriceRangeForSearchBloc($search[0], $criterions_group_indexed['id_criterion_group_linked'], (int) $default_currency->id, $this->getCurrentCustomerGroupId(), 0, $count_product = false, $selected_criterion = array(), $selected_criteria_groups_type = array());
$this->_html .= '<li class="ui-state-default massSeoSearchCriterion massSeoSearchCriterionPrice" id="criterion_price' . (isset($price_range[0]['min_price']) ? '-' . (int) $price_range[0]['min_price'] . '-' . (int) $price_range[0]['max_price'] : '') . '" title="' . $this->l('From') . ' ' . (int) $price_range[0]['min_price'] . ' ' . $this->l('to') . ' ' . Tools::displayPrice((int) $price_range[0]['max_price'], $default_currency) . '" onclick="enableCriterion4MassSeo(this);" style="height:50px;">';
$this->_html .= '<input type="checkbox" id="massSeoSearchCriterionPriceInput" name="criteria[' . (int) $criterions_group_indexed['id_criterion_group'] . '][]" value="' . $criterions_group_indexed['id_criterion_group'] . '_' . (isset($price_range[0]['min_price']) ? (double) $price_range[0]['min_price'] . '-' . (double) $price_range[0]['max_price'] : '') . '" onclick="enableCriterion4MassSeo($jqPm( this ).parent(\'li\'));" /> ';
$this->_html .= $this->l('Choose your price range bellow : ') . '<br />';
$this->_html .= '<div id="PM_ASSeoPriceRange" style="width:30%;margin-left:10px;margin-top:10px;float:left"></div>';
$this->_html .= '<span id="PM_ASPriceRangeValue" style="width:35%;display:block;margin-top:10px;float:left;font-size:11px;margin-left:10px;">' . (int) $price_range[0]['min_price'] . ' - ' . Tools::displayPrice((int) $price_range[0]['max_price'], $default_currency) . '</span>';
$this->_html .= '<select id="id_currency" name="id_currency" style="float:left;margin-left:10px;width:50px;margin-top:10px;">';
foreach (Currency::getCurrencies() as $row) {
$this->_html .= '<option value="' . (int) $row['id_currency'] . '" ' . ($default_currency->id == $row['id_currency'] ? 'selected="selected"' : '') . '>' . $row['sign'] . '</option>';
}
$this->_html .= '</select>';
$this->_html .= '<script type="text/javascript">
$jqPm( "#id_currency" ).change(function() {
var id_currency = $jqPm(this).val();
$jqPm.ajax( {
type : "GET",
url : "' . $this->_base_config_url . '&pm_load_function=displaySeoPriceSlider&id_search=' . (int) $criterions_group_indexed['id_search'] . '&id_criterion_group_linked=' . (int) $criterions_group_indexed['id_criterion_group_linked'] . '&id_currency="+id_currency,
dataType : "script"
});
});
$jqPm( "#PM_ASSeoPriceRange" ).slider({
range: true,
min: ' . (int) $price_range[0]['min_price'] . ',
max: ' . (int) $price_range[0]['max_price'] . ',
values: [ ' . (int) $price_range[0]['min_price'] . ', ' . (int) $price_range[0]['max_price'] . ' ],
slide: function( event, ui) {
$jqPm( "#PM_ASPriceRangeValue" ).html( "" + ui.values[0] + " - " + "' . $default_currency->getSign('left') . '" + ui.values[1] + "' . $default_currency->getSign('right') . '" );
$jqPm( "#massSeoSearchCriterionPriceInput" ).val(' . $criterions_group_indexed['id_criterion_group'] . ' + "_" + ui.values[ 0 ] + "-" + ui.values[ 1 ] );
$jqPm( ".seoSearchCriterionPriceSortable" ).attr("id", "criterion_price-" + ui.values[ 0 ] + "-" + ui.values[ 1 ] );
$jqPm( ".seoSearchCriterionPriceSortable" ).attr("title", "' . $this->l('From') . ' " + ui.values[ 0 ] + " ' . $this->l('to') . ' " + "' . $default_currency->getSign('left') . '" + ui.values[1] + "' . $default_currency->getSign('right') . '" );
}
});
</script>';
$this->_html .= '</li>';
} elseif ($criterions_group_indexed['display_type'] == 5) {
$range = AdvancedSearchClass::getCriterionsRange($search[0], $criterions_group_indexed['id_criterion_group'], $this->_cookie->id_lang, false, array(), array(), false, false, false, $criterions_group_indexed);
$this->_html .= '<li class="ui-state-default massSeoSearchCriterion seoSearchCriterionRangeSortable' . $criterions_group_indexed['id_criterion_group'] . '" id="criterion_' . (int) $criterions_group_indexed['id_criterion_group'] . '_' . (double) $range[0]['min'] . '-' . (double) $range[0]['max'] . '" title="' . $this->l('From') . ' ' . (double) $range[0]['min'] . ' ' . $this->l('to') . ' ' . (double) $range[0]['max'] . ' (' . $criterions_group_indexed['range_sign'] . ')" onclick="enableCriterion4MassSeo(this);" style="height:50px;">';
$this->_html .= '<input type="checkbox" id="massSeoSearchCriterionRangeInput' . (int) $criterions_group_indexed['id_criterion_group'] . '" name="criteria[' . (int) $criterions_group_indexed['id_criterion_group'] . '][]" value="' . $criterions_group_indexed['id_criterion_group'] . '_' . (int) $criterions_group_indexed['id_criterion_group'] . '_' . (double) $range[0]['min'] . '-' . (double) $range[0]['max'] . '" onclick="enableCriterion4MassSeo($jqPm( this ).parent(\'li\'));" /> ';
$this->_html .= $this->l('Choose your range bellow : ') . '<br />';
$this->_html .= '<div id="PM_ASSeoRange' . $criterions_group_indexed['id_criterion_group'] . '" style="width:30%;margin-left:10px;float:left"></div>';
$this->_html .= '<span id="PM_ASRangeValue' . $criterions_group_indexed['id_criterion_group'] . '" style="width:35%;display:block;float:left;font-size:11px;margin-left:10px;">' . (double) $range[0]['min'] . ' - ' . (double) $range[0]['max'] . ' (' . $criterions_group_indexed['range_sign'] . ')</span>';
$this->_html .= '<script type="text/javascript">
$jqPm( "#PM_ASSeoRange' . $criterions_group_indexed['id_criterion_group'] . '" ).slider({
range: true,
min: ' . (double) $range[0]['min'] . ',
max: ' . (double) $range[0]['max'] . ',
values: [ ' . (double) $range[0]['min'] . ', ' . (double) $range[0]['max'] . ' ],
slide: function( event, ui) {
$jqPm( "#PM_ASRangeValue' . $criterions_group_indexed['id_criterion_group'] . '" ).html( "" + ui.values[ 0 ] + " - " + ui.values[ 1 ] + " (' . $criterions_group_indexed['range_sign'] . ')" );
$jqPm( "#massSeoSearchCriterionRangeInput' . (int) $criterions_group_indexed['id_criterion_group'] . '" ).val(' . $criterions_group_indexed['id_criterion_group'] . ' + "_" + ui.values[ 0 ] + "-" + ui.values[ 1 ] );
$jqPm( ".seoSearchCriterionRangeSortable' . $criterions_group_indexed['id_criterion_group'] . '" ).attr("id", "criterion_' . $criterions_group_indexed['id_criterion_group'] . '_" + ui.values[ 0 ] + "-" + ui.values[ 1 ] );
$jqPm( ".seoSearchCriterionRangeSortable' . $criterions_group_indexed['id_criterion_group'] . '" ).attr("title", "' . $this->l('From') . ' " + ui.values[ 0 ] + " ' . $this->l('to') . ' " + ui.values[ 1 ] + " (' . $criterions_group_indexed['range_sign'] . ')" );
}
//.........这里部分代码省略.........