本文整理匯總了PHP中Varien_Data_Form::setHtmlIdPrefix方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Data_Form::setHtmlIdPrefix方法的具體用法?PHP Varien_Data_Form::setHtmlIdPrefix怎麽用?PHP Varien_Data_Form::setHtmlIdPrefix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Varien_Data_Form
的用法示例。
在下文中一共展示了Varien_Data_Form::setHtmlIdPrefix方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _prepareForm
protected function _prepareForm()
{
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
$form->setHtmlIdPrefix("template");
$form->setFieldNameSuffix("template");
/* @var $template Mzax_Emarketing_Model_Template */
$template = Mage::registry('current_template');
if ($template->getId()) {
$form->addField('template_id', 'hidden', array('name' => 'template_id', 'value' => $template->getId()));
}
$fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Template Option'), 'class' => 'fieldset-wide'))->addType('editor', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_templateEditor'))->addType('credits', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_credits'));
$fieldset->addField('credits', 'credits', array('name' => 'credits', 'required' => true));
$fieldset->addField('name', 'text', array('name' => 'name', 'required' => true, 'label' => $this->__('Template Name'), 'title' => $this->__('Template Name')));
$fieldset->addField('description', 'textarea', array('name' => 'description', 'required' => true, 'label' => $this->__('Description'), 'title' => $this->__('Description'), 'style' => 'height:4em;', 'note' => "For internal use only"));
$snippets = new Mzax_Emarketing_Model_Medium_Email_Snippets();
Mage::getSingleton('mzax_emarketing/medium_email')->prepareSnippets($snippets);
$editorConfig = new Varien_Object();
$editorConfig->setFilesBrowserWindowUrl($this->getUrl('adminhtml/cms_wysiwyg_images/index'));
$editorConfig->setWidgetWindowUrl($this->getUrl('adminhtml/widget/index'));
$editorConfig->setSnippets($snippets);
$editor = $fieldset->addField('body', 'editor', array('name' => 'body', 'required' => true, 'label' => $this->__('Template HTML'), 'title' => $this->__('Template HTML'), 'logo' => $this->getSkinUrl('images/logo.gif'), 'fullscreen_title' => $this->__('Template %s', $template->getName()), 'style' => 'height:50em;', 'value' => '', 'config' => $editorConfig));
// Setting custom renderer for content field to remove label column
$renderer = $this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element')->setTemplate('cms/page/edit/form/renderer/content.phtml');
$editor->setRenderer($renderer);
$form->addValues($template->getData());
$this->setForm($form);
$form->setUseContainer(true);
return parent::_prepareForm();
}
示例2: getForm
/**
* Retrieve Varien Data Form
*
* @return Varien_Data_Form
*/
public function getForm()
{
if (!$this->_form) {
$this->_form = new Varien_Data_Form();
$this->_form->setElementRenderer(Mage::getBlockSingleton('mzax_emarketing/editable')->setFormat('form'));
$this->_form->setHtmlIdPrefix("emulate_");
$this->_form->setFieldNameSuffix("emulate");
}
return $this->_form;
}
示例3: getConditionsForm
/**
* Rule form getter
*
* @return Varien_Data_Form
*/
public function getConditionsForm()
{
if (!$this->conditionsForm) {
$this->conditionsForm = new Varien_Data_Form();
$this->conditionsForm->setHtmlIdPrefix('rule__conditions__');
$this->conditionsForm->setFieldNameSuffix('rule[conditions]');
$this->conditionsForm->addType('select', Mage::getConfig()->getModelClassName('Aoe_FraudManager/Form_Element_Select'));
}
return $this->conditionsForm;
}
示例4: initForm
public function initForm()
{
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('_mzax_emarketing');
$form->setFieldNameSuffix('mzax_emarketing');
$tracker = Mage::registry('current_tracker');
$form->setHtmlIdPrefix('conditions_');
$renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('mzax/emarketing/fieldset.phtml')->setTestUrl($this->getUrl('*/*/testConditions', array('_current' => true)))->setNewFilterUrl($this->getUrl('*/*/newConditionHtml', array('tracker' => $tracker->getId())));
$fieldset = $form->addFieldset('conditions_fieldset', array('legend' => Mage::helper('salesrule')->__('Only track conversion goals matching the conditions below')))->setRenderer($renderer);
$fieldset->addField('conditions', 'text', array('name' => 'conditions', 'label' => $this->__('Conditions'), 'title' => $this->__('Conditions')))->setTracker($tracker)->setRenderer(Mage::getBlockSingleton('mzax_emarketing/conditions'));
$this->setForm($form);
return $this;
}
示例5: initForm
public function initForm()
{
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('_mzax_emarketing');
$form->setFieldNameSuffix('mzax_emarketing');
$campaign = Mage::registry('current_campaign');
$form->setHtmlIdPrefix('filter_');
$renderer = Mage::getBlockSingleton('adminhtml/widget_form_renderer_fieldset')->setTemplate('mzax/emarketing/fieldset.phtml')->setTestUrl($this->getUrl('*/*/testFilters', array('_current' => true)))->setNewFilterUrl($this->getUrl('*/*/newFilterHtml', array('campaign' => $campaign->getId())));
$fieldset = $form->addFieldset('conditions_fieldset', array('legend' => Mage::helper('salesrule')->__('Only send campaign to people matching the filters below')))->setRenderer($renderer);
$fieldset->addField('filters', 'text', array('name' => 'filters', 'label' => $this->__('Filters'), 'title' => $this->__('Filters')))->setCampaign($campaign)->setRenderer(Mage::getBlockSingleton('mzax_emarketing/filters'));
$this->setForm($form);
return $this;
}
示例6: _prepareForm
protected function _prepareForm()
{
$actionUrl = $this->getUrl('*/*/sales');
$form = new Varien_Data_Form(array('id' => 'filter_form', 'action' => $actionUrl, 'method' => 'get'));
$htmlIdPrefix = 'orderplacedby_report_';
$form->setHtmlIdPrefix($htmlIdPrefix);
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('reports')->__('Filter')));
$adminUserModel = Mage::getModel('admin/user');
$userCollection = $adminUserModel->getCollection()->load();
//Mage::log($userCollection->getData());
$dateFormatIso = "yyyy-MM-dd";
$filter = $this->getRequest()->getParam('filter');
if ($filter) {
$data = explode("&", urldecode(base64_decode($filter)));
$from = ltrim($data[0], 'from=');
$to = ltrim($data[1], 'to=');
echo $orderplacedby = ltrim($data[2], 'orderplacedby=');
} else {
$from = "";
$to = "";
$orderplacedby = "";
}
$fieldset->addField('from', 'date', array('name' => 'from', 'format' => $dateFormatIso, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'label' => Mage::helper('orderplacedby')->__('From'), 'title' => Mage::helper('orderplacedby')->__('From'), 'required' => true, 'value' => $from));
$fieldset->addField('to', 'date', array('name' => 'to', 'format' => $dateFormatIso, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'label' => Mage::helper('orderplacedby')->__('To'), 'title' => Mage::helper('orderplacedby')->__('To'), 'required' => true, 'value' => $to));
$fieldset->addField('orderplacedby', 'select', array('name' => 'orderplacedby', 'note' => 'Currently this filter will not work as it\'s not yet developed', 'label' => Mage::helper('orderplacedby')->__('Order Placed By'), 'title' => Mage::helper('orderplacedby')->__('Order Placed By'), 'values' => array(array('label' => '-- Select --', 'value' => ''), array('label' => 'Admin', 'value' => 'admin'), array('label' => 'Customer', 'value' => 'customer'))));
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例7: _prepareForm
protected function _prepareForm()
{
/* @var $model Amasty_Xlanding_Model_Page */
$model = Mage::registry('amlanding_page');
/* @var $helper Amasty_Xlanding_Helper_Data */
$helper = Mage::helper('amlanding');
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('page_');
$fieldset = $form->addFieldset('base_fieldset', array('legend' => $helper->__('Page Information')));
if ($model->getPageId()) {
$fieldset->addField('page_id', 'hidden', array('name' => 'page_id'));
}
$fieldset->addField('title', 'text', array('name' => 'title', 'label' => $helper->__('Page Name'), 'title' => $helper->__('Page Name'), 'required' => true));
$fieldset->addField('identifier', 'text', array('name' => 'identifier', 'label' => $helper->__('URL Key'), 'title' => $helper->__('URL Key'), 'required' => true, 'class' => 'validate-identifier', 'note' => $helper->__('Relative to Website Base URL')));
/**
* Check is single store mode
*/
if (!Mage::app()->isSingleStoreMode()) {
$fieldset->addField('store_id', 'multiselect', array('label' => $helper->__('Stores'), 'name' => 'stores[]', 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm()));
} else {
$fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => Mage::app()->getStore(true)->getId()));
$model->setStoreId(Mage::app()->getStore(true)->getId());
}
$fieldset->addField('is_active', 'select', array('label' => $helper->__('Status'), 'title' => $helper->__('Page Status'), 'name' => 'is_active', 'required' => true, 'options' => $helper->getAvailableStatuses()));
$form->setValues($model->getData());
$this->setForm($form);
return parent::_prepareForm();
}
示例8: _prepareForm
/**
* Prepare form before rendering HTML
*
* @return Mage_Adminhtml_Block_Widget_Form
*/
protected function _prepareForm()
{
$help = Mage::helper('antoinek_slider');
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('slider_');
$form->setFieldNameSuffix('slider');
$entity = Mage::registry('current_slider');
$form->setDataObject($entity);
if ($entity->getId()) {
$form->addField('slider_id', 'hidden', array('name' => 'slider_id'));
}
$fieldset = $form->addFieldset('general', array('legend' => $help->__('General Information')));
$fieldset->addField('title', 'text', array('name' => 'title', 'label' => $help->__('Title'), 'title' => $help->__('Title'), 'required' => true));
if (!Mage::app()->isSingleStoreMode()) {
$field = $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => Mage::helper('cms')->__('Store View'), 'title' => Mage::helper('cms')->__('Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
$field->setRenderer($renderer);
} else {
$fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => Mage::app()->getStore(true)->getId()));
$entity->setStoreId(Mage::app()->getStore(true)->getId());
}
$fieldset->addField('is_active', 'select', array('name' => 'is_active', 'label' => Mage::helper('adminhtml')->__('Status'), 'title' => Mage::helper('adminhtml')->__('Status'), 'required' => true, 'options' => array('1' => Mage::helper('cms')->__('Enabled'), '0' => Mage::helper('cms')->__('Disabled'))));
Mage::dispatchEvent('antoinek_slider_adminhtml_slider_edit_tab_general_prepare_form', array('form' => $form));
$form->setValues($entity->getData());
$this->setForm($form);
return parent::_prepareForm();
}
示例9: _prepareForm
protected function _prepareForm()
{
$model = Mage::registry('permissions_user');
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('user_');
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('adminhtml')->__('Account Information')));
if ($model->getUserId()) {
$fieldset->addField('user_id', 'hidden', array('name' => 'user_id'));
} else {
if (!$model->hasData('is_active')) {
$model->setIsActive(1);
}
}
$fieldset->addField('username', 'text', array('name' => 'username', 'label' => Mage::helper('adminhtml')->__('User Name'), 'id' => 'username', 'title' => Mage::helper('adminhtml')->__('User Name'), 'required' => true));
$fieldset->addField('firstname', 'text', array('name' => 'firstname', 'label' => Mage::helper('adminhtml')->__('First Name'), 'id' => 'firstname', 'title' => Mage::helper('adminhtml')->__('First Name'), 'required' => true));
$fieldset->addField('lastname', 'text', array('name' => 'lastname', 'label' => Mage::helper('adminhtml')->__('Last Name'), 'id' => 'lastname', 'title' => Mage::helper('adminhtml')->__('Last Name'), 'required' => true));
$fieldset->addField('email', 'text', array('name' => 'email', 'label' => Mage::helper('adminhtml')->__('Email'), 'id' => 'customer_email', 'title' => Mage::helper('adminhtml')->__('User Email'), 'class' => 'required-entry validate-email', 'required' => true));
$fieldset->addField('current_password', 'obscure', array('name' => 'current_password', 'label' => Mage::helper('adminhtml')->__('Current Admin Password'), 'id' => 'current_password', 'title' => Mage::helper('adminhtml')->__('Current Admin Password'), 'class' => 'input-text', 'required' => true));
if ($model->getUserId()) {
$fieldset->addField('password', 'password', array('name' => 'new_password', 'label' => Mage::helper('adminhtml')->__('New Password'), 'id' => 'new_pass', 'title' => Mage::helper('adminhtml')->__('New Password'), 'class' => 'input-text validate-admin-password'));
$fieldset->addField('confirmation', 'password', array('name' => 'password_confirmation', 'label' => Mage::helper('adminhtml')->__('Password Confirmation'), 'id' => 'confirmation', 'class' => 'input-text validate-cpassword'));
} else {
$fieldset->addField('password', 'password', array('name' => 'password', 'label' => Mage::helper('adminhtml')->__('Password'), 'id' => 'customer_pass', 'title' => Mage::helper('adminhtml')->__('Password'), 'class' => 'input-text required-entry validate-admin-password', 'required' => true));
$fieldset->addField('confirmation', 'password', array('name' => 'password_confirmation', 'label' => Mage::helper('adminhtml')->__('Password Confirmation'), 'id' => 'confirmation', 'title' => Mage::helper('adminhtml')->__('Password Confirmation'), 'class' => 'input-text required-entry validate-cpassword', 'required' => true));
}
if (Mage::getSingleton('admin/session')->getUser()->getId() != $model->getUserId()) {
$fieldset->addField('is_active', 'select', array('name' => 'is_active', 'label' => Mage::helper('adminhtml')->__('This account is'), 'id' => 'is_active', 'title' => Mage::helper('adminhtml')->__('Account Status'), 'class' => 'input-select', 'style' => 'width: 80px', 'options' => array('1' => Mage::helper('adminhtml')->__('Active'), '0' => Mage::helper('adminhtml')->__('Inactive'))));
}
$fieldset->addField('user_roles', 'hidden', array('name' => 'user_roles', 'id' => '_user_roles'));
$data = $model->getData();
unset($data['password']);
$form->setValues($data);
$this->setForm($form);
return parent::_prepareForm();
}
示例10: _prepareForm
protected function _prepareForm()
{
$rule = Mage::registry('current_promo_quote_rule');
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('rule_');
$fieldset = $form->addFieldset('default_label_fieldset', array('legend' => Mage::helper('salesrule')->__('Default Label')));
$labels = $rule->getStoreLabels();
$fieldset->addField('store_default_label', 'text', array('name' => 'store_labels[0]', 'required' => false, 'label' => Mage::helper('salesrule')->__('Default Rule Label for All Store Views'), 'value' => isset($labels[0]) ? $labels[0] : ''));
$fieldset = $form->addFieldset('store_labels_fieldset', array('legend' => Mage::helper('salesrule')->__('Store View Specific Labels'), 'table_class' => 'form-list stores-tree'));
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset');
$fieldset->setRenderer($renderer);
foreach (Mage::app()->getWebsites() as $website) {
$fieldset->addField("w_{$website->getId()}_label", 'note', array('label' => $website->getName(), 'fieldset_html_class' => 'website'));
foreach ($website->getGroups() as $group) {
$stores = $group->getStores();
if (count($stores) == 0) {
continue;
}
$fieldset->addField("sg_{$group->getId()}_label", 'note', array('label' => $group->getName(), 'fieldset_html_class' => 'store-group'));
foreach ($stores as $store) {
$fieldset->addField("s_{$store->getId()}", 'text', array('name' => 'store_labels[' . $store->getId() . ']', 'required' => false, 'label' => $store->getName(), 'value' => isset($labels[$store->getId()]) ? $labels[$store->getId()] : '', 'fieldset_html_class' => 'store'));
}
}
}
if ($rule->isReadonly()) {
foreach ($fieldset->getElements() as $element) {
$element->setReadonly(true, true);
}
}
$this->setForm($form);
return parent::_prepareForm();
}
示例11: _prepareForm
protected function _prepareForm()
{
$model = Mage::registry('cms_block');
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
$form->setHtmlIdPrefix('block_');
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('cms')->__('General Information'), 'class' => 'fieldset-wide'));
if ($model->getBlockId()) {
$fieldset->addField('block_id', 'hidden', array('name' => 'block_id'));
}
$fieldset->addField('title', 'text', array('name' => 'title', 'label' => Mage::helper('cms')->__('Block Title'), 'title' => Mage::helper('cms')->__('Block Title'), 'required' => true));
$fieldset->addField('identifier', 'text', array('name' => 'identifier', 'label' => Mage::helper('cms')->__('Identifier'), 'title' => Mage::helper('cms')->__('Identifier'), 'required' => true, 'class' => 'validate-xml-identifier'));
/**
* Check is single store mode
*/
if (!Mage::app()->isSingleStoreMode()) {
$field = $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => Mage::helper('cms')->__('Store View'), 'title' => Mage::helper('cms')->__('Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
$field->setRenderer($renderer);
} else {
$fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => Mage::app()->getStore(true)->getId()));
$model->setStoreId(Mage::app()->getStore(true)->getId());
}
$fieldset->addField('is_active', 'select', array('label' => Mage::helper('cms')->__('Status'), 'title' => Mage::helper('cms')->__('Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => Mage::helper('cms')->__('Enabled'), '0' => Mage::helper('cms')->__('Disabled'))));
if (!$model->getId()) {
$model->setData('is_active', '1');
}
$fieldset->addField('content', 'editor', array('name' => 'content', 'label' => Mage::helper('cms')->__('Content'), 'title' => Mage::helper('cms')->__('Content'), 'style' => 'height:36em', 'required' => true, 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig()));
$form->setValues($model->getData());
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例12: _prepareForm
/**
* prepare the form
* @access protected
* @return Freeresources_Freeresource_Block_Adminhtml_Freeresource_Category_Edit_Tab_Form
*/
protected function _prepareForm()
{
$freeresource = Mage::registry('current_freeresource');
$category = Mage::registry('current_category');
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('category_');
$form->setFieldNameSuffix('category');
$this->setForm($form);
$fieldset = $form->addFieldset('category_form', array('legend' => Mage::helper('icc_freeresources')->__('Category')));
$fieldset->addField('subcategory_id', 'hidden', array('name' => 'subcategory_id', 'label' => 'Sub Category Id', 'required' => false));
$event = $fieldset->addField('freeresource_id', 'select', array('name' => 'freeresource_id', 'label' => 'Free Resource', 'values' => Mage::getModel('icc_freeresources/freeresource_category')->getAllOptions(), 'onchange' => 'checkSelectedItem(this)', 'required' => true));
$event->setAfterElementHtml("<script type=\"text/javascript\">\r\n function checkSelectedItem(selectElement) {\r\n var category_subcategory_id = document.getElementById('category_subcategory_id').value;\r\n var reloadurl = '" . $this->getUrl('icc_freeresources/freeresource') . "id/' + selectElement.value+'/subcatid/' + category_subcategory_id;\r\n new Ajax.Request(reloadurl, {\r\n method: 'get',\r\n onLoading: function (transport) {\r\n \$('category_category_id').update('Searching...');\r\n },\r\n onComplete: function(transport) {\r\n \$('category_category_id').update(transport.responseText);\r\n disableSelectedItem();\r\n }\r\n });\r\n \r\n }\r\n checkSelectedItem(document.getElementById('category_freeresource_id'));\r\n</script>");
$fieldset->addField('category_id', 'select', array('name' => 'category_id', 'label' => 'Category', 'values' => Mage::getModel('icc_freeresources/freeresource_subcategory')->getAllOptions(), 'required' => true));
$fieldset->addField('title', 'text', array('label' => Mage::helper('icc_freeresources')->__('Title'), 'name' => 'title', 'required' => true, 'class' => 'required-entry'));
$fieldset->addField('description', 'editor', array('name' => 'description', 'label' => Mage::helper('icc_freeresources')->__('Description'), 'title' => Mage::helper('icc_freeresources')->__('Description'), 'style' => 'height:15em; width:50em;', 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(), 'wysiwyg' => true, 'required' => false));
$fieldset->addField('product_title', 'text', array('label' => Mage::helper('icc_freeresources')->__('Product Title'), 'name' => 'product_title', 'required' => FALSE));
$fieldset->addField('product_link', 'text', array('label' => Mage::helper('icc_freeresources')->__('Product Link'), 'name' => 'product_link', 'note' => Mage::helper('icc_freeresources')->__('Relative to Website Base URL')));
$fieldset->addField('image_url', 'text', array('label' => Mage::helper('icc_freeresources')->__('Image URL'), 'name' => 'image_url', 'required' => false));
$fieldset->addField('image_url_link', 'text', array('label' => Mage::helper('icc_freeresources')->__('Image Url Link'), 'name' => 'image_url_link', 'note' => Mage::helper('icc_freeresources')->__('Relative to Website Base URL')));
$fieldset->addField('link_to_content', 'editor', array('name' => 'link_to_content', 'label' => Mage::helper('icc_freeresources')->__('Link To Content'), 'title' => Mage::helper('icc_freeresources')->__('Link To Content'), 'style' => 'height:15em; width:50em;', 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(), 'wysiwyg' => true, 'required' => false));
$fieldset->addField('download_url', 'text', array('label' => Mage::helper('icc_freeresources')->__('Download Url'), 'name' => 'download_url', 'required' => FALSE));
$hideShow = $fieldset->addField('download_text', 'text', array('label' => Mage::helper('icc_freeresources')->__('Download Text'), 'name' => 'download_text', 'note' => Mage::helper('icc_freeresources')->__('Relative to Website Base URL')));
$hideShow->setAfterElementHtml("<script type=\"text/javascript\">\r\n function disableSelectedItem() {\r\n var index = document.getElementById('category_freeresource_id').selectedIndex;\r\n var value = document.getElementById('category_freeresource_id').options[index].text;\r\n if (value == 'Free Codes') {\r\n document.getElementById('category_product_title').disabled = false;\r\n document.getElementById('category_product_link').disabled = false;\r\n\r\n document.getElementById('category_download_url').disabled = true;\r\n document.getElementById('category_download_text').disabled = true;\r\n } else {\r\n document.getElementById('category_product_title').disabled = true;\r\n document.getElementById('category_product_link').disabled = true;\r\n\r\n document.getElementById('category_download_url').disabled = false;\r\n document.getElementById('category_download_text').disabled = false;\r\n }\r\n }\r\n</script>");
$fieldset->addField('status', 'select', array('label' => Mage::helper('icc_freeresources')->__('Status'), 'name' => 'status', 'values' => array(array('value' => 1, 'label' => Mage::helper('icc_freeresources')->__('Enabled')), array('value' => 0, 'label' => Mage::helper('icc_freeresources')->__('Disabled')))));
$form->addValues($this->getCategory()->getData());
return parent::_prepareForm();
}
開發者ID:ankita-parashar,項目名稱:magento,代碼行數:32,代碼來源:ICC_Freeresources_Block_Adminhtml_Freeresource_Subcategory_Edit_Tab_Form.php
示例13: _prepareForm
/**
* Prepare form before rendering HTML
* Setting Form Fieldsets and fields
*
* @return Mage_Adminhtml_Block_Widget_Form
*/
protected function _prepareForm()
{
$model = Mage::helper('xmlconnect')->getApplication();
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('app_');
$fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('App Information')));
if ($model->getId()) {
$fieldset->addField('application_id', 'hidden', array('name' => 'application_id', 'value' => $model->getId()));
}
$fieldset->addField('name', 'text', array('name' => 'name', 'label' => $this->__('App Name'), 'title' => $this->__('App Name'), 'maxlength' => '250', 'value' => $model->getName(), 'required' => true));
if ($model->getId()) {
$field = $fieldset->addField('code', 'label', array('label' => $this->__('App Code'), 'title' => $this->__('App Code'), 'value' => $model->getCode()));
}
/**
* Check is single store mode
*/
if (!Mage::app()->isSingleStoreMode()) {
$storeElement = $fieldset->addField('store_id', 'select', array('name' => 'store_id', 'label' => $this->__('Store View'), 'title' => $this->__('Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(true, false)));
} else {
$storeElement = $fieldset->addField('store_id', 'hidden', array('name' => 'store_id', 'value' => Mage::app()->getStore(true)->getId()));
$model->setStoreId(Mage::app()->getStore(true)->getId());
}
if ($model->getId()) {
$storeElement->setValue($model->getStoreId());
$storeElement->setDisabled(true);
}
$fieldset->addField('showdev', 'select', array('name' => 'showdev', 'label' => $this->__('Device Type'), 'title' => $this->__('Device Type'), 'values' => array($model->getType() => $model->getDevtype()), 'disabled' => true));
$fieldset->addField('devtype', 'hidden', array('name' => 'devtype', 'value' => $model->getType()));
$yesNoValues = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
$fieldset->addField('browsing_mode', 'select', array('label' => $this->__('Catalog Only App?'), 'name' => 'browsing_mode', 'note' => $this->__('A Catalog Only App will not support functions such as add to cart, add to wishlist, or login.'), 'value' => $model->getBrowsingMode(), 'values' => $yesNoValues));
$this->setForm($form);
return parent::_prepareForm();
}
示例14: _prepareForm
protected function _prepareForm()
{
if (Mage::getSingleton('adminhtml/session')->getFormData()) {
$data = Mage::getSingleton('adminhtml/session')->getFormData();
Mage::getSingleton('adminhtml/session')->setFormData(null);
} elseif (Mage::registry('rule_data')) {
$data = Mage::registry('rule_data')->getData();
}
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('rule_');
$this->setForm($form);
$fieldset = $form->addFieldset('general_fieldset', array('legend' => Mage::helper('customerreward')->__('General information')));
$fieldset->addField('title', 'text', array('label' => Mage::helper('customerreward')->__('Title'), 'title' => Mage::helper('customerreward')->__('Title'), 'class' => 'required-entry', 'required' => true, 'name' => 'title'));
$fieldset->addField('description', 'editor', array('name' => 'description', 'label' => Mage::helper('customerreward')->__('Description'), 'title' => Mage::helper('customerreward')->__('Description'), 'style' => 'width:276px;height:100px;'));
if (!Mage::app()->isSingleStoreMode()) {
$fieldset->addField('website_ids', 'multiselect', array('name' => 'website_ids[]', 'label' => Mage::helper('customerreward')->__('Websites'), 'title' => Mage::helper('customerreward')->__('Websites'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_config_source_website')->toOptionArray()));
} else {
$fieldset->addField('website_ids', 'hidden', array('name' => 'website_ids[]', 'value' => Mage::app()->getStore(true)->getWebsiteId()));
$data['website_ids'] = Mage::app()->getStore(true)->getWebsiteId();
}
$fieldset->addField('customer_group_ids', 'multiselect', array('label' => Mage::helper('customerreward')->__('Customer groups'), 'title' => Mage::helper('customerreward')->__('Customer groups'), 'name' => 'customer_group_ids', 'required' => true, 'values' => Mage::getResourceModel('customer/group_collection')->addFieldToFilter('customer_group_id', array('gt' => 0))->load()->toOptionArray()));
$dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$fieldset->addField('from_date', 'date', array('name' => 'from_date', 'label' => Mage::helper('customerreward')->__('Validate from'), 'title' => Mage::helper('customerreward')->__('From date'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT, 'format' => $dateFormatIso));
$fieldset->addField('to_date', 'date', array('name' => 'to_date', 'label' => Mage::helper('customerreward')->__('Validate to'), 'title' => Mage::helper('customerreward')->__('To date'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT, 'format' => $dateFormatIso));
$fieldset->addField('is_active', 'select', array('label' => Mage::helper('customerreward')->__('Status'), 'title' => Mage::helper('customerreward')->__('Status'), 'name' => 'is_active', 'values' => array(array('value' => '1', 'label' => Mage::helper('customerreward')->__('Active')), array('value' => '0', 'label' => Mage::helper('customerreward')->__('Inactive')))));
$fieldset->addField('sort_order', 'text', array('name' => 'sort_order', 'label' => Mage::helper('customerreward')->__('Priority'), 'title' => Mage::helper('customerreward')->__('Priority')));
$form->setValues($data);
return parent::_prepareForm();
}
示例15: _prepareForm
protected function _prepareForm()
{
$model = Mage::registry('current_promo_quote_rule');
//$form = new Varien_Data_Form(array('id' => 'edit_form1', 'action' => $this->getData('action'), 'method' => 'post'));
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('rule_');
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('salesrule')->__('General Information')));
if ($model->getId()) {
$fieldset->addField('rule_id', 'hidden', array('name' => 'rule_id'));
}
$fieldset->addField('product_ids', 'hidden', array('name' => 'product_ids'));
$fieldset->addField('name', 'text', array('name' => 'name', 'label' => Mage::helper('salesrule')->__('Rule Name'), 'title' => Mage::helper('salesrule')->__('Rule Name'), 'required' => true));
$fieldset->addField('description', 'textarea', array('name' => 'description', 'label' => Mage::helper('salesrule')->__('Description'), 'title' => Mage::helper('salesrule')->__('Description'), 'style' => 'width: 98%; height: 100px;'));
$fieldset->addField('is_active', 'select', array('label' => Mage::helper('salesrule')->__('Status'), 'title' => Mage::helper('salesrule')->__('Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => Mage::helper('salesrule')->__('Active'), '0' => Mage::helper('salesrule')->__('Inactive'))));
if (!$model->getId()) {
$model->setData('is_active', '1');
}
if (!Mage::app()->isSingleStoreMode()) {
$fieldset->addField('website_ids', 'multiselect', array('name' => 'website_ids[]', 'label' => Mage::helper('catalogrule')->__('Websites'), 'title' => Mage::helper('catalogrule')->__('Websites'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_config_source_website')->toOptionArray()));
} else {
$fieldset->addField('website_ids', 'hidden', array('name' => 'website_ids[]', 'value' => Mage::app()->getStore(true)->getWebsiteId()));
$model->setWebsiteIds(Mage::app()->getStore(true)->getWebsiteId());
}
$customerGroups = Mage::getResourceModel('customer/group_collection')->load()->toOptionArray();
$found = false;
foreach ($customerGroups as $group) {
if ($group['value'] == 0) {
$found = true;
}
}
if (!$found) {
array_unshift($customerGroups, array('value' => 0, 'label' => Mage::helper('salesrule')->__('NOT LOGGED IN')));
}
$fieldset->addField('customer_group_ids', 'multiselect', array('name' => 'customer_group_ids[]', 'label' => Mage::helper('salesrule')->__('Customer Groups'), 'title' => Mage::helper('salesrule')->__('Customer Groups'), 'required' => true, 'values' => $customerGroups));
$couponTypeFiled = $fieldset->addField('coupon_type', 'select', array('name' => 'coupon_type', 'label' => Mage::helper('salesrule')->__('Coupon'), 'required' => true, 'options' => Mage::getModel('salesrule/rule')->getCouponTypes()));
$couponCodeFiled = $fieldset->addField('coupon_code', 'text', array('name' => 'coupon_code', 'label' => Mage::helper('salesrule')->__('Coupon Code'), 'required' => true));
$usesPerCouponFiled = $fieldset->addField('uses_per_coupon', 'text', array('name' => 'uses_per_coupon', 'label' => Mage::helper('salesrule')->__('Uses per Coupon')));
$fieldset->addField('uses_per_customer', 'text', array('name' => 'uses_per_customer', 'label' => Mage::helper('salesrule')->__('Uses per Customer')));
$dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$fieldset->addField('from_date', 'date', array('name' => 'from_date', 'label' => Mage::helper('salesrule')->__('From Date'), 'title' => Mage::helper('salesrule')->__('From Date'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT, 'format' => $dateFormatIso));
$fieldset->addField('to_date', 'date', array('name' => 'to_date', 'label' => Mage::helper('salesrule')->__('To Date'), 'title' => Mage::helper('salesrule')->__('To Date'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT, 'format' => $dateFormatIso));
$fieldset->addField('sort_order', 'text', array('name' => 'sort_order', 'label' => Mage::helper('salesrule')->__('Priority')));
$fieldset->addField('is_rss', 'select', array('label' => Mage::helper('salesrule')->__('Public In RSS Feed'), 'title' => Mage::helper('salesrule')->__('Public In RSS Feed'), 'name' => 'is_rss', 'options' => array('1' => Mage::helper('salesrule')->__('Yes'), '0' => Mage::helper('salesrule')->__('No'))));
if (!$model->getId()) {
//set the default value for is_rss feed to yes for new promotion
$model->setIsRss(1);
}
$form->setValues($model->getData());
if ($model->isReadonly()) {
foreach ($fieldset->getElements() as $element) {
$element->setReadonly(true, true);
}
}
//$form->setUseContainer(true);
$this->setForm($form);
// field dependencies
$this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')->addFieldMap($couponTypeFiled->getHtmlId(), $couponTypeFiled->getName())->addFieldMap($couponCodeFiled->getHtmlId(), $couponCodeFiled->getName())->addFieldMap($usesPerCouponFiled->getHtmlId(), $usesPerCouponFiled->getName())->addFieldDependence($couponCodeFiled->getName(), $couponTypeFiled->getName(), Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC)->addFieldDependence($usesPerCouponFiled->getName(), $couponTypeFiled->getName(), Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC));
Mage::dispatchEvent('adminhtml_promo_quote_edit_tab_main_prepare_form', array('form' => $form));
return parent::_prepareForm();
}