newsletter_main.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class Newsletter_Main extends oxAdminDetails
00010 {
00018     public function render()
00019     {
00020         parent::render();
00021 
00022         $soxId = oxConfig::getParameter( "oxid");
00023         // check if we right now saved a new entry
00024         $sSavedID = oxConfig::getParameter( "saved_oxid");
00025         if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) ) {
00026             $soxId = $sSavedID;
00027             oxSession::deleteVar( "saved_oxid");
00028             $this->_aViewData["oxid"] =  $soxId;
00029             // for reloading upper frame
00030             $this->_aViewData["updatelist"] =  "1";
00031         }
00032 
00033         if ( $soxId != "-1" && isset( $soxId)) {
00034             // load object
00035             $oNewsletter = oxNew( "oxnewsletter" );
00036             $oNewsletter->load( $soxId);
00037             $this->_aViewData["edit"] =  $oNewsletter;
00038         }
00039 
00040         // generate editor
00041         $this->_aViewData["editor"] = $this->_generateTextEditor( "100%", 255, $oNewsletter, "oxnewsletter__oxtemplate");
00042 
00043         return "newsletter_main.tpl";
00044     }
00045 
00051     public function save()
00052     {   $myConfig  = $this->getConfig();
00053 
00054         $soxId      = oxConfig::getParameter( "oxid");
00055         $aParams    = oxConfig::getParameter( "editval");
00056 
00057         // shopid
00058         $sShopID = oxSession::getVar( "actshop");
00059         $aParams['oxnewsletter__oxshopid'] = $sShopID;
00060 
00061         $oNewsletter = oxNew( "oxnewsletter" );
00062         if ( $soxId != "-1")
00063             $oNewsletter->load( $soxId);
00064         else
00065             $aParams['oxnewsletter__oxid'] = null;
00066 
00067         $oNewsletter->assign( $aParams);
00068         $oNewsletter->save();
00069         $this->_aViewData["updatelist"] = "1";
00070 
00071         // set oxid if inserted
00072         if ( $soxId == "-1")
00073             oxSession::setVar( "saved_oxid", $oNewsletter->oxnewsletter__oxid->value);
00074 
00075         return $this->autosave();
00076     }
00077 }

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