Mage_Adminhtml_Block_Newsletter_Subscriber_Grid Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Newsletter_Subscriber_Grid:

Mage_Adminhtml_Block_Widget_Grid Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()

Protected Member Functions

 _prepareCollection ()
 _prepareColumns ()
 _getOptions ($optionsArray)
 _getWebsiteOptions ()
 _getStoreGroupOptions ()
 _getStoreOptions ()
 _prepareMassaction ()


Detailed Description

Definition at line 34 of file Grid.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

Set main configuration of grid

Reimplemented from Varien_Object.

Definition at line 41 of file Grid.php.

00042     {
00043         parent::__construct();
00044         $this->setId('subscriberGrid');
00045         $this->setUseAjax(true);
00046         $this->setDefaultSort('subscriber_id', 'desc');
00047     }


Member Function Documentation

_getOptions ( optionsArray  )  [protected]

Convert OptionsValue array to Options array

Parameters:
array $optionsArray
Returns:
array

Definition at line 151 of file Grid.php.

00152     {
00153         $options = array();
00154         foreach ($optionsArray as $option) {
00155             $options[$option['value']] = $option['label'];
00156         }
00157         return $options;
00158     }

_getStoreGroupOptions (  )  [protected]

Retrieve Store Group Options array

Returns:
array

Definition at line 175 of file Grid.php.

00176     {
00177         return Mage::getModel('adminhtml/system_store')->getStoreGroupOptionHash();
00178     }

_getStoreOptions (  )  [protected]

Retrieve Store Options array

Returns:
array

Definition at line 185 of file Grid.php.

00186     {
00187         return Mage::getModel('adminhtml/system_store')->getStoreOptionHash();
00188     }

_getWebsiteOptions (  )  [protected]

Retrieve Website Options array

Returns:
array

Definition at line 165 of file Grid.php.

00166     {
00167         return Mage::getModel('adminhtml/system_store')->getWebsiteOptionHash();
00168     }

_prepareCollection (  )  [protected]

Prepare collection for grid

Returns:
Mage_Adminhtml_Block_Widget_Grid

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 54 of file Grid.php.

00055     {
00056         $collection = Mage::getResourceSingleton('newsletter/subscriber_collection');
00057         /* @var $collection Mage_Newsletter_Model_Mysql4_Subscriber_Collection */
00058         $collection
00059             ->showCustomerInfo(true)
00060             ->addSubscriberTypeField()
00061             ->showStoreInfo();
00062 
00063         if($this->getRequest()->getParam('queue', false)) {
00064             $collection->useQueue(Mage::getModel('newsletter/queue')
00065                 ->load($this->getRequest()->getParam('queue')));
00066         }
00067 
00068         $this->setCollection($collection);
00069 
00070         return parent::_prepareCollection();
00071     }

_prepareColumns (  )  [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 73 of file Grid.php.

00074     {
00075 
00076         $this->addColumn('subscriber_id', array(
00077             'header'    => Mage::helper('newsletter')->__('ID'),
00078             'index'     => 'subscriber_id'
00079         ));
00080 
00081         $this->addColumn('email', array(
00082             'header'    => Mage::helper('newsletter')->__('Email'),
00083             'index'     => 'subscriber_email'
00084         ));
00085 
00086         $this->addColumn('type', array(
00087             'header'    => Mage::helper('newsletter')->__('Type'),
00088             'index'     => 'type',
00089             'type'      => 'options',
00090             'options'   => array(
00091                 1  => Mage::helper('newsletter')->__('Guest'),
00092                 2  => Mage::helper('newsletter')->__('Customer')
00093             )
00094         ));
00095 
00096         $this->addColumn('firstname', array(
00097             'header'    => Mage::helper('newsletter')->__('Customer Firstname'),
00098             'index'     => 'customer_firstname',
00099             'default'   =>    '----'
00100         ));
00101 
00102         $this->addColumn('lastname', array(
00103             'header'    => Mage::helper('newsletter')->__('Customer Lastname'),
00104             'index'     => 'customer_lastname',
00105             'default'   =>    '----'
00106         ));
00107 
00108         $this->addColumn('status', array(
00109             'header'    => Mage::helper('newsletter')->__('Status'),
00110             'index'     => 'subscriber_status',
00111             'type'      => 'options',
00112             'options'   => array(
00113                 Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE   => Mage::helper('newsletter')->__('Not activated'),
00114                 Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED   => Mage::helper('newsletter')->__('Subscribed'),
00115                 Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED => Mage::helper('newsletter')->__('Unsubscribed'),
00116             )
00117         ));
00118 
00119         $this->addColumn('website', array(
00120             'header'    => Mage::helper('newsletter')->__('Website'),
00121             'index'     => 'website_id',
00122             'type'      => 'options',
00123             'options'   => $this->_getWebsiteOptions()
00124         ));
00125 
00126         $this->addColumn('group', array(
00127             'header'    => Mage::helper('newsletter')->__('Store'),
00128             'index'     => 'group_id',
00129             'type'      => 'options',
00130             'options'   => $this->_getStoreGroupOptions()
00131         ));
00132 
00133         $this->addColumn('store', array(
00134             'header'    => Mage::helper('newsletter')->__('Store View'),
00135             'index'     => 'store_id',
00136             'type'      => 'options',
00137             'options'   => $this->_getStoreOptions()
00138         ));
00139 
00140         $this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
00141         $this->addExportType('*/*/exportXml', Mage::helper('customer')->__('XML'));
00142         return parent::_prepareColumns();
00143     }

_prepareMassaction (  )  [protected]

Prepare grid massaction actions

Returns:
Mage_Adminhtml_Block_Widget_Grid

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 190 of file Grid.php.

00191     {
00192         $this->setMassactionIdField('subscriber_id');
00193         $this->getMassactionBlock()->setFormFieldName('subscriber');
00194 
00195         $this->getMassactionBlock()->addItem('unsubscribe', array(
00196              'label'        => Mage::helper('newsletter')->__('Unsubscribe'),
00197              'url'          => $this->getUrl('*/*/massUnsubscribe')
00198         ));
00199 
00200         return $this;
00201     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:22:51 2009 for Magento by  doxygen 1.5.8