00001 <?php
00002
00007 class List_Review extends oxAdminList
00008 {
00015 public function render()
00016 {
00017 $this->_oList = oxNew( "oxlist", "core" );
00018 $this->_oList->setSqlLimit( 0, 5000 );
00019 $this->_oList->init( "oxreview" );
00020
00021 $aWhere = $this->buildWhere();
00022
00023
00024 $sSql = $this->_buildSelectString( $this->_oList->getBaseObject() );
00025 $sSql = $this->_prepareWhereQuery( $aWhere, $sSql );
00026 $sSql = $this->_prepareOrderByQuery( $sSql );
00027 $sSql = $this->_changeselect( $sSql );
00028 $this->_oList->selectString( $sSql );
00029
00030 parent::render();
00031
00032 $aWhere = oxConfig::getParameter( "where");
00033 if ( is_array( $aWhere ) ) {
00034 foreach ( $aWhere as $sField => $sValue ) {
00035 $this->_aViewData["where"]->{str_replace( '.', '__', $sField )} = $sValue;
00036 }
00037 }
00038
00039 $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;
00040
00041 return "list_review.tpl";
00042 }
00043
00049 public function buildWhere()
00050 {
00051 parent::buildWhere();
00052
00053 $sLangTag = oxLang::getInstance()->getLanguageTag($this->_iEditLang);
00054 $sArtTitleField = 'oxarticles.oxtitle';
00055
00056
00057 if ( $sLangTag && $this->_aWhere[$sArtTitleField] ) {
00058 $this->_aWhere[$sArtTitleField.$sLangTag] = $this->_aWhere[$sArtTitleField];
00059 unset( $this->_aWhere[$sArtTitleField] );
00060 }
00061
00062 return $this->_aWhere;
00063 }
00064
00072 protected function _buildSelectString( $oObject = null )
00073 {
00074 $sArtTable = getViewName('oxarticles');
00075 $sSql = "select oxreviews.oxid, oxreviews.oxcreate, oxreviews.oxtext, oxreviews.oxobjectid, oxarticles.oxtitle".oxLang::getInstance()->getLanguageTag($this->_iEditLang)." as oxtitle from oxreviews left join $sArtTable as oxarticles on oxarticles.oxid=oxreviews.oxobjectid and 'oxarticle'=oxreviews.oxtype where 1";
00076 $sSql .= " and oxreviews.oxlang = '" . $this->_iEditLang . " ' ";
00077
00078 return $sSql;
00079 }
00080
00089 protected function _prepareWhereQuery( $aWhere, $sSql )
00090 {
00091 $sSql = parent::_prepareWhereQuery( $aWhere, $sSql );
00092 return " $sSql and oxarticles.oxid is not null ";
00093 }
00094
00102 protected function _prepareOrderByQuery( $sSql = null )
00103 {
00104 if ( $sSort = oxConfig::getParameter( "sort" ) ) {
00105 $sSql .= " order by $sSort ";
00106 }
00107
00108 return $sSql;
00109 }
00110 }