• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Feature类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Feature的典型用法代码示例。如果您正苦于以下问题:PHP Feature类的具体用法?PHP Feature怎么用?PHP Feature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Feature类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: createFeature

 /**
  * Create feature of the given definition.
  *
  * @return Feature
  */
 protected function createFeature()
 {
     $feature = new Feature($this, $this->getId());
     $feature->setProperty('type', lcfirst(static::getType()));
     $feature->setProperty('options', $this->getOptions());
     return $feature;
 }
开发者ID:pfitz,项目名称:php-leaflet,代码行数:12,代码来源:FeatureTrait.php


示例2: setFeatureStatus

 /**
  * Set an individual feature and its status
  *
  * @param string     $featureLabel
  * @param bool|array $status
  */
 public function setFeatureStatus($featureLabel, $status)
 {
     if (isset($this->featureFlags[$featureLabel])) {
         $feature = $this->get($featureLabel);
     } else {
         $feature = new Feature($featureLabel);
     }
     if (is_array($status)) {
         $feature->setStatus($status);
     } else {
         $feature->setBooleanStatus($status);
     }
     $this->featureFlags[$featureLabel] = $feature;
 }
开发者ID:vestd,项目名称:FeatureFlags,代码行数:20,代码来源:FeatureCollection.php


示例3: plans

 /**
  * Show list of plans
  */
 public function plans()
 {
     if (!$this->ion_auth->logged_in()) {
         redirect('/auth');
     }
     $user = $this->getUser();
     $feature = new Feature();
     $plan = new Plan();
     $this->template->layout = 'layouts/customer_settings';
     $this->template->set('features', $feature->get());
     $this->template->set('plans', $plan->getActualPlansWithoutActive($user));
     $this->template->set('user', $user);
     $this->template->set('options', $this->config->config['period_qualifier']);
     $this->template->render();
 }
开发者ID:andrewkrug,项目名称:repucaution,代码行数:18,代码来源:subscript.php


示例4: processFeatures

 public function processFeatures()
 {
     if (!Feature::isFeatureActive()) {
         return;
     }
     if (Validate::isLoadedObject($product = new Product((int) Tools::getValue('id_product')))) {
         // delete all objects
         $product->deleteFeatures();
         // add new objects
         $languages = Language::getLanguages(false);
         foreach ($_POST as $key => $val) {
             if (preg_match('/^feature_([0-9]+)_value/i', $key, $match)) {
                 if (!empty($val)) {
                     foreach ($val as $v) {
                         $product->addFeaturesToDB($match[1], $v);
                     }
                 } else {
                     if ($default_value = $this->checkFeatures($languages, $match[1])) {
                         $id_value = $product->addFeaturesToDB($match[1], 0, 1);
                         foreach ($languages as $language) {
                             if ($cust = Tools::getValue('custom_' . $match[1] . '_' . (int) $language['id_lang'])) {
                                 $product->addFeaturesCustomToDB($id_value, (int) $language['id_lang'], $cust);
                             } else {
                                 $product->addFeaturesCustomToDB($id_value, (int) $language['id_lang'], $default_value);
                             }
                         }
                     }
                 }
             }
         }
     } else {
         $this->errors[] = Tools::displayError('A product must be created before adding features.');
     }
 }
开发者ID:hantonius,项目名称:advancedfeaturesvalues,代码行数:34,代码来源:AdminProductsController.php


示例5: getContent

 function getContent()
 {
     $is_one_dot_five = version_compare(_PS_VERSION_, '1.5', '>');
     // Smarty
     $template_vars = array('id_tab' => Tools::getValue('id_tab'), 'controller' => Tools::getValue('controller'), 'tab' => Tools::getValue('tab'), 'configure' => Tools::getValue('configure'), 'tab_module' => Tools::getValue('tab_module'), 'module_name' => Tools::getValue('module_name'), 'token' => Tools::getValue('token'), 'ebay_token' => Configuration::get('EBAY_SECURITY_TOKEN'), '_module_dir_' => _MODULE_DIR_, 'ebay_categories' => EbayCategoryConfiguration::getEbayCategories($this->ebay_profile->id), 'id_lang' => $this->context->cookie->id_lang, 'id_ebay_profile' => $this->ebay_profile->id, '_path' => $this->path, 'possible_attributes' => AttributeGroup::getAttributesGroups($this->context->cookie->id_lang), 'possible_features' => Feature::getFeatures($this->context->cookie->id_lang, true), 'date' => pSQL(date('Ymdhis')), 'conditions' => $this->_translatePSConditions(EbayCategoryConditionConfiguration::getPSConditions()), 'form_items_specifics' => EbaySynchronizer::getNbSynchronizableEbayCategoryCondition(), 'form_items_specifics_mixed' => EbaySynchronizer::getNbSynchronizableEbayCategoryConditionMixed(), 'isOneDotFive' => $is_one_dot_five);
     return $this->display('formItemsSpecifics.tpl', $template_vars);
 }
开发者ID:kevindesousa,项目名称:ebay,代码行数:7,代码来源:EbayFormItemsSpecificsTab.php


