newsletter_main.php

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