Public Member Functions | |
__construct () | |
getRowUrl ($row) | |
Protected Member Functions | |
_prepareCollection () | |
_prepareColumns () | |
_addColumnFilterToCollection ($column) | |
_prepareMassaction () |
Definition at line 34 of file Grid.php.
__construct | ( | ) |
Constructor
By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes
Reimplemented from Varien_Object.
Definition at line 37 of file Grid.php.
00038 { 00039 parent::__construct(); 00040 $this->setId('tag_tag_grid'); 00041 $this->setDefaultSort('name'); 00042 $this->setDefaultDir('ASC'); 00043 }
_addColumnFilterToCollection | ( | $ | column | ) | [protected] |
Reimplemented from Mage_Adminhtml_Block_Widget_Grid.
Definition at line 149 of file Grid.php.
00150 { 00151 if($column->getIndex()=='stores') { 00152 $this->getCollection()->addStoreFilter($column->getFilter()->getCondition(), false); 00153 } else { 00154 parent::_addColumnFilterToCollection($column); 00155 } 00156 00157 return $this; 00158 }
_prepareCollection | ( | ) | [protected] |
Prepare grid collection object
Reimplemented from Mage_Adminhtml_Block_Widget_Grid.
Definition at line 45 of file Grid.php.
00046 { 00047 $collection = Mage::getResourceModel('tag/tag_collection') 00048 ->addSummary(0) 00049 ->addStoresVisibility(); 00050 $this->setCollection($collection); 00051 return parent::_prepareCollection(); 00052 }
_prepareColumns | ( | ) | [protected] |
Reimplemented from Mage_Adminhtml_Block_Widget_Grid.
Definition at line 54 of file Grid.php.
00055 { 00056 $baseUrl = $this->getUrl(); 00057 00058 $this->addColumn('name', array( 00059 'header' => Mage::helper('tag')->__('Tag'), 00060 'index' => 'name', 00061 )); 00062 00063 $this->addColumn('total_used', array( 00064 'header' => Mage::helper('tag')->__('Uses'), 00065 'width' => '140px', 00066 'align' => 'right', 00067 'index' => 'uses', 00068 'type' => 'number', 00069 )); 00070 00071 $this->addColumn('products', array( 00072 'header' => Mage::helper('tag')->__('Products'), 00073 'width' => '140px', 00074 'align' => 'right', 00075 'index' => 'products', 00076 'type' => 'number', 00077 )); 00078 00079 $this->addColumn('customers', array( 00080 'header' => Mage::helper('tag')->__('Customers'), 00081 'width' => '140px', 00082 'align' => 'right', 00083 'index' => 'customers', 00084 'type' => 'number', 00085 )); 00086 00087 $this->addColumn('popularity', array( 00088 'header' => Mage::helper('tag')->__('Popularity'), 00089 'width' => '140px', 00090 'align' => 'right', 00091 'index' => 'popularity', 00092 'type' => 'number', 00093 )); 00094 00095 $this->addColumn('status', array( 00096 'header' => Mage::helper('tag')->__('Status'), 00097 'width' => '90px', 00098 'index' => 'status', 00099 'type' => 'options', 00100 'options' => $this->helper('tag/data')->getStatusesArray(), 00101 )); 00102 00103 if (!Mage::app()->isSingleStoreMode()) { 00104 $this->addColumn('visible_in', array( 00105 'header' => Mage::helper('tag')->__('Visible In'), 00106 'type' => 'store', 00107 'skipAllStoresLabel' => true, 00108 'index' => 'stores', 00109 'sortable' => false, 00110 'store_view'=> true 00111 )); 00112 } 00113 00114 $this->addColumn('actions', array( 00115 'header' => Mage::helper('tag')->__('Actions'), 00116 'width' => '100px', 00117 'type' => 'action', 00118 'getter' => 'getId', 00119 'sortable' => false, 00120 'filter' => false, 00121 'actions' => array( 00122 array( 00123 'caption' => Mage::helper('tag')->__('Edit Tag'), 00124 'url' => $this->getUrl('*/*/edit', array('ret' => 'all', 'tag_id'=>'$tag_id')), 00125 ), 00126 array( 00127 'caption' => Mage::helper('tag')->__('View Products'), 00128 'url' => $this->getUrl('*/*/product', array('ret' => 'all', 'tag_id'=>'$tag_id')), 00129 ), 00130 00131 array( 00132 'caption' => Mage::helper('tag')->__('View Customers'), 00133 'url' => $this->getUrl('*/*/customer', array('ret' => 'all', 'tag_id'=>'$tag_id')), 00134 ) 00135 ), 00136 )); 00137 00138 return parent::_prepareColumns(); 00139 }
_prepareMassaction | ( | ) | [protected] |
Prepare grid massaction actions
Reimplemented from Mage_Adminhtml_Block_Widget_Grid.
Definition at line 160 of file Grid.php.
00161 { 00162 $this->setMassactionIdField('tag_id'); 00163 $this->getMassactionBlock()->setFormFieldName('tag'); 00164 00165 $this->getMassactionBlock()->addItem('delete', array( 00166 'label'=> Mage::helper('tag')->__('Delete'), 00167 'url' => $this->getUrl('*/*/massDelete'), 00168 'confirm' => Mage::helper('tag')->__('Are you sure?') 00169 )); 00170 00171 $statuses = $this->helper('tag/data')->getStatusesOptionsArray(); 00172 00173 array_unshift($statuses, array('label'=>'', 'value'=>'')); 00174 00175 $this->getMassactionBlock()->addItem('status', array( 00176 'label'=> Mage::helper('tag')->__('Change status'), 00177 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)), 00178 'additional' => array( 00179 'visibility' => array( 00180 'name' => 'status', 00181 'type' => 'select', 00182 'class' => 'required-entry', 00183 'label' => Mage::helper('tag')->__('Status'), 00184 'values' => $statuses 00185 ) 00186 ) 00187 )); 00188 00189 return $this; 00190 }
getRowUrl | ( | $ | row | ) |