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 ( oxLang::getInstance()->getLanguageNames(), $oOtherLang );
00037 
00038             if ( count( $aLang))
00039                 $this->_aViewData["posslang"] = $aLang;
00040 
00041             foreach ( $oOtherLang as $id => $language) {
00042                 $oLang= new oxStdClass();
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 
00050             $aColumns = array();
00051             include_once 'inc/'.strtolower(__CLASS__).'.inc.php';
00052             $this->_aViewData['oxajax'] = $aColumns;
00053 
00054             return "popups/usergroup_main.tpl";
00055         }
00056         return "usergroup_main.tpl";
00057     }
00058 
00064     public function save()
00065     {
00066 
00067         parent::save();
00068 
00069         $soxId = $this->getEditObjectId();
00070         $aParams    = oxConfig::getParameter( "editval");
00071         // checkbox handling
00072         if ( !isset( $aParams['oxgroups__oxactive'] ) ) {
00073             $aParams['oxgroups__oxactive'] = 0;
00074         }
00075 
00076         $oGroup = oxNew( "oxgroups" );
00077         if ( $soxId != "-1") {
00078             $oGroup->load( $soxId );
00079         } else {
00080             $aParams['oxgroups__oxid'] = null;
00081         }
00082 
00083         $oGroup->setLanguage( 0 );
00084         $oGroup->assign( $aParams);
00085         $oGroup->setLanguage( $this->_iEditLang );
00086         $oGroup->save();
00087 
00088         // set oxid if inserted
00089         $this->setEditObjectId( $oGroup->getId() );
00090     }
00091 
00097     public function saveinnlang()
00098     {
00099         $this->save();
00100     }
00101 }