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         $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 }