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 
00044     public function render()
00045     {
00046         parent::render();
00047 
00048         // is logged in ?
00049         if ( !( $this->getUser() ) ) {
00050             return $this->_sThisTemplate = $this->_sThisLoginTemplate;
00051         }
00052 
00053         //for older templates
00054         $this->_aViewData['delivadr']        = $this->getDeliverAddress();
00055         $this->_aViewData['oxcountrylist']   = $this->getCountryList();
00056         $this->_aViewData['aMustFillFields'] = $this->getMustFillFields();
00057 
00058         return $this->_sThisTemplate;
00059     }
00060 
00066     public function getDeliverAddress()
00067     {
00068         // is logged in ?
00069         if ( $oUser = $this->getUser() ) {
00070             $oAdresses = $oUser->getUserAddresses();
00071             if ( $oAdresses->count() ) {
00072                 foreach ( $oAdresses as $oAddress ) {
00073                     if ( $oAddress->selected == 1 ) {
00074                         $this->_aViewData['deladr'] = null;
00075                         return $oAddress;
00076                     }
00077                 }
00078                 $oAdresses->rewind();
00079                 return $oAdresses->current();
00080             }
00081         }
00082     }
00083 
00089     public function getCountryList()
00090     {
00091         if ( $this->_oCountryList === null ) {
00092             // passing country list
00093             $this->_oCountryList = oxNew( 'oxcountrylist' );
00094             $this->_oCountryList->loadActiveCountries();
00095         }
00096         return $this->_oCountryList;
00097     }
00098 }