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
00056 if ( !( $this->getUser() ) ) {
00057 return $this->_sThisTemplate = $this->_sThisLoginTemplate;
00058 }
00059
00060
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
00076 if ( $oUser = $this->getUser() ) {
00077 $oAdresses = $oUser->getUserAddresses();
00078 if ( $oAdresses->count() ) {
00079 foreach ( $oAdresses as $oAddress ) {
00080 if ( $oAddress->selected == 1 ) {
00081 return $oAddress;
00082 }
00083 }
00084 }
00085 }
00086
00087 $oAdresses->rewind();
00088 return $oAdresses->current();;
00089 }
00090
00096 public function getCountryList()
00097 {
00098 if ( $this->_oCountryList === null ) {
00099
00100 $this->_oCountryList = oxNew( 'oxcountrylist' );
00101 $this->_oCountryList->loadActiveCountries();
00102 }
00103 return $this->_oCountryList;
00104 }
00105
00111 public function getMustFillFields()
00112 {
00113 if ( $this->_aMustFillFields === null ) {
00114 $this->_aMustFillFields = false;
00115
00116 $aMustFillFields = $this->getConfig()->getConfigParam( 'aMustFillFields' );
00117 if ( is_array( $aMustFillFields ) ) {
00118 $this->_aMustFillFields = array_flip( $aMustFillFields );
00119 }
00120 }
00121
00122 return $this->_aMustFillFields;
00123 }
00124
00132 public function isFieldRequired( $sField )
00133 {
00134 if ( $aMustFillFields = $this->getMustFillFields() ) {
00135 if ( isset( $aMustFillFields[$sField] ) ) {
00136 return true;
00137 }
00138 }
00139
00140 return false;
00141 }
00142 }