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_Remote_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_remote_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('category', array(
00065 'header'=>Mage::helper('adminhtml')->__('Category'),
00066 'index'=>'category',
00067 ));
00068
00069 $this->addColumn('name', array(
00070 'header'=>Mage::helper('adminhtml')->__('Extension Name'),
00071 'index'=>'name',
00072 ));
00073
00074 $this->addColumn('summary', array(
00075 'header'=>Mage::helper('adminhtml')->__('Summary'),
00076 'index'=>'summary',
00077 ));
00078
00079 $this->addColumn('remote_version', array(
00080 'header'=>Mage::helper('adminhtml')->__('Available Version'),
00081 'index'=>'remote_version',
00082 'type'=>'range',
00083 'width'=>'140px',
00084 ));
00085
00086 $this->addColumn('local_version', array(
00087 'header'=>Mage::helper('adminhtml')->__('Installed Version'),
00088 'index'=>'local_version',
00089 'type'=>'range',
00090 'width'=>'140px',
00091 ));
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 return $this;
00112 }
00113
00114 protected function _prepareMassaction()
00115 {
00116 return $this;
00117
00118 $this->setMassactionIdField('id');
00119 $this->getMassactionBlock()->setFormFieldName('package');
00120
00121 $this->getMassactionBlock()->addItem('install', array(
00122 'label'=> $this->__('Install'),
00123 'url' => $this->getUrl('*/*/massInstall'),
00124 'confirm' => $this->__('Are you sure you wish to INSTALL all selected packages?')
00125 ));
00126
00127 $this->getMassactionBlock()->addItem('upgrade', array(
00128 'label'=> $this->__('Upgrade'),
00129 'url' => $this->getUrl('*/*/massUpgrade'),
00130 'confirm' => $this->__('Are you sure you wish to UPGRADE all selected packages?')
00131 ));
00132
00133 return $this;
00134 }
00135
00136 public function getRowUrl($row)
00137 {
00138 $url = Mage::getModel('adminhtml/url');
00139 $url->setQueryParam('id', $row->getId());
00140 return $url->getUrl('*/*/edit');
00141 }
00142
00143 public function getGridUrl()
00144 {
00145 return $this->getUrl('*/*/grid', array('_current'=>true));
00146 }
00147
00148 }
00149