account_noticelist.php

Go to the documentation of this file.
00001 <?php
00002 
00010 class Account_Noticelist extends Account
00011 {
00016     protected $_sThisTemplate = 'account_noticelist.tpl';
00017 
00023     protected $_aNoticeProductList = null;
00024 
00030     protected $_aSimilarProductList = null;
00031 
00037     protected $_aRecommList = null;
00038 
00044     protected $_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
00045 
00059     public function render()
00060     {
00061         parent::render();
00062 
00063         // is logged in ?
00064         $oUser = $this->getUser();
00065         if ( !$oUser ) {
00066             return $this->_sThisTemplate = $this->_sThisLoginTemplate;
00067         }
00068 
00069         //to maintain compatibility we still set the old template variable using new getter in render
00070         $this->_aViewData['noticelist']  = $this->getNoticeProductList();
00071         $this->_aViewData['similarlist'] = $this->getSimilarProducts();
00072         $this->_aViewData['similarrecommlist'] = $this->getSimilarRecommLists();
00073 
00074         return $this->_sThisTemplate;
00075     }
00076 
00082     public function getNoticeProductList()
00083     {
00084         if ( $this->_aNoticeProductList === null ) {
00085             if ( $oUser = $this->getUser() ) {
00086                 $this->_aNoticeProductList = $oUser->getBasket( 'noticelist' )->getArticles();
00087             }
00088         }
00089         return $this->_aNoticeProductList;
00090     }
00091 
00097     public function getSimilarProducts()
00098     {
00099         // similar products list
00100         if ( $this->_aSimilarProductList === null && count( $this->getNoticeProductList() ) ) {
00101 
00102             // just ensuring that next call will skip this check
00103             $this->_aSimilarProductList = false;
00104 
00105             // loading similar products
00106             if ( $oSimilarProd = current( $this->getNoticeProductList() ) ) {
00107                 $this->_aSimilarProductList = $oSimilarProd->getSimilarProducts();
00108             }
00109         }
00110 
00111         return $this->_aSimilarProductList;
00112     }
00113 
00119     public function getSimilarRecommLists()
00120     {
00121         if ( $this->getViewConfig()->getShowListmania() ) {
00122             // recommlist
00123             if ( $this->_aRecommList === null ) {
00124 
00125                 // just ensuring that next call will skip this check
00126                 $this->_aRecommList = false;
00127 
00128                 // loading recomm list
00129                 $aNoticeProdList = $this->getNoticeProductList();
00130                 if ( is_array( $aNoticeProdList ) && count( $aNoticeProdList ) ) {
00131                     $oRecommList = oxNew('oxrecommlist');
00132                     $this->_aRecommList = $oRecommList->getRecommListsByIds( array_keys( $aNoticeProdList ));
00133 
00134                 }
00135             }
00136             return $this->_aRecommList;
00137         }
00138     }
00139 }