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