00001 <?php
00002
00008 class User_Extend extends oxAdminDetails
00009 {
00016 public function render()
00017 {
00018 parent::render();
00019
00020 $soxId = oxConfig::getParameter( "oxid");
00021 if ( $soxId != "-1" && isset( $soxId)) {
00022
00023 $oUser = oxNew( "oxuser" );
00024 $oUser->load( $soxId);
00025
00026
00027 $oCountry = oxNew( "oxCountry" );
00028 $oCountry->loadInLang( oxLang::getInstance()->getTplLanguage(), $oUser->oxuser__oxcountryid->value );
00029 $oUser->oxuser__oxcountry = new oxField( $oCountry->oxcountry__oxtitle->value);
00030
00031 $this->_aViewData["edit"] = $oUser;
00032 }
00033
00034 if (!$this->_allowAdminEdit($soxId))
00035 $this->_aViewData['readonly'] = true;
00036
00037 return "user_extend.tpl";
00038 }
00039
00045 public function save()
00046 {
00047
00048
00049 $soxId = oxConfig::getParameter( "oxid" );
00050 $aParams = oxConfig::getParameter( "editval" );
00051 $blNewsParams = oxConfig::getParameter( "editnews" );
00052 $blEmailFailed = oxConfig::getParameter( "emailfailed" );
00053
00054 if (!$this->_allowAdminEdit($soxId))
00055 return false;
00056
00057
00058 $oUser = oxNew( "oxuser" );
00059 if ( $soxId != "-1")
00060 $oUser->load( $soxId);
00061 else
00062 $aParams['oxuser__oxid'] = null;
00063
00064
00065 $aParams['oxuser__oxactive'] = $oUser->oxuser__oxactive->value;
00066 if ( isset( $blNewsParams ) ) {
00067 $oNewsSubscription = $oUser->getNewsSubscription();
00068 $oNewsSubscription->setOptInStatus( (int)$blNewsParams );
00069 $oNewsSubscription->setOptInEmailStatus( (int)$blEmailFailed );
00070 }
00071
00072 $oUser->assign( $aParams);
00073 $oUser->save();
00074
00075
00076 if ( $soxId == "-1")
00077 oxSession::setVar( "saved_oxid", $oUser->oxuser__oxid->value);
00078 }
00079 }