3,7 → 3,6 |
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; |
|
/** |
19,17 → 18,9 |
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 après avoir interrogé un service de l'annuaire, les intitulés correspondant aux |
* Retourne, 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 à |
37,10 → 28,9 |
*/ |
public function getIntitules() { |
$intitules = false; |
$this->chargerIdentites(); |
if ($this->identites) { |
if ($identites = $this->getIdentites()) { |
$intitules = array(); |
foreach ($this->identites as $courriel => $infos) { |
foreach ($identites as $courriel => $infos) { |
$intitules[$courriel] = $infos['intitule']; |
} |
} |
47,37 → 37,6 |
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); |