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 = $this->_aViewData["oxid"] = $this->getEditObjectId();
00023 if ( $soxId != '-1' && isset( $soxId ) ) {
00024
00025 $oLinks = oxNew( 'oxgbentry' );
00026 $oLinks->load( $soxId );
00027
00028
00029 if ( !isset( $oLinks->oxgbentries__oxviewed ) || !$oLinks->oxgbentries__oxviewed->value ) {
00030 $oLinks->oxgbentries__oxviewed = new oxField( 1 );
00031 $oLinks->save();
00032 }
00033 $this->_aViewData["edit"] = $oLinks;
00034 }
00035
00036
00037 $this->_aViewData['blShowActBox'] = $myConfig->getConfigParam( 'blGBModerate' );
00038
00039 return 'adminguestbook_main.tpl';
00040 }
00041
00047 public function save()
00048 {
00049
00050 $soxId = $this->getEditObjectId();
00051 $aParams = oxConfig::getParameter( "editval" );
00052
00053
00054 if ( !isset( $aParams['oxgbentries__oxactive'] ) ) {
00055 $aParams['oxgbentries__oxactive'] = 0;
00056 }
00057
00058
00059 $aParams['oxgbentries__oxshopid'] = oxSession::getVar( "actshop");
00060
00061 $oLinks = oxNew( "oxgbentry" );
00062 if ( $soxId != "-1" ) {
00063 $oLinks->load( $soxId );
00064 } else {
00065 $aParams['oxgbentries__oxid'] = null;
00066
00067
00068 $aParams['oxgbentries__oxuserid'] = oxSession::getVar( 'auth' );
00069 }
00070
00071 $oLinks->assign( $aParams );
00072 $oLinks->save();
00073 $this->setEditObjectId( $oLinks->getId() );
00074 }
00075
00076 }