1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34:
35: class Mage_Adminhtml_Block_Tag_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36: {
37:
38: public function __construct()
39: {
40: parent::__construct();
41: $this->setId('tag_form');
42: $this->setTitle(Mage::helper('tag')->__('Block Information'));
43: }
44:
45: 46: 47: 48: 49:
50: protected function _prepareForm()
51: {
52: $model = Mage::registry('tag_tag');
53:
54: $form = new Varien_Data_Form(
55: array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post')
56: );
57:
58: $fieldset = $form->addFieldset('base_fieldset',
59: array('legend'=>Mage::helper('tag')->__('General Information')));
60:
61: if ($model->getTagId()) {
62: $fieldset->addField('tag_id', 'hidden', array(
63: 'name' => 'tag_id',
64: ));
65: }
66:
67: $fieldset->addField('form_key', 'hidden', array(
68: 'name' => 'form_key',
69: 'value' => Mage::getSingleton('core/session')->getFormKey(),
70: ));
71:
72: $fieldset->addField('store_id', 'hidden', array(
73: 'name' => 'store_id',
74: 'value' => (int)$this->getRequest()->getParam('store')
75: ));
76:
77: $fieldset->addField('name', 'text', array(
78: 'name' => 'tag_name',
79: 'label' => Mage::helper('tag')->__('Tag Name'),
80: 'title' => Mage::helper('tag')->__('Tag Name'),
81: 'required' => true,
82: 'after_element_html' => ' ' . Mage::helper('adminhtml')->__('[GLOBAL]'),
83: ));
84:
85: $fieldset->addField('status', 'select', array(
86: 'label' => Mage::helper('tag')->__('Status'),
87: 'title' => Mage::helper('tag')->__('Status'),
88: 'name' => 'tag_status',
89: 'required' => true,
90: 'options' => array(
91: Mage_Tag_Model_Tag::STATUS_DISABLED => Mage::helper('tag')->__('Disabled'),
92: Mage_Tag_Model_Tag::STATUS_PENDING => Mage::helper('tag')->__('Pending'),
93: Mage_Tag_Model_Tag::STATUS_APPROVED => Mage::helper('tag')->__('Approved'),
94: ),
95: 'after_element_html' => ' ' . Mage::helper('adminhtml')->__('[GLOBAL]'),
96: ));
97:
98: $fieldset->addField('base_popularity', 'text', array(
99: 'name' => 'base_popularity',
100: 'label' => Mage::helper('tag')->__('Base Popularity'),
101: 'title' => Mage::helper('tag')->__('Base Popularity'),
102: 'after_element_html' => ' ' . Mage::helper('tag')->__('[STORE VIEW]'),
103: ));
104:
105: if (!$model->getId() && !Mage::getSingleton('adminhtml/session')->getTagData() ) {
106: $model->setStatus(Mage_Tag_Model_Tag::STATUS_APPROVED);
107: }
108:
109: if ( Mage::getSingleton('adminhtml/session')->getTagData() ) {
110: $form->addValues(Mage::getSingleton('adminhtml/session')->getTagData());
111: Mage::getSingleton('adminhtml/session')->setTagData(null);
112: } else {
113: $form->addValues($model->getData());
114: }
115:
116: $this->setForm($form);
117: return parent::_prepareForm();
118: }
119: }
120: