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