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 = $this->_aViewData["oxid"] = $this->getEditObjectId();
00023         if ( $soxId != '-1' && isset( $soxId ) ) {
00024             // load object
00025             $oLinks = oxNew( 'oxgbentry' );
00026             $oLinks->load( $soxId );
00027 
00028             // #580A - setting GB entry as viewed in admin
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         //show "active" checkbox if moderating is active
00037         $this->_aViewData['blShowActBox'] = $myConfig->getConfigParam( 'blGBModerate' );
00038 
00039         return 'adminguestbook_main.tpl';
00040     }
00041 
00047     public function save()
00048     {
00049         parent::save();
00050 
00051         $soxId = $this->getEditObjectId();
00052         $aParams = oxConfig::getParameter( "editval" );
00053 
00054         // checkbox handling
00055         if ( !isset( $aParams['oxgbentries__oxactive'] ) ) {
00056             $aParams['oxgbentries__oxactive'] = 0;
00057         }
00058 
00059             // shopid
00060             $aParams['oxgbentries__oxshopid'] = oxSession::getVar( "actshop");
00061 
00062         $oLinks = oxNew( "oxgbentry" );
00063         if ( $soxId != "-1" ) {
00064             $oLinks->load( $soxId );
00065         } else {
00066             $aParams['oxgbentries__oxid'] = null;
00067 
00068             // author
00069             $aParams['oxgbentries__oxuserid'] = oxSession::getVar( 'auth' );
00070         }
00071 
00072         $oLinks->assign( $aParams );
00073         $oLinks->save();
00074         $this->setEditObjectId( $oLinks->getId() );
00075     }
00076 
00077 }