OXID eShop CE  4.8.10
 All Classes Files Functions Variables Pages
newsletter_main.php
Go to the documentation of this file.
1 <?php
2 
9 {
17  public function render()
18  {
20 
21  $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
22  if ( $soxId != "-1" && isset( $soxId)) {
23  // load object
24  $oNewsletter = oxNew( "oxnewsletter" );
25  $oNewsletter->load( $soxId);
26  $this->_aViewData["edit"] = $oNewsletter;
27  }
28 
29  // generate editor
30  $this->_aViewData["editor"] = $this->_generateTextEditor( "100%", 255, $oNewsletter, "oxnewsletter__oxtemplate");
31 
32  return "newsletter_main.tpl";
33  }
34 
40  public function save()
41  { $myConfig = $this->getConfig();
42 
43  $soxId = $this->getEditObjectId();
44  $aParams = oxConfig::getParameter( "editval");
45 
46  // shopid
47  $sShopID = oxSession::getVar( "actshop");
48  $aParams['oxnewsletter__oxshopid'] = $sShopID;
49 
50  $oNewsletter = oxNew( "oxnewsletter" );
51  if ( $soxId != "-1")
52  $oNewsletter->load( $soxId);
53  else
54  $aParams['oxnewsletter__oxid'] = null;
55 
56  $oNewsletter->assign( $aParams);
57  $oNewsletter->save();
58 
59  // set oxid if inserted
60  $this->setEditObjectId( $oNewsletter->getId() );
61  }
62 }