list_review.php

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

Generated on Tue Apr 21 15:45:44 2009 for OXID eShop CE by  doxygen 1.5.5