ws-2.0 : setInfosLogin

This commit is contained in:
Michael RICOIS 2011-01-20 11:19:41 +00:00
parent 5a6eef0925
commit 49f15d84e0
3 changed files with 30 additions and 16 deletions

View File

@ -215,11 +215,27 @@ class WsScores
public function setInfosLogin($login, $tabInfos) {
$params = new stdClass();
$params->login = $login;
$params->tabInfoUserWS = $tabInfos;
if (in_array($tabInfos['action'], array('new', 'update', 'changepwd'))){
$params->action = $tabInfos['action'];
$params->infos->idClient = $tabInfos['idClient'];
$params->infos->nom = $tabInfos['nom'];
$params->infos->prenom = $tabInfos['prenom'];
$params->infos->reference = $tabInfos['reference'];
$params->infos->email = $tabInfos['email'];
$params->infos->tel_fix = $tabInfos['tel_fix'];
$params->infos->tel_mob = $tabInfos['tel_mob'];
$params->infos->rech_nbrep = $tabInfos['rech_nbrep'];
$params->infos->formatMail = $tabInfos['formatMail'];
$params->infos->password = $tabInfos['password'];
$params->infos->droits = $tabInfos['droits'];
$params->infos->pref = $tabInfos['pref'];
} else {
$params->action = $tabInfos['action'];
}
$client = $this->loadClient('interne');
try {
$reponse = $client->setInfosLogin($params);
return $reponse->seInfosLoginResult->result;
return $reponse->setInfosLoginResult->result;
} catch (SoapFault $fault) {
require_once 'soaperror.php';
processSoapFault($client, $fault, $_SESSION['tabInfo']);

View File

@ -1,27 +1,24 @@
<?php
if (isset($_REQUEST['action']) == true) {
if ($_REQUEST['action'] == 'delete') {
$tabOptions = array('delete' => true);
$ws = new WsScores();
$reponse = $ws->setInfosLogin($_REQUEST['login'], $tabOptions);
$reponse = $ws->setInfosLogin($_REQUEST['login'], 'delete');
if ($reponse->result) {
$message = 'Compte "'.$_REQUEST['login'].'" supprimé !';
} else {
$message = 'Erreur lors de la suppression du compte utilisateur !';
}
} else if ($_REQUEST['action'] == 'activate') {
$tabOptions = array('actif' => true);
$ws = new WsScores();
$reponse = $ws->setInfosLogin($_REQUEST['login'], $tabOptions);
$reponse = $ws->setInfosLogin($_REQUEST['login'], 'actif');
if ($reponse->result) {
$message = 'Compte "'.$_REQUEST['login'].'" activé !';
} else {
$message = 'Erreur lors de l\'activation du compte utilisateur !';
}
} else if ($_REQUEST['action'] == 'unactivate') {
$tabOptions = array('actif' => false);
$ws = new WsScores();
$reponse = $ws->setInfosLogin($_REQUEST['login'], $tabOptions);
$reponse = $ws->setInfosLogin($_REQUEST['login'], 'desactif');
if ($reponse->result) {
$message = 'Compte "'.$_REQUEST['login'].'" désactivé !';
} else {
@ -31,7 +28,7 @@ if (isset($_REQUEST['action']) == true) {
}
}
//Liste des utilisateurs - SuperAdministrateur
$idClient = -1;
$idClient = $_SESSION['tabInfo']['idClient'];
if (isset($_REQUEST['idClient']) && !empty($_REQUEST['idClient']) &&
$_SESSION['tabInfo']['profil'] == 'SuperAdministrateur'){
$idClient = $_REQUEST['idClient'];

View File

@ -14,12 +14,12 @@ if (isset($_REQUEST['login']) && $_REQUEST['login'] != '' &&
// On affecte la valeur en session de mode edition
// d'après le résultat du formulaire
if (isset($tabOptions) && isset($tabOptions['mode_edition']) == false &&
$tabOptions['action'] == 'save') {
$tabOptions['action'] == 'update') {
$_SESSION['tabInfo']['mode_edition'] = 0;
}
}
if (isset($tabOptions) &&
($tabOptions['action'] == 'save' ||
($tabOptions['action'] == 'update' ||
$tabOptions['action'] == 'new')) {
$message = 'Erreur lors de la mise à jour du compte !';
@ -42,7 +42,8 @@ if (isset($tabOptions) &&
$ws = new WsScores();
$reponse = $ws->setInfosLogin($loginVu, $tabOptions);
if ($reponse == 1 ){
FB::log($reponse, 'setInfosLogin');
if ($reponse == 1 ){
$message = 'Compte mis à jour !';
}
@ -60,7 +61,7 @@ if (isset($tabOptions) &&
if ($_REQUEST['frmOptions']['changepwd'] == 1 &&
$loginVu == $_SESSION['tabInfo']['login'] &&
$tabOptions['action'] == 'save') {
$tabOptions['action'] == 'update') {
?>
<script language="javascript">
$(document).ready(function(){
@ -78,9 +79,9 @@ if (isset($_REQUEST['action']) == false || $_REQUEST['action'] != 'new') {
$login = $loginVu;
$ws = new WsScores();
$reponse = $ws->getInfosLogin($loginVu);
FB::log($reponse, 'getInfosLogin');
$InfosLogin = $reponse->result;
$idClient = $InfosLogin->idClient;
FB::log($InfosLogin, 'InfosLogin');
} else {
$login = $loginVu;
$ws = new WsScores();
@ -136,7 +137,7 @@ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'new') {
<?php
} else {
?>
<input type="hidden" name="frmOptions[action]" value="save"/>
<input type="hidden" name="frmOptions[action]" value="update"/>
<?php
}
?>
@ -221,7 +222,7 @@ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'new') {
print '<a href="#" id="password">Modifier le mot de passe.</a>';
}
?>
<input type="<?=$typeChamp?>" name="frmOptions[password]" value="oqsrihgwslglm"/>
<input type="<?=$typeChamp?>" name="frmOptions[password]" value=""/>
<input type="hidden" name="frmOptions[changepwd]" value="0"/>
</div>