Subversion Repositories eFlore/Applications.cel

Rev

Rev 3257 | Rev 3271 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3257 Rev 3260
Line 89... Line 89...
89
		$contenu = ''; //print_r($retour);exit;
89
		$contenu = ''; //print_r($retour);exit;
90
		if (is_null($retour)) {
90
		if (is_null($retour)) {
91
			$this->messages[] = 'La ressource demandée a retourné une valeur nulle.';
91
			$this->messages[] = 'La ressource demandée a retourné une valeur nulle.';
92
		} else {
92
		} else {
93
			if (isset($retour['donnees'])) {
93
			if (isset($retour['donnees'])) {
-
 
94
				$retour['donnees']['conf_mode'] = $this->config['parametres']['modeServeur'];
94
				$retour['donnees']['prod'] = ($this->config['parametres']['modeServeur'] === 'prod');
95
				$retour['donnees']['prod'] = ($this->config['parametres']['modeServeur'] === 'prod');
95
				$retour['donnees']['bar'] = $this->bar;
96
				$retour['donnees']['bar'] = $this->bar;
96
				$retour['donnees']['url_base'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], '');
97
				$retour['donnees']['url_base'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], '');
97
				$retour['donnees']['url_ws_annuaire'] = sprintf($this->config['chemins']['baseURLServicesAnnuaireTpl'], 'utilisateur/identite-par-courriel/');
98
				$retour['donnees']['url_ws_annuaire'] = sprintf($this->config['chemins']['baseURLServicesAnnuaireTpl'], 'utilisateur/identite-par-courriel/');
98
				$retour['donnees']['url_ws_saisie'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], self::WS_SAISIE);
99
				$retour['donnees']['url_ws_saisie'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], self::WS_SAISIE);
99
				$retour['donnees']['url_ws_obs'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], self::WS_OBS);
100
				$retour['donnees']['url_ws_obs'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], self::WS_OBS);
100
				$retour['donnees']['url_ws_upload'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], self::WS_UPLOAD);
101
				$retour['donnees']['url_ws_upload'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], self::WS_UPLOAD);
101
				$retour['donnees']['authTpl'] = $this->config['manager']['authTpl'].'?projet='.$this->parametres['projet'].'&langue='.$this->parametres['langue'];
102
				$retour['donnees']['authTpl'] = $this->config['manager']['authTpl'].'?projet='.$this->parametres['projet'].'&langue='.$this->parametres['langue'];
102
				$retour['donnees']['mode'] = $mode;
103
				$retour['donnees']['mode'] = $mode;
-
 
104
				if( isset( $this->parametres['squelette'] ) ) {
-
 
105
					$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS. $this->parametres['squelette'].'.tpl.html';
-
 
106
				} else {
103
				$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.$retour['squelette'].'.tpl.html';
107
					$squelette = dirname(__FILE__).self::DS.'squelettes'.self::DS.$retour['squelette'].'.tpl.html';
-
 
108
				}
104
				$contenu = $this->traiterSquelettePhp($squelette, $retour['donnees']);
109
				$contenu = $this->traiterSquelettePhp($squelette, $retour['donnees']);
105
			} else {
110
			} else {
106
				$this->messages[] = 'Les données à transmettre au squelette sont nulles.';
111
				$this->messages[] = 'Les données à transmettre au squelette sont nulles.';
107
			}
112
			}
108
		}
113
		}
Line 220... Line 225...
220
 
225
 
