list_review.php

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"] . '&amp;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         // build where
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         $sArtTable = getViewName('oxarticles');
00111         $sArtTitleField = "{$sArtTable}.oxtitle";
00112         $sSqlForTitle = null;
00113         $sLangTag = oxLang::getInstance()->getLanguageTag( $this->_iEditLang );
00114 
00115         $sSql = parent::_prepareWhereQuery( $aWhere, $sSql );
00116 
00117         //removing parent id checking from sql
00118         $sStr = "/\s+and\s+".getViewName( 'oxarticles' )."\.oxparentid\s*=\s*''/";
00119         $sSql = preg_replace( $sStr, " ", $sSql );
00120 
00121         // if searching in article title field, updating sql for this case
00122         if ( $this->_aWhere[$sArtTitleField] ) {
00123             $sSqlForTitle = " (CONCAT( {$sArtTable}.oxtitle{$sLangTag}, if(isnull(oxparentarticles.oxtitle{$sLangTag}), '', oxparentarticles.oxtitle{$sLangTag}), {$sArtTable}.oxvarselect{$sLangTag})) ";
00124             $sSql = preg_replace( "/{$sArtTable}\.oxtitle\s+like/", "$sSqlForTitle like", $sSql );
00125         }
00126 
00127         return " $sSql and {$sArtTable}.oxid is not null ";
00128     }
00129 
00137     protected function _prepareOrderByQuery( $sSql = null )
00138     {
00139         if ( $sSort = oxConfig::getParameter( "sort" ) ) {
00140             $sSql .= " order by ".oxDb::getInstance()->escapeString( $sSort ) ." ";
00141         }
00142 
00143         return $sSql;
00144     }
00145 }

Generated by  doxygen 1.6.2