Move updateProfil vers Scores_Utilisateur
This commit is contained in:
parent
4737272c67
commit
dfab9631a0
@ -1,52 +1,6 @@
|
||||
<?php
|
||||
class UserController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Récupére les valeurs du profil depuis le webservice
|
||||
* @param unknown_type $login
|
||||
* @param unknown_type $password
|
||||
*/
|
||||
protected function updateProfil($login, $password)
|
||||
{
|
||||
Zend_Registry::get('firebug')->info('updateProfil');
|
||||
$ws = new WsScores();
|
||||
$utilisateur = new Scores_Utilisateur();
|
||||
$InfosLogin = $ws->getInfosLogin($login, $_SERVER['REMOTE_ADDR']);
|
||||
$identity = new stdClass;
|
||||
$identity->username = $login;
|
||||
$identity->password = $password;
|
||||
$identity->email = $InfosLogin->result->email;
|
||||
$identity->profil = $InfosLogin->result->profil;
|
||||
$identity->pref = $InfosLogin->result->pref;
|
||||
$identity->droits = $InfosLogin->result->droits;
|
||||
$identity->droitsClients = $InfosLogin->result->droitsClients;
|
||||
$identity->nom = $InfosLogin->result->nom;
|
||||
$identity->prenom = $InfosLogin->result->prenom;
|
||||
$identity->tel = $InfosLogin->result->tel;
|
||||
$identity->fax = $InfosLogin->result->fax;
|
||||
$identity->mobile = $InfosLogin->result->mobile;
|
||||
$identity->id = $InfosLogin->result->id;
|
||||
$identity->idClient = $InfosLogin->result->idClient;
|
||||
$identity->reference = $InfosLogin->result->reference;
|
||||
$identity->nbReponses = $InfosLogin->result->nbReponses;
|
||||
$identity->typeScore = $InfosLogin->result->typeScore;
|
||||
$identity->dateValidation = $InfosLogin->result->dateValidation;
|
||||
$identity->nombreConnexions = $InfosLogin->result->nombreConnexions;
|
||||
$identity->dateDerniereConnexion = $InfosLogin->result->dateDerniereConnexion;
|
||||
$identity->dateDebutCompte = $InfosLogin->result->dateDebutCompte;
|
||||
$identity->dateFinCompte = $InfosLogin->result->dateFinCompte;
|
||||
$identity->ip = $_SERVER['REMOTE_ADDR'];
|
||||
$identity->timeout = (!empty($InfosLogin->result->timeout)) ?
|
||||
$InfosLogin->result->timeout : 1800;
|
||||
$identity->time = time() + $identity->timeout;
|
||||
$identity->modeEdition = false;
|
||||
$identity->acceptationCGU = $InfosLogin->result->acceptationCGU;
|
||||
$lang = in_array($InfosLogin->result->lang,array('fr','en')) ? $InfosLogin->result->lang : 'fr';
|
||||
$identity->lang = $lang;
|
||||
$identity->langtmp = $lang;
|
||||
$identity->browser = $utilisateur->getBrowserInfo();
|
||||
return $identity;
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
@ -134,7 +88,8 @@ class UserController extends Zend_Controller_Action
|
||||
//Mise à jour du profil
|
||||
if ($isProfilUpdated && $updateResult) {
|
||||
|
||||
$identity = $this->updateProfil($identity->username, $identity->password);
|
||||
$InfosLogin = $ws->getInfosLogin($identity->username, $_SERVER['REMOTE_ADDR']);
|
||||
$identity = $user->updateProfil($InfosLogin);
|
||||
$auth->getStorage()->write($identity);
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
<?php
|
||||
class Scores_Utilisateur
|
||||
{
|
||||
/**
|
||||
* Identity
|
||||
* @var stdClass
|
||||
*/
|
||||
protected $identity = null;
|
||||
|
||||
public function __construct()
|
||||
@ -11,6 +15,50 @@ class Scores_Utilisateur
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupére les valeurs du profil depuis le webservice
|
||||
* @param stdClass $InfosLogin
|
||||
* @return stdClass
|
||||
*/
|
||||
protected function updateProfil($InfosLogin)
|
||||
{
|
||||
$identity = new stdClass;
|
||||
$identity->username = $login;
|
||||
$identity->password = $password;
|
||||
$identity->email = $InfosLogin->result->email;
|
||||
$identity->profil = $InfosLogin->result->profil;
|
||||
$identity->pref = $InfosLogin->result->pref;
|
||||
$identity->droits = $InfosLogin->result->droits;
|
||||
$identity->droitsClients = $InfosLogin->result->droitsClients;
|
||||
$identity->nom = $InfosLogin->result->nom;
|
||||
$identity->prenom = $InfosLogin->result->prenom;
|
||||
$identity->tel = $InfosLogin->result->tel;
|
||||
$identity->fax = $InfosLogin->result->fax;
|
||||
$identity->mobile = $InfosLogin->result->mobile;
|
||||
$identity->id = $InfosLogin->result->id;
|
||||
$identity->idClient = $InfosLogin->result->idClient;
|
||||
$identity->reference = $InfosLogin->result->reference;
|
||||
$identity->nbReponses = $InfosLogin->result->nbReponses;
|
||||
$identity->typeScore = $InfosLogin->result->typeScore;
|
||||
$identity->dateValidation = $InfosLogin->result->dateValidation;
|
||||
$identity->nombreConnexions = $InfosLogin->result->nombreConnexions;
|
||||
$identity->dateDerniereConnexion = $InfosLogin->result->dateDerniereConnexion;
|
||||
$identity->dateDebutCompte = $InfosLogin->result->dateDebutCompte;
|
||||
$identity->dateFinCompte = $InfosLogin->result->dateFinCompte;
|
||||
$identity->ip = $_SERVER['REMOTE_ADDR'];
|
||||
$identity->timeout = (!empty($InfosLogin->result->timeout)) ?
|
||||
$InfosLogin->result->timeout : 1800;
|
||||
$identity->time = time() + $identity->timeout;
|
||||
$identity->modeEdition = false;
|
||||
$identity->acceptationCGU = $InfosLogin->result->acceptationCGU;
|
||||
$lang = in_array($InfosLogin->result->lang,array('fr','en')) ? $InfosLogin->result->lang : 'fr';
|
||||
$identity->lang = $lang;
|
||||
$identity->langtmp = $lang;
|
||||
$identity->browser = $this->getBrowserInfo();
|
||||
|
||||
return $identity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is log in
|
||||
* @return boolean
|
||||
|
Loading…
Reference in New Issue
Block a user