OXID eShop CE  4.8.10
 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 {
14  public function render()
15  { $myConfig = $this->getConfig();
16 
18 
19  $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
20  if ( $soxId != "-1" && isset( $soxId)) {
21  // load object
22  $oNews = oxNew( "oxnews" );
23  $iNewsLang = oxConfig::getParameter("newslang");
24 
25  if (!isset($iNewsLang))
26  $iNewsLang = $this->_iEditLang;
27 
28  $this->_aViewData["newslang"] = $iNewsLang;
29  $oNews->loadInLang( $iNewsLang, $soxId );
30 
31  foreach ( oxRegistry::getLang()->getLanguageNames() as $id => $language) {
32  $oLang= new stdClass();
33  $oLang->sLangDesc = $language;
34  $oLang->selected = ($id == $this->_iEditLang);
35  $this->_aViewData["otherlang"][$id] = clone $oLang;
36  }
37 
38 
39  $this->_aViewData["edit"] = $oNews;
40 
41 
42  }
43  $this->_aViewData["editor"] = $this->_generateTextEditor( "100%", 255, $oNews, "oxnews__oxlongdesc", "news.tpl.css");
44 
45  return "news_text.tpl";
46  }
47 
53  public function save()
54  {
55  parent::save();
56 
57  $myConfig = $this->getConfig();
58 
59  $soxId = $this->getEditObjectId();
60  $aParams = oxConfig::getParameter( "editval");
61 
62  $oNews = oxNew( "oxnews" );
63 
64  $iNewsLang = oxConfig::getParameter("newslang");
65 
66  if (!isset($iNewsLang))
67  $iNewsLang = $this->_iEditLang;
68 
69  if ( $soxId != "-1")
70  $oNews->loadInLang( $iNewsLang, $soxId );
71  else
72  $aParams['oxnews__oxid'] = null;
73 
74 
75 
76  //$aParams = $oNews->ConvertNameArray2Idx( $aParams);
77 
78  $oNews->setLanguage(0);
79  $oNews->assign( $aParams);
80  $oNews->setLanguage($iNewsLang);
81 
82  $oNews->save();
83  // set oxid if inserted
84  $this->setEditObjectId( $oNews->getId() );
85  }
86 
87 }