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