Guest User

Untitled

a guest
Jun 24th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. <?php
  2. class Academy_Informations_Block_Adminhtml_Messages_Grid extends Mage_Adminhtml_Block_Widget_Grid
  3. {
  4. public function __construct()
  5. {
  6. parent::__construct();
  7. $this->setDefaultSort('message_id');
  8. $this->setDefaultDir('DESC');
  9. }
  10.  
  11. protected function _prepareCollection()
  12. {
  13. $messageModel = Mage::getModel('academy_informations/message');
  14. $messageCollection = $messageModel->getCollection();
  15.  
  16. $this->setCollection($messageCollection);
  17. return parent::_prepareCollection();
  18. }
  19.  
  20. protected function _prepareColumns()
  21. {
  22. $this->addColumn('message_id', array(
  23. 'index' => 'message_id',
  24. 'header' => $this->__('Message Id')
  25. ));
  26.  
  27. $this->addColumn('content', array(
  28. 'index' => 'content',
  29. 'header' => $this->__('Content')
  30. ));
  31.  
  32. $this->addColumn('category_id', array(
  33. 'index' => 'category_id',
  34. 'header' => $this->__('Category Id'),
  35. 'type' => 'options',
  36. 'options' => array('0' => 'machin',
  37. '1' => 'bidule',
  38. '2' => 'truc',
  39. '3' => 'pouet',
  40. '4' => 'pouetpouet')
  41. ));
  42.  
  43. $this->addColumn('action',
  44. array(
  45. 'header' => $this->__('Action'),
  46. 'width' => '50px',
  47. 'type' => 'action',
  48. 'getter' => 'getId',
  49. 'actions' => array(
  50. array(
  51. 'caption' => Mage::helper('catalog')->__('Edit'),
  52. 'url' => array(
  53. 'base'=>'*/*/edit',
  54. 'params'=>array('store'=>$this->getRequest()->getParam('store'))
  55. ),
  56. 'field' => 'id'
  57. )
  58. ),
  59. 'filter' => false,
  60. 'sortable' => false,
  61. 'index' => 'stores',
  62. ));
  63. }
  64.  
  65. public function getRowUrl($row)
  66. {
  67. return $this->getUrl('*/*/edit', array('id' => $row->getId()));
  68. }
  69. }
Add Comment
Please, Sign In to add comment