00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Adminhtml_Block_Extensions_Local_Grid extends Mage_Adminhtml_Block_Widget_Grid
00035 {
00036 protected function _construct()
00037 {
00038 $this->setId('packagesGrid');
00039 $this->setEmptyText(Mage::helper('adminhtml')->__('No Extensions Found'));
00040 $this->setUseAjax(true);
00041 $this->setSaveParametersInSession(true);
00042 }
00043
00044 protected function _prepareCollection()
00045 {
00046 $collection = Mage::getModel('adminhtml/extension_local_collection');
00047
00048 $this->setCollection($collection);
00049
00050 return parent::_prepareCollection();
00051 }
00052
00053 protected function _prepareColumns()
00054 {
00055 $ext = Mage::getModel('adminhtml/extension');
00056
00057 $this->addColumn('channel', array(
00058 'header'=>Mage::helper('adminhtml')->__('Channel'),
00059 'index'=>'channel',
00060 #'type'=>'options',
00061 #'options'=>$ext->getKnownChannels(),
00062 ));
00063
00064 $this->addColumn('name', array(
00065 'header'=>Mage::helper('adminhtml')->__('Extension Name'),
00066 'index'=>'name',
00067 ));
00068
00069 $this->addColumn('version', array(
00070 'header'=>Mage::helper('adminhtml')->__('Version'),
00071 'index'=>'version',
00072 'type'=>'range',
00073 'width'=>'140px',
00074 ));
00075
00076 $this->addColumn('stability', array(
00077 'header'=>Mage::helper('adminhtml')->__('Stability'),
00078 'index'=>'stability',
00079 'type'=>'options',
00080 'options'=>$ext->getStabilityOptions(),
00081 ));
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 return $this;
00095 }
00096
00097 protected function _prepareMassaction()
00098 {
00099 return $this;
00100
00101 $this->setMassactionIdField('id');
00102 $this->getMassactionBlock()->setFormFieldName('package');
00103
00104 $this->getMassactionBlock()->addItem('uninstall', array(
00105 'label'=> $this->__('Uninstall'),
00106 'url' => $this->getUrl('*/*/massUninstall'),
00107 'confirm' => $this->__('Are you sure you wish to UNINSTALL all selected packages?')
00108 ));
00109
00110 $this->getMassactionBlock()->addItem('upgrade', array(
00111 'label'=> $this->__('Upgrade'),
00112 'url' => $this->getUrl('*/*/massUpgrade'),
00113 'confirm' => $this->__('Are you sure you wish to UPGRADE all selected packages?')
00114 ));
00115
00116 return $this;
00117 }
00118
00119 public function getRowUrl($row)
00120 {
00121 $url = Mage::getModel('adminhtml/url');
00122 $url->setQueryParam('id', $row->getId());
00123 return $url->getUrl('*/*/edit');
00124 }
00125
00126 public function getGridUrl()
00127 {
00128 return $this->getUrl('*/*/grid', array('_current'=>true));
00129 }
00130
00131 }
00132