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["viewListSize"] = $this->_getViewListSize();
00043 $this->_aViewData["whereparam"] = $this->_aViewData["whereparam"] . '&viewListSize='.$this->_getViewListSize();
00044 $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;
00045 $this->_aViewData["articleListTable"] = getViewName('oxarticles');
00046
00047 return "list_review.tpl";
00048 }
00049
00059 protected function _setFilterParams()
00060 {
00061 parent::_setFilterParams();
00062
00063
00064 if ( is_array( $aWhere = oxConfig::getParameter( 'where' ) ) ) {
00065
00066 $myUtils = oxUtils::getInstance();
00067 $sTable = 'oxarticles';
00068
00069 $oSearchKeys = isset( $this->_aViewData['where'] ) ? $this->_aViewData['where'] : new oxStdClass();
00070
00071 while ( list( $sName, $sValue ) = each( $aWhere ) ) {
00072 $sFieldName = str_replace( getViewName( $sTable ) . '.', $sTable . '.', $sName );
00073 $sFieldName = $myUtils->getArrFldName( $sFieldName );
00074 $oSearchKeys->$sFieldName = $sValue;
00075 }
00076 $this->_aViewData['where'] = $oSearchKeys;
00077 }
00078 }
00079
00087 protected function _buildSelectString( $oObject = null )
00088 {
00089 $sArtTable = getViewName('oxarticles');
00090 $sLangTag = oxLang::getInstance()->getLanguageTag( $this->_iEditLang );
00091
00092 $sSql = "select oxreviews.oxid, oxreviews.oxcreate, oxreviews.oxtext, oxreviews.oxobjectid, {$sArtTable}.oxparentid, {$sArtTable}.oxtitle{$sLangTag} as oxtitle, {$sArtTable}.oxvarselect{$sLangTag} as oxvarselect, oxparentarticles.oxtitle{$sLangTag} as parenttitle, ";
00093 $sSql .= "concat( {$sArtTable}.oxtitle{$sLangTag}, if(isnull(oxparentarticles.oxtitle{$sLangTag}), '', oxparentarticles.oxtitle{$sLangTag}), {$sArtTable}.oxvarselect{$sLangTag}) as arttitle from oxreviews ";
00094 $sSql .= "left join $sArtTable as {$sArtTable} on {$sArtTable}.oxid=oxreviews.oxobjectid and 'oxarticle' = oxreviews.oxtype ";
00095 $sSql .= "left join $sArtTable as oxparentarticles on oxparentarticles.oxid = {$sArtTable}.oxparentid ";
00096 $sSql .= "where 1 and oxreviews.oxlang = '{$this->_iEditLang}' ";
00097 return $sSql;
00098 }
00099
00108 protected function _prepareWhereQuery( $aWhere, $sSql )
00109 {
00110 $oStr = getStr();
00111 $sArtTable = getViewName('oxarticles');
00112 $sArtTitleField = "{$sArtTable}.oxtitle";
00113 $sSqlForTitle = null;
00114 $sLangTag = oxLang::getInstance()->getLanguageTag( $this->_iEditLang );
00115
00116 $sSql = parent::_prepareWhereQuery( $aWhere, $sSql );
00117
00118
00119 $sStr = "/\s+and\s+".getViewName( 'oxarticles' )."\.oxparentid\s*=\s*''/";
00120 $sSql = $oStr->preg_replace( $sStr, " ", $sSql );
00121
00122
00123 if ( $this->_aWhere[$sArtTitleField] ) {
00124 $sSqlForTitle = " (CONCAT( {$sArtTable}.oxtitle{$sLangTag}, if(isnull(oxparentarticles.oxtitle{$sLangTag}), '', oxparentarticles.oxtitle{$sLangTag}), {$sArtTable}.oxvarselect{$sLangTag})) ";
00125 $sSql = $oStr->preg_replace( "/{$sArtTable}\.oxtitle\s+like/", "$sSqlForTitle like", $sSql );
00126 }
00127
00128 return " $sSql and {$sArtTable}.oxid is not null ";
00129 }
00130
00138 protected function _prepareOrderByQuery( $sSql = null )
00139 {
00140 if ( $sSort = oxConfig::getParameter( "sort" ) ) {
00141 $sSql .= " order by ".oxDb::getInstance()->escapeString( $sSort ) ." ";
00142 }
00143
00144 return $sSql;
00145 }
00146 }