newsletter_main.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class Newsletter_Main extends oxAdminDetails
00009 {
00010 
00018     public function render()
00019     {
00020         parent::render();
00021 
00022         $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
00023         if ($soxId != "-1" && isset($soxId)) {
00024             // load object
00025             $oNewsletter = oxNew("oxnewsletter");
00026             $oNewsletter->load($soxId);
00027             $this->_aViewData["edit"] = $oNewsletter;
00028         }
00029 
00030         // generate editor
00031         $this->_aViewData["editor"] = $this->_generateTextEditor(
00032             "100%",
00033             255,
00034             $oNewsletter,
00035             "oxnewsletter__oxtemplate"
00036         );
00037 
00038         return "newsletter_main.tpl";
00039     }
00040 
00044     public function save()
00045     {
00046         $myConfig = $this->getConfig();
00047 
00048         $soxId = $this->getEditObjectId();
00049         $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
00050 
00051         // shopid
00052         $sShopID = oxRegistry::getSession()->getVariable("actshop");
00053         $aParams['oxnewsletter__oxshopid'] = $sShopID;
00054 
00055         $oNewsletter = oxNew("oxnewsletter");
00056         if ($soxId != "-1") {
00057             $oNewsletter->load($soxId);
00058         } else {
00059             $aParams['oxnewsletter__oxid'] = null;
00060         }
00061 
00062         $oNewsletter->assign($aParams);
00063         $oNewsletter->save();
00064 
00065         // set oxid if inserted
00066         $this->setEditObjectId($oNewsletter->getId());
00067     }
00068 }