New file |
0,0 → 1,51 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* Service retournant l'id d'un utilisateur en fonction de son courriel. |
* |
* @category php 5.2 |
* @package Annuaire::Services |
* @author Aurélien PERONNET <aurelien@tela-botanica.org> |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
* @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org) |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL |
* @version $Id$ |
*/ |
class Utilisateur extends JRestService { |
|
public function getElement($ressources){ |
$this->ressources = $ressources; |
|
$infos = null; |
|
if (isset($this->ressources[0])) { |
$methode_demande = array_shift($this->ressources); |
$methode = $this->traiterNomMethodeGet($methode_demande); |
if (method_exists($this, $methode)) { |
$infos = $this->$methode(); |
} else { |
$this->messages[] = "Ce type de ressource '$methode_demande' n'est pas disponible."; |
} |
} else { |
$this->messages[] = "Le premier paramêtre du chemin du service doit correspondre au type de ressource demandée."; |
} |
|
if (!is_null($infos)) { |
$this->envoyerJson($infos); |
} else { |
$info = 'Un problème est survenu : '.print_r($this->messages, true); |
$this->envoyerTxt($info); |
} |
} |
|
public function getPrenomNomParCourriel() { |
$courriels = explode(',', $this->ressources[0]); |
$id_annuaire = Config::get('annuaire_defaut'); |
|
$controleur = new AnnuaireModele(); |
$infos = $controleur->obtenirPrenomNomParCourriel($id_annuaire, $courriels); |
return $infos; |
} |
} |
?> |