account_user.php

Go to the documentation of this file.
00001 <?php
00002 
00011 class Account_User extends Account
00012 {
00018     protected $_sThisTemplate = 'account_user.tpl';
00019 
00025     protected $_oDelAddress = null;
00026 
00032     protected $_oCountryList = null;
00033 
00039     protected $_aMustFillFields = null;
00040 
00051     public function render()
00052     {
00053         parent::render();
00054 
00055         // is logged in ?
00056         if ( !( $this->getUser() ) ) {
00057             return $this->_sThisTemplate = $this->_sThisLoginTemplate;
00058         }
00059 
00060         //for older templates
00061         $this->_aViewData['delivadr']        = $this->getDeliverAddress();
00062         $this->_aViewData['oxcountrylist']   = $this->getCountryList();
00063         $this->_aViewData['aMustFillFields'] = $this->getMustFillFields();
00064 
00065         return $this->_sThisTemplate;
00066     }
00067 
00073     public function getDeliverAddress()
00074     {
00075         // is logged in ?
00076         if ( $this->_oDelAddress === null ) {
00077             $this->_oDelAddress = false;
00078 
00079             if ( $oUser = $this->getUser() ) {
00080                 $sAddressId = $oUser->getSelectedAddress();
00081                 if ( $sAddressId && $sAddressId != '-1' ) {
00082                     $this->_oDelAddress = oxNew( 'oxbase' );
00083                     $this->_oDelAddress->init( 'oxaddress' );
00084                     $this->_oDelAddress->load( $sAddressId );
00085                 }
00086             }
00087         }
00088 
00089         return $this->_oDelAddress;
00090     }
00091 
00097     public function getCountryList()
00098     {
00099         if ( $this->_oCountryList === null ) {
00100             // passing country list
00101             $this->_oCountryList = oxNew( 'oxcountrylist' );
00102             $this->_oCountryList->loadActiveCountries();
00103         }
00104         return $this->_oCountryList;
00105     }
00106 
00112     public function getMustFillFields()
00113     {
00114         if ( $this->_aMustFillFields === null ) {
00115             $this->_aMustFillFields = false;
00116 
00117             $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
00118             if ( is_array( $aMustFillFields ) ) {
00119                 $this->_aMustFillFields = array_flip( $aMustFillFields );
00120             }
00121         }
00122 
00123         return $this->_aMustFillFields;
00124     }
00125 
00133     public function isFieldRequired( $sField )
00134     {
00135         if ( $aMustFillFields = $this->getMustFillFields() ) {
00136             if ( isset( $aMustFillFields[$sField] ) ) {
00137                 return true;
00138             }
00139         }
00140 
00141         return false;
00142     }
00143 }

Generated on Tue Apr 21 15:45:45 2009 for OXID eShop CE by  doxygen 1.5.5