OXID eShop CE  4.10.3
 All Classes Namespaces Files Functions Variables Pages
news_text.php
Go to the documentation of this file.
1 <?php
2 
8 class News_Text extends oxAdminDetails
9 {
10 
17  public function render()
18  {
19  $myConfig = $this->getConfig();
20 
22 
23  $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
24  if ($soxId != "-1" && isset($soxId)) {
25  // load object
26  $oNews = oxNew("oxnews");
27  $iNewsLang = oxRegistry::getConfig()->getRequestParameter("newslang");
28 
29  if (!isset($iNewsLang)) {
30  $iNewsLang = $this->_iEditLang;
31  }
32 
33  $this->_aViewData["newslang"] = $iNewsLang;
34  $oNews->loadInLang($iNewsLang, $soxId);
35 
36  foreach (oxRegistry::getLang()->getLanguageNames() as $id => $language) {
37  $oLang = new stdClass();
38  $oLang->sLangDesc = $language;
39  $oLang->selected = ($id == $this->_iEditLang);
40  $this->_aViewData["otherlang"][$id] = clone $oLang;
41  }
42 
43 
44  $this->_aViewData["edit"] = $oNews;
45 
46 
47  }
48  $this->_aViewData["editor"] = $this->_generateTextEditor("100%", 255, $oNews, "oxnews__oxlongdesc", "news.tpl.css");
49 
50  return "news_text.tpl";
51  }
52 
58  public function save()
59  {
60  parent::save();
61 
62  $myConfig = $this->getConfig();
63 
64  $soxId = $this->getEditObjectId();
65  $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
66 
67  $oNews = oxNew("oxnews");
68 
69  $iNewsLang = oxRegistry::getConfig()->getRequestParameter("newslang");
70 
71  if (!isset($iNewsLang)) {
72  $iNewsLang = $this->_iEditLang;
73  }
74 
75  if ($soxId != "-1") {
76  $oNews->loadInLang($iNewsLang, $soxId);
77  } else {
78  $aParams['oxnews__oxid'] = null;
79  }
80 
81 
82  //$aParams = $oNews->ConvertNameArray2Idx( $aParams);
83 
84  $oNews->setLanguage(0);
85  $oNews->assign($aParams);
86  $oNews->setLanguage($iNewsLang);
87 
88  $oNews->save();
89  // set oxid if inserted
90  $this->setEditObjectId($oNews->getId());
91  }
92 }