register.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class Register extends User
00008 {
00014     protected $_sThisTemplate = 'page/account/register.tpl';
00015 
00021     protected $_sSuccessTemplate = 'page/account/register_success.tpl';
00022 
00028     protected $_sConfirmTemplate = 'page/account/register_confirm.tpl';
00029 
00034     protected $_blIsOrderStep = false;
00035 
00041     protected $_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
00042 
00049     public function render()
00050     {
00051         parent::render();
00052 
00053         // checking registration status
00054         if ( $this->isEnabledPrivateSales() && $this->isConfirmed() ) {
00055             $sTemplate = $this->_sConfirmTemplate;
00056         } elseif ( $this->getRegistrationStatus() ) {
00057             $sTemplate = $this->_sSuccessTemplate;
00058         } else {
00059             $sTemplate = $this->_sThisTemplate;
00060         }
00061 
00062         return $sTemplate;
00063     }
00064 
00070     public function getRegistrationError()
00071     {
00072         return oxConfig::getParameter( 'newslettererror' );
00073     }
00074 
00080     public function getRegistrationStatus()
00081     {
00082         return oxConfig::getParameter( 'success' );
00083     }
00084 
00092     public function isFieldRequired( $sField )
00093     {
00094         if ( $aMustFillFields = $this->getMustFillFields() ) {
00095             if ( isset( $aMustFillFields[$sField] ) ) {
00096                 return true;
00097             }
00098         }
00099 
00100         return false;
00101     }
00102 
00110     public function confirmRegistration()
00111     {
00112         $oUser = oxNew( 'oxuser' );
00113         if ( $oUser->loadUserByUpdateId( $this->getUpdateId() ) ) {
00114 
00115             // resetting update key parameter
00116             $oUser->setUpdateKey( true );
00117 
00118             // saving ..
00119             $oUser->oxuser__oxactive = new oxField( 1 );
00120             $oUser->save();
00121 
00122             // forcing user login
00123             oxSession::setVar( 'usr', $oUser->getId() );
00124 
00125             // redirecting to confirmation page
00126             return 'register?confirmstate=1';
00127         } else {
00128             // confirmation failed
00129             oxRegistry::get("oxUtilsView")->addErrorToDisplay( 'REGISTER_ERRLINKEXPIRED', false, true );
00130 
00131             // redirecting to confirmation page
00132             return 'account';
00133         }
00134     }
00135 
00141     public function getUpdateId()
00142     {
00143         return oxConfig::getParameter( 'uid' );
00144     }
00145 
00151     public function isConfirmed()
00152     {
00153          return (bool) oxConfig::getParameter( "confirmstate" );
00154     }
00155 
00161     public function getBreadCrumb()
00162     {
00163         $aPaths = array();
00164         $aPath = array();
00165 
00166         $aPath['title'] = oxRegistry::getLang()->translateString( 'PAGE_ACCOUNT_REGISTER_REGISTER', oxRegistry::getLang()->getBaseLanguage(), false );
00167         $aPath['link']  = $this->getLink();
00168         $aPaths[] = $aPath;
00169 
00170         return $aPaths;
00171     }
00172 
00173 
00174 }