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 
00066         //removing parent id checking from sql
00067         $sStr = "/\s+and\s+".$sArtTable."\.oxparentid\s*=\s*''/";
00068         $sQ = getStr()->preg_replace( $sStr, " ", $sQ );
00069 
00070         return " $sQ and {$sArtTable}.oxid is not null ";
00071     }
00072 
00081     protected function _prepareWhereQuery( $aWhere, $sSql )
00082     {
00083         $sSql = parent::_prepareWhereQuery( $aWhere, $sSql );
00084 
00085         $sArtTable = getViewName( 'oxarticles', $this->_iEditLang );
00086         $sArtTitleField = "{$sArtTable}.oxtitle";
00087 
00088         // if searching in article title field, updating sql for this case
00089         if ( $this->_aWhere[$sArtTitleField] ) {
00090             $sSqlForTitle = " (CONCAT( {$sArtTable}.oxtitle, if(isnull(oxparentarticles.oxtitle), '', oxparentarticles.oxtitle), {$sArtTable}.oxvarselect)) ";
00091             $sSql = getStr()->preg_replace( "/{$sArtTable}\.oxtitle\s+like/", "$sSqlForTitle like", $sSql );
00092         }
00093 
00094         return $sSql;
00095     }
00096 }