usergroup_main.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class UserGroup_Main extends oxAdminDetails
00009 {
00010 
00018     public function render()
00019     {
00020         parent::render();
00021 
00022         $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
00023         if ($soxId != "-1" && isset($soxId)) {
00024             // load object
00025             $oGroup = oxNew("oxgroups");
00026             $oGroup->loadInLang($this->_iEditLang, $soxId);
00027 
00028             $oOtherLang = $oGroup->getAvailableInLangs();
00029             if (!isset($oOtherLang[$this->_iEditLang])) {
00030                 // echo "language entry doesn't exist! using: ".key($oOtherLang);
00031                 $oGroup->loadInLang(key($oOtherLang), $soxId);
00032             }
00033 
00034             $this->_aViewData["edit"] = $oGroup;
00035 
00036             // remove already created languages
00037             $aLang = array_diff(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
00038 
00039             if (count($aLang)) {
00040                 $this->_aViewData["posslang"] = $aLang;
00041             }
00042 
00043             foreach ($oOtherLang as $id => $language) {
00044                 $oLang = new stdClass();
00045                 $oLang->sLangDesc = $language;
00046                 $oLang->selected = ($id == $this->_iEditLang);
00047                 $this->_aViewData["otherlang"][$id] = clone $oLang;
00048             }
00049         }
00050         if (oxRegistry::getConfig()->getRequestParameter("aoc")) {
00051             $oUsergroupMainAjax = oxNew('usergroup_main_ajax');
00052             $this->_aViewData['oxajax'] = $oUsergroupMainAjax->getColumns();
00053 
00054             return "popups/usergroup_main.tpl";
00055         }
00056 
00057         return "usergroup_main.tpl";
00058     }
00059 
00065     public function save()
00066     {
00067 
00068         parent::save();
00069 
00070         $soxId = $this->getEditObjectId();
00071         $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
00072         // checkbox handling
00073         if (!isset($aParams['oxgroups__oxactive'])) {
00074             $aParams['oxgroups__oxactive'] = 0;
00075         }
00076 
00077         $oGroup = oxNew("oxgroups");
00078         if ($soxId != "-1") {
00079             $oGroup->load($soxId);
00080         } else {
00081             $aParams['oxgroups__oxid'] = null;
00082         }
00083 
00084         $oGroup->setLanguage(0);
00085         $oGroup->assign($aParams);
00086         $oGroup->setLanguage($this->_iEditLang);
00087         $oGroup->save();
00088 
00089         // set oxid if inserted
00090         $this->setEditObjectId($oGroup->getId());
00091     }
00092 
00096     public function saveinnlang()
00097     {
00098         $this->save();
00099     }
00100 }