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_Checkout_Agreement_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36: {
37: 38: 39: 40:
41: public function __construct()
42: {
43: parent::__construct();
44:
45: $this->setId('checkoutAgreementForm');
46: $this->setTitle(Mage::helper('checkout')->__('Terms and Conditions Information'));
47: }
48:
49: 50: 51: 52:
53: protected function _prepareForm()
54: {
55: $model = Mage::registry('checkout_agreement');
56: $form = new Varien_Data_Form(array(
57: 'id' => 'edit_form',
58: 'action' => $this->getData('action'),
59: 'method' => 'post'
60: ));
61:
62: $fieldset = $form->addFieldset('base_fieldset', array(
63: 'legend' => Mage::helper('checkout')->__('Terms and Conditions Information'),
64: 'class' => 'fieldset-wide',
65: ));
66:
67: if ($model->getId()) {
68: $fieldset->addField('agreement_id', 'hidden', array(
69: 'name' => 'agreement_id',
70: ));
71: }
72: $fieldset->addField('name', 'text', array(
73: 'name' => 'name',
74: 'label' => Mage::helper('checkout')->__('Condition Name'),
75: 'title' => Mage::helper('checkout')->__('Condition Name'),
76: 'required' => true,
77: ));
78:
79: $fieldset->addField('is_active', 'select', array(
80: 'label' => Mage::helper('checkout')->__('Status'),
81: 'title' => Mage::helper('checkout')->__('Status'),
82: 'name' => 'is_active',
83: 'required' => true,
84: 'options' => array(
85: '1' => Mage::helper('checkout')->__('Enabled'),
86: '0' => Mage::helper('checkout')->__('Disabled'),
87: ),
88: ));
89:
90: $fieldset->addField('is_html', 'select', array(
91: 'label' => Mage::helper('checkout')->__('Show Content as'),
92: 'title' => Mage::helper('checkout')->__('Show Content as'),
93: 'name' => 'is_html',
94: 'required' => true,
95: 'options' => array(
96: 0 => Mage::helper('checkout')->__('Text'),
97: 1 => Mage::helper('checkout')->__('HTML'),
98: ),
99: ));
100:
101: if (!Mage::app()->isSingleStoreMode()) {
102: $field = $fieldset->addField('store_id', 'multiselect', array(
103: 'name' => 'stores[]',
104: 'label' => Mage::helper('checkout')->__('Store View'),
105: 'title' => Mage::helper('checkout')->__('Store View'),
106: 'required' => true,
107: 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
108: ));
109: $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
110: $field->setRenderer($renderer);
111: }
112: else {
113: $fieldset->addField('store_id', 'hidden', array(
114: 'name' => 'stores[]',
115: 'value' => Mage::app()->getStore(true)->getId()
116: ));
117: $model->setStoreId(Mage::app()->getStore(true)->getId());
118: }
119:
120: $fieldset->addField('checkbox_text', 'editor', array(
121: 'name' => 'checkbox_text',
122: 'label' => Mage::helper('checkout')->__('Checkbox Text'),
123: 'title' => Mage::helper('checkout')->__('Checkbox Text'),
124: 'rows' => '5',
125: 'cols' => '30',
126: 'wysiwyg' => false,
127: 'required' => true,
128: ));
129:
130: $fieldset->addField('content', 'editor', array(
131: 'name' => 'content',
132: 'label' => Mage::helper('checkout')->__('Content'),
133: 'title' => Mage::helper('checkout')->__('Content'),
134: 'style' => 'height:24em;',
135: 'wysiwyg' => false,
136: 'required' => true,
137: ));
138:
139: $fieldset->addField('content_height', 'text', array(
140: 'name' => 'content_height',
141: 'label' => Mage::helper('checkout')->__('Content Height (css)'),
142: 'title' => Mage::helper('checkout')->__('Content Height'),
143: 'maxlength' => 25,
144: 'class' => 'validate-css-length',
145: ));
146:
147: $form->setValues($model->getData());
148: $form->setUseContainer(true);
149: $this->setForm($form);
150:
151: return parent::_prepareForm();
152: }
153: }
154: