adminguestbook_main.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class Adminguestbook_Main extends oxAdminDetails
00009 {
00010 
00017     public function render()
00018     {
00019         $myConfig = $this->getConfig();
00020 
00021         parent::render();
00022 
00023         $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
00024         if ($soxId != '-1' && isset($soxId)) {
00025             // load object
00026             $oLinks = oxNew('oxgbentry');
00027             $oLinks->load($soxId);
00028 
00029             // #580A - setting GB entry as viewed in admin
00030             if (!isset($oLinks->oxgbentries__oxviewed) || !$oLinks->oxgbentries__oxviewed->value) {
00031                 $oLinks->oxgbentries__oxviewed = new oxField(1);
00032                 $oLinks->save();
00033             }
00034             $this->_aViewData["edit"] = $oLinks;
00035         }
00036 
00037         //show "active" checkbox if moderating is active
00038         $this->_aViewData['blShowActBox'] = $myConfig->getConfigParam('blGBModerate');
00039 
00040         return 'adminguestbook_main.tpl';
00041     }
00042 
00046     public function save()
00047     {
00048         parent::save();
00049 
00050         $soxId = $this->getEditObjectId();
00051         $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
00052 
00053         // checkbox handling
00054         if (!isset($aParams['oxgbentries__oxactive'])) {
00055             $aParams['oxgbentries__oxactive'] = 0;
00056         }
00057 
00058         // shopid
00059         $aParams['oxgbentries__oxshopid'] = oxRegistry::getSession()->getVariable("actshop");
00060 
00061         $oLinks = oxNew("oxgbentry");
00062         if ($soxId != "-1") {
00063             $oLinks->load($soxId);
00064         } else {
00065             $aParams['oxgbentries__oxid'] = null;
00066 
00067             // author
00068             $aParams['oxgbentries__oxuserid'] = oxRegistry::getSession()->getVariable('auth');
00069         }
00070 
00071         $oLinks->assign($aParams);
00072         $oLinks->save();
00073         $this->setEditObjectId($oLinks->getId());
00074     }
00075 }