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_Widget_Grid_Container extends Mage_Adminhtml_Block_Widget_Container
36: {
37:
38: protected $_addButtonLabel;
39: protected $_backButtonLabel;
40: protected $_blockGroup = 'adminhtml';
41:
42: public function __construct()
43: {
44: if (is_null($this->_addButtonLabel)) {
45: $this->_addButtonLabel = $this->__('Add New');
46: }
47: if(is_null($this->_backButtonLabel)) {
48: $this->_backButtonLabel = $this->__('Back');
49: }
50:
51: parent::__construct();
52:
53: $this->setTemplate('widget/grid/container.phtml');
54:
55: $this->_addButton('add', array(
56: 'label' => $this->getAddButtonLabel(),
57: 'onclick' => 'setLocation(\'' . $this->getCreateUrl() .'\')',
58: 'class' => 'add',
59: ));
60: }
61:
62: protected function _prepareLayout()
63: {
64: $this->setChild( 'grid',
65: $this->getLayout()->createBlock( $this->_blockGroup.'/' . $this->_controller . '_grid',
66: $this->_controller . '.grid')->setSaveParametersInSession(true) );
67: return parent::_prepareLayout();
68: }
69:
70: public function getCreateUrl()
71: {
72: return $this->getUrl('*/*/new');
73: }
74:
75: public function getGridHtml()
76: {
77: return $this->getChildHtml('grid');
78: }
79:
80: protected function getAddButtonLabel()
81: {
82: return $this->_addButtonLabel;
83: }
84:
85: protected function getBackButtonLabel()
86: {
87: return $this->_backButtonLabel;
88: }
89:
90: protected function _addBackButton()
91: {
92: $this->_addButton('back', array(
93: 'label' => $this->getBackButtonLabel(),
94: 'onclick' => 'setLocation(\'' . $this->getBackUrl() .'\')',
95: 'class' => 'back',
96: ));
97: }
98:
99: public function ()
100: {
101: return 'icon-head ' . parent::getHeaderCssClass();
102: }
103:
104: public function ()
105: {
106: return 'width:50%;';
107: }
108: }
109: