adminguestbook_main.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class Adminguestbook_Main extends oxAdminDetails
00009 {
00016     public function render()
00017     {
00018         $myConfig  = $this->getConfig();
00019 
00020         parent::render();
00021 
00022         $soxId = oxConfig::getParameter( "oxid");
00023 
00024         // check if we right now saved a new entry
00025         $sSavedID = oxConfig::getParameter( "saved_oxid" );
00026         if ( ( $soxId == "-1" || !isset( $soxId ) ) && isset( $sSavedID ) ) {
00027 
00028             $soxId = $sSavedID;
00029             oxSession::deleteVar( 'saved_oxid' );
00030             $this->_aViewData["oxid"] = $soxId;
00031 
00032             // for reloading upper frame
00033             $this->_aViewData["updatelist"] = '1';
00034         }
00035 
00036         if ( $soxId != '-1' && isset( $soxId ) ) {
00037             // load object
00038             $oLinks = oxNew( 'oxgbentry' );
00039             $oLinks->load( $soxId );
00040 
00041             // #580A - setting GB entry as viewed in admin
00042             if ( !$oLinks->oxgbentries__oxviewed->value ) {
00043                 $oLinks->oxgbentries__oxviewed->setValue(1);
00044                 $oLinks->save();
00045             }
00046             $this->_aViewData["edit"] =  $oLinks;
00047         }
00048 
00049         //show "active" checkbox if moderating is active
00050         $this->_aViewData['blShowActBox'] = $myConfig->getConfigParam( 'blGBModerate' );
00051 
00052         return 'adminguestbook_main.tpl';
00053     }
00054 
00060     public function save()
00061     {
00062 
00063         $soxId   = oxConfig::getParameter( "oxid" );
00064         $aParams = oxConfig::getParameter( "editval" );
00065 
00066         // checkbox handling
00067         if ( !isset( $aParams['oxgbentries__oxactive'] ) )
00068             $aParams['oxgbentries__oxactive'] = 0;
00069 
00070             // shopid
00071             $sShopID = oxSession::getVar( "actshop");
00072             $aParams['oxgbentries__oxshopid'] = $sShopID;
00073 
00074         $oLinks = oxNew( "oxgbentry" );
00075 
00076         if ( $soxId != "-1" ) {
00077             $oLinks->load( $soxId );
00078         } else {
00079             $aParams['oxgbentries__oxid'] = null;
00080 
00081             // author
00082             $iUsrID = oxSession::getVar( 'auth' );
00083             $aParams['oxgbentries__oxuserid'] = $iUsrID;
00084         }
00085 
00086         $oLinks->assign( $aParams );
00087         $oLinks->save();
00088         $this->_aViewData['updatelist'] = '1';
00089 
00090         // set oxid if inserted
00091         if ( $soxId == '-1' ) {
00092             oxSession::setVar( 'saved_oxid', $oLinks->oxgbentries__oxid->value );
00093         }
00094     }
00095 
00096 }

Generated on Mon Oct 26 20:07:15 2009 for OXID eShop CE by  doxygen 1.5.5