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_XmlConnect
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: * Application grid block
29: *
30: * @category Mage
31: * @package Mage_XmlConnect
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34: class Mage_Xmlconnect_Block_Adminhtml_Mobile_Grid extends Mage_Adminhtml_Block_Widget_Grid
35: {
36: /**
37: * Class constructor
38: */
39: public function __construct()
40: {
41: parent::__construct();
42: $this->setId('mobile_apps_grid');
43: $this->setDefaultSort('application_id');
44: $this->setDefaultDir('ASC');
45: }
46:
47: /**
48: * Initialize grid data collection
49: *
50: * @return Mage_Adminhtml_Block_Widget_Grid
51: */
52: protected function _prepareCollection()
53: {
54: $collection = Mage::getModel('xmlconnect/application')->getCollection();
55: $this->setCollection($collection);
56: return parent::_prepareCollection();
57: }
58:
59: /**
60: * Declare grid columns
61: *
62: * @return Mage_Adminhtml_Block_Widget_Grid
63: */
64: protected function _prepareColumns()
65: {
66: $this->addColumn('name', array(
67: 'header' => $this->__('App Name'),
68: 'align' => 'left',
69: 'index' => 'name',
70: ));
71:
72: $this->addColumn('code', array(
73: 'header' => $this->__('App Code'),
74: 'align' => 'left',
75: 'index' => 'code',
76: 'width' => '200',
77: ));
78:
79: if (!Mage::app()->isSingleStoreMode()) {
80: $this->addColumn('store_id', array(
81: 'header' => $this->__('Store View'),
82: 'index' => 'store_id',
83: 'type' => 'store',
84: 'store_view' => true,
85: 'sortable' => false,
86: 'width' => '250',
87: ));
88: }
89:
90: $this->addColumn('type', array(
91: 'header' => $this->__('Device'),
92: 'type' => 'text',
93: 'index' => 'type',
94: 'align' => 'center',
95: 'filter' => 'adminhtml/widget_grid_column_filter_select',
96: 'options' => Mage::helper('xmlconnect')->getSupportedDevices(),
97: 'renderer' => 'xmlconnect/adminhtml_mobile_grid_renderer_type',
98: ));
99:
100: $this->addColumn('status', array(
101: 'header' => $this->__('Status'),
102: 'index' => 'status',
103: 'renderer' => 'xmlconnect/adminhtml_mobile_grid_renderer_bool',
104: 'align' => 'center',
105: 'filter' => 'adminhtml/widget_grid_column_filter_select',
106: 'options' => Mage::helper('xmlconnect')->getStatusOptions(),
107:
108: ));
109:
110: return parent::_prepareColumns();
111: }
112:
113: /**
114: * Row click url
115: *
116: * @param Mage_Catalog_Model_Product|Varien_Object $row
117: * @return string
118: */
119: public function getRowUrl($row)
120: {
121: return $this->getUrl('*/*/edit', array('application_id' => $row->getId()));
122: }
123: }
124: