list_review.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class List_Review extends oxAdminList
00008 {
00015     public function render()
00016     {
00017         $this->_oList = oxNew( "oxlist", "core" );
00018         $this->_oList->setSqlLimit( 0, 5000 );
00019         $this->_oList->init( "oxreview" );
00020 
00021         $aWhere = $this->buildWhere();
00022         //$aWhere['oxreviews.oxlang'] = $this->_iEditLang;
00023 
00024         $sSql = $this->_buildSelectString( $this->_oList->getBaseObject() );
00025         $sSql = $this->_prepareWhereQuery( $aWhere, $sSql );
00026         $sSql = $this->_prepareOrderByQuery( $sSql );
00027         $sSql = $this->_changeselect( $sSql );
00028         //$this->_oList->setAssignCallback( array( oxNew("List_Review"), 'formatArticleTitle'));
00029         $this->_oList->selectString( $sSql );
00030 
00031         parent::render();
00032 
00033         $aWhere = oxConfig::getParameter( "where");
00034         if ( is_array( $aWhere ) ) {
00035             foreach ( $aWhere as $sField => $sValue ) {
00036                 $this->_aViewData["where"]->{str_replace( '.', '__', $sField )} = $sValue;
00037             }
00038         }
00039 
00040         $this->_aViewData["menustructure"] =  $this->getNavigation()->getDomXml()->documentElement->childNodes;
00041 
00042         return "list_review.tpl";
00043     }
00044 
00045 
00053     protected function _buildSelectString( $oObject = null )
00054     {
00055         $sArtTable = getViewName('oxarticles');
00056         $sLangTag = oxLang::getInstance()->getLanguageTag( $this->_iEditLang );
00057 
00058         $sSql = "select oxreviews.oxid, oxreviews.oxcreate, oxreviews.oxtext, oxreviews.oxobjectid, oxarticles.oxparentid, oxarticles.oxtitle{$sLangTag} as oxtitle, oxarticles.oxvarselect{$sLangTag} as oxvarselect, oxparentarticles.oxtitle{$sLangTag} as parenttitle,
00059                    concat( oxarticles.oxtitle{$sLangTag}, if(isnull(oxparentarticles.oxtitle{$sLangTag}), '', oxparentarticles.oxtitle{$sLangTag}), oxarticles.oxvarselect_1) as arttitle from oxreviews
00060                  left join $sArtTable as oxarticles on oxarticles.oxid=oxreviews.oxobjectid and 'oxarticle' = oxreviews.oxtype
00061                  left join $sArtTable as oxparentarticles on oxparentarticles.oxid = oxarticles.oxparentid
00062                  where 1 and oxreviews.oxlang = '{$this->_iEditLang}' ";
00063         return $sSql;
00064     }
00065 
00074     protected function _prepareWhereQuery( $aWhere, $sSql )
00075     {
00076         $sArtTitleField = 'oxarticles.oxtitle';
00077         $sSqlForTitle = null;
00078         $sLangTag = oxLang::getInstance()->getLanguageTag( $this->_iEditLang );
00079 
00080         $sSql = parent::_prepareWhereQuery( $aWhere, $sSql );
00081 
00082         // if searching in article title field, updating sql for this case
00083         if ( $this->_aWhere[$sArtTitleField] ) {
00084             $sSqlForTitle = " (CONCAT( oxarticles.oxtitle{$sLangTag}, if(isnull(oxparentarticles.oxtitle{$sLangTag}), '', oxparentarticles.oxtitle{$sLangTag}), oxarticles.oxvarselect{$sLangTag})) ";
00085             $sSql = preg_replace( "/oxarticles\.oxtitle\s+like/", "$sSqlForTitle like", $sSql );
00086         }
00087 
00088         return " $sSql and oxarticles.oxid is not null ";
00089     }
00090 
00098     protected function _prepareOrderByQuery( $sSql = null )
00099     {
00100         if ( $sSort = oxConfig::getParameter( "sort" ) ) {
00101             $sSql .= " order by $sSort ";
00102         }
00103 
00104         return $sSql;
00105     }
00106 }

Generated on Thu Feb 19 15:02:21 2009 for OXID eShop CE by  doxygen 1.5.5