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