register.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class Register extends User
00008 {
00009 
00015     protected $_sThisTemplate = 'page/account/register.tpl';
00016 
00022     protected $_sSuccessTemplate = 'page/account/register_success.tpl';
00023 
00029     protected $_sConfirmTemplate = 'page/account/register_confirm.tpl';
00030 
00036     protected $_blIsOrderStep = false;
00037 
00043     protected $_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
00044 
00051     public function render()
00052     {
00053         parent::render();
00054 
00055         // checking registration status
00056         if ($this->isEnabledPrivateSales() && $this->isConfirmed()) {
00057             $sTemplate = $this->_sConfirmTemplate;
00058         } elseif ($this->getRegistrationStatus()) {
00059             $sTemplate = $this->_sSuccessTemplate;
00060         } else {
00061             $sTemplate = $this->_sThisTemplate;
00062         }
00063 
00064         return $sTemplate;
00065     }
00066 
00072     public function getRegistrationError()
00073     {
00074         return oxRegistry::getConfig()->getRequestParameter('newslettererror');
00075     }
00076 
00082     public function getRegistrationStatus()
00083     {
00084         return oxRegistry::getConfig()->getRequestParameter('success');
00085     }
00086 
00094     public function isFieldRequired($sField)
00095     {
00096         if ($aMustFillFields = $this->getMustFillFields()) {
00097             if (isset($aMustFillFields[$sField])) {
00098                 return true;
00099             }
00100         }
00101 
00102         return false;
00103     }
00104 
00112     public function confirmRegistration()
00113     {
00114         $oUser = oxNew('oxuser');
00115         if ($oUser->loadUserByUpdateId($this->getUpdateId())) {
00116 
00117             // resetting update key parameter
00118             $oUser->setUpdateKey(true);
00119 
00120             // saving ..
00121             $oUser->oxuser__oxactive = new oxField(1);
00122             $oUser->save();
00123 
00124             // forcing user login
00125             oxRegistry::getSession()->setVariable('usr', $oUser->getId());
00126 
00127             // redirecting to confirmation page
00128             return 'register?confirmstate=1';
00129         } else {
00130             // confirmation failed
00131             oxRegistry::get("oxUtilsView")->addErrorToDisplay('REGISTER_ERRLINKEXPIRED', false, true);
00132 
00133             // redirecting to confirmation page
00134             return 'account';
00135         }
00136     }
00137 
00143     public function getUpdateId()
00144     {
00145         return oxRegistry::getConfig()->getRequestParameter('uid');
00146     }
00147 
00153     public function isConfirmed()
00154     {
00155         return (bool) oxRegistry::getConfig()->getRequestParameter("confirmstate");
00156     }
00157 
00163     public function getBreadCrumb()
00164     {
00165         $aPaths = array();
00166         $aPath = array();
00167 
00168         $iBaseLanguage = oxRegistry::getLang()->getBaseLanguage();
00169         $aPath['title'] = oxRegistry::getLang()->translateString('REGISTER', $iBaseLanguage, false);
00170         $aPath['link']  = $this->getLink();
00171         $aPaths[] = $aPath;
00172 
00173         return $aPaths;
00174     }
00175 }