account_newsletter.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class Account_Newsletter extends Account
00010 {
00011 
00017     protected $_sThisTemplate = 'page/account/newsletter.tpl';
00018 
00024     protected $_blNewsletter = null;
00025 
00031     protected $_iSubscriptionStatus = 0;
00032 
00040     public function render()
00041     {
00042 
00043         parent::render();
00044 
00045         // is logged in ?
00046         $oUser = $this->getUser();
00047         if (!$oUser) {
00048             return $this->_sThisTemplate = $this->_sThisLoginTemplate;
00049         }
00050 
00051         return $this->_sThisTemplate;
00052     }
00053 
00054 
00060     public function isNewsletter()
00061     {
00062         $oUser = $this->getUser();
00063         if (!$oUser) {
00064             return false;
00065         }
00066 
00067         return $oUser->getNewsSubscription()->getOptInStatus();
00068     }
00069 
00076     public function subscribe()
00077     {
00078         if (!oxRegistry::getSession()->checkSessionChallenge()) {
00079             return false;
00080         }
00081 
00082         // is logged in ?
00083         $oUser = $this->getUser();
00084         if (!$oUser) {
00085             return false;
00086         }
00087 
00088         $iStatus = $this->getConfig()->getRequestParameter('status');
00089         if ($oUser->setNewsSubscription($iStatus, $this->getConfig()->getConfigParam('blOrderOptInEmail'))) {
00090             $this->_iSubscriptionStatus = ($iStatus == 0 && $iStatus !== null) ? -1 : 1;
00091         }
00092     }
00093 
00100     public function getSubscriptionStatus()
00101     {
00102         return $this->_iSubscriptionStatus;
00103     }
00104 
00110     public function getBreadCrumb()
00111     {
00112         $aPaths = array();
00113         $aPath = array();
00114         $oUtils = oxRegistry::get("oxUtilsUrl");
00115         $iBaseLanguage = oxRegistry::getLang()->getBaseLanguage();
00116         $sSelfLink = $this->getViewConfig()->getSelfLink();
00117 
00118         $aPath['title'] = oxRegistry::getLang()->translateString('MY_ACCOUNT', $iBaseLanguage, false);
00119         $aPath['link'] = oxRegistry::get("oxSeoEncoder")->getStaticUrl($sSelfLink . 'cl=account');
00120         $aPaths[] = $aPath;
00121 
00122         $aPath['title'] = oxRegistry::getLang()->translateString('NEWSLETTER_SETTINGS', $iBaseLanguage, false);
00123         $aPath['link'] = $oUtils->cleanUrl($this->getLink(), array('fnc'));
00124         $aPaths[] = $aPath;
00125 
00126         return $aPaths;
00127     }
00128 }