Added execAccountActiveAdmin() method in adminUser coordination object

This commit is contained in:
Rooty 2021-04-07 06:42:00 +02:00
parent 60e4995ad1
commit 49b63148d5

View File

@ -210,7 +210,7 @@ Class AdminUser extends CoordinationObj
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("ligne.vuser_login", htmlentitiesconv($currentUser->getLogin()));
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("ligne.vuser_mail", htmlentitiesconv($currentUser->getMail()));
$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("ligne.vmailto", "mailto:".htmlentitiesconv($currentUser->getMail()));
$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("ligne.url_account_active",formatUrl($this->getId(),"AdminUser","ChangeAccountActive","",$currentUser->getId()));
$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("ligne.url_account_active",formatUrl($this->getId(),"AdminUser","execAccountActiveAdmin","",$currentUser->getId()));
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("ligne.vuser_account_active", ($currentUser->getAccountActive()=="on")?"toggle-on text-success":"toggle-off text-danger" );
$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("ligne.vuser_id", "user".$currentUser->getId());
@ -844,6 +844,58 @@ function exportAdmin()
return "";
}
/**
* Function permettant de modifier le compte sélectionnépar l'administrateur(traitement)
* @access public
* @return chaine code message
*/
function execAccountActiveAdmin()
{
global $SERVER_NAME, $SCRIPT_NAME, $CONF_PERSISTANT_SECURE, $CONF_DATA_PATH;
/* gestion du lib en fonction de la langue courante */
// $currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
// $defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
/* fin récupération des codes par defaut */
/* Vérification du statut du compte */
// $user_account_active=(isset($_POST["user_account_active"]))?$_POST["user_account_active"]:"off";
/*Récupération des messages utilisateurs*/
addMessageFile("user.ini");
if((!isset($_GET["param"])) && (!is_numeric($_GET["param"])))
{
$GLOBALS["SYSTEM_CONTROL"]->messageSystem = "msgError";
/* On inclus la template (voir package.template.php) */
withBlocPath("AdminUser", "actionAdmin");
$this->actionAdmin();
ExitBloc();
return "";
}
else
{
$MyUser = $GLOBALS["SYSTEM_MANAGER"]["USER"]->createInstance($_GET["param"]);
$user_account_active = $MyUser->getAccountActive();
if( $user_account_active == "on" )
$user_account_active = "off";
elseif( $user_account_active == "off" )
$user_account_active = "on";
//On enregistre les modifications de l'objet User
$MyUser->setAccountActive($user_account_active);
//On enregistre les paramètres
$ObjUsersave = $GLOBALS["SYSTEM_MANAGER"]["USER"]->saveInstance($MyUser);
# Redirection vers le formulaire
systemRedirect(formatUrl($this->getId(),"AdminUser","actionAdmin"));
}
return "";
}
/**
* Méthode de l'outil News permettant d'obtenir le News pour une communauté
*