account_newsletter.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class Account_Newsletter extends Account
00010 {
00015     protected $_sThisTemplate = 'page/account/newsletter.tpl';
00016 
00022     protected $_blNewsletter = null;
00023 
00029     protected $_iSubscriptionStatus = 0;
00030 
00038     public function render()
00039     {
00040 
00041         parent::render();
00042 
00043         // is logged in ?
00044         $oUser = $this->getUser();
00045         if ( !$oUser ) {
00046             return $this->_sThisTemplate = $this->_sThisLoginTemplate;
00047         }
00048 
00049         return $this->_sThisTemplate;
00050     }
00051 
00052 
00058     public function isNewsletter()
00059     {
00060         $oUser = $this->getUser();
00061         if ( !$oUser ) {
00062             return false;
00063         }
00064 
00065         return $oUser->getNewsSubscription()->getOptInStatus();
00066     }
00067 
00074     public function subscribe()
00075     {
00076         // is logged in ?
00077         $oUser = $this->getUser();
00078         if ( !$oUser ) {
00079             return false;
00080         }
00081 
00082         $iStatus = $this->getConfig()->getRequestParameter( 'status' );
00083         if ( $oUser->setNewsSubscription( $iStatus, $this->getConfig()->getConfigParam( 'blOrderOptInEmail' ) ) ) {
00084             $this->_iSubscriptionStatus = ($iStatus == 0 && $iStatus !== null)? -1 : 1;
00085         }
00086     }
00087 
00094     public function getSubscriptionStatus()
00095     {
00096         return $this->_iSubscriptionStatus;
00097     }
00098 
00104     public function getBreadCrumb()
00105     {
00106         $aPaths = array();
00107         $aPath = array();
00108         $oUtils = oxRegistry::get("oxUtilsUrl");
00109         $aPath['title'] = oxRegistry::getLang()->translateString( 'MY_ACCOUNT', oxRegistry::getLang()->getBaseLanguage(), false );
00110         $aPath['link']  = oxRegistry::get("oxSeoEncoder")->getStaticUrl( $this->getViewConfig()->getSelfLink() . 'cl=account' );
00111         $aPaths[] = $aPath;
00112 
00113         $aPath['title'] = oxRegistry::getLang()->translateString( 'NEWSLETTER_SETTINGS', oxRegistry::getLang()->getBaseLanguage(), false );
00114         $aPath['link']  = $oUtils->cleanUrl( $this->getLink(), array( 'fnc' ));
00115         $aPaths[] = $aPath;    
00116         
00117         return $aPaths;
00118     }
00119 }