Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Newsletter_Block_Subscribe
  • Mage_Newsletter_Helper_Data
  • Mage_Newsletter_ManageController
  • Mage_Newsletter_Model_Message
  • Mage_Newsletter_Model_Mysql4_Problem
  • Mage_Newsletter_Model_Mysql4_Problem_Collection
  • Mage_Newsletter_Model_Mysql4_Queue
  • Mage_Newsletter_Model_Mysql4_Queue_Collection
  • Mage_Newsletter_Model_Mysql4_Subscriber
  • Mage_Newsletter_Model_Mysql4_Subscriber_Collection
  • Mage_Newsletter_Model_Mysql4_Template
  • Mage_Newsletter_Model_Mysql4_Template_Collection
  • Mage_Newsletter_Model_Observer
  • Mage_Newsletter_Model_Problem
  • Mage_Newsletter_Model_Queue
  • Mage_Newsletter_Model_Resource_Problem
  • Mage_Newsletter_Model_Resource_Problem_Collection
  • Mage_Newsletter_Model_Resource_Queue
  • Mage_Newsletter_Model_Resource_Queue_Collection
  • Mage_Newsletter_Model_Resource_Subscriber
  • Mage_Newsletter_Model_Resource_Subscriber_Collection
  • Mage_Newsletter_Model_Resource_Template
  • Mage_Newsletter_Model_Resource_Template_Collection
  • Mage_Newsletter_Model_Session
  • Mage_Newsletter_Model_Subscriber
  • Mage_Newsletter_Model_Template
  • Mage_Newsletter_Model_Template_Filter
  • Mage_Newsletter_SubscriberController
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Magento
 4:  *
 5:  * NOTICE OF LICENSE
 6:  *
 7:  * This source file is subject to the Open Software License (OSL 3.0)
 8:  * that is bundled with this package in the file LICENSE.txt.
 9:  * It is also available through the world-wide-web at this URL:
10:  * http://opensource.org/licenses/osl-3.0.php
11:  * If you did not receive a copy of the license and are unable to
12:  * obtain it through the world-wide-web, please send an email
13:  * to license@magentocommerce.com so we can send you a copy immediately.
14:  *
15:  * DISCLAIMER
16:  *
17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
18:  * versions in the future. If you wish to customize Magento for your
19:  * needs please refer to http://www.magentocommerce.com for more information.
20:  *
21:  * @category    Mage
22:  * @package     Mage_Newsletter
23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
25:  */
26: 
27: 
28: /**
29:  * Customers newsletter subscription controller
30:  *
31:  * @category   Mage
32:  * @package    Mage_Newsletter
33:  * @author      Magento Core Team <core@magentocommerce.com>
34:  */
35: class Mage_Newsletter_ManageController extends Mage_Core_Controller_Front_Action
36: {
37:     /**
38:      * Action predispatch
39:      *
40:      * Check customer authentication for some actions
41:      */
42:     public function preDispatch()
43:     {
44:         parent::preDispatch();
45:         if (!Mage::getSingleton('customer/session')->authenticate($this)) {
46:             $this->setFlag('', 'no-dispatch', true);
47:         }
48:     }
49: 
50:     public function indexAction()
51:     {
52:         $this->loadLayout();
53:         $this->_initLayoutMessages('customer/session');
54:         $this->_initLayoutMessages('catalog/session');
55: 
56:         if ($block = $this->getLayout()->getBlock('customer_newsletter')) {
57:             $block->setRefererUrl($this->_getRefererUrl());
58:         }
59:         $this->getLayout()->getBlock('head')->setTitle($this->__('Newsletter Subscription'));
60:         $this->renderLayout();
61:     }
62: 
63:     public function saveAction()
64:     {
65:         if (!$this->_validateFormKey()) {
66:             return $this->_redirect('customer/account/');
67:         }
68:         try {
69:             Mage::getSingleton('customer/session')->getCustomer()
70:             ->setStoreId(Mage::app()->getStore()->getId())
71:             ->setIsSubscribed((boolean)$this->getRequest()->getParam('is_subscribed', false))
72:             ->save();
73:             if ((boolean)$this->getRequest()->getParam('is_subscribed', false)) {
74:                 Mage::getSingleton('customer/session')->addSuccess($this->__('The subscription has been saved.'));
75:             } else {
76:                 Mage::getSingleton('customer/session')->addSuccess($this->__('The subscription has been removed.'));
77:             }
78:         }
79:         catch (Exception $e) {
80:             Mage::getSingleton('customer/session')->addError($this->__('An error occurred while saving your subscription.'));
81:         }
82:         $this->_redirect('customer/account/');
83:     }
84: }
85: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0