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

Generated on Wed Apr 22 12:26:29 2009 for OXID eShop CE by  doxygen 1.5.5