article_review.php

Go to the documentation of this file.
00001 <?php
00002 
00010 class Article_Review extends oxAdminDetails
00011 {
00018     public function render()
00019     {
00020         $myConfig = $this->getConfig();
00021 
00022         parent::render();
00023 
00024         $this->_aViewData["edit"] = $oArticle = oxNew( "oxarticle" );
00025 
00026         $soxId    = oxConfig::getParameter( 'oxid' );
00027         $sRevoxId = oxConfig::getParameter( 'rev_oxid' );
00028         if ( $soxId != "-1" && isset( $soxId)) {
00029 
00030             // load object
00031             $oArticle->load( $soxId);
00032 
00033 
00034 
00035             $sSelect  = "select oxreviews.* from oxreviews
00036                          where oxreviews.OXOBJECTID = '".$oArticle->oxarticles__oxid->value
00037                         ."' and oxreviews.oxtype = 'oxarticle'";
00038 
00039             $this->aVariantList = $oArticle->getVariants();
00040             if ( $myConfig->getConfigParam( 'blShowVariantReviews' ) && count( $this->aVariantList )) {
00041 
00042                 // verifying rights
00043                 foreach ( $this->aVariantList as $oVariant ) {
00044                     $sSelect .= "or oxreviews.oxparentid = '".$oVariant->oxarticles__oxid->value."' ";
00045                 }
00046             }
00047 
00048             //$sSelect .= "and oxreviews.oxtext".oxLang::getInstance()->getLanguageTag($this->_iEditLang)." != ''";
00049             $sSelect .= "and oxreviews.oxlang = '" . $this->_iEditLang . "'";
00050             $sSelect .= "and oxreviews.oxtext != '' ";
00051 
00052             // all reviews
00053             $oRevs = oxNew( "oxlist" );
00054             $oRevs->init( "oxreview" );
00055             $oRevs->selectString( $sSelect );
00056 
00057             foreach ( $oRevs as $oRev ) {
00058                 if ( $oRev->oxreviews__oxid->value == $sRevoxId ) {
00059                     $oRev->selected = 1;
00060                     break;
00061                 }
00062             }
00063             $this->_aViewData["allreviews"]   = $oRevs;
00064             $this->_aViewData["editlanguage"] = $this->_iEditLang;
00065 
00066             if ( isset( $sRevoxId ) ) {
00067                 $oReview = oxNew( "oxreview" );
00068                 $oReview->load( $sRevoxId );
00069                 $this->_aViewData["editreview"] = $oReview;
00070 
00071                 $oUser = oxNew( "oxuser" );
00072                 $oUser->load( $oReview->oxreviews__oxuserid->value);
00073                 $this->_aViewData["user"] = $oUser;
00074             }
00075             //show "active" checkbox if moderating is active
00076             $this->_aViewData["blShowActBox"] = $myConfig->getConfigParam( 'blGBModerate' );
00077 
00078         }
00079 
00080         return "article_review.tpl";
00081     }
00082 
00088     public function save()
00089     {
00090         $myConfig  = $this->getConfig();
00091 
00092 
00093         $aParams = oxConfig::getParameter( "editval");
00094         // checkbox handling
00095         if ( $myConfig->getConfigParam( 'blGBModerate' ) && !isset( $aParams['oxreviews__oxactive'] ) ) {
00096             $aParams['oxreviews__oxactive'] = 0;
00097         }
00098 
00099         $sRevoxId = oxConfig::getParameter( "rev_oxid" );
00100         $oReview  = oxNew( "oxreview" );
00101         $oReview->load( $sRevoxId );
00102 
00103             // shopid
00104             $oReview->oxreviews__oxshopid->value = oxSession::getVar( "actshop");
00105 
00106         $oReview->assign( $aParams);
00107         $oReview->save();
00108 
00109         return $this->autosave();
00110     }
00111 
00117     public function delete()
00118     {
00119 
00120         $sRevoxId = oxConfig::getParameter( "rev_oxid" );
00121         $oReview  = oxNew( "oxreview" );
00122         $oReview->load( $sRevoxId);
00123         $oReview->delete();
00124     }
00125 }

Generated on Thu Dec 4 12:04:55 2008 for OXID eShop CE by  doxygen 1.5.5