1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Adminhtml
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27: /**
28: * Design changes grid
29: *
30: * @category Mage
31: * @package Mage_Adminhtml
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34: class Mage_Adminhtml_Block_System_Design_Grid extends Mage_Adminhtml_Block_Widget_Grid
35: {
36:
37: /**
38: * Class constructor
39: */
40: public function __construct()
41: {
42: parent::__construct();
43: $this->setId('designGrid');
44: $this->setSaveParametersInSession(true);
45: $this->setUseAjax(true);
46: }
47:
48: /**
49: * Prepare grid data collection
50: *
51: * @return Mage_Adminhtml_Block_System_Design_Grid
52: */
53: protected function _prepareCollection()
54: {
55: $storeId = (int) $this->getRequest()->getParam('store', 0);
56:
57: $collection = Mage::getResourceModel('core/design_collection');
58:
59: $this->setCollection($collection);
60: parent::_prepareCollection();
61: return $this;
62: }
63:
64: /**
65: * Define grid columns
66: *
67: * @return Mage_Adminhtml_Block_System_Design_Grid
68: */
69: protected function _prepareColumns()
70: {
71: if (!Mage::app()->isSingleStoreMode()) {
72: $this->addColumn('store_id', array(
73: 'header' => Mage::helper('catalog')->__('Store'),
74: 'width' => '100px',
75: 'type' => 'store',
76: 'store_view' => true,
77: 'sortable' => false,
78: 'index' => 'store_id',
79: ));
80: }
81:
82: $this->addColumn('package', array(
83: 'header' => Mage::helper('catalog')->__('Design'),
84: 'width' => '150px',
85: 'index' => 'design',
86: ));
87: $this->addColumn('date_from', array(
88: 'header' => Mage::helper('catalogrule')->__('Date From'),
89: 'align' => 'left',
90: 'width' => '100px',
91: 'type' => 'date',
92: 'index' => 'date_from',
93: ));
94:
95: $this->addColumn('date_to', array(
96: 'header' => Mage::helper('catalogrule')->__('Date To'),
97: 'align' => 'left',
98: 'width' => '100px',
99: 'type' => 'date',
100: 'index' => 'date_to',
101: ));
102:
103: return parent::_prepareColumns();
104: }
105:
106: /**
107: * Prepare row click url
108: *
109: * @param Varien_Object $row
110: * @return string
111: */
112: public function getRowUrl($row)
113: {
114: return $this->getUrl('*/*/edit', array('id' => $row->getId()));
115: }
116:
117: /**
118: * Prepare grid url
119: *
120: * @return string
121: */
122: public function getGridUrl()
123: {
124: return $this->getUrl('*/*/grid', array('_current' => true));
125: }
126:
127: }
128: