adminguestbook_main.php

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

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