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: class Mage_Adminhtml_Block_Sales_Order_Status_New_Form extends Mage_Adminhtml_Block_Widget_Form
31: {
32: public function __construct()
33: {
34: parent::__construct();
35: $this->setId('new_order_status');
36: }
37:
38: 39: 40: 41: 42:
43: protected function _prepareForm()
44: {
45: $model = Mage::registry('current_status');
46: $labels = $model ? $model->getStoreLabels() : array();
47:
48: $form = new Varien_Data_Form(array(
49: 'id' => 'edit_form',
50: 'action' => $this->getData('action'),
51: 'method' => 'post'
52: ));
53:
54: $fieldset = $form->addFieldset('base_fieldset', array(
55: 'legend' => Mage::helper('sales')->__('Order Status Information')
56: ));
57:
58: $fieldset->addField('is_new', 'hidden', array('name' => 'is_new', 'value' => 1));
59:
60: $fieldset->addField('status', 'text',
61: array(
62: 'name' => 'status',
63: 'label' => Mage::helper('sales')->__('Status Code'),
64: 'class' => 'required-entry validate-code',
65: 'required' => true,
66: )
67: );
68:
69: $fieldset->addField('label', 'text',
70: array(
71: 'name' => 'label',
72: 'label' => Mage::helper('sales')->__('Status Label'),
73: 'class' => 'required-entry',
74: 'required' => true,
75: )
76: );
77:
78:
79: $fieldset = $form->addFieldset('store_labels_fieldset', array(
80: 'legend' => Mage::helper('sales')->__('Store View Specific Labels'),
81: 'table_class' => 'form-list stores-tree',
82: ));
83: $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset');
84: $fieldset->setRenderer($renderer);
85:
86: foreach (Mage::app()->getWebsites() as $website) {
87: $fieldset->addField("w_{$website->getId()}_label", 'note', array(
88: 'label' => $website->getName(),
89: 'fieldset_html_class' => 'website',
90: ));
91: foreach ($website->getGroups() as $group) {
92: $stores = $group->getStores();
93: if (count($stores) == 0) {
94: continue;
95: }
96: $fieldset->addField("sg_{$group->getId()}_label", 'note', array(
97: 'label' => $group->getName(),
98: 'fieldset_html_class' => 'store-group',
99: ));
100: foreach ($stores as $store) {
101: $fieldset->addField("store_label_{$store->getId()}", 'text', array(
102: 'name' => 'store_labels['.$store->getId().']',
103: 'required' => false,
104: 'label' => $store->getName(),
105: 'value' => isset($labels[$store->getId()]) ? $labels[$store->getId()] : '',
106: 'fieldset_html_class' => 'store',
107: ));
108: }
109: }
110: }
111:
112: if ($model) {
113: $form->addValues($model->getData());
114: }
115: $form->setAction($this->getUrl('*/sales_order_status/save'));
116: $form->setUseContainer(true);
117: $this->setForm($form);
118:
119: return parent::_prepareForm();
120: }
121: }
122: