account_order.php

Go to the documentation of this file.
00001 <?php
00002 
00011 class Account_Order extends Account
00012 {
00017     protected $_iAllArtCnt = 0;
00018 
00023     protected $_iCntPages = null;
00024 
00029     protected $_sThisTemplate = 'account_order.tpl';
00030 
00036     protected $_aOrderList = null;
00037 
00043     protected $_aArticlesList  = null;
00044 
00055     public function render()
00056     {
00057         parent::render();
00058 
00059         // is logged in ?
00060         $oUser = $this->getUser();
00061         if ( !$oUser ) {
00062             return $this->_sThisTemplate = $this->_sThisLoginTemplate;
00063         }
00064 
00065         // Load Orderlist
00066         $this->_aViewData['orderlist'] = $this->getOrderList();
00067 
00068         // Load orders articles
00069         $this->_aViewData['articlesList'] = $this->getOrderArticleList();
00070 
00071         return $this->_sThisTemplate;
00072     }
00073 
00079     public function getOrderList()
00080     {
00081         if ( $this->_aOrderList === null ) {
00082             $this->_aOrderList = array();
00083 
00084             // Load user Orderlist
00085             if ( $oUser = $this->getUser() ) {
00086                 $iNrofCatArticles = (int) $this->getConfig()->getConfigParam( 'iNrofCatArticles' );
00087                 $iNrofCatArticles = $iNrofCatArticles?$iNrofCatArticles:1;
00088                 $this->_iAllArtCnt = $oUser->getOrderCount();
00089                 if ( $this->_iAllArtCnt && $this->_iAllArtCnt > 0 ) {
00090                     $this->_aOrderList = $oUser->getOrders( $iNrofCatArticles, $this->getActPage() );
00091                     $this->_iCntPages  = round( $this->_iAllArtCnt/$iNrofCatArticles + 0.49 );
00092                 }
00093             }
00094         }
00095         return $this->_aOrderList;
00096     }
00097 
00103     public function getOrderArticleList()
00104     {
00105         if ( $this->_aArticlesList === null ) {
00106 
00107             // marking as set
00108             $this->_aArticlesList = false;
00109             $oOrdersList = $this->getOrderList();
00110             if ( $oOrdersList && $oOrdersList->count() ) {
00111                 $this->_aArticlesList = oxNew( 'oxarticlelist' );
00112                 $this->_aArticlesList->loadOrderArticles( $oOrdersList );
00113             }
00114         }
00115 
00116         return $this->_aArticlesList;
00117     }
00118 
00124     public function getPageNavigation()
00125     {
00126         if ( $this->_oPageNavigation === null ) {
00127             $this->_oPageNavigation = $this->generatePageNavigation();
00128         }
00129         return $this->_oPageNavigation;
00130     }
00131 }