示例6: getContent

 function getContent()
 {
     // Check if the module is configured
     if (!$this->ebay_profile->getConfiguration('EBAY_PAYPAL_EMAIL')) {
         return '<p class="error"><b>' . $this->ebay->l('Please configure the \'General settings\' tab before using this tab') . '</b></p><br /><script type="text/javascript">$("#menuTab4").addClass("wrong")</script>';
     }
     $iso = $this->context->language->iso_code;
     $iso_tiny_mce = file_exists(_PS_ROOT_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en';
     // Display Form
     $url_vars = array('id_tab' => '4', 'section' => 'template');
     if (version_compare(_PS_VERSION_, '1.5', '>')) {
         $url_vars['controller'] = Tools::getValue('controller');
     } else {
         $url_vars['tab'] = Tools::getValue('tab');
     }
     $action_url = $this->_getUrl($url_vars);
     if (Tools::getValue('reset_template')) {
         $ebay_product_template = EbayProductTemplate::getContent($this->ebay, $this->smarty);
     } else {
         $ebay_product_template = Tools::getValue('ebay_product_template', $this->ebay_profile->getConfiguration('EBAY_PRODUCT_TEMPLATE'));
     }
     $ebay_product_template_title = $this->ebay_profile->getConfiguration('EBAY_PRODUCT_TEMPLATE_TITLE');
     $smarty_vars = array('action_url' => $action_url, 'ebay_product_template' => $ebay_product_template, 'ebay_product_template_title' => $ebay_product_template_title, 'features_product' => Feature::getFeatures($this->context->language->id), 'ad' => dirname($_SERVER['PHP_SELF']), 'base_uri' => __PS_BASE_URI__, 'is_one_dot_three' => Tools::substr(_PS_VERSION_, 0, 3) == '1.3', 'is_one_dot_five' => version_compare(_PS_VERSION_, '1.5', '>'), 'theme_css_dir' => _THEME_CSS_DIR_);
     if (Tools::substr(_PS_VERSION_, 0, 3) == '1.3') {
         $smarty_vars['theme_name'] = _THEME_NAME_;
         $smarty_vars['language'] = file_exists(_PS_ROOT_DIR_ . '/js/tinymce/jscripts/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en';
     } elseif (version_compare(_PS_VERSION_, '1.5', '>')) {
         $smarty_vars['iso'] = file_exists(_PS_ROOT_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en';
     } else {
         $smarty_vars['iso_type_mce'] = $iso_tiny_mce;
         $smarty_vars['ps_js_dir'] = _PS_JS_DIR_;
     }
     return $this->display('formTemplateManager.tpl', $smarty_vars);
 }
开发者ID:anantha89,项目名称:gpprestashop,代码行数:34,代码来源:EbayFormTemplateManagerTab.php


示例7: create_sql

 public function create_sql($sql_type, $data)
 {
     if (Feature::is_check_user_login($sql_type)) {
         return new Check_user_login_sql($data);
     } else {
         if (Feature::is_add_receipt($sql_type)) {
             return new Add_receipt_sql($data);
         } else {
             if (Feature::is_remove_product($sql_type)) {
                 return new Remove_product_sql($data);
             } else {
                 if (Feature::is_push_alter_product_data($sql_type)) {
                     return new Push_alter_product_data_sql($data);
                 } else {
                     if (Feature::is_push_new_product_data($sql_type)) {
                         return new Push_new_product_data_sql($data);
                     } else {
                         if (Feature::is_get_list_of_product_info($sql_type)) {
                             return new Get_list_of_product_info_sql($data);
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:Ruyka,项目名称:Tam-An-Food-Store-Manager,代码行数:26,代码来源:SQLFactory.php


示例8: renderForm

 public function renderForm()
 {
     if (!$this->object->id) {
         $this->object->price = -1;
     }
     $shops = Shop::getShops();
     if (count($this->context->employee->getAssociatedShops()) > 1) {
         $shops = array_merge(array(0 => array('id_shop' => 0, 'name' => $this->l('All shops'))), $shops);
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Specific price rules')), 'input' => array(array('type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', 'size' => 33, 'maxlength' => 32, 'required' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'select', 'label' => $this->l('Shop:'), 'name' => 'id_shop', 'options' => array('query' => $shops, 'id' => 'id_shop', 'name' => 'name'), 'condition' => Shop::isFeatureActive(), 'default_value' => Shop::getContextShopID()), array('type' => 'select', 'label' => $this->l('Currency:'), 'name' => 'id_currency', 'options' => array('query' => array_merge(array(0 => array('id_currency' => 0, 'name' => $this->l('All currencies'))), Currency::getCurrencies()), 'id' => 'id_currency', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Country:'), 'name' => 'id_country', 'options' => array('query' => array_merge(array(0 => array('id_country' => 0, 'name' => $this->l('All countries'))), Country::getCountries((int) $this->context->language->id)), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Group:'), 'name' => 'id_group', 'options' => array('query' => array_merge(array(0 => array('id_group' => 0, 'name' => $this->l('All groups'))), Group::getGroups((int) $this->context->language->id)), 'id' => 'id_group', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('From quantity:'), 'name' => 'from_quantity', 'size' => 6, 'maxlength' => 10, 'required' => true), array('type' => 'text', 'label' => $this->l('Price (tax excl.):'), 'name' => 'price', 'size' => 6, 'disabled' => $this->object->price == -1 ? 1 : 0, 'maxlength' => 10, 'suffix' => $this->context->currency->getSign('right')), array('type' => 'checkbox', 'name' => 'leave_bprice', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Leave base price'), 'val' => '1', 'checked' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'date', 'label' => $this->l('From:'), 'name' => 'from', 'size' => 12), array('type' => 'date', 'label' => $this->l('To:'), 'name' => 'to', 'size' => 12), array('type' => 'select', 'label' => $this->l('Reduction type:'), 'name' => 'reduction_type', 'options' => array('query' => array(array('reduction_type' => 'amount', 'name' => $this->l('Amount')), array('reduction_type' => 'percentage', 'name' => $this->l('Percentage'))), 'id' => 'reduction_type', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('Reduction:'), 'name' => 'reduction', 'required' => true)), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
     if (($value = $this->getFieldValue($this->object, 'price')) != -1) {
         $price = number_format($value, 2);
     } else {
         $price = '';
     }
     $this->fields_value = array('price' => $price, 'from_quantity' => ($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1, 'reduction' => number_format(($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0, 2), 'leave_bprice_on' => $price ? 0 : 1);
     $attribute_groups = array();
     $attributes = Attribute::getAttributes((int) $this->context->language->id);
     foreach ($attributes as $attribute) {
         if (!isset($attribute_groups[$attribute['id_attribute_group']])) {
             $attribute_groups[$attribute['id_attribute_group']] = array('id_attribute_group' => $attribute['id_attribute_group'], 'name' => $attribute['attribute_group']);
         }
         $attribute_groups[$attribute['id_attribute_group']]['attributes'][] = array('id_attribute' => $attribute['id_attribute'], 'name' => $attribute['name']);
     }
     $features = Feature::getFeatures((int) $this->context->language->id);
     foreach ($features as &$feature) {
         $feature['values'] = FeatureValue::getFeatureValuesWithLang((int) $this->context->language->id, $feature['id_feature'], true);
     }
     $this->tpl_form_vars = array('manufacturers' => Manufacturer::getManufacturers(), 'suppliers' => Supplier::getSuppliers(), 'attributes_group' => $attribute_groups, 'features' => $features, 'categories' => Category::getSimpleCategories((int) $this->context->language->id), 'conditions' => $this->object->getConditions(), 'is_multishop' => Shop::isFeatureActive());
     return parent::renderForm();
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:31,代码来源:AdminSpecificPriceRuleController.php


示例9: initFieldsetFeaturesDetachables

 public function initFieldsetFeaturesDetachables()
 {
     $this->fields_form[2]['form'] = array('legend' => array('title' => $this->l('Optional features'), 'icon' => 'icon-puzzle-piece'), 'description' => $this->l('Some features can be disabled in order to improve performance.'), 'input' => array(array('type' => 'hidden', 'name' => 'features_detachables_up'), array('type' => 'switch', 'label' => $this->l('Combinations'), 'name' => 'combination', 'is_bool' => true, 'disabled' => Combination::isCurrentlyUsed(), 'values' => array(array('id' => 'combination_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'combination_0', 'value' => 0, 'label' => $this->l('No'))), 'hint' => $this->l('Choose "No" to disable Product Combinations.'), 'desc' => Combination::isCurrentlyUsed() ? $this->l('You cannot set this parameter to No when combinations are already used by some of your products') : null), array('type' => 'switch', 'label' => $this->l('Features'), 'name' => 'feature', 'is_bool' => true, 'values' => array(array('id' => 'feature_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'feature_0', 'value' => 0, 'label' => $this->l('No'))), 'hint' => $this->l('Choose "No" to disable Product Features.')), array('type' => 'switch', 'label' => $this->l('Customer Groups'), 'name' => 'customer_group', 'is_bool' => true, 'disabled' => Group::isCurrentlyUsed(), 'values' => array(array('id' => 'group_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'group_0', 'value' => 0, 'label' => $this->l('No'))), 'hint' => $this->l('Choose "No" to disable Customer Groups.'))), 'submit' => array('title' => $this->l('Save')));
     $this->fields_value['combination'] = Combination::isFeatureActive();
     $this->fields_value['feature'] = Feature::isFeatureActive();
     $this->fields_value['customer_group'] = Group::isFeatureActive();
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:7,代码来源:AdminPerformanceController.php


示例10: ajaxProcessUpdatePositions

 public function ajaxProcessUpdatePositions()
 {
     if ($this->tabAccess['edit'] === '1') {
         $way = (int) Tools::getValue('way');
         $id = (int) Tools::getValue('id');
         $table = 'feature';
         $positions = Tools::getValue($table);
         if (empty($positions)) {
             $table = 'feature_value';
             $positions = Tools::getValue($table);
         }
         $new_positions = array();
         foreach ($positions as $v) {
             if (!empty($v)) {
                 $new_positions[] = $v;
             }
         }
         foreach ($new_positions as $position => $value) {
             $pos = explode('_', $value);
             if (isset($pos[2]) && (int) $pos[2] === $id) {
                 if ($table == 'feature') {
                     if ($feature = new Feature((int) $pos[2])) {
                         if (isset($position) && $feature->updatePosition($way, $position, $id)) {
                             echo 'ok position ' . (int) $position . ' for feature ' . (int) $pos[1] . '\\r\\n';
                         } else {
                             echo '{"hasError" : true, "errors" : "Can not update feature ' . (int) $id . ' to position ' . (int) $position . ' "}';
                         }
                     } else {
                         echo '{"hasError" : true, "errors" : "This feature (' . (int) $id . ') can t be loaded"}';
                     }
                     break;
                 } elseif ($table == 'feature_value') {
                     if ($feature_value = new FeatureValue((int) $pos[2])) {
                         if (isset($position) && $feature_value->updatePosition($way, $position, $id)) {
                             echo 'ok position ' . (int) $position . ' for feature value ' . (int) $pos[2] . '\\r\\n';
                         } else {
                             echo '{"hasError" : true, "errors" : "Can not update feature value ' . (int) $id . ' to position ' . (int) $position . ' "}';
                         }
                     } else {
                         echo '{"hasError" : true, "errors" : "This feature value (' . (int) $id . ') can t be loaded"}';
                     }
                     break;
                 }
             }
         }
     }
 }
开发者ID:hantonius,项目名称:advancedfeaturesvalues,代码行数:47,代码来源:AdminFeaturesController.php


示例11: toExtGeoJSON

 public function toExtGeoJSON()
 {
     $json_data = parent::toExtGeoJSON();
     if (isset($this->geometry)) {
         $json_data = array_merge($json_data, array('type' => 'Feature', 'geometry' => $this->geometry->toJSON()));
     }
     return $json_data;
 }
开发者ID:jtet,项目名称:php-libkml,代码行数:8,代码来源:Placemark.php


示例12: finalizeInstall

 public function finalizeInstall()
 {
     try {
         Feature::reregister('intercom', 'intercom', 'Intercom', 'Two-way intercom feature, dial feature number and extension', User::TYPE_SYSTEM_ADMIN);
     } catch (FeatureException $e) {
         if ($e->getCode() != 0 || $e->getCode() == -2) {
             throw $e;
         }
     }
 }
开发者ID:swk,项目名称:bluebox,代码行数:10,代码来源:configure.php


示例13: getValue

 public function getValue($source)
 {
     $value = '';
     if (array_key_exists('feature', $source)) {
         $values = Feature::where('id', '=', $source['feature']);
         if ($values->count()) {
             $value = $values->first()->feature;
         }
     }
     return $value;
 }
开发者ID:apetrailmukesh,项目名称:bootstrap,代码行数:11,代码来源:UtilityFeature.php


示例14: import

function import()
{
    try {
        $page = isset($_GET['page']) ? $_GET['page'] : null;
        if ($page == 0) {
            del_feature();
        }
        $results = get_writing($page);
        $size = sizeof($results);
        foreach ($results as $r) {
            $f = new Feature();
            $w = json_decode($r->writing);
            $char_id = $r->char_id;
            $features = $f->make_feature($w);
            //获取特征
            $dic = new Dictionary();
            $dict_feature = $dic->get_feature($char_id);
            //获取数据库中已存的特征值
            $dict_feature = isset($dict_feature) ? json_decode($dict_feature) : null;
            $t = new Trainer();
            $t->train($features, $dict_feature);
            $c = new Character();
            $first_stroke_type = $c->get_first_stroke_type($w);
            //首笔的笔画类型(横竖撇点折)
            $int_strokes = sizeof($w->s);
            //笔画数
            $dic->update_character($char_id, json_encode($t->train_features), $int_strokes, $first_stroke_type);
        }
        if ($size > 0) {
            echo "<meta HTTP-EQUIV=REFRESH CONTENT='5;URL=import.php?page=" . ($page + 1) . "'>";
        } else {
            echo "导入完成";
        }
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}
开发者ID:tianxang,项目名称:php-handwriting,代码行数:37,代码来源:import.php


示例15: getCMSFields

 public function getCMSFields()
 {
     $fields = new FieldList();
     $feature = $this->Feature();
     if ($feature->exists()) {
         $fields->push(ReadonlyField::create("FeatureTitle", "Feature", $feature->Title));
         $fields->push($feature->getValueField());
     } else {
         $selected = Feature::get()->innerJoin("ProductFeatureValue", "Feature.ID = ProductFeatureValue.FeatureID")->filter("ProductFeatureValue.ProductID", Controller::curr()->currentPageID())->getIDList();
         $features = Feature::get()->filter("ID:not", $selected);
         $fields->push(DropdownField::create("FeatureID", "Feature", $features->map()->toArray()));
         $fields->push(LiteralField::create("creationnote", "<p class=\"message\">You can choose a value for this feature after saving.</p>"));
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-shop-comparison,代码行数:15,代码来源:ProductFeatureValue.php


示例16: displayForm

    /**
     * Display form
     *
     * @global string $currentIndex Current URL in order to keep current Tab
     */
    public function displayForm($isMainTab = true)
    {
        global $currentIndex;
        parent::displayForm();
        if (!($obj = $this->loadObject(true))) {
            return;
        }
        echo '
		<h2>' . $this->l('Add a new feature value') . '</h2>
		<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . Tools::getValue('token') . '" method="post">
		' . ($obj->id ? '<input type="hidden" name="id_feature_value" value="' . $obj->id . '" />' : '') . '
			<fieldset class="width2">
				<legend><img src="../img/t/AdminFeatures.gif" />' . $this->l('Add a new feature value') . '</legend>
				<label>' . $this->l('Value:') . ' </label>
				<div class="margin-form">';
        foreach ($this->_languages as $language) {
            echo '
					<div id="value_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="value_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'value', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup>
						<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
					</div>
					<script type="text/javascript">
						var flag_fields = \'value\';
					</script>';
        }
        $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'flag_fields', 'value', false, true);
        echo '
					<div class="clear"></div>
				</div>
				<label>' . $this->l('Feature:') . ' </label>
				<div class="margin-form">
					<select name="id_feature">';
        $features = Feature::getFeatures($this->_defaultFormLanguage);
        foreach ($features as $feature) {
            echo '<option value="' . $feature['id_feature'] . '"' . ($this->getFieldValue($obj, 'id_feature') == $feature['id_feature'] ? ' selected="selected"' : '') . '>' . $feature['name'] . '</option>';
        }
        echo '
					</select><sup> *</sup>
				</div>
				' . Module::hookExec('featureValueForm', array('id_feature_value' => $obj->id)) . '
				<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>';
    }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:52,代码来源:AdminFeaturesValues.php


示例17: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab("Root.Features", $grid = GridField::create("Features", "Features", $this->owner->Features(), GridFieldConfig_RecordEditor::create()));
     $grid->getConfig()->removeComponentsByType('GridFieldDataColumns')->removeComponentsByType('GridFieldAddNewButton')->addComponent(new GridFieldAddNewInlineButton())->addComponent(new GridFieldEditableColumns())->addComponent(new GridFieldOrderableRows());
     $grid->getConfig()->getComponentByType('GridFieldEditableColumns')->setDisplayFields(array('FeatureID' => function ($record, $column, $grid) {
         $dropdown = new DropdownField($column, 'Feature', Feature::get()->map('ID', 'Title')->toArray());
         $dropdown->addExtraClass('on_feature_select_fetch_value_field');
         return $dropdown;
     }, 'Value' => function ($record, $column, $grid) {
         if ($record->FeatureID) {
             $field = $record->Feature()->getValueField();
             $field->setName($column);
             return $field;
         }
         return new HiddenField($column);
     }));
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-shop-comparison,代码行数:17,代码来源:ProductFeaturesExtension.php


示例18: process

 public function process()
 {
     parent::process();
     $hasProduct = false;
     $product_list = Tools::getValue('compare_product_list');
     $postProducts = isset($product_list) ? rtrim($product_list, '|') : '';
     if (!Configuration::get('PS_COMPARATOR_MAX_ITEM')) {
         return Tools::redirect('404.php');
     }
     if ($postProducts) {
         $ids = array_unique(explode('|', $postProducts));
         if (sizeof($ids) > 0) {
             if (sizeof($ids) > Configuration::get('PS_COMPARATOR_MAX_ITEM')) {
                 $ids = array_slice($ids, 0, Configuration::get('PS_COMPARATOR_MAX_ITEM'));
             }
             $listProducts = array();
             $listFeatures = array();
             foreach ($ids as $id) {
                 $curProduct = new Product((int) $id, true, (int) self::$cookie->id_lang);
                 if (!Validate::isLoadedObject($curProduct)) {
                     continue;
                 }
                 if (!$curProduct->active) {
                     unset($ids[$k]);
                     continue;
                 }
                 foreach ($curProduct->getFrontFeatures(self::$cookie->id_lang) as $feature) {
                     $listFeatures[$curProduct->id][$feature['id_feature']] = $feature['value'];
                 }
                 $cover = Product::getCover((int) $id);
                 $curProduct->id_image = Tools::htmlentitiesUTF8(Product::defineProductImage(array('id_image' => $cover['id_image'], 'id_product' => $id), self::$cookie->id_lang));
                 $curProduct->allow_oosp = Product::isAvailableWhenOutOfStock($curProduct->out_of_stock);
                 $listProducts[] = $curProduct;
             }
             if (sizeof($listProducts) > 0) {
                 $width = 80 / sizeof($listProducts);
                 $hasProduct = true;
                 $ordered_features = Feature::getFeaturesForComparison($ids, self::$cookie->id_lang);
                 self::$smarty->assign(array('ordered_features' => $ordered_features, 'product_features' => $listFeatures, 'products' => $listProducts, 'link' => new Link(), 'width' => $width, 'homeSize' => Image::getSize('home')));
                 self::$smarty->assign('HOOK_EXTRA_PRODUCT_COMPARISON', Module::hookExec('extraProductComparison', array('list_ids_product' => $ids)));
             }
         }
     }
     self::$smarty->assign('hasProduct', $hasProduct);
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:45,代码来源:CompareController.php


示例19: index

 public function index($request)
 {
     if (!SecurityToken::inst()->checkRequest($request)) {
         return $this->httpError(403);
     }
     $id = $request->getVar('ID');
     if (!$id) {
         return $this->httpError(400);
     }
     $feature = Feature::get()->byId($id);
     if (!$feature) {
         return $this->httpError(404);
     }
     if (!$feature->canView()) {
         return $this->httpError(403);
     }
     $field = $feature->getValueField()->setName($request->getVar('Name'));
     return $field->forTemplate();
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-shop-comparison,代码行数:19,代码来源:ProductFeatureValueFieldController.php


示例20: displayForm

    /**
     * Display form
     *
     * @global string $currentIndex Current URL in order to keep current Tab
     */
    public function displayForm($token = NULL)
    {
        global $currentIndex;
        $defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
        $languages = Language::getLanguages();
        $obj = $this->loadObject(true);
        echo '
		<script type="text/javascript">
			id_language = Number(' . $defaultLanguage . ');
		</script>
		<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . ($token ? $token : $this->token) . '" method="post">
		' . ($obj->id ? '<input type="hidden" name="id_feature_value" value="' . $obj->id . '" />' : '') . '
			<fieldset class="width3"><legend><img src="../img/t/AdminFeatures.gif" />' . $this->l('Value') . '</legend>
				<label>' . $this->l('Value:') . ' </label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            echo '
					<div id="value_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="value_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'value', intval($language['id_lang'])), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup>
						<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
					</div>';
        }
        $this->displayFlags($languages, $defaultLanguage, 'value', 'value');
        echo '
					<div style="clear: both;"></div>
				</div>
				<label>' . $this->l('Feature:') . ' </label>
				<div class="margin-form">
					<select name="id_feature">';
        $features = Feature::getFeatures($defaultLanguage);
        foreach ($features as $feature) {
            echo '<option value="' . $feature['id_feature'] . '"' . ($this->getFieldValue($obj, 'id_feature') == $feature['id_feature'] ? ' selected="selected"' : '') . '>' . $feature['name'] . '</option>';
        }
        echo '
					</select><sup> *</sup>
				</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>';
    }
开发者ID:sealence,项目名称:local,代码行数:48,代码来源:AdminFeaturesValues.php



注:本文中的Feature类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP FeatureValue类代码示例发布时间:2022-05-23
下一篇:
PHP Fave类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap