list_review.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class List_Review extends Article_List
00007 {
00013     protected $_sListType  = 'oxlist';
00014 
00020     protected $_sListClass = 'oxreview';
00021 
00027     protected function _getViewListSize()
00028     {
00029         return $this->_getUserDefListSize();
00030     }
00031 
00038     public function render()
00039     {
00040         oxAdminList::render();
00041 
00042         $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;
00043         $this->_aViewData["articleListTable"] = getViewName('oxarticles');
00044 
00045         return "list_review.tpl";
00046     }
00047 
00055     protected function _buildSelectString( $oObject = null )
00056     {
00057         $sArtTable = getViewName( 'oxarticles', $this->_iEditLang );
00058 
00059         $sQ  = "select oxreviews.oxid, oxreviews.oxcreate, oxreviews.oxtext, oxreviews.oxobjectid, {$sArtTable}.oxparentid, {$sArtTable}.oxtitle as oxtitle, {$sArtTable}.oxvarselect as oxvarselect, oxparentarticles.oxtitle as parenttitle, ";
00060         $sQ .= "concat( {$sArtTable}.oxtitle, if(isnull(oxparentarticles.oxtitle), '', oxparentarticles.oxtitle), {$sArtTable}.oxvarselect) as arttitle from oxreviews ";
00061         $sQ .= "left join $sArtTable as {$sArtTable} on {$sArtTable}.oxid=oxreviews.oxobjectid and 'oxarticle' = oxreviews.oxtype ";
00062         $sQ .= "left join $sArtTable as oxparentarticles on oxparentarticles.oxid = {$sArtTable}.oxparentid ";
00063         $sQ .= "where 1 and oxreviews.oxlang = '{$this->_iEditLang}' ";
00064 
00065         return $sQ;
00066     }
00067 
00076     protected function _prepareWhereQuery( $aWhere, $sSql )
00077     {
00078         $oStr = getStr();
00079         $sArtTable = getViewName('oxarticles');
00080         $sArtTitleField = "{$sArtTable}.oxtitle";
00081         $sSqlForTitle = null;
00082 
00083         $sSql = parent::_prepareWhereQuery( $aWhere, $sSql );
00084 
00085         //removing parent id checking from sql
00086         $sStr = "/\s+and\s+".getViewName( 'oxarticles' )."\.oxparentid\s*=\s*''/";
00087         $sSql = $oStr->preg_replace( $sStr, " ", $sSql );
00088 
00089         // if searching in article title field, updating sql for this case
00090         if ( $this->_aWhere[$sArtTitleField] ) {
00091             $sSqlForTitle = " (CONCAT( {$sArtTable}.oxtitle, if(isnull(oxparentarticles.oxtitle), '', oxparentarticles.oxtitle), {$sArtTable}.oxvarselect)) ";
00092             $sSql = $oStr->preg_replace( "/{$sArtTable}\.oxtitle\s+like/", "$sSqlForTitle like", $sSql );
00093         }
00094 
00095         return " $sSql and {$sArtTable}.oxid is not null ";
00096     }
00097 }