OXID eShop CE  4.8.12
 All Classes Files Functions Variables Pages
list_review.php
Go to the documentation of this file.
1 <?php
2 
6 class List_Review extends Article_List
7 {
13  protected $_sListType = 'oxlist';
14 
20  protected $_sListClass = 'oxreview';
21 
27  protected function _getViewListSize()
28  {
29  return $this->_getUserDefListSize();
30  }
31 
38  public function render()
39  {
41 
42  $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;
43  $this->_aViewData["articleListTable"] = getViewName('oxarticles');
44 
45  return "list_review.tpl";
46  }
47 
55  protected function _buildSelectString( $oObject = null )
56  {
57  $sArtTable = getViewName( 'oxarticles', $this->_iEditLang );
58 
59  $sQ = "select oxreviews.oxid, oxreviews.oxcreate, oxreviews.oxtext, oxreviews.oxobjectid, {$sArtTable}.oxparentid, {$sArtTable}.oxtitle as oxtitle, {$sArtTable}.oxvarselect as oxvarselect, oxparentarticles.oxtitle as parenttitle, ";
60  $sQ .= "concat( {$sArtTable}.oxtitle, if(isnull(oxparentarticles.oxtitle), '', oxparentarticles.oxtitle), {$sArtTable}.oxvarselect) as arttitle from oxreviews ";
61  $sQ .= "left join $sArtTable as {$sArtTable} on {$sArtTable}.oxid=oxreviews.oxobjectid and 'oxarticle' = oxreviews.oxtype ";
62  $sQ .= "left join $sArtTable as oxparentarticles on oxparentarticles.oxid = {$sArtTable}.oxparentid ";
63  $sQ .= "where 1 and oxreviews.oxlang = '{$this->_iEditLang}' ";
64 
65 
66  //removing parent id checking from sql
67  $sStr = "/\s+and\s+".$sArtTable."\.oxparentid\s*=\s*''/";
68  $sQ = getStr()->preg_replace( $sStr, " ", $sQ );
69 
70  return " $sQ and {$sArtTable}.oxid is not null ";
71  }
72 
81  protected function _prepareWhereQuery( $aWhere, $sSql )
82  {
83  $sSql = parent::_prepareWhereQuery( $aWhere, $sSql );
84 
85  $sArtTable = getViewName( 'oxarticles', $this->_iEditLang );
86  $sArtTitleField = "{$sArtTable}.oxtitle";
87 
88  // if searching in article title field, updating sql for this case
89  if ( $this->_aWhere[$sArtTitleField] ) {
90  $sSqlForTitle = " (CONCAT( {$sArtTable}.oxtitle, if(isnull(oxparentarticles.oxtitle), '', oxparentarticles.oxtitle), {$sArtTable}.oxvarselect)) ";
91  $sSql = getStr()->preg_replace( "/{$sArtTable}\.oxtitle\s+like/", "$sSqlForTitle like", $sSql );
92  }
93 
94  return $sSql;
95  }
96 }