Public Member Functions | |
indexAction () | |
gridAction () | |
exportCsvAction () | |
exportXmlAction () | |
massUnsubscribeAction () | |
Protected Member Functions | |
_sendUploadResponse ($fileName, $content, $contentType='application/octet-stream') | |
_isAllowed () |
Definition at line 34 of file SubscriberController.php.
_isAllowed | ( | ) | [protected] |
Reimplemented from Mage_Adminhtml_Controller_Action.
Definition at line 130 of file SubscriberController.php.
00131 { 00132 return Mage::getSingleton('admin/session')->isAllowed('newsletter/subscriber'); 00133 }
_sendUploadResponse | ( | $ | fileName, | |
$ | content, | |||
$ | contentType = 'application/octet-stream' | |||
) | [protected] |
Prepare file download response
string | $fileName | |
string | $content | |
string | $contentType |
Definition at line 100 of file SubscriberController.php.
00101 { 00102 $this->_prepareDownloadResponse($fileName, $content, $contentType); 00103 }
exportCsvAction | ( | ) |
Export subscribers grid to CSV format
Definition at line 69 of file SubscriberController.php.
00070 { 00071 $fileName = 'subscribers.csv'; 00072 $content = $this->getLayout()->createBlock('adminhtml/newsletter_subscriber_grid') 00073 ->getCsv(); 00074 00075 $this->_prepareDownloadResponse($fileName, $content); 00076 }
exportXmlAction | ( | ) |
Export subscribers grid to XML format
Definition at line 81 of file SubscriberController.php.
00082 { 00083 $fileName = 'subscribers.xml'; 00084 $content = $this->getLayout()->createBlock('adminhtml/newsletter_subscriber_grid') 00085 ->getXml(); 00086 00087 $this->_prepareDownloadResponse($fileName, $content); 00088 }
gridAction | ( | ) |
Definition at line 58 of file SubscriberController.php.
00059 { 00060 $this->loadLayout(); 00061 $this->getResponse()->setBody( 00062 $this->getLayout()->createBlock('adminhtml/newsletter_subscriber_grid')->toHtml() 00063 ); 00064 }
indexAction | ( | ) |
Definition at line 37 of file SubscriberController.php.
00038 { 00039 if ($this->getRequest()->getParam('ajax')) { 00040 $this->_forward('grid'); 00041 return; 00042 } 00043 00044 $this->loadLayout(); 00045 00046 $this->_setActiveMenu('newsletter/subscriber'); 00047 00048 $this->_addBreadcrumb(Mage::helper('newsletter')->__('Newsletter'), Mage::helper('newsletter')->__('Newsletter')); 00049 $this->_addBreadcrumb(Mage::helper('newsletter')->__('Subscribers'), Mage::helper('newsletter')->__('Subscribers')); 00050 00051 $this->_addContent( 00052 $this->getLayout()->createBlock('adminhtml/newsletter_subscriber','subscriber') 00053 ); 00054 00055 $this->renderLayout(); 00056 }
massUnsubscribeAction | ( | ) |
Definition at line 105 of file SubscriberController.php.
00106 { 00107 $subscribersIds = $this->getRequest()->getParam('subscriber'); 00108 if (!is_array($subscribersIds)) { 00109 Mage::getSingleton('adminhtml/session')->addError(Mage::helper('newsletter')->__('Please select subscriber(s)')); 00110 } 00111 else { 00112 try { 00113 foreach ($subscribersIds as $subscriberId) { 00114 $subscriber = Mage::getModel('newsletter/subscriber')->load($subscriberId); 00115 $subscriber->unsubscribe(); 00116 } 00117 Mage::getSingleton('adminhtml/session')->addSuccess( 00118 Mage::helper('adminhtml')->__( 00119 'Total of %d record(s) were successfully updated', count($subscribersIds) 00120 ) 00121 ); 00122 } catch (Exception $e) { 00123 Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); 00124 } 00125 } 00126 00127 $this->_redirect('*/*/index'); 00128 }