*/ class Mage_Xmlconnect_Block_Adminhtml_Mobile_Grid extends Mage_Adminhtml_Block_Widget_Grid { /** * Class constructor */ public function __construct() { parent::__construct(); $this->setId('mobile_apps_grid'); $this->setDefaultSort('application_id'); $this->setDefaultDir('ASC'); } /** * Initialize grid data collection * * @return Mage_Adminhtml_Block_Widget_Grid */ protected function _prepareCollection() { $collection = Mage::getModel('xmlconnect/application')->getCollection(); $this->setCollection($collection); return parent::_prepareCollection(); } /** * Declare grid columns * * @return Mage_Adminhtml_Block_Widget_Grid */ protected function _prepareColumns() { $this->addColumn('name', array( 'header' => $this->__('App Name'), 'align' => 'left', 'index' => 'name', )); $this->addColumn('code', array( 'header' => $this->__('App Code'), 'align' => 'left', 'index' => 'code', 'width' => '200', )); if (!Mage::app()->isSingleStoreMode()) { $this->addColumn('store_id', array( 'header' => $this->__('Store View'), 'index' => 'store_id', 'type' => 'store', 'store_view' => true, 'sortable' => false, 'width' => '250', )); } $this->addColumn('type', array( 'header' => $this->__('Device'), 'type' => 'text', 'index' => 'type', 'align' => 'center', 'filter' => 'adminhtml/widget_grid_column_filter_select', 'options' => Mage::helper('xmlconnect')->getSupportedDevices(), 'renderer' => 'xmlconnect/adminhtml_mobile_grid_renderer_type', )); $this->addColumn('status', array( 'header' => $this->__('Status'), 'index' => 'status', 'renderer' => 'xmlconnect/adminhtml_mobile_grid_renderer_bool', 'align' => 'center', 'filter' => 'adminhtml/widget_grid_column_filter_select', 'options' => Mage::helper('xmlconnect')->getStatusOptions(), )); return parent::_prepareColumns(); } /** * Row click url * * @param Mage_Catalog_Model_Product|Varien_Object $row * @return string */ public function getRowUrl($row) { return $this->getUrl('*/*/edit', array('application_id' => $row->getId())); } }