本文整理汇总了PHP中Feature::nbFeatures方法的典型用法代码示例。如果您正苦于以下问题:PHP Feature::nbFeatures方法的具体用法?PHP Feature::nbFeatures怎么用?PHP Feature::nbFeatures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feature
的用法示例。
在下文中一共展示了Feature::nbFeatures方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayFormFeatures
public function displayFormFeatures($obj, $languages, $defaultLanguage)
{
global $cookie, $currentIndex;
//duplicate AdminTab::displayForm for display flag near traanslateable input fields
$allowEmployeeFormLang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
echo '
<script type="text/javascript">
$(document).ready(function() {
id_language = ' . $defaultLanguage . ';
languages = new Array();';
foreach ($languages as $k => $language) {
echo '
languages[' . $k . '] = {
id_lang: ' . (int) $language['id_lang'] . ',
iso_code: \'' . $language['iso_code'] . '\',
name: \'' . htmlentities($language['name'], ENT_COMPAT, 'UTF-8') . '\'
};';
}
echo '
displayFlags(languages, id_language, ' . $allowEmployeeFormLang . ');
});
</script>';
if ($obj->id) {
// $feature = Feature::getFeatures(intval($cookie->id_lang));
include_once 'ExFeature.php';
$feature = ExFeature::getFeatures($defaultLanguage);
$ctab = '';
foreach ($feature as $group) {
foreach ($group["features"] as $f) {
$ctab .= 'ccustom_' . $f['id'] . '¤';
}
}
$ctab = rtrim($ctab, '¤');
?>
<table cellpadding="5">
<tr>
<td colspan="2"><b><?php
echo $this->l('Assign features to this product');
?>
</b></td>
</tr>
</table>
<hr style="width:730px;" />
<a href="#" id="all_close" class="module_toggle_all"><?php
echo $this->l('Collapse all');
?>
</a>
<a id="all_open" class="module_toggle_all" href="#"><?php
echo $this->l('Expand all');
?>
</a><br />
<?php
// Header
$nb_feature = Feature::nbFeatures(intval($cookie->id_lang));
?>
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:906px;">
<tr>
<th style="width:30%; padding-left:10px;"><?php
echo $this->l('Features');
?>
</td>
<th style="width:25%"><?php
echo $this->l('Value');
?>
</td>
<th style="width:45%"><?php
echo $this->l('Customized');
?>
</td>
</tr>
<?php
if (!$nb_feature) {
?>
<tr><td colspan="3" style="text-align:center;">'.$this->l('No features defined').'</td></tr>
<?php
}
?>
</table>
<?php
// Listing
if ($nb_feature) {
$pfeatures = Product::getFeaturesStatic($obj->id);
$product_features = array();
foreach ($pfeatures as $pf) {
if (!array_key_exists($pf["id_feature"], $product_features)) {
$product_features[$pf["id_feature"]] = array();
}
$product_features[$pf["id_feature"]][] = $pf["id_feature_value"];
}
unset($pfeatures);
$odd = 0;
?>
<?php
// <table cellpadding="5" style="width:743px; margin-top:10px">
?>
<?php
//.........这里部分代码省略.........
示例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>';
}
}