1 |
<?php
|
1 |
<?php
|
2 |
|
2 |
|
3 |
/**
|
3 |
/**
|
4 |
* @category PHP
|
4 |
* @category PHP
|
5 |
* @package jrest
|
5 |
* @package jrest
|
6 |
* @author Raphaël Droz <raphael@tela-botania.org>
|
6 |
* @author Raphaël Droz <raphael@tela-botania.org>
|
7 |
* @copyright 2013 Tela-Botanica
|
7 |
* @copyright 2013 Tela-Botanica
|
8 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
8 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
9 |
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
|
9 |
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
|
10 |
*/
|
10 |
*/
|
11 |
|
11 |
|
12 |
/**
|
12 |
/**
|
13 |
* Service d'export de données d'observation du CEL au format XLS
|
13 |
* Service d'export de données d'observation du CEL au format XLS
|
14 |
*
|
14 |
*
|
15 |
* Format du service :
|
15 |
* Format du service :
|
16 |
* POST /ExportXLS
|
16 |
* POST /ExportXLS
|
17 |
* POST /ExportXLS/<Utilisateur>
|
17 |
* POST /ExportXLS/<Utilisateur>
|
18 |
* TODO: GET /ExportXLS/<Utilisateur> [ sans "range" ? ]
|
18 |
* TODO: GET /ExportXLS/<Utilisateur> [ sans "range" ? ]
|
19 |
*
|
19 |
*
|
20 |
* Les données POST acceptées sont:
|
20 |
* Les données POST acceptées sont:
|
21 |
* range (obligatoire): un range d'id_observation sous la forme d'entier ou d'intervalles d'entiers
|
21 |
* range (obligatoire): un range d'id_observation sous la forme d'entier ou d'intervalles d'entiers
|
22 |
* séparés par des virgules ou bien '*' (pour toutes)
|
22 |
* séparés par des virgules ou bien '*' (pour toutes)
|
23 |
* TODO: limit
|
23 |
* TODO: limit
|
24 |
* TODO: départ
|
24 |
* TODO: départ
|
25 |
* TODO: sets (ou colonnes, ou extended)
|
25 |
* TODO: sets (ou colonnes, ou extended)
|
26 |
* TODO: + les critères supportés par fabriquerSousRequeteRecherche()
|
26 |
* TODO: + les critères supportés par fabriquerSousRequeteRecherche()
|
27 |
*
|
27 |
*
|
28 |
* Si <Utilisateur> est fourni, celui-ci doit être authentifié
|
28 |
* Si <Utilisateur> est fourni, celui-ci doit être authentifié
|
29 |
* TODO: export des données public et non-sensible d'un utilisateur
|
29 |
* TODO: export des données public et non-sensible d'un utilisateur
|
30 |
*
|
30 |
*
|
31 |
* Si <Utilisateur> est fourni, le observations seront le résultat de l'intersection des 2 contraintes
|
31 |
* Si <Utilisateur> est fourni, le observations seront le résultat de l'intersection des 2 contraintes
|
32 |
*
|
32 |
*
|
33 |
*/
|
33 |
*/
|
34 |
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(realpath(__FILE__))) . '/lib');
|
34 |
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(realpath(__FILE__))) . '/lib');
|
35 |
// TERM
|
35 |
// TERM
|
36 |
ini_set('html_errors', 0);
|
36 |
ini_set('html_errors', 0);
|
37 |
ini_set('xdebug.cli_color', 2);
|
37 |
ini_set('xdebug.cli_color', 2);
|
38 |
require_once('lib/PHPExcel/Classes/PHPExcel.php');
|
38 |
require_once('lib/PHPExcel/Classes/PHPExcel.php');
|
- |
|
39 |
|
- |
|
40 |
define('SEPARATEUR_IMAGES', ",");
|
39 |
|
41 |
|
40 |
// si getNomCommun_v2 ou getNomCommun_v3 sont utilisés
|
42 |
// si getNomCommun_v2 ou getNomCommun_v3 sont utilisés
|
41 |
/*require_once('/home/raphael/eflore/framework/framework/Framework.php');
|
43 |
/*require_once('/home/raphael/eflore/framework/framework/Framework.php');
|
42 |
Framework::setCheminAppli("/home/raphael/eflore/projets/services/index.php");
|
44 |
Framework::setCheminAppli("/home/raphael/eflore/projets/services/index.php");
|
43 |
Framework::setInfoAppli(Config::get('info'));
|
45 |
Framework::setInfoAppli(Config::get('info'));
|
44 |
require_once('/home/raphael/eflore/projets/services/modules/0.1/Projets.php');*/
|
46 |
require_once('/home/raphael/eflore/projets/services/modules/0.1/Projets.php');*/
|
45 |
|
47 |
|
46 |
class ExportXLS extends Cel {
|
48 |
class ExportXLS extends Cel {
|
47 |
|
49 |
|
48 |
private $cache = Array();
|
50 |
private $cache = Array();
|
- |
|
51 |
private $id_utilisateur = NULL;
|
49 |
|
52 |
|
50 |
function ExportXLS($config) {
|
53 |
function ExportXLS($config) {
|
51 |
parent::__construct($config);
|
54 |
parent::__construct($config);
|
52 |
}
|
55 |
}
|
53 |
|
56 |
|
54 |
/*
|
57 |
/*
|
55 |
* Process $_POST et $_GET
|
58 |
* Process $_POST et $_GET
|
56 |
* TODO: changer JRest pour pouvoir disposer d'un nom de méthode plus représentatif que "updateXXX"
|
59 |
* TODO: changer JRest pour pouvoir disposer d'un nom de méthode plus représentatif que "updateXXX"
|
57 |
* en POST
|
60 |
* en POST
|
58 |
*/
|
61 |
*/
|
59 |
function updateElement($uid, $pairs) {
|
62 |
function updateElement($uid, $pairs) {
|
60 |
$params = Array('uid' => $uid[0]);
|
63 |
$params = Array('uid' => $uid[0]);
|
61 |
// TODO: pas de range mais un utilisateur: possible
|
64 |
// TODO: pas de range mais un utilisateur: possible
|
62 |
if(!isset($_POST['range'])) {
|
65 |
if(!isset($_POST['range'])) {
|
63 |
header('HTTP/1.0 204 No Content');
|
66 |
header('HTTP/1.0 204 No Content');
|
64 |
exit;
|
67 |
exit;
|
65 |
}
|
68 |
}
|
66 |
// trim() car: `POST http://url<<<"range=*"`
|
69 |
// trim() car: `POST http://url<<<"range=*"`
|
67 |
elseif(trim($_POST['range']) == '*') {
|
70 |
elseif(trim($_POST['range']) == '*') {
|
68 |
$obs_ids = Array('*');
|
71 |
$obs_ids = Array('*');
|
69 |
}
|
72 |
}
|
70 |
else {
|
73 |
else {
|
71 |
$obs_ids = self::rangeToList(trim($_POST['range']));
|
74 |
$obs_ids = self::rangeToList(trim($_POST['range']));
|
72 |
}
|
75 |
}
|
73 |
$this->export($obs_ids, NULL, $params);
|
76 |
$this->export($obs_ids, NULL, $params);
|
74 |
exit;
|
77 |
exit;
|
75 |
}
|
78 |
}
|
76 |
|
79 |
|
77 |
/*
|
80 |
/*
|
78 |
* $param: Tableau associatif, indexes supportés:
|
81 |
* $param: Tableau associatif, indexes supportés:
|
79 |
* - widget: le nom du widget d'origine (utilisé pour les méta-données du tableur)
|
82 |
* - widget: le nom du widget d'origine (utilisé pour les méta-données du tableur)
|
80 |
*
|
83 |
*
|
81 |
*/
|
84 |
*/
|
82 |
function export(Array $obs_ids, String $fieldSets = NULL, Array $params = Array()) {
|
85 |
function export(Array $obs_ids, String $fieldSets = NULL, Array $params = Array()) {
|
83 |
$colonnes = self::nom_d_ensemble_vers_liste_de_colonnes($fieldSets);
|
86 |
$colonnes = self::nom_d_ensemble_vers_liste_de_colonnes($fieldSets);
|
84 |
// $colonne_abbrev = array_keys($colonnes);
|
87 |
// $colonne_abbrev = array_keys($colonnes);
|
85 |
$chercheur_observations = new RechercheObservation($this->config);
|
88 |
$chercheur_observations = new RechercheObservation($this->config);
|
86 |
|
89 |
|
87 |
$objPHPExcel = new PHPExcel();
|
90 |
$objPHPExcel = new PHPExcel();
|
88 |
|
91 |
|
89 |
// TODO: $params['part'] pour le multi-part
|
92 |
// TODO: $params['part'] pour le multi-part
|
90 |
$params['widget'] = isset($params['widget']) ? $params['widget'] : 'CEL';
|
93 |
$params['widget'] = isset($params['widget']) ? $params['widget'] : 'CEL';
|
91 |
// TODO: controleUtilisateur()
|
94 |
// TODO: controleUtilisateur()
|
92 |
if(! $params['uid']) { // || ! $this->controleUtilisateur($params['uid'])) {
|
95 |
if(! $params['uid']) { // || ! $this->controleUtilisateur($params['uid'])) {
|
93 |
$params['uid'] = NULL;
|
96 |
$params['uid'] = NULL;
|
94 |
}
|
97 |
}
|
- |
|
98 |
if($params['uid']) $this->id_utilisateur = intval($params['uid']);
|
95 |
|
99 |
|
96 |
$criteres = Array();
|
100 |
$criteres = Array();
|
97 |
if(! $obs_ids || count($obs_ids) == 1 && $obs_ids[0] == '*') {
|
101 |
if(! $obs_ids || count($obs_ids) == 1 && $obs_ids[0] == '*') {
|
98 |
unset($criteres['raw']);
|
102 |
unset($criteres['raw']);
|
99 |
}
|
103 |
}
|
100 |
else {
|
104 |
else {
|
101 |
$criteres = Array('raw' =>
|
105 |
$criteres = Array('raw' =>
|
102 |
sprintf('id_observation IN (%s)', implode(',', $obs_ids)));
|
106 |
sprintf('id_observation IN (%s)', implode(',', $obs_ids)));
|
103 |
}
|
107 |
}
|
104 |
|
108 |
|
105 |
$criteres['debut'] = isset($_GET['debut']) ? intval($_GET['debut']) : 0;
|
109 |
$criteres['debut'] = isset($_GET['debut']) ? intval($_GET['debut']) : 0;
|
106 |
$criteres['limite'] = isset($_GET['limite']) ? intval($_GET['limite']) : 0;
|
110 |
$criteres['limite'] = isset($_GET['limite']) ? intval($_GET['limite']) : 0;
|
107 |
$observations = $chercheur_observations
|
111 |
$observations = $chercheur_observations
|
108 |
->rechercherObservations($params['uid'], $criteres, $criteres['debut'], $criteres['limite'], TRUE)
|
112 |
->rechercherObservations($params['uid'], $criteres, $criteres['debut'], $criteres['limite'], TRUE)
|
109 |
->get();
|
113 |
->get();
|
110 |
|
114 |
|
111 |
// debug //echo ($chercheur_observations->requete_selection_observations);
|
115 |
// debug //echo ($chercheur_observations->requete_selection_observations);
|
112 |
// XXX: malheureusement l'instance de JRest n'est pas accessible ici
|
116 |
// XXX: malheureusement l'instance de JRest n'est pas accessible ici
|
113 |
if(!$observations) {
|
117 |
if(!$observations) {
|
114 |
header('HTTP/1.0 204 No Content');
|
118 |
header('HTTP/1.0 204 No Content');
|
115 |
exit;
|
119 |
exit;
|
116 |
}
|
120 |
}
|
117 |
|
121 |
|
118 |
$objPHPExcel->getProperties()->setCreator($params['widget']) // ou $uid ?
|
122 |
$objPHPExcel->getProperties()->setCreator($params['widget']) // ou $uid ?
|
119 |
->setLastModifiedBy("XX") // TODO: $uid
|
123 |
->setLastModifiedBy("XX") // TODO: $uid
|
120 |
->setTitle("YY") // TODO
|
124 |
->setTitle("YY") // TODO
|
121 |
->setSubject("ZZ") // TODO
|
125 |
->setSubject("ZZ") // TODO
|
122 |
->setDescription("Export blah");
|
126 |
->setDescription("Export blah");
|
123 |
//->setKeywords("office PHPExcel php")
|
127 |
//->setKeywords("office PHPExcel php")
|
124 |
//->setCategory("Test result file")
|
128 |
//->setCategory("Test result file")
|
125 |
|
129 |
|
126 |
$objPHPExcel->getActiveSheet()->setTitle("Observations");
|
130 |
$objPHPExcel->getActiveSheet()->setTitle("Observations");
|
127 |
$feuille = $objPHPExcel->setActiveSheetIndex(0);
|
131 |
$feuille = $objPHPExcel->setActiveSheetIndex(0);
|
128 |
$colid = 0;
|
132 |
$colid = 0;
|
129 |
foreach($colonnes as $colonne) {
|
133 |
foreach($colonnes as $colonne) {
|
- |
|
134 |
if($colonne['extra'] == 2) continue;
|
- |
|
135 |
|
130 |
$feuille->setCellValueByColumnAndRow($colid, 1, $colonne['nom']);
|
136 |
$feuille->setCellValueByColumnAndRow($colid, 1, $colonne['nom']);
|
131 |
if($colonne['extra']) {
|
137 |
if($colonne['extra'] == 1) {
|
132 |
$feuille->getStyleByColumnAndRow($colid, 1)->getBorders()->applyFromArray(
|
138 |
$feuille->getStyleByColumnAndRow($colid, 1)->getBorders()->applyFromArray(
|
133 |
array(
|
139 |
array(
|
134 |
'allborders' => array(
|
140 |
'allborders' => array(
|
135 |
'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
|
141 |
'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
|
136 |
'color' => array('rgb' => PHPExcel_Style_Color::COLOR_BLUE)
|
142 |
'color' => array('rgb' => PHPExcel_Style_Color::COLOR_BLUE)
|
137 |
)
|
143 |
)
|
138 |
)
|
144 |
)
|
139 |
);
|
145 |
);
|
140 |
}
|
146 |
}
|
141 |
$colid++;
|
147 |
$colid++;
|
142 |
}
|
148 |
}
|
143 |
|
149 |
|
144 |
$objPHPExcel->getActiveSheet()->getDefaultColumnDimension()->setWidth(12);
|
150 |
$objPHPExcel->getActiveSheet()->getDefaultColumnDimension()->setWidth(12);
|
145 |
|
151 |
|
146 |
$ligne = 2;
|
152 |
$ligne = 2;
|
147 |
foreach ($observations as $obs) {
|
153 |
foreach ($observations as $obs) {
|
148 |
$colid = 0;
|
154 |
$colid = 0;
|
149 |
foreach($colonnes as $abbrev => $colonne) {
|
155 |
foreach($colonnes as $abbrev => $colonne) {
|
- |
|
156 |
if($colonne['extra'] == 2) continue;
|
- |
|
157 |
|
150 |
// valeur direct depuis cel_obs ?
|
158 |
// valeur direct depuis cel_obs ?
|
151 |
if(isset($obs[$abbrev])) $valeur = $obs[$abbrev];
|
159 |
if(isset($obs[$abbrev])) $valeur = $obs[$abbrev];
|
152 |
|
160 |
|
153 |
// pré-processeur de la champs
|
161 |
// pré-processeur de la champs
|
154 |
if(function_exists($colonne['fonction'])) {
|
162 |
if(function_exists($colonne['fonction'])) {
|
155 |
$valeur = $colonne['fonction']($valeur);
|
163 |
$valeur = $colonne['fonction']($valeur);
|
156 |
} elseif(method_exists(__CLASS__, $colonne['fonction'])) {
|
164 |
} elseif(method_exists(__CLASS__, $colonne['fonction'])) {
|
157 |
$valeur = call_user_func(array(__CLASS__, $colonne['fonction']), $valeur);
|
165 |
$valeur = call_user_func(array(__CLASS__, $colonne['fonction']), $valeur);
|
158 |
} elseif($colonne['fonction']) {
|
166 |
} elseif($colonne['fonction']) {
|
159 |
die("méthode {$colonne['fonction']} introuvable");
|
167 |
die("méthode {$colonne['fonction']} introuvable");
|
160 |
}
|
168 |
}
|
161 |
// fonction pour obtenir des champs (étendus)
|
169 |
// fonction pour obtenir des champs (étendus)
|
162 |
elseif(function_exists($colonne['fonction_data'])) {
|
170 |
elseif(function_exists($colonne['fonction_data'])) {
|
163 |
$valeur = $colonne['fonction_data']($obs);
|
171 |
$valeur = $colonne['fonction_data']($obs);
|
164 |
}
|
172 |
}
|
165 |
elseif(method_exists(__CLASS__, $colonne['fonction_data'])) {
|
173 |
elseif(method_exists(__CLASS__, $colonne['fonction_data'])) {
|
166 |
$valeur = call_user_func(array(__CLASS__, $colonne['fonction_data']), $obs);
|
174 |
$valeur = call_user_func(array(__CLASS__, $colonne['fonction_data']), $obs);
|
167 |
}
|
175 |
}
|
168 |
|
176 |
|
169 |
|
177 |
|
170 |
// // cette section devrait être vide:
|
178 |
// // cette section devrait être vide:
|
171 |
// // cas particuliers ingérable avec l'architecture actuelle:
|
179 |
// // cas particuliers ingérable avec l'architecture actuelle:
|
172 |
if(false && $abbrev == 'date_observation' && $valeur == "0000-00-00") { /* blah */ }
|
180 |
if(false && $abbrev == 'date_observation' && $valeur == "0000-00-00") { /* blah */ }
|
173 |
// // fin de section "cas particuliers"
|
181 |
// // fin de section "cas particuliers"
|
174 |
|
182 |
|
175 |
$feuille->setCellValueByColumnAndRow($colid, $ligne, $valeur);
|
183 |
$feuille->setCellValueByColumnAndRow($colid, $ligne, $valeur);
|
176 |
$colid++;
|
184 |
$colid++;
|
177 |
}
|
185 |
}
|
178 |
$ligne++;
|
186 |
$ligne++;
|
179 |
}
|
187 |
}
|
180 |
|
188 |
|
181 |
header("Content-Type: application/vnd.ms-excel");
|
189 |
header("Content-Type: application/vnd.ms-excel");
|
182 |
header("Content-Disposition: attachment; filename=\"liste.xls\"; charset=utf-8");
|
190 |
header("Content-Disposition: attachment; filename=\"liste.xls\"; charset=utf-8");
|
183 |
header("Cache-Control: max-age=0");
|
191 |
header("Cache-Control: max-age=0");
|
184 |
// Le format Excel2007 utilise un fichier temporaire
|
192 |
// Le format Excel2007 utilise un fichier temporaire
|
185 |
$generateur = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
193 |
$generateur = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
186 |
// $generateur = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
194 |
// $generateur = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
187 |
$generateur->save('php://output');
|
195 |
$generateur->save('php://output');
|
188 |
exit;
|
196 |
exit;
|
189 |
}
|
197 |
}
|
190 |
|
198 |
|
191 |
/*
|
199 |
/*
|
192 |
* @param $fieldSets: un range, eg: 1-5,8,32,58-101
|
200 |
* @param $fieldSets: un range, eg: 1-5,8,32,58-101
|
193 |
* @return un tableau trié, eg: 1,2,3,4,5,8,32,58,...,101
|
201 |
* @return un tableau trié, eg: 1,2,3,4,5,8,32,58,...,101
|
194 |
* http://stackoverflow.com/questions/7698664/converting-a-range-or-partial-array-in-the-form-3-6-or-3-6-12-into-an-arra
|
202 |
* http://stackoverflow.com/questions/7698664/converting-a-range-or-partial-array-in-the-form-3-6-or-3-6-12-into-an-arra
|
195 |
*/
|
203 |
*/
|
196 |
static function rangeToList($in = '') {
|
204 |
static function rangeToList($in = '') {
|
197 |
$inSets = explode(',', $in);
|
205 |
$inSets = explode(',', $in);
|
198 |
$outSets = array();
|
206 |
$outSets = array();
|
199 |
|
207 |
|
200 |
foreach($inSets as $inSet) {
|
208 |
foreach($inSets as $inSet) {
|
201 |
list($start,$end) = explode('-', $inSet . '-' . $inSet);
|
209 |
list($start,$end) = explode('-', $inSet . '-' . $inSet);
|
202 |
// ignore les ranges trop importants
|
210 |
// ignore les ranges trop importants
|
203 |
if($start > 10000000 || $end > 10000000 || abs($start-$end) > 10000) continue;
|
211 |
if($start > 10000000 || $end > 10000000 || abs($start-$end) > 10000) continue;
|
204 |
$outSets = array_merge($outSets,range($start,$end));
|
212 |
$outSets = array_merge($outSets,range($start,$end));
|
205 |
}
|
213 |
}
|
206 |
$outSets = array_unique($outSets);
|
214 |
$outSets = array_unique($outSets);
|
207 |
$outSets = array_filter($outSets, 'is_numeric');
|
215 |
$outSets = array_filter($outSets, 'is_numeric');
|
208 |
sort($outSets);
|
216 |
sort($outSets);
|
209 |
return $outSets;
|
217 |
return $outSets;
|
210 |
}
|
218 |
}
|
211 |
|
219 |
|
212 |
/*
|
220 |
/*
|
213 |
* @param $fieldSets: un liste de noms de colonnes ou de sets de colonnes
|
221 |
* @param $fieldSets: un liste de noms de colonnes ou de sets de colonnes
|
214 |
* séparés par des virgules
|
222 |
* séparés par des virgules
|
215 |
* eg: "espece" ou "champs-etendus", ...
|
223 |
* eg: "espece" ou "champs-etendus", ...
|
216 |
*
|
224 |
*
|
217 |
* @return: un tableau associatif déjà ordonné
|
225 |
* @return: un tableau associatif déjà ordonné
|
218 |
* clé: abbrev [machine-name] de la colonne (eg: "espece" ou "mot-clef")
|
226 |
* clé: abbrev [machine-name] de la colonne (eg: "espece" ou "mot-clef")
|
219 |
* valeur: des données relative à cette colonne, cf GenColInfo
|
227 |
* valeur: des données relative à cette colonne, cf GenColInfo
|
220 |
*
|
228 |
*
|
221 |
* @TODO: fonction commune à la génération en CSV
|
229 |
* @TODO: fonction commune à la génération en CSV
|
222 |
*
|
230 |
*
|
223 |
*/
|
231 |
*/
|
224 |
static function nom_d_ensemble_vers_liste_de_colonnes($groupe_de_champs = 'standard') {
|
232 |
static function nom_d_ensemble_vers_liste_de_colonnes($groupe_de_champs = 'standard') {
|
225 |
if(! $groupe_de_champs) $groupe_de_champs = 'standard';
|
233 |
if(! $groupe_de_champs) $groupe_de_champs = 'standard';
|
226 |
$groupe_de_champs = array_flip(explode(',', $groupe_de_champs));
|
234 |
$groupe_de_champs = array_flip(explode(',', $groupe_de_champs));
|
227 |
$colonnes = Array();
|
235 |
$colonnes = Array();
|
228 |
|
236 |
|
229 |
if(isset($groupe_de_champs['standard'])) {
|
237 |
if(isset($groupe_de_champs['standard'])) {
|
230 |
$colonnes += Array(
|
238 |
$colonnes += Array(
|
231 |
'nom_sel' => self::GenColInfo('nom_sel', 'Espèce'),
|
239 |
'nom_sel' => self::GenColInfo('nom_sel', 'Espèce'),
|
232 |
'nom_sel_nn' => self::GenColInfo('nom_sel_nn', 'Numéro nomenclatural'),
|
240 |
'nom_sel_nn' => self::GenColInfo('nom_sel_nn', 'Numéro nomenclatural'),
|
233 |
'nom_ret' => self::GenColInfo('nom_ret', 'Nom retenu'),
|
241 |
'nom_ret' => self::GenColInfo('nom_ret', 'Nom retenu'),
|
234 |
'nom_ret_nn' => self::GenColInfo('nom_ret_nn', 'Numéro nomenclatural nom retenu'),
|
242 |
'nom_ret_nn' => self::GenColInfo('nom_ret_nn', 'Numéro nomenclatural nom retenu'),
|
235 |
'nt' => self::GenColInfo('nt', 'Numéro taxonomique'),
|
243 |
'nt' => self::GenColInfo('nt', 'Numéro taxonomique'),
|
236 |
'famille' => self::GenColInfo('famille', 'Famille'),
|
244 |
'famille' => self::GenColInfo('famille', 'Famille'),
|
237 |
'nom_referentiel' => self::GenColInfo('nom_referentiel', 'Referentiel taxonomique'),
|
245 |
'nom_referentiel' => self::GenColInfo('nom_referentiel', 'Referentiel taxonomique'),
|
238 |
'zone_geo' => self::GenColInfo('zone_geo', 'Commune'),
|
246 |
'zone_geo' => self::GenColInfo('zone_geo', 'Commune'),
|
239 |
'ce_zone_geo' => self::GenColInfo('ce_zone_geo', 'Identifiant Commune', 0, 'convertirCodeZoneGeoVersDepartement'),
|
247 |
'ce_zone_geo' => self::GenColInfo('ce_zone_geo', 'Identifiant Commune', 0, 'convertirCodeZoneGeoVersDepartement'),
|
240 |
'date_observation' => self::GenColInfo('date_observation', 'Date', 0, 'formaterDate'),
|
248 |
'date_observation' => self::GenColInfo('date_observation', 'Date', 0, 'formaterDate'),
|
241 |
'lieudit' => self::GenColInfo('lieudit', 'Lieu-dit'),
|
249 |
'lieudit' => self::GenColInfo('lieudit', 'Lieu-dit'),
|
242 |
'station' => self::GenColInfo('station', 'Station'),
|
250 |
'station' => self::GenColInfo('station', 'Station'),
|
243 |
'milieu' => self::GenColInfo('milieu', 'Milieu'),
|
251 |
'milieu' => self::GenColInfo('milieu', 'Milieu'),
|
244 |
'commentaire' => self::GenColInfo('commentaire', 'Notes'),
|
252 |
'commentaire' => self::GenColInfo('commentaire', 'Notes'),
|
245 |
'latitude' => self::GenColInfo('latitude', 'Latitude', 1),
|
253 |
'latitude' => self::GenColInfo('latitude', 'Latitude', 1),
|
246 |
'longitude' => self::GenColInfo('longitude', 'Longitude', 1),
|
254 |
'longitude' => self::GenColInfo('longitude', 'Longitude', 1),
|
247 |
'geodatum' => self::GenColInfo('geodatum', 'Référentiel Géographique', 1),
|
255 |
'geodatum' => self::GenColInfo('geodatum', 'Référentiel Géographique', 1),
|
248 |
|
256 |
|
249 |
// TODO: importable = FALSE car pas de merge de données importées
|
257 |
// TODO: importable = FALSE car pas de merge de données importées
|
250 |
'ordre' => self::GenColInfo('ordre', 'Ordre', 1, NULL, NULL, FALSE),
|
258 |
'ordre' => self::GenColInfo('ordre', 'Ordre', 1, NULL, NULL, FALSE),
|
251 |
'id_observation' => self::GenColInfo('id_observation', 'Identifiant', 1, NULL, NULL, FALSE),
|
259 |
'id_observation' => self::GenColInfo('id_observation', 'Identifiant', 1, NULL, NULL, FALSE),
|
252 |
|
260 |
|
253 |
'mots_cles_texte' => self::GenColInfo('mots_cles_texte', 'Mots Clés', 1),
|
261 |
'mots_cles_texte' => self::GenColInfo('mots_cles_texte', 'Mots Clés', 1),
|
254 |
'commentaire' => self::GenColInfo('commentaire', 'Commentaires', 1),
|
262 |
'commentaire' => self::GenColInfo('commentaire', 'Commentaires', 1),
|
255 |
'date_creation' => self::GenColInfo('date_creation', 'Date Création', 1),
|
263 |
'date_creation' => self::GenColInfo('date_creation', 'Date Création', 1),
|
256 |
'date_modification' => self::GenColInfo('date_modification', 'Date Modification', 1),
|
264 |
'date_modification' => self::GenColInfo('date_modification', 'Date Modification', 1),
|
- |
|
265 |
|
- |
|
266 |
// rappel transmission = 1, signifie simplement "public"
|
257 |
// importable = FALSE car à l'import ce sont de "nouvelles" données, donc "non-transmises"
|
267 |
// des données importées peuvent être d'emblée "publiques"
|
- |
|
268 |
// "importable" = TRUE
|
258 |
'transmission' => self::GenColInfo('transmission', 'Transmis', 1, NULL, NULL, FALSE),
|
269 |
'transmission' => self::GenColInfo('transmission', 'Transmis', 1),
|
259 |
'date_transmission' => self::GenColInfo('date_transmission', 'Date Transmission', 1),
|
270 |
'date_transmission' => self::GenColInfo('date_transmission', 'Date Transmission', 1),
|
260 |
'abondance' => self::GenColInfo('abondance', 'Abondance', 1, NULL, NULL, FALSE),
|
271 |
'abondance' => self::GenColInfo('abondance', 'Abondance', 1, NULL, NULL, FALSE),
|
261 |
'certitude' => self::GenColInfo('certitude', 'Certitude', 1, NULL, NULL, FALSE),
|
272 |
'certitude' => self::GenColInfo('certitude', 'Certitude', 1, NULL, NULL, FALSE),
|
262 |
'phenologie' => self::GenColInfo('phenologie', 'Phénologie', 1, NULL, NULL, FALSE),
|
273 |
'phenologie' => self::GenColInfo('phenologie', 'Phénologie', 1, NULL, NULL, FALSE),
|
263 |
|
274 |
|
264 |
'nom_commun' => self::GenColInfo('nom_commun', 'Nom Commun', 1, NULL, 'getNomCommun', FALSE)
|
275 |
'nom_commun' => self::GenColInfo('nom_commun', 'Nom Commun', 1, NULL, 'getNomCommun', FALSE),
|
265 |
//'nom-commun' => self::GenColInfo('nom-commun', 'Nom Commun', 1, NULL, 'getNomCommun_v2')
|
276 |
//'nom-commun' => self::GenColInfo('nom-commun', 'Nom Commun', 1, NULL, 'getNomCommun_v2'),
|
- |
|
277 |
//'nom-commun' => self::GenColInfo('nom-commun', 'Nom Commun', 1, NULL, 'getNomCommun_v3'),
|
- |
|
278 |
|
266 |
//'nom-commun' => self::GenColInfo('nom-commun', 'Nom Commun', 1, NULL, 'getNomCommun_v3')
|
279 |
'images' => self::GenColInfo('image', 'Image(s)', 1, NULL, 'getImages', TRUE),
|
267 |
);
|
280 |
);
|
268 |
}
|
281 |
}
|
269 |
|
282 |
|
270 |
return $colonnes;
|
283 |
return $colonnes;
|
271 |
}
|
284 |
}
|
272 |
|
285 |
|
273 |
/*
|
286 |
/*
|
274 |
* Wrapper générant un tableau associatif:
|
287 |
* Wrapper générant un tableau associatif:
|
- |
|
288 |
|
- |
|
289 |
* @param $abbrev (obligatoire): nom court de colonne, largement utilisé lors de l'import.
|
- |
|
290 |
* En effet chaque ligne importée est accessible à l'aide du `define` de $abbrev en majuscule, préfixé de "C_"
|
- |
|
291 |
* Exemple: $ligne[C_LONGITUDE] pour "longitude".
|
- |
|
292 |
* cf: ImportXLS::detectionEntete()
|
- |
|
293 |
|
- |
|
294 |
* @param $nom (obligatoire): nom complet de colonne (utilisé pour la ligne d'en-tête)
|
- |
|
295 |
|
- |
|
296 |
* @param $is_extra:
|
- |
|
297 |
* Si 0, la colonne est une colonne standard
|
- |
|
298 |
* Si 1, la colonne est extra [le plus souvent générée automatiquement]
|
275 |
* @param $is_extra: défini si la colonne est extra (auquelle une bordure bleue entoure son nom dans la première ligne
|
299 |
* (auquel cas une bordure bleue entoure son nom dans la ligne d'entête)
|
- |
|
300 |
* Si 2, la colonne n'est pas traité à l'export, mais une définition peut lui être donnée
|
- |
|
301 |
* qui pourra être utilisée à l'import, exemple: "image"
|
- |
|
302 |
|
276 |
* @param $fonction (optionnel): un nom d'un fonction de préprocessing
|
303 |
* @param $fonction (optionnel): un nom d'un fonction de préprocessing
|
277 |
* $fonction doit prendre comme seul argument la valeur d'origine et retourner la valeur transformée
|
304 |
* $fonction doit prendre comme seul argument la valeur d'origine et retourner la valeur transformée
|
- |
|
305 |
|
278 |
* @param $fonction_data (optionnel): une *méthode* d'obtention de donnée
|
306 |
* @param $fonction_data (optionnel): une *méthode* d'obtention de donnée
|
279 |
* $fonction_data doit prendre comme premier argument les champs de l'enregistrement existant
|
307 |
* $fonction_data doit prendre comme premier argument le tableau des champs de l'enregistrement existant
|
280 |
* $fonction_data doit retourner une valeur
|
308 |
* $fonction_data doit retourner une valeur
|
- |
|
309 |
|
- |
|
310 |
* @param $importable (optionnel): défini si la colonne est traitée (ou absolument ignorée par PHPExcel) lors de
|
- |
|
311 |
* l'import.
|
281 |
|
312 |
|
282 |
*/
|
313 |
*/
|
283 |
static function GenColInfo($abbrev, $nom, $is_extra = 0, $fonction = NULL, $fonction_data = NULL, $importable = TRUE) {
|
314 |
static function GenColInfo($abbrev, $nom, $is_extra = 0, $fonction = NULL, $fonction_data = NULL, $importable = TRUE) {
|
284 |
return Array('abbrev' => $abbrev,
|
315 |
return Array('abbrev' => $abbrev,
|
285 |
'nom' => $nom,
|
316 |
'nom' => $nom,
|
286 |
'extra' => $is_extra ? 1 : 0,
|
317 |
'extra' => $is_extra ? 1 : 0,
|
287 |
'fonction' => $fonction,
|
318 |
'fonction' => $fonction,
|
288 |
'fonction_data' => $fonction_data,
|
319 |
'fonction_data' => $fonction_data,
|
289 |
'importable' => $importable
|
320 |
'importable' => $importable
|
290 |
);
|
321 |
);
|
291 |
}
|
322 |
}
|
292 |
|
323 |
|
293 |
protected function formaterDate($date_heure_mysql, $format = NULL) {
|
324 |
protected function formaterDate($date_heure_mysql, $format = NULL) {
|
294 |
if (!$date_heure_mysql || $date_heure_mysql == "0000-00-00 00:00:00") return "00/00/0000";
|
325 |
if (!$date_heure_mysql || $date_heure_mysql == "0000-00-00 00:00:00") return "00/00/0000";
|
295 |
$timestamp = DateTime::createFromFormat("Y-m-d H:i:s", $date_heure_mysql)->getTimestamp();
|
326 |
$timestamp = DateTime::createFromFormat("Y-m-d H:i:s", $date_heure_mysql)->getTimestamp();
|
296 |
if(!$timestamp) return "00/00/0000";
|
327 |
if(!$timestamp) return "00/00/0000";
|
297 |
// TODO: les widget ne font malheureusement pas usage de l'heure dans le CEL
|
328 |
// TODO: les widget ne font malheureusement pas usage de l'heure dans le CEL
|
- |
|
329 |
// TODO: si modification, ne pas oublier de modifier le format d'import correspondant
|
- |
|
330 |
// dans ImportXLS (actuellement: "d/m/Y")
|
298 |
$date_formatee = strftime('%A %d %B %Y', $timestamp);
|
331 |
$date_formatee = strftime('%d/%m/%Y', $timestamp);
|
299 |
if(!$date_formatee) return "00/00/0000";
|
332 |
if(!$date_formatee) return "00/00/0000";
|
300 |
return $date_formatee;
|
333 |
return $date_formatee;
|
301 |
}
|
334 |
}
|
- |
|
335 |
|
- |
|
336 |
|
- |
|
337 |
// TODO: mettre en static + param "id_utilisateur"
|
- |
|
338 |
function getImages($obs) {
|
- |
|
339 |
if(! $this->id_utilisateur) return NULL;
|
- |
|
340 |
|
- |
|
341 |
$rec = $this->requeter(
|
- |
|
342 |
sprintf("SELECT GROUP_CONCAT(nom_original SEPARATOR '%s') FROM cel_images i"
|
- |
|
343 |
. " LEFT JOIN cel_obs_images oi ON (i.id_image = oi.id_image)"
|
- |
|
344 |
. " LEFT JOIN cel_obs o ON (oi.id_observation = o.id_observation)"
|
- |
|
345 |
. " WHERE ce_utilisateur = %d",
|
- |
|
346 |
|
- |
|
347 |
SEPARATEUR_IMAGES,
|
- |
|
348 |
$this->id_utilisateur));
|
- |
|
349 |
return $rec ? array_pop($rec) : NULL;
|
- |
|
350 |
|
- |
|
351 |
}
|
302 |
|
352 |
|
303 |
|
353 |
|
304 |
// TODO: référentiel ne devrait pas être généré au moment d'un Config::get,
|
354 |
// TODO: référentiel ne devrait pas être généré au moment d'un Config::get,
|
305 |
// comme dans Config::get('nomsVernaRechercheLimiteeTpl')
|
355 |
// comme dans Config::get('nomsVernaRechercheLimiteeTpl')
|
306 |
// Par exemple, la variable pour "nva" ?
|
356 |
// Par exemple, la variable pour "nva" ?
|
307 |
function getNomCommun($obs) {
|
357 |
function getNomCommun($obs) {
|
308 |
$langue = 'fra';
|
358 |
$langue = 'fra';
|
309 |
list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
|
359 |
list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
|
310 |
if($referentiel == 'bdtfx') $referentiel = 'nvjfl';
|
360 |
if($referentiel == 'bdtfx') $referentiel = 'nvjfl';
|
311 |
else return '';
|
361 |
else return '';
|
312 |
|
362 |
|
313 |
$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
|
363 |
$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
|
314 |
if(isset($this->cache['getNomCommun'][$cache_id])) {
|
364 |
if(isset($this->cache['getNomCommun'][$cache_id])) {
|
315 |
//debug: error_log("require url_service_nom_attribution: OK ! (pour \"{$obs['nom_ret']}\")");
|
365 |
//debug: error_log("require url_service_nom_attribution: OK ! (pour \"{$obs['nom_ret']}\")");
|
316 |
return $this->cache['getNomCommun'][$cache_id];
|
366 |
return $this->cache['getNomCommun'][$cache_id];
|
317 |
}
|
367 |
}
|
318 |
// pas de cache:
|
368 |
// pas de cache:
|
319 |
//debug: error_log("require url_service_nom_attribution pour \"{$obs['nom_ret']}\"");
|
369 |
//debug: error_log("require url_service_nom_attribution pour \"{$obs['nom_ret']}\"");
|
320 |
|
370 |
|
321 |
// pour bdtfx:
|
371 |
// pour bdtfx:
|
322 |
// /service:eflore:0.1/nvjfl/noms-vernaculaires/attributions?masque.nt=X&masque.lg=fra&retour.champs=num_statut
|
372 |
// /service:eflore:0.1/nvjfl/noms-vernaculaires/attributions?masque.nt=X&masque.lg=fra&retour.champs=num_statut
|
323 |
// /projet/services/modules/0.1/nvjfl/NomsVernaculaires.php
|
373 |
// /projet/services/modules/0.1/nvjfl/NomsVernaculaires.php
|
324 |
$url = str_replace(Array('{referentiel}', '{valeur}', '{langue}'),
|
374 |
$url = str_replace(Array('{referentiel}', '{valeur}', '{langue}'),
|
325 |
Array($referentiel, $obs['nt'], $langue),
|
375 |
Array($referentiel, $obs['nt'], $langue),
|
326 |
$this->config['eflore']['url_service_nom_attribution']) .
|
376 |
$this->config['eflore']['url_service_nom_attribution']) .
|
327 |
"&retour.champs=num_statut";
|
377 |
"&retour.champs=num_statut";
|
328 |
$noms = @json_decode(file_get_contents($url));
|
378 |
$noms = @json_decode(file_get_contents($url));
|
329 |
if(! $noms) return '';
|
379 |
if(! $noms) return '';
|
330 |
$noms = array_filter((array)($noms->resultat), function($item) { return ($item->num_statut == 1); });
|
380 |
$noms = array_filter((array)($noms->resultat), function($item) { return ($item->num_statut == 1); });
|
331 |
$nom = array_pop($noms)->nom_vernaculaire;
|
381 |
$nom = array_pop($noms)->nom_vernaculaire;
|
332 |
|
382 |
|
333 |
// cache
|
383 |
// cache
|
334 |
$this->cache['getNomCommun'][$cache_id] = $nom;
|
384 |
$this->cache['getNomCommun'][$cache_id] = $nom;
|
335 |
return $nom;
|
385 |
return $nom;
|
336 |
}
|
386 |
}
|
337 |
|
387 |
|
338 |
|
388 |
|
339 |
/* Tente de bootstraper le framework au plus court et d'initialiser une instance de
|
389 |
/* Tente de bootstraper le framework au plus court et d'initialiser une instance de
|
340 |
NomsVernaculaires pour obtenir le nom commun */
|
390 |
NomsVernaculaires pour obtenir le nom commun */
|
341 |
function getNomCommun_v2($obs) {
|
391 |
function getNomCommun_v2($obs) {
|
342 |
static $service;
|
392 |
static $service;
|
343 |
$service = new Projets();
|
393 |
$service = new Projets();
|
344 |
|
394 |
|
345 |
$langue = 'fra';
|
395 |
$langue = 'fra';
|
346 |
list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
|
396 |
list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
|
347 |
if($referentiel == 'bdtfx') $referentiel = 'nvjfl';
|
397 |
if($referentiel == 'bdtfx') $referentiel = 'nvjfl';
|
348 |
else return '';
|
398 |
else return '';
|
349 |
|
399 |
|
350 |
$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
|
400 |
$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
|
351 |
if(isset($this->cache['getNomCommun'][$cache_id])) {
|
401 |
if(isset($this->cache['getNomCommun'][$cache_id])) {
|
352 |
error_log("require NomsVernaculaires.php: OK ! (pour \"{$obs['nom_ret']}\")");
|
402 |
error_log("require NomsVernaculaires.php: OK ! (pour \"{$obs['nom_ret']}\")");
|
353 |
return $this->cache['getNomCommun'][$cache_id];
|
403 |
return $this->cache['getNomCommun'][$cache_id];
|
354 |
}
|
404 |
}
|
355 |
// pas de cache:
|
405 |
// pas de cache:
|
356 |
error_log("require NomsVernaculaires.php pour \"{$obs['nom_ret']}\"");
|
406 |
error_log("require NomsVernaculaires.php pour \"{$obs['nom_ret']}\"");
|
357 |
|
407 |
|
358 |
$donnees = Array('masque.nt' => $obs['nt'],
|
408 |
$donnees = Array('masque.nt' => $obs['nt'],
|
359 |
'masque.lg' => $langue,
|
409 |
'masque.lg' => $langue,
|
360 |
'retour.champs' => 'num_statut');
|
410 |
'retour.champs' => 'num_statut');
|
361 |
$noms = $service->consulter(Array('nvjfl', 'noms-vernaculaires'), $donnees);
|
411 |
$noms = $service->consulter(Array('nvjfl', 'noms-vernaculaires'), $donnees);
|
362 |
|
412 |
|
363 |
if(! $noms) return '';
|
413 |
if(! $noms) return '';
|
364 |
$noms = array_filter((array)($noms->resultat), function($item) { return ($item->num_statut == 1); });
|
414 |
$noms = array_filter((array)($noms->resultat), function($item) { return ($item->num_statut == 1); });
|
365 |
$nom = array_pop($noms)->nom_vernaculaire;
|
415 |
$nom = array_pop($noms)->nom_vernaculaire;
|
366 |
|
416 |
|
367 |
// cache
|
417 |
// cache
|
368 |
$this->cache['getNomCommun'][$cache_id] = $nom;
|
418 |
$this->cache['getNomCommun'][$cache_id] = $nom;
|
369 |
return $nom;
|
419 |
return $nom;
|
370 |
}
|
420 |
}
|
371 |
|
421 |
|
372 |
|
422 |
|
373 |
/* Effectue un bootstraping plus sage que ci-dessus, mais le gain d'efficacité
|
423 |
/* Effectue un bootstraping plus sage que ci-dessus, mais le gain d'efficacité
|
374 |
n'est pas aussi retentissant qu'espéré */
|
424 |
n'est pas aussi retentissant qu'espéré */
|
375 |
static $service;
|
425 |
static $service;
|
376 |
function getNomCommun_v3($obs) {
|
426 |
function getNomCommun_v3($obs) {
|
377 |
if(! $this->service) $this->service = new Projets();
|
427 |
if(! $this->service) $this->service = new Projets();
|
378 |
|
428 |
|
379 |
$langue = 'fra';
|
429 |
$langue = 'fra';
|
380 |
list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
|
430 |
list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
|
381 |
if($referentiel == 'bdtfx') $referentiel = 'nvjfl';
|
431 |
if($referentiel == 'bdtfx') $referentiel = 'nvjfl';
|
382 |
else return '';
|
432 |
else return '';
|
383 |
|
433 |
|
384 |
$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
|
434 |
$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
|
385 |
if(isset($this->cache['getNomCommun'][$cache_id])) {
|
435 |
if(isset($this->cache['getNomCommun'][$cache_id])) {
|
386 |
error_log("require NomsVernaculaires.php: OK ! (pour \"{$obs['nom_ret']}\")");
|
436 |
error_log("require NomsVernaculaires.php: OK ! (pour \"{$obs['nom_ret']}\")");
|
387 |
return $this->cache['getNomCommun'][$cache_id];
|
437 |
return $this->cache['getNomCommun'][$cache_id];
|
388 |
}
|
438 |
}
|
389 |
// pas de cache:
|
439 |
// pas de cache:
|
390 |
error_log("require NomsVernaculaires.php pour \"{$obs['nom_ret']}\"");
|
440 |
error_log("require NomsVernaculaires.php pour \"{$obs['nom_ret']}\"");
|
391 |
|
441 |
|
392 |
$donnees = Array('masque.nt' => $obs['nt'],
|
442 |
$donnees = Array('masque.nt' => $obs['nt'],
|
393 |
'masque.lg' => $langue,
|
443 |
'masque.lg' => $langue,
|
394 |
'retour.champs' => 'conseil_emploi');
|
444 |
'retour.champs' => 'conseil_emploi');
|
395 |
$this->service->initialiserRessourcesEtParametres(Array('nvjfl', 'noms-vernaculaires', 'attributions'), $donnees);
|
445 |
$this->service->initialiserRessourcesEtParametres(Array('nvjfl', 'noms-vernaculaires', 'attributions'), $donnees);
|
396 |
try {
|
446 |
try {
|
397 |
$noms = $this->service->traiterRessources();
|
447 |
$noms = $this->service->traiterRessources();
|
398 |
} catch(Exception $e) { return ''; }
|
448 |
} catch(Exception $e) { return ''; }
|
399 |
if(! $noms) return '';
|
449 |
if(! $noms) return '';
|
400 |
$noms = array_filter($noms['resultat'], function($item) { return ($item['num_statut'] == 1); });
|
450 |
$noms = array_filter($noms['resultat'], function($item) { return ($item['num_statut'] == 1); });
|
401 |
$nom = array_pop($noms)['nom_vernaculaire'];
|
451 |
$nom = array_pop($noms)['nom_vernaculaire'];
|
402 |
|
452 |
|
403 |
// cache
|
453 |
// cache
|
404 |
$this->cache['getNomCommun'][$cache_id] = $nom;
|
454 |
$this->cache['getNomCommun'][$cache_id] = $nom;
|
405 |
return $nom;
|
455 |
return $nom;
|
406 |
}
|
456 |
}
|
407 |
|
457 |
|
408 |
}
|
458 |
}
|