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 = oxConfig::getParameter( "oxid");
00022         // check if we right now saved a new entry
00023         $sSavedID = oxConfig::getParameter( "saved_oxid");
00024         if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) ) {
00025             $soxId = $sSavedID;
00026             oxSession::deleteVar( "saved_oxid");
00027             $this->_aViewData["oxid"] =  $soxId;
00028             // for reloading upper frame
00029             $this->_aViewData["updatelist"] =  "1";
00030         }
00031 
00032         if ( $soxId != "-1" && isset( $soxId)) {
00033             // load object
00034             $oGroup = oxNew( "oxgroups" );
00035             $oGroup->loadInLang( $this->_iEditLang, $soxId);
00036 
00037             $oOtherLang = $oGroup->getAvailableInLangs();
00038             if (!isset($oOtherLang[$this->_iEditLang])) {
00039                 // echo "language entry doesn't exist! using: ".key($oOtherLang);
00040                 $oGroup->loadInLang( key($oOtherLang), $soxId );
00041             }
00042 
00043             $this->_aViewData["edit"] =  $oGroup;
00044 
00045             // remove already created languages
00046             $aLang = array_diff ( oxLang::getInstance()->getLanguageNames(), $oOtherLang );
00047 
00048             if ( count( $aLang))
00049                 $this->_aViewData["posslang"] = $aLang;
00050 
00051             foreach ( $oOtherLang as $id => $language) {
00052                 $oLang= new oxStdClass();
00053                 $oLang->sLangDesc = $language;
00054                 $oLang->selected = ($id == $this->_iEditLang);
00055                 $this->_aViewData["otherlang"][$id] = clone $oLang;
00056             }
00057         }
00058         if ( oxConfig::getParameter("aoc") ) {
00059 
00060             $aColumns = array();
00061             include_once 'inc/'.strtolower(__CLASS__).'.inc.php';
00062             $this->_aViewData['oxajax'] = $aColumns;
00063 
00064             return "popups/usergroup_main.tpl";
00065         }
00066         return "usergroup_main.tpl";
00067     }
00068 
00074     public function save()
00075     {
00076 
00077         $soxId      = oxConfig::getParameter( "oxid");
00078         $aParams    = oxConfig::getParameter( "editval");
00079         // checkbox handling
00080         if ( !isset( $aParams['oxgroups__oxactive'] ) ) {
00081             $aParams['oxgroups__oxactive'] = 0;
00082         }
00083 
00084         $oGroup = oxNew( "oxgroups" );
00085         if ( $soxId != "-1") {
00086             $oGroup->load( $soxId );
00087         } else {
00088             $aParams['oxgroups__oxid'] = null;
00089         }
00090 
00091         $oGroup->setLanguage( 0 );
00092         $oGroup->assign( $aParams);
00093         $oGroup->setLanguage( $this->_iEditLang );
00094         $oGroup->save();
00095 
00096         // set oxid if inserted
00097         if ( $soxId == "-1" ) {
00098             oxSession::setVar( "saved_oxid", $oGroup->oxgroups__oxid->value );
00099         }
00100     }
00101 
00107     public function saveinnlang()
00108     {
00109         $this->save();
00110     }
00111 }