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