| Line 117... |
Line 117... |
| 117 |
}
|
117 |
}
|
| 118 |
}
|
118 |
}
|
| 119 |
$this->envoyer($contenu);
|
119 |
$this->envoyer($contenu);
|
| 120 |
}
|
120 |
}
|
| Line 121... |
Line -... |
| 121 |
|
- |
|
| 122 |
|
121 |
|
| 123 |
private function executerSaisie() {
|
122 |
private function executerSaisie() {
|
| 124 |
$retour = array();
|
123 |
$retour = array();
|
| 125 |
$retour['squelette'] = 'lg';
|
124 |
$retour['squelette'] = 'lg';
|
| 126 |
$retour['donnees']['general'] = I18n::get('General');
|
125 |
$retour['donnees']['general'] = I18n::get('General');
|
| Line 135... |
Line 134... |
| 135 |
return $retour;
|
134 |
return $retour;
|
| 136 |
}
|
135 |
}
|
| Line 137... |
Line 136... |
| 137 |
|
136 |
|
| 138 |
/* Recherche si le projet existe sinon va chercher les infos de base */
|
137 |
/* Recherche si le projet existe sinon va chercher les infos de base */
|
| 139 |
private function rechercherProjet() {
|
- |
|
| 140 |
// projet avec un squelette défini (et non juste un mot-clé d'observation)
|
- |
|
| 141 |
$estProjetDefini = true;
|
138 |
private function rechercherProjet() {
|
| 142 |
$tab = array();
|
139 |
$tab = array();
|
| 143 |
$url = $this->config['lg']['celUrlTpl'].'?projet='.$this->parametres['projet'].'&langue='.$this->parametres['langue'];
|
140 |
$url = $this->config['lg']['celUrlTpl'].'?projet='.$this->parametres['projet'].'&langue='.$this->parametres['langue'];
|
| 144 |
$json = $this->getDao()->consulter($url);
|
- |
|
| 145 |
|
- |
|
| 146 |
if ( $json ) {
|
- |
|
| 147 |
$tab = $this->rechercherChampsSupp();
|
- |
|
| 148 |
} else {
|
- |
|
| 149 |
$url = $this->config['lg']['celUrlTpl'].'?projet=base&langue='.$this->parametres['langue'];
|
- |
|
| 150 |
$json = $this->getDao()->consulter($url);
|
- |
|
| 151 |
$estProjetDefini = false;
|
- |
|
| 152 |
}
|
141 |
$json = $this->getDao()->consulter($url);
|
| 153 |
$tableau = json_decode($json, true);
|
142 |
$tableau = json_decode($json, true);
|
| 154 |
$tableau = $this->traiterParametres($estProjetDefini, $tableau[0]);
|
143 |
$tableau = $this->traiterParametres($tableau[0]);
|
| 155 |
if (isset($this->parametres['squelette']) && $this->parametres['squelette'] === 'lichens') {
|
144 |
if (isset($this->parametres['squelette']) && $this->parametres['squelette'] === 'lichens') {
|
| 156 |
$tableau['type_especes'] = 'liste';
|
145 |
$tableau['type_especes'] = 'liste';
|
| 157 |
$tableau['referentiel'] = 'taxref';
|
146 |
$tableau['referentiel'] = 'taxref';
|
| 158 |
}
|
147 |
}
|
| Line 169... |
Line 158... |
| 169 |
$langue_projet_url = ( isset ( $this->parametres['langue'] ) && $this->parametres['langue'] !== 'fr' ) ? '_' . $this->parametres['langue'] : '';
|
158 |
$langue_projet_url = ( isset ( $this->parametres['langue'] ) && $this->parametres['langue'] !== 'fr' ) ? '_' . $this->parametres['langue'] : '';
|
| 170 |
$tableau['chemin_fichiers'] = sprintf( $this->config['chemins']['baseURLAbsoluDyn'], $this->config['lg']['imgProjet'] . '/' );
|
159 |
$tableau['chemin_fichiers'] = sprintf( $this->config['chemins']['baseURLAbsoluDyn'], $this->config['lg']['imgProjet'] . '/' );
|
| 171 |
return $tableau;
|
160 |
return $tableau;
|
| 172 |
}
|
161 |
}
|
| Line 173... |
Line -... |
| 173 |
|
- |
|
| 174 |
/* Recherche si un projet a des champs de saisie supplémentaire */
|
- |
|
| 175 |
private function rechercherChampsSupp() {
|
- |
|
| 176 |
$retour = array();
|
- |
|
| 177 |
$projet = $this->parametres['projet'];
|
- |
|
| 178 |
$url = $this->config['lg']['celChpSupTpl'] .'?projet=' . $projet . '&langue=' . $this->parametres['langue'];
|
- |
|
| 179 |
$json = $this->getDao()->consulter($url);
|
- |
|
| 180 |
$retour = (array) json_decode($json, true);
|
- |
|
| 181 |
|
- |
|
| 182 |
foreach ( $retour[$projet]['champs-supp'] as $key => $chsup ) {
|
- |
|
| 183 |
|
- |
|
| 184 |
$retour[$projet]['champs-supp'][$key]['name'] = $this->clean_string( $chsup['name'] );
|
- |
|
| 185 |
$retour[$projet]['champs-supp'][$key]['description'] = $this->clean_string( $chsup['description']);
|
- |
|
| 186 |
$retour[$projet]['champs-supp'][$key]['unit'] = $this->clean_string( $chsup['unit'] );
|
- |
|
| 187 |
|
- |
|
| 188 |
if ( isset( $chsup['fieldValues'] ) ) {
|
- |
|
| 189 |
$retour[$projet]['champs-supp'][$key]['fieldValues'] = json_decode( $chsup['fieldValues'], true );
|
- |
|
| 190 |
if ( isset($retour[$projet]['champs-supp'][$key]['fieldValues']['placeholder'] ) ) {
|
- |
|
| 191 |
$retour[$projet]['champs-supp'][$key]['fieldValues']['placeholder'] = $this->clean_string( $retour[$projet]['champs-supp'][$key]['fieldValues']['placeholder'] );
|
- |
|
| 192 |
}
|
- |
|
| 193 |
|
- |
|
| 194 |
if ( isset( $retour[$projet]['champs-supp'][$key]['fieldValues']['listValue'] ) ) {
|
- |
|
| 195 |
foreach( $retour[$projet]['champs-supp'][$key]['fieldValues']['listValue'] as $list_key => $list_value ) {
|
- |
|
| 196 |
$retour[$projet]['champs-supp'][$key]['fieldValues']['listValue'][$list_key] = $this->clean_string( $list_value );
|
- |
|
| 197 |
// Obtenir une liste de valeurs utilisables dans les attributs for id ou name par exemple
|
- |
|
| 198 |
$retour[$projet]['champs-supp'][$key]['fieldValues']['cleanListValue'][] = 'val-' . preg_replace( '/[^A-Za-z0-9_\-]/', '', $this->remove_accents( $list_value ) );
|
- |
|
| 199 |
}
|
- |
|
| 200 |
}
|
- |
|
| 201 |
}
|
- |
|
| 202 |
$retour[$projet]['champs-supp'][$key]['mandatory'] = intval( $chsup['mandatory'] );
|
- |
|
| 203 |
}
|
- |
|
| 204 |
return $retour;
|
- |
|
| 205 |
}
|
- |
|
| 206 |
|
- |
|
| 207 |
private function clean_string( $string ) {
|
- |
|
| 208 |
// les fonctions de base de php ne parviennent pas à une conversion satisfaisante des codes ascii
|
- |
|
| 209 |
// qui ont été générés automatiquement lors de la transmission des chaines en json
|
- |
|
| 210 |
// dans le widget cel manager vers la base
|
- |
|
| 211 |
// Pour les mêmes raisons, @apos@ et @quot@ est une autre astuces utilisée dans ce même widget
|
- |
|
| 212 |
// pour permettre la transmission des apostrophes et guillements sans erreur
|
- |
|
| 213 |
$patterns = array( '/\@apos\@/', '/\@quot\@/', '/u00c0/', '/u00c1/', '/u00c2/', '/u00c3/', '/u00c4/', '/u00c5/', '/u00c6/', '/u00c7/', '/u00c8/', '/u00c9/', '/u00ca/', '/u00cb/', '/u00cc/', '/u00cd/', '/u00ce/', '/u00cf/', '/u00d1/', '/u00d2/', '/u00d3/', '/u00d4/', '/u00d5/', '/u00d6/', '/u00d8/', '/u00d9/', '/u00da/', '/u00db/', '/u00dc/', '/u00dd/', '/u00df/', '/u00e0/', '/u00e1/', '/u00e2/', '/u00e3/', '/u00e4/', '/u00e5/', '/u00e6/', '/u00e7/', '/u00e8/', '/u00e9/', '/u00ea/', '/u00eb/', '/u00ec/', '/u00ed/', '/u00ee/', '/u00ef/', '/u00f0/', '/u00f1/', '/u00f2/', '/u00f3/', '/u00f4/', '/u00f5/', '/u00f6/', '/u00f8/', '/u00f9/', '/u00fa/', '/u00fb/', '/u00fc/', '/u00fd/', '/u00ff/' );
|
- |
|
| 214 |
$replacements = array( ''', '"', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý','ÿ' );
|
- |
|
| 215 |
|
- |
|
| 216 |
$clean_string = preg_replace( $patterns, $replacements, $string );
|
- |
|
| 217 |
|
- |
|
| 218 |
return $clean_string;
|
- |
|
| 219 |
}
|
- |
|
| 220 |
|
162 |
|
| 221 |
// remplace certains parametres définis en bd par les parametres définis dans l'url
|
163 |
// remplace certains parametres définis en bd par les parametres définis dans l'url
|
| 222 |
private function traiterParametres($estProjetDefini, $tableau) {
|
164 |
private function traiterParametres($tableau) {
|
| 223 |
$criteres = array('tag-obs', 'tag-img', 'projet', 'titre', 'logo');
|
- |
|
| 224 |
$criteresProjetNonDefini = array('commune', 'num_nom', 'referentiel');
|
165 |
$criteres = array('tag-obs', 'tag-img', 'projet', 'titre', 'logo');
|
| 225 |
foreach($this->parametres as $nom_critere => $valeur_critere) {
|
- |
|
| 226 |
if (($estProjetDefini == false || $tableau['projet'] == 'base') && in_array($nom_critere, $criteresProjetNonDefini)) {
|
- |
|
| 227 |
$tableau[$nom_critere] = $valeur_critere;
|
166 |
foreach($this->parametres as $nom_critere => $valeur_critere) {
|
| 228 |
} else if (in_array($nom_critere, $criteres)) {
|
167 |
if (in_array($nom_critere, $criteres)) {
|
| 229 |
$tableau[$nom_critere] = $valeur_critere;
|
168 |
$tableau[$nom_critere] = $valeur_critere;
|
| 230 |
}
|
169 |
}
|
| 231 |
}
|
170 |
}
|
| 232 |
return $tableau;
|
171 |
return $tableau;
|
| Line 247... |
Line 186... |
| 247 |
$retour = $this->chargerInfosTaxon( $infos_projets['referentiel'], $infos_projets['especes'] );
|
186 |
$retour = $this->chargerInfosTaxon( $infos_projets['referentiel'], $infos_projets['especes'] );
|
| 248 |
break;
|
187 |
break;
|
| 249 |
case 'referentiel' : break;
|
188 |
case 'referentiel' : break;
|
| 250 |
case 'liste' :
|
189 |
case 'liste' :
|
| 251 |
$referentiel = $infos_projets['referentiel'];
|
190 |
$referentiel = $infos_projets['referentiel'];
|
| 252 |
////////////////////// temporaire test transmission liste taxons
|
- |
|
| 253 |
$retour['taxons'] = $this->recupererListeNomsSci();
|
191 |
$retour['taxons'] = $this->recupererListeNomsSci();
|
| 254 |
break;
|
192 |
break;
|
| 255 |
}
|
193 |
}
|
| 256 |
} else if ( isset( $infos_projets['referentiel'] ) ) {
|
194 |
} else if ( isset( $infos_projets['referentiel'] ) ) {
|
| 257 |
$referentiel = $infos_projets['referentiel'];
|
195 |
$referentiel = $infos_projets['referentiel'];
|
| Line 429... |
Line 367... |
| 429 |
}
|
367 |
}
|
| 430 |
$tableauJs = implode(',', $dimensions);
|
368 |
$tableauJs = implode(',', $dimensions);
|
| 431 |
}
|
369 |
}
|
| 432 |
return $tableauJs;
|
370 |
return $tableauJs;
|
| 433 |
}
|
371 |
}
|
| 434 |
|
- |
|
| 435 |
private function remove_accents($string) {
|
- |
|
| 436 |
if ( !preg_match('/[\x80-\xff]/', $string) ) {
|
- |
|
| 437 |
return $string;
|
- |
|
| 438 |
}
|
- |
|
| 439 |
|
- |
|
| 440 |
$chars = array(
|
- |
|
| 441 |
// Decompositions for Latin-1 Supplement
|
- |
|
| 442 |
chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
|
- |
|
| 443 |
chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
|
- |
|
| 444 |
chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
|
- |
|
| 445 |
chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
|
- |
|
| 446 |
chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
|
- |
|
| 447 |
chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
|
- |
|
| 448 |
chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
|
- |
|
| 449 |
chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
|
- |
|
| 450 |
chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
|
- |
|
| 451 |
chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
|
- |
|
| 452 |
chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
|
- |
|
| 453 |
chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
|
- |
|
| 454 |
chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
|
- |
|
| 455 |
chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
|
- |
|
| 456 |
chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
|
- |
|
| 457 |
chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
|
- |
|
| 458 |
chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
|
- |
|
| 459 |
chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
|
- |
|
| 460 |
chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
|
- |
|
| 461 |
chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
|
- |
|
| 462 |
chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
|
- |
|
| 463 |
chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
|
- |
|
| 464 |
chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
|
- |
|
| 465 |
chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
|
- |
|
| 466 |
chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
|
- |
|
| 467 |
chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
|
- |
|
| 468 |
chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
|
- |
|
| 469 |
chr(195).chr(191) => 'y',
|
- |
|
| 470 |
// Decompositions for Latin Extended-A
|
- |
|
| 471 |
chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
|
- |
|
| 472 |
chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
|
- |
|
| 473 |
chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
|
- |
|
| 474 |
chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
|
- |
|
| 475 |
chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
|
- |
|
| 476 |
chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
|
- |
|
| 477 |
chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
|
- |
|
| 478 |
chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
|
- |
|
| 479 |
chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
|
- |
|
| 480 |
chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
|
- |
|
| 481 |
chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
|
- |
|
| 482 |
chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
|
- |
|
| 483 |
chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
|
- |
|
| 484 |
chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
|
- |
|
| 485 |
chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
|
- |
|
| 486 |
chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
|
- |
|
| 487 |
chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
|
- |
|
| 488 |
chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
|
- |
|
| 489 |
chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
|
- |
|
| 490 |
chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
|
- |
|
| 491 |
chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
|
- |
|
| 492 |
chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
|
- |
|
| 493 |
chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
|
- |
|
| 494 |
chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
|
- |
|
| 495 |
chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
|
- |
|
| 496 |
chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij',
|
- |
|
| 497 |
chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
|
- |
|
| 498 |
chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
|
- |
|
| 499 |
chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
|
- |
|
| 500 |
chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
|
- |
|
| 501 |
chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
|
- |
|
| 502 |
chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
|
- |
|
| 503 |
chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
|
- |
|
| 504 |
chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
|
- |
|
| 505 |
chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
|
- |
|
| 506 |
chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
|
- |
|
| 507 |
chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
|
- |
|
| 508 |
chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
|
- |
|
| 509 |
chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
|
- |
|
| 510 |
chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
|
- |
|
| 511 |
chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
|
- |
|
| 512 |
chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe',
|
- |
|
| 513 |
chr(197).chr(148) => 'R', chr(197).chr(149) => 'r',
|
- |
|
| 514 |
chr(197).chr(150) => 'R', chr(197).chr(151) => 'r',
|
- |
|
| 515 |
chr(197).chr(152) => 'R', chr(197).chr(153) => 'r',
|
- |
|
| 516 |
chr(197).chr(154) => 'S', chr(197).chr(155) => 's',
|
- |
|
| 517 |
chr(197).chr(156) => 'S', chr(197).chr(157) => 's',
|
- |
|
| 518 |
chr(197).chr(158) => 'S', chr(197).chr(159) => 's',
|
- |
|
| 519 |
chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
|
- |
|
| 520 |
chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
|
- |
|
| 521 |
chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
|
- |
|
| 522 |
chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
|
- |
|
| 523 |
chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
|
- |
|
| 524 |
chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
|
- |
|
| 525 |
chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
|
- |
|
| 526 |
chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
|
- |
|
| 527 |
chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
|
- |
|
| 528 |
chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
|
- |
|
| 529 |
chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
|
- |
|
| 530 |
chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
|
- |
|
| 531 |
chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
|
- |
|
| 532 |
chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
|
- |
|
| 533 |
chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
|
- |
|
| 534 |
chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
|
- |
|
| 535 |
);
|
- |
|
| 536 |
|
- |
|
| 537 |
$string = strtr($string, $chars);
|
- |
|
| 538 |
|
- |
|
| 539 |
return $string;
|
- |
|
| 540 |
}
|
- |
|
| 541 |
|
- |
|
| 542 |
}
|
372 |
}
|
| 543 |
?>
|
373 |
?>
|