account.php

Go to the documentation of this file.
00001 <?php
00002 
00010 class Account extends oxUBase
00011 {
00016     protected $_iOrderCnt = null;
00017 
00022     protected $_sArticleId = null;
00023 
00028     protected $_sSearchParamForHtml = null;
00029 
00034     protected $_sSearchParam = null;
00035 
00040     protected $_sSearchCatId = null;
00041 
00046     protected $_sSearchVendor = null;
00047 
00052     protected $_sListType = null;
00053 
00058     protected $_sThisTemplate = 'account_main.tpl';
00059 
00064     protected $_sThisLoginTemplate = 'account_login.tpl';
00065 
00072     protected $_iViewIndexState = 1;
00073 
00084     public function render()
00085     {
00086         parent::render();
00087 
00088         // loading actions
00089         $this->_loadActions();
00090 
00091         //
00092         if ( $sArtID = oxConfig::getParameter('aid') ) {
00093             $this->_aViewData['aid'] = $this->getArticleId();
00094             // #1834M - specialchar search
00095             $this->_aViewData['searchparam']        = $this->getSearchParam();
00096             $this->_aViewData['searchparamforhtml'] = $this->getSearchParamForHtml();
00097             $this->_aViewData['searchcnid']         = $this->getSearchCatId();
00098             $this->_aViewData['searchvendor']       = $this->getSearchVendor();
00099             $this->_aViewData['listtype']           = $this->getListType();
00100         }
00101 
00102         // is logged in ?
00103         $oUser = $this->getUser();
00104         if ( !$oUser || $oUser->oxuser__oxpassword->value == '' ) {
00105             return $this->_sThisTemplate = $this->_sThisLoginTemplate;
00106         }
00107 
00108         // calculating amount of orders made by user
00109         $this->_aViewData['iordersmade'] = $this->getOrderCnt();
00110 
00111         return $this->_sThisTemplate;
00112     }
00113 
00119     public function login_noredirect()
00120     {
00121         $sReturn = $this->_oaComponents['oxcmp_user']->login_noredirect();
00122 
00123         $sArtID = oxConfig::getParameter( 'aid' );
00124         if ( $sArtID ) {
00125             $sReturn = "details?anid=$sArtID";
00126 
00127             $sCatId = oxConfig::getParameter( 'cnid' );
00128             if ( $sCatId ) {
00129                 $sReturn .= "&cnid=$sCatId";
00130             }
00131             // #1834M - specialchar search
00132             $sSearchParamForLink = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
00133             if ( $sSearchParamForLink ) {
00134                 $sReturn .= "&searchparam=$sSearchParamForLink";
00135             }
00136 
00137             $sSearchCatId = oxConfig::getParameter( 'searchcnid' );
00138             if ( $sSearchCatId ) {
00139                 $sReturn .= "&searchcnid=$sSearchCatId";
00140             }
00141 
00142             $sSearchVendor = oxConfig::getParameter( 'searchvendor' );
00143             if ( $sSearchVendor ) {
00144                 $sReturn .= "&searchvendor=$sSearchVendor";
00145             }
00146 
00147             $sListType = oxConfig::getParameter( 'listtype' );
00148             if ( $sListType ) {
00149                 $sReturn .= "&listtype=$sListType";
00150             }
00151         }
00152 
00153         return $sReturn;
00154     }
00155 
00161     public function getOrderCnt()
00162     {
00163         if ( $this->_iOrderCnt === null ) {
00164             $this->_iOrderCnt = 0;
00165             if ( $oUser = $this->getUser() ) {
00166                 $this->_iOrderCnt = $oUser->getOrderCount();
00167             }
00168         }
00169         return $this->_iOrderCnt;
00170     }
00171 
00177     public function getArticleId()
00178     {
00179         if ( $this->_sArticleId === null) {
00180             // passing wishlist information
00181             if ( $sArticleId = oxConfig::getParameter('aid') ) {
00182                 $this->_sArticleId = $sArticleId;
00183             }
00184         }
00185         return $this->_sArticleId;
00186     }
00187 
00193     public function getSearchParamForHtml()
00194     {
00195         if ( $this->_sSearchParamForHtml === null ) {
00196             $this->_sSearchParamForHtml = false;
00197             if ( $this->getArticleId() ) {
00198                 $this->_sSearchParamForHtml = oxConfig::getParameter( 'searchparam' );
00199             }
00200         }
00201         return $this->_sSearchParamForHtml;
00202     }
00203 
00209     public function getSearchParam()
00210     {
00211         if ( $this->_sSearchParam === null ) {
00212             $this->_sSearchParam = false;
00213             if ( $this->getArticleId() ) {
00214                 $this->_sSearchParam = rawurlencode( oxConfig::getParameter( 'searchparam', true ) );
00215             }
00216         }
00217         return $this->_sSearchParam;
00218     }
00219 
00225     public function getSearchCatId()
00226     {
00227         if ( $this->_sSearchCatId === null ) {
00228             $this->_sSearchCatId = false;
00229             if ( $this->getArticleId() ) {
00230                 $this->_sSearchCatId = rawurldecode( oxConfig::getParameter( 'searchcnid' ) );
00231             }
00232         }
00233         return $this->_sSearchCatId;
00234     }
00235 
00241     public function getSearchVendor()
00242     {
00243         if ( $this->_sSearchVendor === null ) {
00244             $this->_sSearchVendor = false;
00245             if ( $this->getArticleId() ) {
00246                 // searching in vendor #671
00247                 $this->_sSearchVendor = rawurldecode( oxConfig::getParameter( 'searchvendor' ) );
00248             }
00249         }
00250         return $this->_sSearchVendor;
00251     }
00252 
00258     public function getListType()
00259     {
00260         if ( $this->_sListType === null ) {
00261             $this->_sListType = false;
00262             if ( $this->getArticleId() ) {
00263                 // searching in vendor #671
00264                 $this->_sListType = oxConfig::getParameter( 'listtype' );
00265             }
00266         }
00267         return $this->_sListType;
00268     }
00269 }

Generated on Thu Dec 4 12:04:57 2008 for OXID eShop CE by  doxygen 1.5.5