OXID eShop CE  4.9.6
 All Classes Files Functions Variables Pages
account_newsletter.php
Go to the documentation of this file.
1 <?php
2 
10 {
11 
17  protected $_sThisTemplate = 'page/account/newsletter.tpl';
18 
24  protected $_blNewsletter = null;
25 
31  protected $_iSubscriptionStatus = 0;
32 
40  public function render()
41  {
42 
44 
45  // is logged in ?
46  $oUser = $this->getUser();
47  if (!$oUser) {
48  return $this->_sThisTemplate = $this->_sThisLoginTemplate;
49  }
50 
51  return $this->_sThisTemplate;
52  }
53 
54 
60  public function isNewsletter()
61  {
62  $oUser = $this->getUser();
63  if (!$oUser) {
64  return false;
65  }
66 
67  return $oUser->getNewsSubscription()->getOptInStatus();
68  }
69 
76  public function subscribe()
77  {
78  if (!oxRegistry::getSession()->checkSessionChallenge()) {
79  return false;
80  }
81 
82  // is logged in ?
83  $oUser = $this->getUser();
84  if (!$oUser) {
85  return false;
86  }
87 
88  $iStatus = $this->getConfig()->getRequestParameter('status');
89  if ($oUser->setNewsSubscription($iStatus, $this->getConfig()->getConfigParam('blOrderOptInEmail'))) {
90  $this->_iSubscriptionStatus = ($iStatus == 0 && $iStatus !== null) ? -1 : 1;
91  }
92  }
93 
100  public function getSubscriptionStatus()
101  {
103  }
104 
110  public function getBreadCrumb()
111  {
112  $aPaths = array();
113  $aPath = array();
114  $oUtils = oxRegistry::get("oxUtilsUrl");
115  $iBaseLanguage = oxRegistry::getLang()->getBaseLanguage();
116  $sSelfLink = $this->getViewConfig()->getSelfLink();
117 
118  $aPath['title'] = oxRegistry::getLang()->translateString('MY_ACCOUNT', $iBaseLanguage, false);
119  $aPath['link'] = oxRegistry::get("oxSeoEncoder")->getStaticUrl($sSelfLink . 'cl=account');
120  $aPaths[] = $aPath;
121 
122  $aPath['title'] = oxRegistry::getLang()->translateString('NEWSLETTER_SETTINGS', $iBaseLanguage, false);
123  $aPath['link'] = $oUtils->cleanUrl($this->getLink(), array('fnc'));
124  $aPaths[] = $aPath;
125 
126  return $aPaths;
127  }
128 }