list_order.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class List_Order extends Order_List
00007 {
00013     protected function _getViewListSize()
00014     {
00015         return $this->_getUserDefListSize();
00016     }
00017 
00024     public function render()
00025     {
00026         oxAdminList::render();
00027 
00028         $this->_aViewData["viewListSize"]  = $this->_getViewListSize();
00029         $this->_aViewData["whereparam"]    = $this->_aViewData["whereparam"] . '&amp;viewListSize='.$this->_getViewListSize();
00030         $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;
00031 
00032         return "list_order.tpl";
00033     }
00034 
00035 
00044     public function _prepareWhereQuery( $aWhere, $sqlFull )
00045     {
00046         return oxAdminList::_prepareWhereQuery( $aWhere, $sqlFull );
00047     }
00048 
00056     protected function _calcListItemsCount( $sSql )
00057     {
00058         // count SQL
00059         $sSql = preg_replace( '/select .* from/', 'select count(*) from ', $sSql );
00060 
00061         // removing order by
00062         $sSql = preg_replace( '/order by .*$/', '', $sSql );
00063 
00064         // con of list items which fits current search conditions
00065         $this->_iListSize = oxDb::getDb()->getOne( "select count(*) from ( $sSql ) as test" );
00066 
00067         // set it into session that other frames know about size of DB
00068         oxSession::setVar( 'iArtCnt', $this->_iListSize );
00069     }
00070 
00078     protected function _buildSelectString( $oObject = null )
00079     {
00080         return 'select oxorderarticles.oxid, oxorder.oxid as oxorderid, max(oxorder.oxorderdate) as oxorderdate, oxorderarticles.oxartnum, sum( oxorderarticles.oxamount ) as oxorderamount, oxorderarticles.oxtitle, round( sum(oxorderarticles.oxbrutprice*oxorder.oxcurrate),2) as oxprice from oxorderarticles left join oxorder on oxorder.oxid=oxorderarticles.oxorderid where 1 ';
00081     }
00082 
00090     protected function _prepareOrderByQuery( $sSql = null )
00091     {
00092         // calculating sum
00093         $sSumQ = preg_replace("/select .*? from/", "select round( sum(oxorderarticles.oxbrutprice*oxorder.oxcurrate),2) from", $sSql );
00094         $this->_aViewData["sumresult"] = oxDb::getDb()->getOne( $sSumQ );
00095 
00096         $sSql = " $sSql group by oxorderarticles.oxartnum";
00097         if ( $sSort = oxConfig::getParameter( "sort" ) ) {
00098             if ($sSort == 'oxorder.oxorderdate') {
00099                 $sSql .= " order by max(oxorder.oxorderdate) DESC";
00100             } else {
00101                 $sSql .= " order by " . oxDb::getInstance()->escapeString( $sSort );
00102             }
00103         }
00104         return $sSql;
00105     }
00106 }

Generated by  doxygen 1.6.2