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_Review_Add_Form extends Mage_Adminhtml_Block_Widget_Form
36: {
37: protected function _prepareForm()
38: {
39: $statuses = Mage::getModel('review/review')
40: ->getStatusCollection()
41: ->load()
42: ->toOptionArray();
43:
44: $form = new Varien_Data_Form();
45:
46: $fieldset = $form->addFieldset('add_review_form', array('legend' => Mage::helper('review')->__('Review Details')));
47:
48: $fieldset->addField('product_name', 'note', array(
49: 'label' => Mage::helper('review')->__('Product'),
50: 'text' => 'product_name',
51: ));
52:
53: $fieldset->addField('detailed_rating', 'note', array(
54: 'label' => Mage::helper('review')->__('Product Rating'),
55: 'required' => true,
56: 'text' => '<div id="rating_detail">'
57: . $this->getLayout()->createBlock('adminhtml/review_rating_detailed')->toHtml() . '</div>',
58: ));
59:
60: $fieldset->addField('status_id', 'select', array(
61: 'label' => Mage::helper('review')->__('Status'),
62: 'required' => true,
63: 'name' => 'status_id',
64: 'values' => $statuses,
65: ));
66:
67: 68: 69:
70: if (!Mage::app()->isSingleStoreMode()) {
71: $field = $fieldset->addField('select_stores', 'multiselect', array(
72: 'label' => Mage::helper('review')->__('Visible In'),
73: 'required' => true,
74: 'name' => 'select_stores[]',
75: 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(),
76: ));
77: $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
78: $field->setRenderer($renderer);
79: }
80:
81: $fieldset->addField('nickname', 'text', array(
82: 'name' => 'nickname',
83: 'title' => Mage::helper('review')->__('Nickname'),
84: 'label' => Mage::helper('review')->__('Nickname'),
85: 'maxlength' => '50',
86: 'required' => true,
87: ));
88:
89: $fieldset->addField('title', 'text', array(
90: 'name' => 'title',
91: 'title' => Mage::helper('review')->__('Summary of Review'),
92: 'label' => Mage::helper('review')->__('Summary of Review'),
93: 'maxlength' => '255',
94: 'required' => true,
95: ));
96:
97: $fieldset->addField('detail', 'textarea', array(
98: 'name' => 'detail',
99: 'title' => Mage::helper('review')->__('Review'),
100: 'label' => Mage::helper('review')->__('Review'),
101: 'style' => 'height: 600px;',
102: 'required' => true,
103: ));
104:
105: $fieldset->addField('product_id', 'hidden', array(
106: 'name' => 'product_id',
107: ));
108:
109: 110: 111: 112:
113:
114: $form->setMethod('post');
115: $form->setUseContainer(true);
116: $form->setId('edit_form');
117: $form->setAction($this->getUrl('*/*/post'));
118:
119: $this->setForm($form);
120: }
121: }
122: