本文整理汇总了PHP中FeatureValue::selectLang方法的典型用法代码示例。如果您正苦于以下问题:PHP FeatureValue::selectLang方法的具体用法?PHP FeatureValue::selectLang怎么用?PHP FeatureValue::selectLang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FeatureValue
的用法示例。
在下文中一共展示了FeatureValue::selectLang方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayFormFeatures
//.........这里部分代码省略.........
</a>
</div>
<div id="group_<?php
echo $gid;
?>
_content" class="tab_module_content" style="display:none;border:solid 1px #CCC">
<div id="modgo_blocksearch">
<table style="width:100%" cellpadding="0" cellspacing="0">
<?php
foreach ($group["features"] as $tab_features) {
$current_item = false;
$custom = true;
foreach ($obj->getFeatures() as $tab_products) {
if ($tab_products['id_feature'] == $tab_features['id_feature']) {
$current_item = $tab_products['id_feature_value'];
}
}
$featureValues = FeatureValue::getFeatureValuesWithLang((int) $cookie->id_lang, (int) $tab_features['id_feature']);
echo '
<tr>
<td style="padding-left: 10px; width: 30%">' . $tab_features['name'] . '</td>
<td style="width: 25%">';
if (sizeof($featureValues)) {
echo '
<select id="feature_' . $tab_features['id_feature'] . '_value" name="feature_' . $tab_features['id_feature'] . '_value"
onchange="$(\'.custom_' . $tab_features['id_feature'] . '_\').val(\'\');">
<option value="0">--- </option>';
foreach ($featureValues as $value) {
if ($current_item == $value['id_feature_value']) {
$custom = false;
}
echo '<option value="' . $value['id_feature_value'] . '"' . ($current_item == $value['id_feature_value'] ? ' selected="selected"' : '') . '>' . substr($value['value'], 0, 40) . (Tools::strlen($value['value']) > 40 ? '...' : '') . ' </option>';
}
echo '</select>';
} else {
echo '<input type="hidden" name="feature_' . $tab_features['id_feature'] . '_value" value="0" /><span style="font-size: 10px; color: #666;">' . $this->l('N/A') . ' - <a href="index.php?tab=AdminFeatures&addfeature_value&id_feature=' . (int) $tab_features['id_feature'] . '&token=' . Tools::getAdminToken('AdminFeatures' . (int) Tab::getIdFromClassName('AdminFeatures') . (int) $cookie->id_employee) . '" style="color: #666; text-decoration: underline;">' . $this->l('Add pre-defined values first') . '</a></span>';
}
echo '
</td>
<td style="width:45%" class="translatable">';
$tab_customs = $custom ? FeatureValue::getFeatureValueLang($current_item) : array();
foreach ($languages as $language) {
echo '
<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left; margin-top: 5px; margin-bottom: 5px;">
<textarea class="custom_' . $tab_features['id_feature'] . '_" name="custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'] . '" cols="40" rows="1"
onkeyup="$(\'#feature_' . $tab_features['id_feature'] . '_value\').val(0);" >' . htmlentities(Tools::getValue('custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'], FeatureValue::selectLang($tab_customs, $language['id_lang'])), ENT_COMPAT, 'UTF-8') . '</textarea>
</div>';
}
/* echo '<div style="
float: left;
margin-top: 10px;
margin-left: 5px">'
.$this->displayFlags($languages, $defaultLanguage, $ctab, 'ccustom_'.$tab_features['id_feature'], true).
'</div>'; */
echo '
</td>
</tr>';
}
?>
</table>
</div>
</div>
<?php
}
?>
<div id="updateFeatureAdminContainer" style="text-align: center; margin-top: 10px;">
<input type="submit" name="submitProductFeature" id="submitProductFeature" value="<?php
echo $this->l('Update features');
?>
" class="button" />
</div>
<?php
}
?>
<hr style="width:730px;" />
<div style="text-align:center;">
<a href="index.php?tab=AdminExFeatures&addfeature&token=<?php
echo Tools::getAdminToken('AdminExFeatures' . intval(Tab::getIdFromClassName('AdminExFeatures')) . intval($cookie->id_employee));
?>
" onclick="return confirm('<?php
echo $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false);
?>
');">
<img src="../img/admin/add.gif" alt="new_features" title="<?php
echo $this->l('Create new features');
?>
" /> <?php
echo $this->l('Create new features');
?>
</a>
</div>
<?php
} else {
echo '<b>' . $this->l('You must save this product before adding features') . '.</b>';
}
}
示例2: displayFormFeatures
function displayFormFeatures($obj, $languages, $defaultLanguage)
{
global $cookie, $currentIndex;
if ($obj->id) {
$feature = Feature::getFeatures(intval($cookie->id_lang));
$ctab = '';
foreach ($feature as $tab) {
$ctab .= 'ccustom_' . $tab['id_feature'] . '¤';
}
$ctab = rtrim($ctab, '¤');
echo '
<table cellpadding="5">
<tr>
<td colspan="2"><b>' . $this->l('Assign features to this product') . '</b></td>
</tr>
</table>
<hr style="width:730px;"><br />';
// Header
$nb_feature = Feature::nbFeatures(intval($cookie->id_lang));
echo '
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:600px;">
<tr>
<th>' . $this->l('Features') . '</td>
<th style="width:220px">' . $this->l('Value') . '</td>
<th style="width:170px">' . $this->l('Customized') . '</td>
</tr>';
if (!$nb_feature) {
echo '<tr><td colspan="3" style="text-align:center;">' . $this->l('No features defined') . '</td></tr>';
}
echo '</table>';
// Listing
if ($nb_feature) {
echo '
<table cellpadding="5" style="width:600px; margin-top:10px">';
foreach ($feature as $tab_features) {
$current_item = false;
$custom = false;
$product_features = $obj->getFeatures();
foreach ($product_features as $tab_products) {
if ($tab_products['id_feature'] == $tab_features['id_feature']) {
$current_item = $tab_products['id_feature_value'];
}
}
echo '
<tr>
<td>' . $tab_features['name'] . '</td>
<td style="width:220px">
<select name="feature_' . $tab_features['id_feature'] . '_value">
<option value="0">--- </option>';
$feature_values = FeatureValue::getFeatureValues($tab_features['id_feature']);
foreach ($feature_values as $tab_values) {
if (!$tab_values['custom']) {
$value = FeatureValue::selectLang(FeatureValue::getFeatureValueLang($tab_values['id_feature_value']), intval($cookie->id_lang));
echo '<option value="' . $tab_values['id_feature_value'] . '"' . ($current_item == $tab_values['id_feature_value'] ? ' selected="selected"' : '') . '>' . substr($value, 0, 40) . (Tools::strlen($value) > 40 ? '...' : '') . ' </option>';
} else {
$custom = true;
}
}
echo '
</select>
</td>
<td style="width:170px">';
$tab_customs = array();
if ($custom) {
$tab_customs = FeatureValue::getFeatureValueLang($current_item);
}
foreach ($languages as $language) {
$custom_lang = FeatureValue::selectLang($tab_customs, $language['id_lang']);
echo '
<div id="ccustom_' . $tab_features['id_feature'] . '_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
<input type="text" name="custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'] . '" size="20" value="' . htmlentities(Tools::getValue('custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'], $custom_lang), ENT_COMPAT, 'UTF-8') . '" />
</div>';
}
$this->displayFlags($languages, $defaultLanguage, $ctab, 'ccustom_' . $tab_features['id_feature']);
echo '
</td>
</tr>';
}
echo '
<tr>
<td> </td>
<td style="height:50px; " valign="bottom"><input type="submit" name="submitProductFeature" id="submitProductFeature" value="' . $this->l('Update features') . '" class="button" /></td>
</tr>';
}
echo '</table>
<hr style="width:730px;">
<div style="text-align:center;">
<a href="index.php?tab=AdminFeatures&addfeature&token=' . Tools::getAdminToken('AdminFeatures' . intval(Tab::getIdFromClassName('AdminFeatures')) . intval($cookie->id_employee)) . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="new_features" title="' . $this->l('Create new features') . '" /> ' . $this->l('Create new features') . '</a>
</div>';
} else {
echo '<b>' . $this->l('You must save this product before adding features') . '.</b>';
}
}
示例3: displayFormFeatures
function displayFormFeatures($obj)
{
global $cookie, $currentIndex;
parent::displayForm();
if ($obj->id) {
$feature = Feature::getFeatures((int) $cookie->id_lang);
$ctab = '';
foreach ($feature as $tab) {
$ctab .= 'ccustom_' . $tab['id_feature'] . '¤';
}
$ctab = rtrim($ctab, '¤');
echo '
<table cellpadding="5">
<tr>
<td colspan="2">
<b>' . $this->l('Assign features to this product:') . '</b><br />
<ul style="margin: 10px 0 0 20px;">
<li>' . $this->l('You can specify a value for each relevant feature regarding this product, empty fields will not be displayed.') . '</li>
<li>' . $this->l('You can either set a specific value, or select among existing pre-defined values you added previously.') . '</li>
</ul>
</td>
</tr>
</table>
<hr style="width:100%;" /><br />';
// Header
$nb_feature = Feature::nbFeatures((int) $cookie->id_lang);
echo '
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:900px;">
<tr>
<th>' . $this->l('Feature') . '</td>
<th style="width:30%">' . $this->l('Pre-defined value') . '</td>
<th style="width:40%"><u>' . $this->l('or') . '</u> ' . $this->l('Customized value') . '</td>
</tr>';
if (!$nb_feature) {
echo '<tr><td colspan="3" style="text-align:center;">' . $this->l('No features defined') . '</td></tr>';
}
echo '</table>';
// Listing
if ($nb_feature) {
echo '
<table cellpadding="5" style="width: 900px; margin-top: 10px">';
foreach ($feature as $tab_features) {
$current_item = false;
$custom = true;
foreach ($obj->getFeatures() as $tab_products) {
if ($tab_products['id_feature'] == $tab_features['id_feature']) {
$current_item = $tab_products['id_feature_value'];
}
}
$featureValues = FeatureValue::getFeatureValuesWithLang((int) $cookie->id_lang, (int) $tab_features['id_feature']);
echo '
<tr>
<td>' . $tab_features['name'] . '</td>
<td style="width: 30%">';
if (sizeof($featureValues)) {
echo '
<select id="feature_' . $tab_features['id_feature'] . '_value" name="feature_' . $tab_features['id_feature'] . '_value"
onchange="$(\'.custom_' . $tab_features['id_feature'] . '_\').val(\'\');">
<option value="0">--- </option>';
foreach ($featureValues as $value) {
if ($current_item == $value['id_feature_value']) {
$custom = false;
}
echo '<option value="' . $value['id_feature_value'] . '"' . ($current_item == $value['id_feature_value'] ? ' selected="selected"' : '') . '>' . substr($value['value'], 0, 40) . (Tools::strlen($value['value']) > 40 ? '...' : '') . ' </option>';
}
echo '</select>';
} else {
echo '<input type="hidden" name="feature_' . $tab_features['id_feature'] . '_value" value="0" /><span style="font-size: 10px; color: #666;">' . $this->l('N/A') . ' - <a href="index.php?tab=AdminFeatures&addfeature_value&id_feature=' . (int) $tab_features['id_feature'] . '&token=' . Tools::getAdminToken('AdminFeatures' . (int) Tab::getIdFromClassName('AdminFeatures') . (int) $cookie->id_employee) . '" style="color: #666; text-decoration: underline;">' . $this->l('Add pre-defined values first') . '</a></span>';
}
echo '
</td>
<td style="width:40%" class="translatable">';
$tab_customs = $custom ? FeatureValue::getFeatureValueLang($current_item) : array();
foreach ($this->_languages as $language) {
echo '
<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
<textarea class="custom_' . $tab_features['id_feature'] . '_" name="custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'] . '" cols="40" rows="1"
onkeyup="if (isArrowKey(event)) return ;$(\'#feature_' . $tab_features['id_feature'] . '_value\').val(0);" >' . htmlentities(Tools::getValue('custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'], FeatureValue::selectLang($tab_customs, $language['id_lang'])), ENT_COMPAT, 'UTF-8') . '</textarea>
</div>';
}
echo '
</td>
</tr>';
}
echo '
<tr>
<td style="height: 50px; text-align: center;" colspan="3"><input type="submit" name="submitProductFeature" id="submitProductFeature" value="' . $this->l('Save modifications') . '" class="button" /></td>
</tr>';
}
echo '</table>
<hr style="width:100%;" />
<div style="text-align:center;">
<a href="index.php?tab=AdminFeatures&addfeature&token=' . Tools::getAdminToken('AdminFeatures' . (int) Tab::getIdFromClassName('AdminFeatures') . (int) $cookie->id_employee) . '" onclick="return confirm(\'' . $this->l('You will lose all modifications not saved, you may want to save modifications first?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="new_features" title="' . $this->l('Add a new feature') . '" /> ' . $this->l('Add a new feature') . '</a>
</div>';
} else {
echo '<b>' . $this->l('You must save this product before adding features') . '.</b>';
}
}