OXID eShop CE  4.9.10
 All Classes Files Functions Variables Pages
usergroup_main.php
Go to the documentation of this file.
1 <?php
2 
9 {
10 
18  public function render()
19  {
21 
22  $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
23  if ($soxId != "-1" && isset($soxId)) {
24  // load object
25  $oGroup = oxNew("oxgroups");
26  $oGroup->loadInLang($this->_iEditLang, $soxId);
27 
28  $oOtherLang = $oGroup->getAvailableInLangs();
29  if (!isset($oOtherLang[$this->_iEditLang])) {
30  // echo "language entry doesn't exist! using: ".key($oOtherLang);
31  $oGroup->loadInLang(key($oOtherLang), $soxId);
32  }
33 
34  $this->_aViewData["edit"] = $oGroup;
35 
36  // remove already created languages
37  $aLang = array_diff(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
38 
39  if (count($aLang)) {
40  $this->_aViewData["posslang"] = $aLang;
41  }
42 
43  foreach ($oOtherLang as $id => $language) {
44  $oLang = new stdClass();
45  $oLang->sLangDesc = $language;
46  $oLang->selected = ($id == $this->_iEditLang);
47  $this->_aViewData["otherlang"][$id] = clone $oLang;
48  }
49  }
50  if (oxRegistry::getConfig()->getRequestParameter("aoc")) {
51  $oUsergroupMainAjax = oxNew('usergroup_main_ajax');
52  $this->_aViewData['oxajax'] = $oUsergroupMainAjax->getColumns();
53 
54  return "popups/usergroup_main.tpl";
55  }
56 
57  return "usergroup_main.tpl";
58  }
59 
65  public function save()
66  {
67 
68  parent::save();
69 
70  $soxId = $this->getEditObjectId();
71  $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
72  // checkbox handling
73  if (!isset($aParams['oxgroups__oxactive'])) {
74  $aParams['oxgroups__oxactive'] = 0;
75  }
76 
77  $oGroup = oxNew("oxgroups");
78  if ($soxId != "-1") {
79  $oGroup->load($soxId);
80  } else {
81  $aParams['oxgroups__oxid'] = null;
82  }
83 
84  $oGroup->setLanguage(0);
85  $oGroup->assign($aParams);
86  $oGroup->setLanguage($this->_iEditLang);
87  $oGroup->save();
88 
89  // set oxid if inserted
90  $this->setEditObjectId($oGroup->getId());
91  }
92 
96  public function saveinnlang()
97  {
98  $this->save();
99  }
100 }