account_downloads.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class Account_Downloads extends Account
00008 {
00009 
00015     protected $_sThisTemplate = 'page/account/downloads.tpl';
00016 
00022     protected $_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
00023 
00027     protected $_oOrderFilesList = null;
00028 
00029 
00035     public function getBreadCrumb()
00036     {
00037         $aPaths = array();
00038         $aPath = array();
00039 
00040         $iBaseLanguage = oxRegistry::getLang()->getBaseLanguage();
00042         $oSeoEncoder = oxRegistry::get("oxSeoEncoder");
00043         $aPath['title'] = oxRegistry::getLang()->translateString('MY_ACCOUNT', $iBaseLanguage, false);
00044         $aPath['link'] = $oSeoEncoder->getStaticUrl($this->getViewConfig()->getSelfLink() . "cl=account");
00045         $aPaths[] = $aPath;
00046 
00047         $aPath['title'] = oxRegistry::getLang()->translateString('MY_DOWNLOADS', $iBaseLanguage, false);
00048         $aPath['link'] = $this->getLink();
00049         $aPaths[] = $aPath;
00050 
00051         return $aPaths;
00052     }
00053 
00059     public function getOrderFilesList()
00060     {
00061         if ($this->_oOrderFilesList !== null) {
00062             return $this->_oOrderFilesList;
00063         }
00064 
00065         $oOrderFileList = oxNew('oxOrderFileList');
00066         $oOrderFileList->loadUserFiles($this->getUser()->getId());
00067 
00068         $this->_oOrderFilesList = $this->_prepareForTemplate($oOrderFileList);
00069 
00070         return $this->_oOrderFilesList;
00071     }
00072 
00080     protected function _prepareForTemplate($oOrderFileList)
00081     {
00082         $oOrderArticles = array();
00083 
00084         foreach ($oOrderFileList as $oOrderFile) {
00085             $sOrderArticleIdField = 'oxorderfiles__oxorderarticleid';
00086             $sOrderNumberField = 'oxorderfiles__oxordernr';
00087             $sOrderDateField = 'oxorderfiles__oxorderdate';
00088             $sOrderTitleField = 'oxorderfiles__oxarticletitle';
00089             $sOrderArticleId = $oOrderFile->$sOrderArticleIdField->value;
00090             $oOrderArticles[$sOrderArticleId]['oxordernr'] = $oOrderFile->$sOrderNumberField->value;
00091             $oOrderArticles[$sOrderArticleId]['oxorderdate'] = substr($oOrderFile->$sOrderDateField->value, 0, 16);
00092             $oOrderArticles[$sOrderArticleId]['oxarticletitle'] = $oOrderFile->$sOrderTitleField->value;
00093             $oOrderArticles[$sOrderArticleId]['oxorderfiles'][] = $oOrderFile;
00094         }
00095 
00096         return $oOrderArticles;
00097     }
00098 
00104     public function getDownloadError()
00105     {
00106         return $this->getConfig()->getRequestParameter('download_error');
00107     }
00108 }