本文整理汇总了PHP中Varien_Data_Form_Element_Fieldset类的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Fieldset类的具体用法?PHP Varien_Data_Form_Element_Fieldset怎么用?PHP Varien_Data_Form_Element_Fieldset使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Varien_Data_Form_Element_Fieldset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareAttributes
/**
* Render required attributes
* @param Varien_Data_Form_Element_Fieldset $fldAttr
* @param Amasty_Banners_Model_Rule $model
*/
protected function prepareAttributes($fldAttr, $model)
{
$hlp = Mage::helper('ambanners');
/*
* Add Empty Fields user for new conditions
*/
$fieldSet = $this->getForm()->addFieldset('attributestmp', array('legend' => $hlp->__('Attribute Tmp')));
$fieldSet->addField('attr_code[][]', 'select', array('label' => $hlp->__('Has attribute'), 'name' => 'attr_code[]', 'values' => $this->getAttributes(), 'onchange' => 'showOptions(this)'));
$fieldSet->addField('attr_value[][]', 'text', array('label' => $hlp->__('Attribute value is'), 'name' => 'attr_value[]'));
$array = $model->getAttributesAsArray();
foreach ($array as $attributeCode => $attributeValue) {
if (empty($attributeCode)) {
continue;
}
if (is_array($attributeValue)) {
foreach ($attributeValue as $i => $value) {
/*
* Add Attribute Names
*/
$elementCode = $attributeCode . '-' . $value . '-' . $i;
$fldAttr->addField('attr_code[' . $elementCode . ']', 'select', array('label' => $hlp->__('Has attribute'), 'name' => 'attr_code[' . $elementCode . ']', 'values' => $this->getAttributes(), 'onchange' => 'showOptions(this)', 'value' => $attributeCode, 'note' => $hlp->__('If attribute is related to configurable products, please make sure that attribute is used in layered navigation'), 'after_element_html' => '<a href="#" onclick="landingRemove(this);return false;" title="' . $hlp->__('Remove') . '">' . $hlp->__('X') . '</a>'));
/*
* Add Attribute Options
*/
$attribute = Mage::getModel('catalog/product')->getResource()->getAttribute($attributeCode);
if ('select' === $attribute->getFrontendInput() || 'multiselect' === $attribute->getFrontendInput()) {
$options = $attribute->getFrontend()->getSelectOptions();
$fldAttr->addField('attr_value[' . $elementCode . ']', 'select', array('label' => $hlp->__('Attribute value is'), 'name' => 'attr_value[' . $elementCode . ']', 'values' => $options, 'value' => $value));
} else {
$fldAttr->addField('attr_value[' . $elementCode . ']', 'text', array('label' => $hlp->__('Attribute value is'), 'name' => 'attr_value[' . $elementCode . ']', 'value' => $value));
}
}
}
}
}
示例2: addField
/**
* @param Varien_Data_Form_Element_Fieldset $fieldset
* @param string $id
* @param string $type
* @param array $options
* @return Varien_Data_Form_Element_Abstract
*/
public function addField($fieldset, $id, $type, $options)
{
/** @noinspection PhpParamsInspection */
$field = $fieldset->addField($id, $type, $options);
if (isset($options['values'])) {
$field->setValues($options['values']);
}
$field->setRenderer($this->getFieldRenderer());
return $field;
}
示例3: createFieldConditions
/**
* @param Varien_Data_Form_Element_Fieldset $fieldset
* @return Varien_Data_Form_Element_Abstract
*/
private function createFieldConditions(Varien_Data_Form_Element_Fieldset $fieldset)
{
/** @var Varien_Data_Form_Element_Abstract $result */
$result = $fieldset->addField('conditions', 'text', array('name' => 'conditions', 'label' => Mage::helper('catalogrule')->__('Conditions'), 'title' => Mage::helper('catalogrule')->__('Conditions'), 'required' => true));
/** @var Mage_Rule_Block_Conditions $blockRuleConditions */
$blockRuleConditions = Mage::getBlockSingleton('rule/conditions');
$result->setData('rule', $this->getRule());
$result->setRenderer($blockRuleConditions);
df_assert($result instanceof Varien_Data_Form_Element_Abstract);
return $result;
}
示例4: _addFieldsToFieldset
/**
* This method makes life a little easier for us by pre-populating
* fields with $_POST data where applicable and wraps our post data in
* 'newsData' so we can easily separate all relevant information in
* the controller. You can of course omit this method entirely and call
* the $fieldset->addField() method directly.
*/
protected function _addFieldsToFieldset(Varien_Data_Form_Element_Fieldset $fieldset, $fields)
{
$requestData = new Varien_Object($this->getRequest()->getPost('newsData'));
foreach ($fields as $name => $_data) {
if ($requestValue = $requestData->getData($name)) {
$_data['value'] = $requestValue;
}
// wrap all fields with newsData group
$_data['name'] = "newsData[{$name}]";
// generally label and title always the same
$_data['title'] = $_data['label'];
// finally call vanilla functionality to add field
$fieldset->addField($name, $_data['input'], $_data);
}
return $this;
}
示例5: addField
/**
* @param Varien_Data_Form_Element_Fieldset $fieldset
* @param string $id
* @param string $type
* @param array $options
* @return Varien_Data_Form_Element_Abstract
*/
public function addField($fieldset, $id, $type, $options)
{
if (isset($options['renderer'])) {
$renderer = $this->getLayout()->getBlockSingleton($options['renderer']);
unset($options['renderer']);
} else {
$renderer = $this->getFieldRenderer();
}
/** @noinspection PhpParamsInspection */
$field = $fieldset->addField($id, $type, $options);
if (isset($options['values'])) {
$field->setValues($options['values']);
}
$field->setRenderer($renderer);
return $field;
}
示例6: _addFieldsToFieldset
protected function _addFieldsToFieldset(Varien_Data_Form_Element_Fieldset $fieldset, $fields)
{
$requestData = new Varien_Object($this->getRequest()->getPost('accordionData'));
foreach ($fields as $name => $_data) {
if ($requestValue = $requestData->getData($name)) {
$_data['value'] = $requestValue;
}
# code...
$_data['name'] = "accordionData[{$name}]";
$_data['title'] = $_data['label'];
if (!array_key_exists('value', $_data)) {
$_data['value'] = $this->_getAccordion()->getData($name);
}
$fieldset->addField($name, $_data['input'], $_data);
}
return $this;
}
示例7: _addModule
/**
* @param Aitoc_Aitsys_Model_Module $module
* @param Varien_Data_Form_Element_Fieldset $fieldset
*/
protected function _addModule(Aitoc_Aitsys_Model_Module $module, Varien_Data_Form_Element_Fieldset $fieldset)
{
if ($module->isIgnore()) {
return false;
}
$aModule = $module;
$label = $module->getInfo()->getLabel() . ($module->getInfo()->getVersion() ? ' v' . $module->getInfo()->getVersion() : '');
$message = '';
$messageType = 'notice-msg';
$isDemo = false;
if ($this->tool()->platform()->hasDemoMode()) {
$xml = simplexml_load_file(Mage::getBaseDir() . "/aitmodules.xml");
$link = (string) $xml->modules->{$aModule}['key'];
if ($link == '') {
$link = $this->tool()->getAitocUrl();
}
$message = Mage::helper('aitsys')->__("The extension is already enabled on this Demo Magento installation and can't be disabled for security reasons. Please proceed to the next step outlined in the extension's <a href='%s' target='_blank'>User Manual</a> to see how it works.", $link);
$isDemo = true;
} elseif (defined('COMPILER_INCLUDE_PATH')) {
$compilerUrl = version_compare(Mage::getVersion(), '1.5.0.0', '>=') ? Mage::helper('adminhtml')->getUrl('adminhtml/compiler_process/index/') : Mage::helper('adminhtml')->getUrl('compiler/process/index/');
$message = Mage::helper('aitsys')->__('Before activating or deactivating the extension please turn off the compiler at <br /><a href="%s">System > Tools > Compilation</a>', $compilerUrl);
$messageType = 'warning-msg';
} elseif (!$module->getInfo()->isMagentoCompatible()) {
$message = Mage::helper('aitsys/strings')->getString('ER_ENT_HASH');
} elseif (!$module->getAccess()) {
$message = Mage::helper('aitsys')->__('File does not have write permissions: %s', $aModule['file']);
$messageType = 'error-msg';
}
if ($module->getInfo()->getSerial()) {
$info = 'S/N: ' . $module->getInfo()->getSerial();
}
if ($aModule['key'] == 'Aitoc_Common') {
$info = 'Used by other AITOC\'s modules. Do not disable.';
}
if ($message && $messageType != 'notice-msg' || $isDemo) {
$field = $fieldset->addField('ignore_' . $aModule['key'], 'note', array('name' => 'ignore[' . $aModule['key'] . ']', 'label' => $label, 'info' => empty($info) ? '' : $info, 'note' => '<ul class="messages"><li class="' . $messageType . '"><ul><li>' . $message . '</li></ul></li></ul>', 'module' => $module));
if (!$isDemo) {
$field->setRenderer($this->_elementRenderer);
}
return;
}
$fieldset->addField('hidden_enable_' . $aModule['key'], 'hidden', array('name' => 'enable[' . $aModule['key'] . ']', 'value' => 0));
$fieldset->addField('enable_' . $aModule['key'], 'checkbox', array('name' => ($module->getAccess() ? 'enable' : 'ignore') . '[' . $aModule['key'] . ']', 'label' => $label, 'value' => 1, 'checked' => $aModule['value'], 'note' => $message ? '<ul class="messages"><li class="' . $messageType . '"><ul><li>' . $message . '</li></ul></li></ul>' : '', 'info' => empty($info) ? '' : $info, 'module' => $module))->setRenderer($this->_elementRenderer);
}
示例8: populateFieldset
/**
* Populate form fieldset with group data
*
* @param Varien_Data_Form_Element_Fieldset $fieldset
*/
public function populateFieldset(Varien_Data_Form_Element_Fieldset $fieldset)
{
$originalData = array();
foreach ($this->_data as $key => $value) {
if (!is_array($value)) {
$originalData[$key] = $value;
}
}
$fieldset->setOriginalData($originalData);
}
示例9: _getFieldHtml
/**
* @param Varien_Data_Form_Element_Fieldset $fieldset
* @param string $id
* @param string $status
* @return string
*/
protected function _getFieldHtml($fieldset, $id, $status)
{
$configData = $this->getConfigData();
$path = 'sales/order_statuses/status_' . $id;
//TODO: move as property of form
$data = isset($configData[$path]) ? $configData[$path] : array();
$e = $this->_getDummyElement();
$field = $fieldset->addField($id, 'text', array('name' => 'groups[order_statuses][fields][status_' . $id . '][value]', 'label' => $status, 'value' => isset($data['value']) ? $data['value'] : $status, 'default_value' => isset($data['default_value']) ? $data['default_value'] : '', 'old_value' => isset($data['old_value']) ? $data['old_value'] : '', 'inherit' => isset($data['inherit']) ? $data['inherit'] : '', 'can_use_default_value' => $this->getForm()->canUseDefaultValue($e), 'can_use_website_value' => $this->getForm()->canUseWebsiteValue($e)))->setRenderer($this->_getFieldRenderer());
return $field->toHtml();
}
示例10: _addFieldsToFieldset
/**
* This method makes life a little easier for us by pre-populating
* fields with $_POST data where applicable and wrapping our post data
* in 'brandData' so that we can easily separate all relevant information
* in the controller. You could of course omit this method entirely
* and call the $fieldset->addField() method directly.
* @return self
*/
protected function _addFieldsToFieldset(Varien_Data_Form_Element_Fieldset $fieldset, $fields)
{
foreach ($fields as $name => $_data) {
// Wrap all fields with brandData group.
$_data['name'] = "configData[{$name}]";
// Generally, label and title are always the same.
$_data['title'] = $_data['label'];
// If no new value exists, use the existing data.
if (!array_key_exists('value', $_data)) {
$_data['value'] = $this->_getValue()->getData($name);
}
if ($name == "test_mode") {
$_data['checked'] = $this->_getValue()->getData($name);
}
// Finally, call vanilla functionality to add field.
$fieldset->addField($name, $_data['input'], $_data);
}
return $this;
}
示例11: _addFieldsToFieldset
/**
* This method makes life a little easier for us by pre-populating
* fields with $_POST data where applicable and wraps our post data in
* 'brandData' so we can easily separate all relevant information in
* the controller. You can of course omit this method entirely and call
* the $fieldset->addField() method directly.
*/
protected function _addFieldsToFieldset(Varien_Data_Form_Element_Fieldset $fieldset, $fields)
{
$requestData = new Varien_Object($this->getRequest()->getPost('mappingData'));
foreach ($fields as $name => $_data) {
if ($requestValue = $requestData->getData($name)) {
$_data['value'] = $requestValue;
}
// wrap all fields with brandData group
$_data['name'] = "mappingData[{$name}]";
// generally label and title always the same
$_data['title'] = $_data['label'];
// if no new value exists, use existing brand data
if (!array_key_exists('value', $_data)) {
$_data['value'] = $this->_getBrand()->getData($name);
}
// finally call vanilla functionality to add field
$fieldset->addField($name, $_data['input'], $_data);
}
return $this;
}
示例12: _addFieldsToFieldset
/**
* This method makes life a little easier for us by pre-populating
* fields with $_POST data where applicable and wrapping our post data
* in 'commentData' so that we can easily separate all relevant information
* in the controller. You could of course omit this method entirely
* and call the $fieldset->addField() method directly.
*/
protected function _addFieldsToFieldset(Varien_Data_Form_Element_Fieldset $fieldset, $fields)
{
$requestData = new Varien_Object($this->getRequest()->getPost('commentData'));
foreach ($fields as $name => $_data) {
if ($requestValue = $requestData->getData($name)) {
$_data['value'] = $requestValue;
}
// Wrap all fields with commentData group.
$_data['name'] = "commentData[{$name}]";
// Generally, label and title are always the same.
$_data['title'] = $_data['label'];
// If no new value exists, use the existing comment data.
if (!array_key_exists('value', $_data)) {
$_data['value'] = $this->_getComment()->getData($name);
}
// Finally, call vanilla functionality to add field.
$fieldset->addField($name, $_data['input'], $_data);
}
return $this;
}
示例13: _prepareVisibleFields
/**
* Prepare form fieldset
* All fields are visible
*
* @param Varien_Data_Form_Element_Fieldset $fieldset
*
* @return Mage_Adminhtml_Block_Sales_Order_Create_Giftmessage_Form
*/
protected function _prepareVisibleFields(Varien_Data_Form_Element_Fieldset $fieldset)
{
$fieldset->addField('sender', 'text', array('name' => $this->_getFieldName('sender'), 'label' => Mage::helper('sales')->__('From'), 'required' => $this->getMessage()->getMessage() ? true : false));
$fieldset->addField('recipient', 'text', array('name' => $this->_getFieldName('recipient'), 'label' => Mage::helper('sales')->__('To'), 'required' => $this->getMessage()->getMessage() ? true : false));
$fieldset->addField('message', 'textarea', array('name' => $this->_getFieldName('message'), 'label' => Mage::helper('sales')->__('Message'), 'rows' => '5', 'cols' => '20'));
return $this;
}
示例14: toHtml
public function toHtml()
{
$model = $this->getModel();
parent::__construct(array('legend' => __('URL Settings')));
$this->addField('url_template', 'text', array('name' => 'properties[url_template]', 'label' => __('Url Template'), 'required' => true, 'value' => $model->getProperty('url_template'), 'note' => Mage::helper('searchindex/help')->field('url_template')));
return parent::toHtml();
}
示例15: toHtml
public function toHtml()
{
$model = $this->getModel();
parent::__construct(array('legend' => __('Additional')));
$this->addField('ignore', 'multiselect', array('name' => 'properties[ignore]', 'label' => __('Ingnored Pages'), 'required' => false, 'value' => $model->getProperty('ignore'), 'values' => Mage::getSingleton('adminhtml/system_config_source_cms_page')->toOptionArray(), 'note' => Mage::helper('searchindex/help')->field('ignore')));
return parent::toHtml();
}