OXID eShop CE  4.10.1
 All Classes Namespaces Files Functions Variables Pages
register.php
Go to the documentation of this file.
1 <?php
2 
7 class Register extends User
8 {
9 
15  protected $_sThisTemplate = 'page/account/register.tpl';
16 
22  protected $_sSuccessTemplate = 'page/account/register_success.tpl';
23 
29  protected $_sConfirmTemplate = 'page/account/register_confirm.tpl';
30 
36  protected $_blIsOrderStep = false;
37 
44 
51  public function render()
52  {
54 
55  // checking registration status
56  if ($this->isEnabledPrivateSales() && $this->isConfirmed()) {
57  $sTemplate = $this->_sConfirmTemplate;
58  } elseif ($this->getRegistrationStatus()) {
59  $sTemplate = $this->_sSuccessTemplate;
60  } else {
61  $sTemplate = $this->_sThisTemplate;
62  }
63 
64  return $sTemplate;
65  }
66 
72  public function getRegistrationError()
73  {
74  return oxRegistry::getConfig()->getRequestParameter('newslettererror');
75  }
76 
82  public function getRegistrationStatus()
83  {
84  return oxRegistry::getConfig()->getRequestParameter('success');
85  }
86 
94  public function isFieldRequired($sField)
95  {
96  if ($aMustFillFields = $this->getMustFillFields()) {
97  if (isset($aMustFillFields[$sField])) {
98  return true;
99  }
100  }
101 
102  return false;
103  }
104 
112  public function confirmRegistration()
113  {
114  $oUser = oxNew('oxuser');
115  if ($oUser->loadUserByUpdateId($this->getUpdateId())) {
116 
117  // resetting update key parameter
118  $oUser->setUpdateKey(true);
119 
120  // saving ..
121  $oUser->oxuser__oxactive = new oxField(1);
122  $oUser->save();
123 
124  // forcing user login
125  oxRegistry::getSession()->setVariable('usr', $oUser->getId());
126 
127  // redirecting to confirmation page
128  return 'register?confirmstate=1';
129  } else {
130  // confirmation failed
131  oxRegistry::get("oxUtilsView")->addErrorToDisplay('REGISTER_ERRLINKEXPIRED', false, true);
132 
133  // redirecting to confirmation page
134  return 'account';
135  }
136  }
137 
143  public function getUpdateId()
144  {
145  return oxRegistry::getConfig()->getRequestParameter('uid');
146  }
147 
153  public function isConfirmed()
154  {
155  return (bool) oxRegistry::getConfig()->getRequestParameter("confirmstate");
156  }
157 
163  public function getBreadCrumb()
164  {
165  $aPaths = array();
166  $aPath = array();
167 
168  $iBaseLanguage = oxRegistry::getLang()->getBaseLanguage();
169  $aPath['title'] = oxRegistry::getLang()->translateString('REGISTER', $iBaseLanguage, false);
170  $aPath['link'] = $this->getLink();
171  $aPaths[] = $aPath;
172 
173  return $aPaths;
174  }
175 }