OXID eShop CE  4.8.10
 All Classes Files Functions Variables Pages
account_newsletter.php
Go to the documentation of this file.
1 <?php
2 
10 {
15  protected $_sThisTemplate = 'page/account/newsletter.tpl';
16 
22  protected $_blNewsletter = null;
23 
29  protected $_iSubscriptionStatus = 0;
30 
38  public function render()
39  {
40 
42 
43  // is logged in ?
44  $oUser = $this->getUser();
45  if ( !$oUser ) {
46  return $this->_sThisTemplate = $this->_sThisLoginTemplate;
47  }
48 
49  return $this->_sThisTemplate;
50  }
51 
52 
58  public function isNewsletter()
59  {
60  $oUser = $this->getUser();
61  if ( !$oUser ) {
62  return false;
63  }
64 
65  return $oUser->getNewsSubscription()->getOptInStatus();
66  }
67 
74  public function subscribe()
75  {
76  if (!oxRegistry::getSession()->checkSessionChallenge()) {
77  return false;
78  }
79 
80  // is logged in ?
81  $oUser = $this->getUser();
82  if ( !$oUser ) {
83  return false;
84  }
85 
86  $iStatus = $this->getConfig()->getRequestParameter( 'status' );
87  if ( $oUser->setNewsSubscription( $iStatus, $this->getConfig()->getConfigParam( 'blOrderOptInEmail' ) ) ) {
88  $this->_iSubscriptionStatus = ($iStatus == 0 && $iStatus !== null)? -1 : 1;
89  }
90  }
91 
98  public function getSubscriptionStatus()
99  {
101  }
102 
108  public function getBreadCrumb()
109  {
110  $aPaths = array();
111  $aPath = array();
112  $oUtils = oxRegistry::get("oxUtilsUrl");
113  $aPath['title'] = oxRegistry::getLang()->translateString( 'MY_ACCOUNT', oxRegistry::getLang()->getBaseLanguage(), false );
114  $aPath['link'] = oxRegistry::get("oxSeoEncoder")->getStaticUrl( $this->getViewConfig()->getSelfLink() . 'cl=account' );
115  $aPaths[] = $aPath;
116 
117  $aPath['title'] = oxRegistry::getLang()->translateString( 'NEWSLETTER_SETTINGS', oxRegistry::getLang()->getBaseLanguage(), false );
118  $aPath['link'] = $oUtils->cleanUrl( $this->getLink(), array( 'fnc' ));
119  $aPaths[] = $aPath;
120 
121  return $aPaths;
122  }
123 }