Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 386 → Rev 387

/trunk/services/bibliotheque/Utilisateurs.php
3,6 → 3,7
const TPL_URL_WS_ANNUAIRE = 'http://www.tela-botanica.org/service:annuaire:utilisateur/identite-par-courriel/%s';
 
private $courriels = array();
private $identites = array();
private $clientRest = null;
 
/**
18,9 → 19,17
public function setCourriels($courriels) {
$this->courriels = $courriels;
}
/**
* Lance l'interrogation du service de l'annuaire.
*
* @return null.
*/
public function chargerIdentites() {
$this->identites = $this->getIdentites();
}
 
/**
* Retourne, avoir interrogé un service de l'annuaire, les intitulés correspondant aux
* Retourne après avoir interrogé un service de l'annuaire, les intitulés correspondant aux
* courriels des utilisateurs.
*
* @return mixed tableau avec en clé le courriel et en valeur l'intitulé de la personne à
28,9 → 37,10
*/
public function getIntitules() {
$intitules = false;
if ($identites = $this->getIdentites()) {
$this->chargerIdentites();
if ($this->identites) {
$intitules = array();
foreach ($identites as $courriel => $infos) {
foreach ($this->identites as $courriel => $infos) {
$intitules[$courriel] = $infos['intitule'];
}
}
37,6 → 47,37
return $intitules;
}
 
/**
* Retourne un intitulé en fonction d'un courriel.
*
* @return String l'intitulé de l'utilisateur ou une chaine vide en cas de problème.
*/
public function getIntitule($courriel) {
$intitule = '';
if ($this->contenirCourriel($courriel)) {
$intitule = $this->identites[$courriel]['intitule'];
}
return $intitule;
}
 
/**
* Retourne l'identifiant de l'utilisateur en fonction d'un courriel.
*
* @return String l'id de l'utilisateur ou une chaine vide en cas de problème.
*/
public function getId($courriel) {
$id = '';
if ($this->contenirCourriel($courriel)) {
$id = $this->identites[$courriel]['id'];
}
return $id;
}
 
private function contenirCourriel($courriel) {
$ok = ($this->identites && isset($this->identites[$courriel])) ? true : false;
return $ok;
}
 
private function getIdentites() {
$utilisateursInfos = $this->consulterServiceAnnuaire();
$identites = $this->extraireIdentites($utilisateursInfos);