list_review.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class List_Review extends Article_List
00007 {
00008 
00014     protected $_sListType = 'oxlist';
00015 
00021     protected $_sListClass = 'oxreview';
00022 
00028     protected function _getViewListSize()
00029     {
00030         return $this->_getUserDefListSize();
00031     }
00032 
00039     public function render()
00040     {
00041         oxAdminList::render();
00042 
00043         $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;
00044         $this->_aViewData["articleListTable"] = getViewName('oxarticles');
00045 
00046         return "list_review.tpl";
00047     }
00048 
00056     protected function _buildSelectString($oObject = null)
00057     {
00058         $sArtTable = getViewName('oxarticles', $this->_iEditLang);
00059 
00060         $sQ = "select oxreviews.oxid, oxreviews.oxcreate, oxreviews.oxtext, oxreviews.oxobjectid, {$sArtTable}.oxparentid, {$sArtTable}.oxtitle as oxtitle, {$sArtTable}.oxvarselect as oxvarselect, oxparentarticles.oxtitle as parenttitle, ";
00061         $sQ .= "concat( {$sArtTable}.oxtitle, if(isnull(oxparentarticles.oxtitle), '', oxparentarticles.oxtitle), {$sArtTable}.oxvarselect) as arttitle from oxreviews ";
00062         $sQ .= "left join $sArtTable as {$sArtTable} on {$sArtTable}.oxid=oxreviews.oxobjectid and 'oxarticle' = oxreviews.oxtype ";
00063         $sQ .= "left join $sArtTable as oxparentarticles on oxparentarticles.oxid = {$sArtTable}.oxparentid ";
00064         $sQ .= "where 1 and oxreviews.oxlang = '{$this->_iEditLang}' ";
00065 
00066 
00067         //removing parent id checking from sql
00068         $sStr = "/\s+and\s+" . $sArtTable . "\.oxparentid\s*=\s*''/";
00069         $sQ = getStr()->preg_replace($sStr, " ", $sQ);
00070 
00071         return " $sQ and {$sArtTable}.oxid is not null ";
00072     }
00073 
00082     protected function _prepareWhereQuery($aWhere, $sSql)
00083     {
00084         $sSql = parent::_prepareWhereQuery($aWhere, $sSql);
00085 
00086         $sArtTable = getViewName('oxarticles', $this->_iEditLang);
00087         $sArtTitleField = "{$sArtTable}.oxtitle";
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 = getStr()->preg_replace("/{$sArtTable}\.oxtitle\s+like/", "$sSqlForTitle like", $sSql);
00093         }
00094 
00095         return $sSql;
00096     }
00097 }