OXID eShop CE  4.9.10
 All Classes Files Functions Variables Pages
category_text.php
Go to the documentation of this file.
1 <?php
2 
9 {
10 
17  public function render()
18  {
20 
21  $this->_aViewData['edit'] = $oCategory = oxNew('oxcategory');
22 
23  $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
24  if ($soxId != "-1" && isset($soxId)) {
25  // load object
26  $iCatLang = oxRegistry::getConfig()->getRequestParameter("catlang");
27 
28  if (!isset($iCatLang)) {
29  $iCatLang = $this->_iEditLang;
30  }
31 
32  $this->_aViewData["catlang"] = $iCatLang;
33 
34  $oCategory->loadInLang($iCatLang, $soxId);
35 
36 
37  foreach (oxRegistry::getLang()->getLanguageNames() as $id => $language) {
38  $oLang = new stdClass();
39  $oLang->sLangDesc = $language;
40  $oLang->selected = ($id == $this->_iEditLang);
41  $this->_aViewData["otherlang"][$id] = clone $oLang;
42  }
43  }
44 
45  $this->_aViewData["editor"] = $this->_generateTextEditor("100%", 300, $oCategory, "oxcategories__oxlongdesc", "list.tpl.css");
46 
47  return "category_text.tpl";
48  }
49 
55  public function save()
56  {
57  parent::save();
58 
59  $myConfig = $this->getConfig();
60 
61  $soxId = $this->getEditObjectId();
62  $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
63 
64  $oCategory = oxNew("oxcategory");
65  $iCatLang = oxRegistry::getConfig()->getRequestParameter("catlang");
66  $iCatLang = $iCatLang ? $iCatLang : 0;
67 
68  if ($soxId != "-1") {
69  $oCategory->loadInLang($iCatLang, $soxId);
70  } else {
71  $aParams['oxcategories__oxid'] = null;
72  }
73 
74 
75  $oCategory->setLanguage(0);
76  $oCategory->assign($aParams);
77  $oCategory->setLanguage($iCatLang);
78  $oCategory->save();
79 
80  // set oxid if inserted
81  $this->setEditObjectId($oCategory->getId());
82  }
83 }