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 extends Mage_Adminhtml_Block_Widget_Form_Container
36: {
37: 38: 39: 40: 41:
42: public function __construct()
43: {
44: $this->_objectId = 'tag_id';
45: $this->_controller = 'tag';
46:
47: parent::__construct();
48:
49: $this->_updateButton('save', 'label', Mage::helper('tag')->__('Save Tag'));
50: $this->_updateButton('delete', 'label', Mage::helper('tag')->__('Delete Tag'));
51:
52: $this->addButton('save_and_edit_button', array(
53: 'label' => Mage::helper('tag')->__('Save and Continue Edit'),
54: 'onclick' => "saveAndContinueEdit('" . $this->getSaveAndContinueUrl() . "')",
55: 'class' => 'save'
56: ), 1);
57: }
58:
59: 60: 61: 62: 63:
64: protected function _prepareLayout()
65: {
66: parent::_prepareLayout();
67:
68: $this->setChild('store_switcher', $this->getLayout()->createBlock('adminhtml/tag_store_switcher'))
69: ->setChild('tag_assign_accordion', $this->getLayout()->createBlock('adminhtml/tag_edit_assigned'))
70: ->setChild('accordion', $this->getLayout()->createBlock('adminhtml/tag_edit_accordion'));
71:
72: return $this;
73: }
74:
75: 76: 77: 78: 79:
80: public function ()
81: {
82: if (Mage::registry('current_tag')->getId()) {
83: return Mage::helper('tag')->__("Edit Tag '%s'", $this->htmlEscape(Mage::registry('current_tag')->getName()));
84: }
85: return Mage::helper('tag')->__('New Tag');
86: }
87:
88: 89: 90: 91: 92:
93: public function getAcordionsHtml()
94: {
95: return $this->getChildHtml('accordion');
96: }
97:
98: 99: 100: 101: 102:
103: public function getDeleteUrl()
104: {
105: return $this->getUrl('*/*/delete', array('tag_id' => $this->getRequest()->getParam($this->_objectId), 'ret' => $this->getRequest()->getParam('ret', 'index')));
106: }
107:
108: 109: 110: 111: 112:
113: public function getTagAssignAccordionHtml()
114: {
115: return $this->getChildHtml('tag_assign_accordion');
116: }
117:
118: 119: 120: 121: 122:
123: public function getStoreSwitcherHtml()
124: {
125: return $this->getChildHtml('store_switcher');
126: }
127:
128: 129: 130: 131: 132:
133: public function isSingleStoreMode()
134: {
135: return Mage::app()->isSingleStoreMode();
136: }
137:
138: 139: 140: 141: 142:
143: public function getSaveUrl()
144: {
145: return $this->getUrl('*/*/save', array('_current'=>true));
146: }
147:
148: 149: 150: 151: 152:
153: public function getSaveAndContinueUrl()
154: {
155: return $this->getUrl('*/*/save', array('_current' => true, 'ret' => 'edit', 'continue' => $this->getRequest()->getParam('ret', 'index'), 'store' => Mage::registry('current_tag')->getStoreId()));
156: }
157:
158: 159: 160: 161: 162:
163: public function getBackUrl()
164: {
165: return $this->getUrl('*/*/' . $this->getRequest()->getParam('ret', 'index'));
166: }
167: }
168: