| 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 152 2010-09-06 16:19:12Z jpm $
|
12 |
* @version SVN: $Id: PersonneDao.php 154 2010-09-13 12:15:11Z jpm $
|
| 13 |
*
|
13 |
*
|
| 14 |
*/
|
14 |
*/
|
| 15 |
class PersonneDao extends Dao {
|
15 |
class PersonneDao extends Dao {
|
| 16 |
const SERVICE_PERSONNE = 'CoelPersonne';
|
16 |
const SERVICE_PERSONNE = 'CoelPersonne';
|
| 17 |
const SERVICE_PERSONNE_A_PUBLICATION = 'CoelPublicationAPersonne';
|
17 |
const SERVICE_PERSONNE_A_PUBLICATION = 'CoelPublicationAPersonne';
|
| 18 |
const SERVICE_PERSONNE_A_COLLECTION = 'CoelCollectionAPersonne';
|
18 |
const SERVICE_PERSONNE_A_COLLECTION = 'CoelCollectionAPersonne';
|
| 19 |
const SERVICE_PERSONNE_A_STRUCTURE = 'CoelStructureAPersonne';
|
19 |
const SERVICE_PERSONNE_A_STRUCTURE = 'CoelStructureAPersonne';
|
| - |
|
20 |
|
| - |
|
21 |
private $cache = array();
|
| Line 20... |
Line 22... |
| 20 |
|
22 |
|
| 21 |
/**
|
23 |
/**
|
| 22 |
* Retourne l'ensemble des information d'une personne.
|
24 |
* Retourne l'ensemble des information d'une personne.
|
| 23 |
*
|
25 |
*
|
| Line 58... |
Line 60... |
| 58 |
$donnees = $this->getPersonneAPublication($id_personne);
|
60 |
$donnees = $this->getPersonneAPublication($id_personne);
|
| 59 |
return $donnees['nbElements'];
|
61 |
return $donnees['nbElements'];
|
| 60 |
}
|
62 |
}
|
| Line 61... |
Line 63... |
| 61 |
|
63 |
|
| - |
|
64 |
private function getPersonneAPublication($id_personne) {
|
| - |
|
65 |
$cache =& $this->cache['PersonneAPublication'];
|
| - |
|
66 |
if (isset($cache[$id_personne])) {
|
| - |
|
67 |
$donnees = $cache[$id_personne];
|
| 62 |
private function getPersonneAPublication($id_personne) {
|
68 |
} else {
|
| 63 |
$url = $this->url_jrest.self::SERVICE_PERSONNE_A_PUBLICATION."/*/$id_personne/2361,2362,2363";
|
69 |
$url = $this->url_jrest.self::SERVICE_PERSONNE_A_PUBLICATION."/*/$id_personne/2361,2362,2363";
|
| 64 |
$json = $this->envoyerRequeteConsultation($url);
|
70 |
$json = $this->envoyerRequeteConsultation($url);
|
| - |
|
71 |
$donnees = json_decode($json, true);
|
| - |
|
72 |
$cache[$id_personne] = $donnees;
|
| 65 |
$donnees = json_decode($json, true);
|
73 |
}
|
| 66 |
return $donnees;
|
74 |
return $donnees;
|
| Line 67... |
Line 75... |
| 67 |
}
|
75 |
}
|
| 68 |
|
76 |
|
| 69 |
/**
|
77 |
/**
|
| 70 |
* Retourne l'ensemble des collections liées à une personne.
|
78 |
* Retourne l'ensemble des collections liées à une personne.
|
| 71 |
*
|
79 |
*
|
| 72 |
* @param integer l'id de la personne.
|
80 |
* @param integer l'id de la personne.
|
| 73 |
* @return array un tableau contenant les informations sur les collections liées à la personne.
|
81 |
* @return array un tableau contenant les informations sur les collections liées à la personne.
|
| 74 |
*/
|
- |
|
| 75 |
public function getPersonneACollection($id_personne) {
|
- |
|
| 76 |
$url = $this->url_jrest.self::SERVICE_PERSONNE_A_COLLECTION."/*/*/$id_personne";
|
82 |
*/
|
| 77 |
$this->addOrdre('cc_nom', self::ORDRE_ASCENDANT);
|
- |
|
| 78 |
$json = $this->envoyerRequeteConsultation($url);
|
83 |
public function getCollectionsLiees($id_personne) {
|
| 79 |
$donnees = json_decode($json, true);
|
84 |
$donnees = $this->getPersonneACollection($id_personne);
|
| Line 80... |
Line 85... |
| 80 |
return $donnees['collectionsAPersonne'];
|
85 |
return $donnees['collectionsAPersonne'];
|
| - |
|
86 |
}
|
| - |
|
87 |
|
| - |
|
88 |
/**
|
| - |
|
89 |
* Retourne le nombre de collections liées à une personne.
|
| - |
|
90 |
*
|
| - |
|
91 |
* @param integer l'id de la personne.
|
| - |
|
92 |
* @return integer le nombre de collections liées à la personne.
|
| - |
|
93 |
*/
|
| - |
|
94 |
public function getNbreCollectionsLiees($id_personne) {
|
| - |
|
95 |
$donnees = $this->getPersonneACollection($id_personne);
|
| - |
|
96 |
return $donnees['nbElements'];
|
| - |
|
97 |
}
|
| - |
|
98 |
|
| - |
|
99 |
private function getPersonneACollection($id_personne) {
|
| - |
|
100 |
$cache =& $this->cache['PersonneACollection'];
|
| - |
|
101 |
if (isset($cache[$id_personne])) {
|
| - |
|
102 |
$donnees = $cache[$id_personne];
|
| - |
|
103 |
} else {
|
| - |
|
104 |
$url = $this->url_jrest.self::SERVICE_PERSONNE_A_COLLECTION."/*/*/$id_personne";
|
| - |
|
105 |
$this->addOrdre('cc_nom', self::ORDRE_ASCENDANT);
|
| - |
|
106 |
$json = $this->envoyerRequeteConsultation($url);
|
| - |
|
107 |
$donnees = json_decode($json, true);
|
| - |
|
108 |
$cache[$id_personne] = $donnees;
|
| - |
|
109 |
}
|
| - |
|
110 |
return $donnees;
|
| 81 |
}
|
111 |
}
|
| 82 |
|
112 |
|
| 83 |
/**
|
113 |
/**
|
| 84 |
* Retourne l'ensemble des structures liées à une personne.
|
114 |
* Retourne l'ensemble des structures liées à une personne.
|
| 85 |
*
|
115 |
*
|
| 86 |
* @param integer l'id de la personne.
|
116 |
* @param integer l'id de la personne.
|
| 87 |
* @return array un tableau contenant les informations sur les structures liées à la personne.
|
- |
|
| 88 |
*/
|
- |
|
| 89 |
public function getPersonneAStructure($id_personne) {
|
117 |
* @return array un tableau contenant les informations sur les structures liées à la personne.
|
| 90 |
$url = $this->url_jrest.self::SERVICE_PERSONNE_A_STRUCTURE."/*/*/$id_personne";
|
- |
|
| 91 |
$this->addOrdre('cs_nom', self::ORDRE_ASCENDANT);
|
118 |
*/
|
| 92 |
$json = $this->envoyerRequeteConsultation($url);
|
119 |
public function getStructuresLiees($id_personne) {
|
| Line -... |
Line 120... |
| - |
|
120 |
$donnees = $this->getPersonneAStructure($id_personne);
|
| - |
|
121 |
return $donnees['structuresAPersonne'];
|
| - |
|
122 |
}
|
| - |
|
123 |
|
| - |
|
124 |
/**
|
| - |
|
125 |
* Retourne le nombre de structures liées à une personne.
|
| - |
|
126 |
*
|
| - |
|
127 |
* @param integer l'id de la personne.
|
| - |
|
128 |
* @return integer le nombre de structures liées à la personne.
|
| - |
|
129 |
*/
|
| - |
|
130 |
public function getNbreStructuresLiees($id_personne) {
|
| - |
|
131 |
$donnees = $this->getPersonneAStructure($id_personne);
|
| - |
|
132 |
return $donnees['nbElements'];
|
| - |
|
133 |
}
|
| - |
|
134 |
|
| - |
|
135 |
private function getPersonneAStructure($id_personne) {
|
| - |
|
136 |
$cache =& $this->cache['PersonneAStructure'];
|
| - |
|
137 |
if (isset($cache[$id_personne])) {
|
| - |
|
138 |
$donnees = $cache[$id_personne];
|
| - |
|
139 |
} else {
|
| - |
|
140 |
$url = $this->url_jrest.self::SERVICE_PERSONNE_A_STRUCTURE."/*/*/$id_personne";
|
| - |
|
141 |
$this->addOrdre('cp_nom', self::ORDRE_ASCENDANT);
|
| - |
|
142 |
$json = $this->envoyerRequeteConsultation($url);
|
| - |
|
143 |
$donnees = json_decode($json, true);
|
| - |
|
144 |
$cache[$id_personne] = $donnees;
|
| - |
|
145 |
}
|
| - |
|
146 |
return $donnees;
|
| - |
|
147 |
}
|
| - |
|
148 |
|
| - |
|
149 |
/**
|
| - |
|
150 |
* Retourne le nom complet d'une personne.
|
| 93 |
$donnees = json_decode($json, true);
|
151 |
*
|
| 94 |
return $donnees['structuresAPersonne'];
|
152 |
* @param integer l'id de la personne.
|
| 95 |
}
|
153 |
* @return string le nom complet de la personne.
|
| 96 |
|
154 |
*/
|
| 97 |
public function getPersonneNomComplet($id) {
|
155 |
public function getPersonneNomComplet($id) {
|
| Line 103... |
Line 161... |
| 103 |
$nom_complet = $donnees['cp_fmt_nom_complet'];
|
161 |
$nom_complet = $donnees['cp_fmt_nom_complet'];
|
| 104 |
}
|
162 |
}
|
| 105 |
return $nom_complet;
|
163 |
return $nom_complet;
|
| 106 |
}
|
164 |
}
|
| Line -... |
Line 165... |
| - |
|
165 |
|
| - |
|
166 |
/**
|
| - |
|
167 |
* Retourne la chaine "truk" des courriels d'une personne.
|
| - |
|
168 |
*
|
| - |
|
169 |
* @param integer l'id de la personne.
|
| - |
|
170 |
* @return string la chaine "truk" des courriels de la personne.
|
| 107 |
|
171 |
*/
|
| 108 |
public function getPersonneCourriels($id) {
|
172 |
public function getPersonneCourriels($id) {
|
| 109 |
$courriels = '';
|
173 |
$courriels = '';
|
| 110 |
$donnees = $this->getPersonne($id);
|
174 |
$donnees = $this->getPersonne($id);
|
| 111 |
if (isset($donnees['nbElements']) && $donnees['nbElements'] >= 1) {
|
175 |
if (isset($donnees['nbElements']) && $donnees['nbElements'] >= 1) {
|