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_System_Store_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
36: {
37: 38: 39: 40:
41: public function __construct()
42: {
43: switch (Mage::registry('store_type')) {
44: case 'website':
45: $this->_objectId = 'website_id';
46: $saveLabel = Mage::helper('core')->__('Save Website');
47: $deleteLabel = Mage::helper('core')->__('Delete Website');
48: $deleteUrl = $this->getUrl('*/*/deleteWebsite', array('item_id' => Mage::registry('store_data')->getId()));
49: break;
50: case 'group':
51: $this->_objectId = 'group_id';
52: $saveLabel = Mage::helper('core')->__('Save Store');
53: $deleteLabel = Mage::helper('core')->__('Delete Store');
54: $deleteUrl = $this->getUrl('*/*/deleteGroup', array('item_id' => Mage::registry('store_data')->getId()));
55: break;
56: case 'store':
57: $this->_objectId = 'store_id';
58: $saveLabel = Mage::helper('core')->__('Save Store View');
59: $deleteLabel = Mage::helper('core')->__('Delete Store View');
60: $deleteUrl = $this->getUrl('*/*/deleteStore', array('item_id' => Mage::registry('store_data')->getId()));
61: break;
62: }
63: $this->_controller = 'system_store';
64:
65: parent::__construct();
66:
67: $this->_updateButton('save', 'label', $saveLabel);
68: $this->_updateButton('delete', 'label', $deleteLabel);
69: $this->_updateButton('delete', 'onclick', 'setLocation(\''.$deleteUrl.'\');');
70:
71: if (!Mage::registry('store_data')->isCanDelete()) {
72: $this->_removeButton('delete');
73: }
74: if (Mage::registry('store_data')->isReadOnly()) {
75: $this->_removeButton('save')->_removeButton('reset');
76: }
77: }
78:
79: 80: 81: 82: 83:
84: public function ()
85: {
86: switch (Mage::registry('store_type')) {
87: case 'website':
88: $editLabel = Mage::helper('core')->__('Edit Website');
89: $addLabel = Mage::helper('core')->__('New Website');
90: break;
91: case 'group':
92: $editLabel = Mage::helper('core')->__('Edit Store');
93: $addLabel = Mage::helper('core')->__('New Store');
94: break;
95: case 'store':
96: $editLabel = Mage::helper('core')->__('Edit Store View');
97: $addLabel = Mage::helper('core')->__('New Store View');
98: break;
99: }
100:
101: return Mage::registry('store_action') == 'add' ? $addLabel : $editLabel;
102: }
103: }
104: