OXID eShop CE  4.10.2
 All Classes Namespaces 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 {
8 
14  protected $_sListType = 'oxlist';
15 
21  protected $_sListClass = 'oxreview';
22 
28  protected function _getViewListSize()
29  {
30  return $this->_getUserDefListSize();
31  }
32 
39  public function render()
40  {
42 
43  $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;
44  $this->_aViewData["articleListTable"] = getViewName('oxarticles');
45 
46  return "list_review.tpl";
47  }
48 
56  protected function _buildSelectString($oObject = null)
57  {
58  $sArtTable = getViewName('oxarticles', $this->_iEditLang);
59 
60  $sQ = "select oxreviews.oxid, oxreviews.oxcreate, oxreviews.oxtext, oxreviews.oxobjectid, {$sArtTable}.oxparentid, {$sArtTable}.oxtitle as oxtitle, {$sArtTable}.oxvarselect as oxvarselect, oxparentarticles.oxtitle as parenttitle, ";
61  $sQ .= "concat( {$sArtTable}.oxtitle, if(isnull(oxparentarticles.oxtitle), '', oxparentarticles.oxtitle), {$sArtTable}.oxvarselect) as arttitle from oxreviews ";
62  $sQ .= "left join $sArtTable as {$sArtTable} on {$sArtTable}.oxid=oxreviews.oxobjectid and 'oxarticle' = oxreviews.oxtype ";
63  $sQ .= "left join $sArtTable as oxparentarticles on oxparentarticles.oxid = {$sArtTable}.oxparentid ";
64  $sQ .= "where 1 and oxreviews.oxlang = '{$this->_iEditLang}' ";
65 
66 
67  //removing parent id checking from sql
68  $sStr = "/\s+and\s+" . $sArtTable . "\.oxparentid\s*=\s*''/";
69  $sQ = getStr()->preg_replace($sStr, " ", $sQ);
70 
71  return " $sQ and {$sArtTable}.oxid is not null ";
72  }
73 
82  protected function _prepareWhereQuery($aWhere, $sSql)
83  {
84  $sSql = parent::_prepareWhereQuery($aWhere, $sSql);
85 
86  $sArtTable = getViewName('oxarticles', $this->_iEditLang);
87  $sArtTitleField = "{$sArtTable}.oxtitle";
88 
89  // if searching in article title field, updating sql for this case
90  if ($this->_aWhere[$sArtTitleField]) {
91  $sSqlForTitle = " (CONCAT( {$sArtTable}.oxtitle, if(isnull(oxparentarticles.oxtitle), '', oxparentarticles.oxtitle), {$sArtTable}.oxvarselect)) ";
92  $sSql = getStr()->preg_replace("/{$sArtTable}\.oxtitle\s+like/", "$sSqlForTitle like", $sSql);
93  }
94 
95  return $sSql;
96  }
97 }