Subversion Repositories eFlore/Applications.coel-consultation

Rev

Rev 31 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 31 Rev 55
Line 7... Line 7...
7
 * @category	php 5.2
7
 * @category	php 5.2
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @copyright	2010 Tela-Botanica
9
 * @copyright	2010 Tela-Botanica
10
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
10
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
12
 * @version		SVN: $Id: PersonneDao.php 31 2010-04-07 15:06:53Z jpm $
12
 * @version		SVN: $Id: PersonneDao.php 55 2010-04-30 16:18:31Z jpm $
13
 *
13
 *
14
 */
14
 */
15
class PersonneDao extends ColModele {
15
class PersonneDao extends ColModele {
16
	const SERVICE_PERSONNE = 'CoelPersonne';
16
	const SERVICE_PERSONNE = 'CoelPersonne';
-
 
17
	const SERVICE_PERSONNE_A_PUBLICATION = 'CoelPublicationAPersonne';
Line 17... Line 18...
17
 
18
 
18
	/**
19
	/**
19
	 * Retourne l'ensemble des information d'une personne.
20
	 * Retourne l'ensemble des information d'une personne.
20
	 * 
21
	 * 
Line 23... Line 24...
23
	 */
24
	 */
24
	public function getPersonne($id) {
25
	public function getPersonne($id) {
25
		$url = $this->url_jrest.self::SERVICE_PERSONNE."/$id";
26
		$url = $this->url_jrest.self::SERVICE_PERSONNE."/$id";
26
		$json = file_get_contents($url);
27
		$json = file_get_contents($url);
27
		$donnees = json_decode($json, true);
28
		$donnees = json_decode($json, true);
-
 
29
		if ($donnees['nbElements'] == 1) {
-
 
30
			$donnees = $donnees['personnes'][0];
-
 
31
		}
-
 
32
		return $donnees;
-
 
33
	}
-
 
34
	
-
 
35
	/**
-
 
36
	 * Retourne l'ensemble des publications liées à une personne.
-
 
37
	 * 
-
 
38
	 * @param integer l'id de la personne.
-
 
39
	 * @return array un tableau contenant les informations sur les publications liées à la personne.
-
 
40
	 */
-
 
41
	public function getPersonneAPublication($id_personne) {
-
 
42
		$url = $this->url_jrest.self::SERVICE_PERSONNE_A_PUBLICATION."/*/$id_personne/2361,2362,2363";
-
 
43
		$json = file_get_contents($url);
-
 
44
		$donnees = json_decode($json, true);
-
 
45
		$this->nettoyerTableauDeTableauxAssoc($donnees);
28
		return $donnees;
46
		return $donnees;
29
	}
47
	}
Line 30... Line 48...
30
	
48
	
-
 
49
	public function getPersonneNomComplet($id) {
31
	public function getPersonneNomComplet($id) {
50
		$nom_complet = '';
-
 
51
		$donnees = $this->getPersonne($id);
32
		$donnees = $this->getPersonne($id);
52
		if (isset($donnees['nbElements']) && $donnees['nbElements'] >= 1) {
-
 
53
			$nom_complet = $donnees['personnes'][0]['cp_fmt_nom_complet'];
-
 
54
		} else if (isset($donnees['cp_fmt_nom_complet'])) {
-
 
55
			$nom_complet = $donnees['cp_fmt_nom_complet'];
33
		$nom_complet = $donnees['personnes'][0]['cp_fmt_nom_complet'];
56
		}
34
		return $nom_complet;
57
		return $nom_complet;
35
	}
58
	}
36
}
59
}
37
?>
60
?>