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 ( !isset( $oLinks->oxgbentries__oxviewed ) || !$oLinks->oxgbentries__oxviewed->value ) {
00043                 $oLinks->oxgbentries__oxviewed = new oxField( 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 
00071             // shopid
00072             $aParams['oxgbentries__oxshopid'] = oxSession::getVar( "actshop");
00073 
00074         $oLinks = oxNew( "oxgbentry" );
00075         if ( $soxId != "-1" ) {
00076             $oLinks->load( $soxId );
00077         } else {
00078             $aParams['oxgbentries__oxid'] = null;
00079 
00080             // author
00081             $aParams['oxgbentries__oxuserid'] = oxSession::getVar( 'auth' );
00082         }
00083 
00084         $oLinks->assign( $aParams );
00085         $oLinks->save();
00086         $this->_aViewData['updatelist'] = '1';
00087 
00088         // set oxid if inserted
00089         if ( $soxId == '-1' ) {
00090             oxSession::setVar( 'saved_oxid', $oLinks->oxgbentries__oxid->value );
00091         }
00092     }
00093 
00094 }

Generated by  doxygen 1.6.2