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         $this->_aViewData['editor'] = $this->_generateTextEditor( "100%", 300, $oLinks, 'oxgbentries__oxcontent', 'agb.tpl.css' );
00050 
00051         //show "active" checkbox if moderating is active
00052         $this->_aViewData['blShowActBox'] = $myConfig->getConfigParam( 'blGBModerate' );
00053 
00054         return 'adminguestbook_main.tpl';
00055     }
00056 
00062     public function save()
00063     {
00064 
00065         $soxId   = oxConfig::getParameter( "oxid" );
00066         $aParams = oxConfig::getParameter( "editval" );
00067 
00068         // checkbox handling
00069         if ( !isset( $aParams['oxgbentries__oxactive'] ) )
00070             $aParams['oxgbentries__oxactive'] = 0;
00071 
00072             // shopid
00073             $sShopID = oxSession::getVar( "actshop");
00074             $aParams['oxgbentries__oxshopid'] = $sShopID;
00075 
00076         $oLinks = oxNew( "oxgbentry" );
00077 
00078         if ( $soxId != "-1" ) {
00079             $oLinks->load( $soxId );
00080         } else {
00081             $aParams['oxgbentries__oxid'] = null;
00082 
00083             // author
00084             $iUsrID = oxSession::getVar( 'auth' );
00085             $aParams['oxgbentries__oxuserid'] = $iUsrID;
00086         }
00087 
00088         $oLinks->assign( $aParams );
00089         $oLinks->save();
00090         $this->_aViewData['updatelist'] = '1';
00091 
00092         // set oxid if inserted
00093         if ( $soxId == '-1' ) {
00094             oxSession::setVar( 'saved_oxid', $oLinks->oxgbentries__oxid->value );
00095         }
00096     }
00097 
00098 }

Generated on Wed May 13 13:25:50 2009 for OXID eShop CE by  doxygen 1.5.5