Fixed addUser method
This commit is contained in:
parent
a70877b16e
commit
d0f1eaa050
@ -4,10 +4,10 @@
|
|||||||
<input type="hidden" name="user_id" mXattribut="value:user_id" class="hidden"/>
|
<input type="hidden" name="user_id" mXattribut="value:user_id" class="hidden"/>
|
||||||
<input type="hidden" name="urlReturn" mXattribut="value:urlReturn" class="hidden"/>
|
<input type="hidden" name="urlReturn" mXattribut="value:urlReturn" class="hidden"/>
|
||||||
<div class="card-header form-inline">
|
<div class="card-header form-inline">
|
||||||
<div class="input-group col-xs-12 col-sm-3 col-lg-10 justify-content-center">
|
<div class="input-group col-xs-12 col-sm-3 col-lg-11 justify-content-center">
|
||||||
<span class="text-center"><h3><mx:text id="formUser1"/></h3></span>
|
<span class="text-center"><h3><mx:text id="formUser1"/></h3></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group col-xs-12 col-sm-3 col-lg-2 justify-content-center">
|
<div class="input-group col-xs-12 col-sm-3 col-lg-1">
|
||||||
<input data-toggle="toggle" data-style="float-right" data-onstyle="success font-weight-bold" data-on="<mx:text id="user_account_sEnabled"/>" data-offstyle="danger font-weight-bold" data-off="<mx:text id="user_account_sDisabled"/>" data-size="mini" type="checkbox"<mx:text id="accountState"/> name="user_account_active">
|
<input data-toggle="toggle" data-style="float-right" data-onstyle="success font-weight-bold" data-on="<mx:text id="user_account_sEnabled"/>" data-offstyle="danger font-weight-bold" data-off="<mx:text id="user_account_sDisabled"/>" data-size="mini" type="checkbox"<mx:text id="accountState"/> name="user_account_active">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -400,29 +400,6 @@ function exportAdmin()
|
|||||||
$MyUser->setPassword("");
|
$MyUser->setPassword("");
|
||||||
$MyUser->setMail("");
|
$MyUser->setMail("");
|
||||||
|
|
||||||
/*MxSelect(string $path, string $name, string | array $selectedValue, array $Value, [string $defaultValue], [int $multipleSize], [string $javascriptAttribut]);*/
|
|
||||||
// $titre = array(getMessage("mr"),getMessage("mrs"), getMessage("miss"));
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxSelect("user_title", "user_title", $MyUser->getTitle(), $titre,"", "", "", "class=\"form\"");
|
|
||||||
//
|
|
||||||
// /*MxFormField(string $path, string $type, $string name, string $value, [string $attribut]); */
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_first_name", "text", "user_first_name", $MyUser->getFirstName(), "class=\"form\"");
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_last_name", "text", "user_last_name", $MyUser->getLastName(), "class=\"form\"");
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_login", "text", "user_login", $MyUser->getLogin(), "class=\"form\"");
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_password", "password", "user_password", $MyUser->getPassword(), "class=\"form\"");
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_password2", "password", "user_password2", $MyUser->getPassword(), "class=\"form\"");
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_mail", "text", "user_mail", $MyUser->getMail(), "class=\"form\"");
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_birthdate", "text", "user_birthdate", $MyUser->getBirthDate(), "class=\"form\"");
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_postal_code", "text", "user_postal_code", $MyUser->getPostalCode(), "class=\"form\"");
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_postal_adress", "textarea", "user_postal_adress", $MyUser->getPostalAddress(), "class=\"form\"");
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_organisation", "text", "user_organisation", $MyUser->getOrganisation(), "class=\"form\"");
|
|
||||||
// $tabcom = $MyUser->getComment();
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_coment", "text", "user_coment", (isset($tabcom[0])?$tabcom[0]:""), "class=\"form\"");
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_city", "text", "user_city", $MyUser->getCity(), "class=\"form\"");
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_state", "text", "user_state", $MyUser->getState(), "class=\"form\"");
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_country", "text", "user_country", $MyUser->getCountry(), "class=\"form\"");
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_tel", "text", "user_tel", $MyUser->getTel(), "class=\"form\"");
|
|
||||||
// $GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_fax", "text", "user_fax", $MyUser->getFax(), "class=\"form\"");
|
|
||||||
|
|
||||||
$titre = array(getMessage("mr"),getMessage("mrs"), getMessage("miss"));
|
$titre = array(getMessage("mr"),getMessage("mrs"), getMessage("miss"));
|
||||||
$GLOBALS["SYSTEM_TEMPLATE"]->MxSelect("user_title", "user_title", $MyUser->getTitle(), $titre, "", "", "", "class=\"form\" title=\"".htmlspecialchars(getMessage("tipSelectTitle"), ENT_QUOTES)."\"");
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxSelect("user_title", "user_title", $MyUser->getTitle(), $titre, "", "", "", "class=\"form\" title=\"".htmlspecialchars(getMessage("tipSelectTitle"), ENT_QUOTES)."\"");
|
||||||
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_first_name", "text", "user_first_name", $MyUser->getFirstName(), "class=\"form\" required=\"true\" title=\"".htmlspecialchars(getMessage("tipFirstName"), ENT_QUOTES)."\"", getMessage("user_first_name"));
|
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_first_name", "text", "user_first_name", $MyUser->getFirstName(), "class=\"form\" required=\"true\" title=\"".htmlspecialchars(getMessage("tipFirstName"), ENT_QUOTES)."\"", getMessage("user_first_name"));
|
||||||
@ -471,6 +448,9 @@ function exportAdmin()
|
|||||||
$groupId=($this->getData("groupId")!="")?$this->getData("groupId"):1;
|
$groupId=($this->getData("groupId")!="")?$this->getData("groupId"):1;
|
||||||
$group_id=(isset($_POST["group_id"]) && is_numeric($_POST["group_id"]))?$_POST["group_id"]:$groupId;
|
$group_id=(isset($_POST["group_id"]) && is_numeric($_POST["group_id"]))?$_POST["group_id"]:$groupId;
|
||||||
|
|
||||||
|
/* Vérification du statut du compte */
|
||||||
|
$user_account_active=(isset($_POST["user_account_active"]))?$_POST["user_account_active"]:"off";
|
||||||
|
|
||||||
/* gestion du lib en fonction de la langue courante */
|
/* gestion du lib en fonction de la langue courante */
|
||||||
$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
|
$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
|
||||||
$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
|
$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
|
||||||
@ -498,7 +478,7 @@ function exportAdmin()
|
|||||||
foreach($_POST as $cle=>$val)
|
foreach($_POST as $cle=>$val)
|
||||||
{
|
{
|
||||||
// echo "cle = ".$cle." val =".$val."<br>";
|
// echo "cle = ".$cle." val =".$val."<br>";
|
||||||
if($val=="" && ($cle !="user_comment" && $cle !="user_fax" && $cle !="user_organisation" && $cle !="user_country" && $cle !="user_id" && $cle !="user_birthdate"))
|
if($val=="" && ($cle !="user_comment" && $cle !="user_fax" && $cle !="user_organisation" && $cle !="user_country" && $cle !="user_id" && $cle !="user_birthdate" && $cle !="user_mastodon" && $cle !="user_jabber" && $cle !="user_facebook" && $cle !="user_website" ))
|
||||||
{
|
{
|
||||||
$chaine .= getMessage($cle).", ";
|
$chaine .= getMessage($cle).", ";
|
||||||
}
|
}
|
||||||
@ -536,14 +516,17 @@ function exportAdmin()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//On enregistre les modifications de l'objet User ???????????????????????????????????????
|
$d = DateTime::createFromFormat('d/m/Y', $_POST['user_birthdate']);
|
||||||
|
|
||||||
|
//On enregistre les modifications de l'objet User
|
||||||
|
$MyUser->setAccountActive($user_account_active);
|
||||||
$MyUser->setTitle($_POST['user_title']);
|
$MyUser->setTitle($_POST['user_title']);
|
||||||
$MyUser->setFirstName($_POST['user_first_name']);
|
$MyUser->setFirstName($_POST['user_first_name']);
|
||||||
$MyUser->setLastName($_POST['user_last_name']);
|
$MyUser->setLastName($_POST['user_last_name']);
|
||||||
$MyUser->setLogin($_POST['user_login']);
|
$MyUser->setLogin($_POST['user_login']);
|
||||||
$MyUser->setPassword($_POST['user_password']);
|
$MyUser->setPassword($_POST['user_password']);
|
||||||
$MyUser->setMail($_POST['user_mail']);
|
$MyUser->setMail($_POST['user_mail']);
|
||||||
$MyUser->setBirthDate($_POST['user_birthdate']);
|
$MyUser->setBirthDate($d->getTimestamp());
|
||||||
$MyUser->setPostalAddress($_POST['user_postal_address']);
|
$MyUser->setPostalAddress($_POST['user_postal_address']);
|
||||||
$MyUser->setPostalCode($_POST['user_postal_code']);
|
$MyUser->setPostalCode($_POST['user_postal_code']);
|
||||||
$MyUser->setCity($_POST['user_city']);
|
$MyUser->setCity($_POST['user_city']);
|
||||||
@ -551,7 +534,11 @@ function exportAdmin()
|
|||||||
$MyUser->setCountry($_POST['user_country']);
|
$MyUser->setCountry($_POST['user_country']);
|
||||||
$MyUser->setOrganisation($_POST['user_organisation']);
|
$MyUser->setOrganisation($_POST['user_organisation']);
|
||||||
$MyUser->setTel($_POST['user_tel']);
|
$MyUser->setTel($_POST['user_tel']);
|
||||||
$MyUser->setFax($_POST['user_fax']);
|
$MyUser->setMastodon($_POST['user_mastodon']);
|
||||||
|
$MyUser->setFacebook($_POST['user_facebook']);
|
||||||
|
$MyUser->setJabber($_POST['user_jabber']);
|
||||||
|
$MyUser->setTel($_POST['user_tel']);
|
||||||
|
$MyUser->setWebsite($_POST['user_website']);
|
||||||
$MyUser->setComment(array($_POST['user_comment']));
|
$MyUser->setComment(array($_POST['user_comment']));
|
||||||
|
|
||||||
//On enregistre les paramà res
|
//On enregistre les paramà res
|
||||||
@ -844,8 +831,6 @@ function exportAdmin()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$d = DateTime::createFromFormat('d/m/Y', $_POST['user_birthdate']);
|
|
||||||
|
|
||||||
//On enregistre les modifications de l'objet User
|
//On enregistre les modifications de l'objet User
|
||||||
$MyUser->setAccountActive($user_account_active);
|
$MyUser->setAccountActive($user_account_active);
|
||||||
$MyUser->setTitle($_POST['user_title']);
|
$MyUser->setTitle($_POST['user_title']);
|
||||||
@ -854,20 +839,21 @@ function exportAdmin()
|
|||||||
$MyUser->setLogin($_POST['user_login']);
|
$MyUser->setLogin($_POST['user_login']);
|
||||||
$MyUser->setPassword($_POST['user_password']);
|
$MyUser->setPassword($_POST['user_password']);
|
||||||
$MyUser->setMail($_POST['user_mail']);
|
$MyUser->setMail($_POST['user_mail']);
|
||||||
|
$d = DateTime::createFromFormat('d/m/Y', $_POST['user_birthdate']);
|
||||||
$MyUser->setBirthDate($d->getTimestamp());
|
$MyUser->setBirthDate($d->getTimestamp());
|
||||||
$MyUser->setPostalAddress($_POST['user_postal_address']);
|
// $MyUser->setPostalAddress($_POST['user_postal_address']);
|
||||||
$MyUser->setPostalCode($_POST['user_postal_code']);
|
// $MyUser->setPostalCode($_POST['user_postal_code']);
|
||||||
$MyUser->setCity($_POST['user_city']);
|
// $MyUser->setCity($_POST['user_city']);
|
||||||
$MyUser->setState($_POST['user_state']);
|
// $MyUser->setState($_POST['user_state']);
|
||||||
$MyUser->setCountry($_POST['user_country']);
|
// $MyUser->setCountry($_POST['user_country']);
|
||||||
$MyUser->setOrganisation($_POST['user_organisation']);
|
// $MyUser->setOrganisation($_POST['user_organisation']);
|
||||||
$MyUser->setTel($_POST['user_tel']);
|
// $MyUser->setTel($_POST['user_tel']);
|
||||||
$MyUser->setMastodon($_POST['user_mastodon']);
|
// $MyUser->setMastodon($_POST['user_mastodon']);
|
||||||
$MyUser->setFacebook($_POST['user_facebook']);
|
// $MyUser->setFacebook($_POST['user_facebook']);
|
||||||
$MyUser->setJabber($_POST['user_jabber']);
|
// $MyUser->setJabber($_POST['user_jabber']);
|
||||||
$MyUser->setTel($_POST['user_tel']);
|
// $MyUser->setTel($_POST['user_tel']);
|
||||||
$MyUser->setWebsite($_POST['user_website']);
|
// $MyUser->setWebsite($_POST['user_website']);
|
||||||
$MyUser->setComment(array($_POST['user_comment']));
|
// $MyUser->setComment(array($_POST['user_comment']));
|
||||||
|
|
||||||
//On enregistre les paramètres
|
//On enregistre les paramètres
|
||||||
$ObjUsersave = $GLOBALS["SYSTEM_MANAGER"]["USER"]->saveInstance($MyUser);
|
$ObjUsersave = $GLOBALS["SYSTEM_MANAGER"]["USER"]->saveInstance($MyUser);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user