221
	private function rechercherInfosEspeces( $infos_projets ) { //print_r($infos_projets);exit;
226
	private function rechercherInfosEspeces( $infos_projets ) { //print_r($infos_projets);exit;
222
		$retour = array();
227
		$retour = array();
223
		$referentiel = $infos_projets['referentiel'];
228
		$referentiel = $infos_projets['referentiel'];
224
		$urlWsNsTpl = $this->config['chemins']['baseURLServicesEfloreTpl'];
229
		$urlWsNsTpl = $this->config['chemins']['baseURLServicesEfloreTpl'];
225
		$urlWsNs = sprintf( $urlWsNsTpl, self::EFLORE_API_VERSION, $referentiel, self::WS_NOM );
230
		$retour['url_ws_autocompletion_ns'] = sprintf( $urlWsNsTpl, self::EFLORE_API_VERSION, $referentiel, self::WS_NOM );;
226
		$urlWsNsSansRef = sprintf( $urlWsNsTpl, self::EFLORE_API_VERSION, '{referentiel}', self::WS_NOM );
-
 
227
		$retour['url_ws_autocompletion_ns'] = $urlWsNs;
-
 
228
		$retour['url_ws_autocompletion_ns_tpl'] = $urlWsNsSansRef;
231
		$retour['url_ws_autocompletion_ns_tpl'] = sprintf( $urlWsNsTpl, self::EFLORE_API_VERSION, '{referentiel}', self::WS_NOM );
Line 229... Line 232...
229
		$retour['ns_referentiel'] = $referentiel;
232
		$retour['ns_referentiel'] = $referentiel;
Line 230... Line 233...
230
 
233
 
Line 355... Line 358...
355
	 */
358
	 */
356
	protected function recupererListeTaxon() {
359
	protected function recupererListeTaxon() {
357
		$taxons = array();
360
		$taxons = array();
358
		$langue_projet_url = ( isset ( $this->parametres['langue'] ) && $this->parametres['langue'] !== 'fr' ) ? '_' . $this->parametres['langue'] : '';
361
		$langue_projet_url = ( isset ( $this->parametres['langue'] ) && $this->parametres['langue'] !== 'fr' ) ? '_' . $this->parametres['langue'] : '';
359
		$chemin_images = dirname(__FILE__) . self::DS . '..' . self::DS . 'manager' . self::DS . 'squelettes' . self::DS . 'img' . self::DS . 'images_projets' . self::DS;
362
		$chemin_images = dirname(__FILE__) . self::DS . '..' . self::DS . 'manager' . self::DS . 'squelettes' . self::DS . 'img' . self::DS . 'images_projets' . self::DS;
360
		$fichier_csv = $chemin_images . $this->parametres['projet'] . $langue_projet_url . self::DS . 'especes.csv'; ;
363
		$fichier_csv = $chemin_images . $this->parametres['projet'] . $langue_projet_url . self::DS . 'especes.csv';
Line 361... Line 364...
361
 
364
 
362
		if ( file_exists( $fichier_csv ) && is_readable( $fichier_csv ) ) {
365
		if ( file_exists( $fichier_csv ) && is_readable( $fichier_csv ) ) {
363
			$taxons = $this->decomposerFichierCsv( $fichier_csv );
366
			$taxons = $this->decomposerFichierCsv( $fichier_csv );
364
		} else {
367
		} else {
Line 400... Line 403...
400
			$dimensions = array();
403
			$dimensions = array();
401
			foreach ($array as $key => $value) {
404
			foreach ($array as $key => $value) {
402
				if (is_array($value)) {
405
				if (is_array($value)) {
403
					$dimensions[$i] = array2js($value,$show_keys);
406
					$dimensions[$i] = array2js($value,$show_keys);
404
					if ($show_keys) {
407
					if ($show_keys) {
405
						$dimensions[$i] = '"'.$key.'":'.$dimensions[$i];
408
						$dimensions[$i] = '\"'.$key.'\":'.$dimensions[$i];
406
					}
409
					}
407
				} else {
410
				} else {
408
					$dimensions[$i] = '"'.addslashes($value).'"';
411
					$dimensions[$i] = '\"'.addslashes($value).'\"';
409
					if ($show_keys) {
412
					if ($show_keys) {
410
						$dimensions[$i] = '"'.$key.'":'.$dimensions[$i];
413
						$dimensions[$i] = '\"'.$key.'\":'.$dimensions[$i];
411
					}
414
					}
412
				}
415
				}
413
				if ($i == 0) {
416
				if ($i == 0) {
414
					$dimensions[$i] = '{'.$dimensions[$i];
417
					$dimensions[$i] = '{'.$dimensions[$i];
415
				}
418
				}
Line 424... Line 427...
424
	}
427
	}
Line 425... Line 428...
425
 
428
 
426
	private function remove_accents($string) {
429
	private function remove_accents($string) {
427
	    if ( !preg_match('/[\x80-\xff]/', $string) )
430
	    if ( !preg_match('/[\x80-\xff]/', $string) )
428
	        return $string;
431
	        return $string;
429
	        
432
 
430
	        $chars = array(
433
	        $chars = array(
431
	            // Decompositions for Latin-1 Supplement
434
	            // Decompositions for Latin-1 Supplement
432
	            chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
435
	            chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
433
	            chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
436
	            chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',