usergroup_main.php

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