Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1475 → Rev 1476

/trunk/widget/modules/saisie/Saisie.php
24,10 → 24,11
const PROJET_DEFAUT = 'defaut';
const WS_SAISIE = "CelWidgetSaisie";
const WS_NOM = "noms";
const NS_PROJET = "bdtfx";
const NS_PROJET_VERSION = "1.01";
private $NS_PROJET_VERSION = "1.01";
const EFLORE_API_VERSION = "0.1";
private $NS_PROJET = "bdtfx";
 
private $projetsVersions = array();
private $projet = null;
private $configProjet = null;
 
40,6 → 41,7
 
$this->projet = isset($projet) ? $projet : self::PROJET_DEFAUT;
$this->chargerConfigProjet();
$this->chargerProjetsVersion();
 
$service = isset($service) ? $service : 'widget';
$methode = $this->traiterNomMethodeExecuter($service);
80,8 → 82,23
$this->debug[] = "Le fichier ini '$fichier_config' du projet n'existe pas.";
}
}
private function chargerProjetsVersion() {
foreach ($this->configProjet as $config => $valeur) {
if(strstr($config,'.version')) {
$this->projetsVersions[str_replace('.version', '', $config)] = $valeur;
}
}
}
 
public function executerWidget() {
$referentiel_impose = false;
if(isset($_GET['referentiel']) && $_GET['referentiel'] != '') {
$this->NS_PROJET = isset($_GET['referentiel']) && $_GET['referentiel'] != '' ? $_GET['referentiel'] : $this->NS_PROJET;
$this->NS_PROJET_VERSION = $this->projetsVersions[$this->NS_PROJET];
$referentiel_impose = true;
}
$widget['squelette'] = $this->projet;
$widget['donnees'] = array();
$widget['donnees']['url_base'] = sprintf($this->config['chemins']['baseURLAbsoluDyn'], '');
90,10 → 107,15
// cas du projet par défaut ou bien d'un projet n'ayant pas de squelette spécifique
if ($this->projet == 'defaut' || !$this->projetASquelette()) {
$urlWsNsTpl = $this->config['chemins']['baseURLServicesEfloreTpl'];
$urlWsNs = sprintf($urlWsNsTpl, self::EFLORE_API_VERSION, self::NS_PROJET, self::WS_NOM);
$urlWsNs = sprintf($urlWsNsTpl, self::EFLORE_API_VERSION, $this->NS_PROJET, self::WS_NOM);
$urlWsNsSansRef = sprintf($urlWsNsTpl, self::EFLORE_API_VERSION, '{referentiel}', self::WS_NOM);
$widget['donnees']['url_ws_autocompletion_ns'] = $urlWsNs;
$widget['donnees']['ns_referentiel'] = self::NS_PROJET.':'.self::NS_PROJET_VERSION;
$widget['donnees']['ns_version'] = self::NS_PROJET_VERSION;
$widget['donnees']['url_ws_autocompletion_ns_tpl'] = $urlWsNsSansRef;
$widget['donnees']['ns_referentiel'] = $this->NS_PROJET.':'.$this->NS_PROJET_VERSION;
$widget['donnees']['ns_projet'] = $this->NS_PROJET;
$widget['donnees']['ns_version'] = $this->NS_PROJET_VERSION;
$widget['donnees']['referentiel_impose'] = $referentiel_impose;
$widget['donnees']['projets_versions'] = $this->projetsVersions;
if(self::especeEstImposee()) {
$nom = self::executerChargementInfosTaxon($_GET['num_nom']);
$widget['donnees']['espece_imposee'] = true;
180,7 → 202,7
}
private function executerChargementInfosTaxon($num_nom) {
$url_service_infos = sprintf($this->config['chemins']['infosTaxonUrl'], $num_nom);
$url_service_infos = sprintf($this->config['chemins']['infosTaxonUrl'], $this->NS_PROJET, $num_nom);
$infos = json_decode(file_get_contents($url_service_infos));
$resultat = array();
if(isset($infos) && !empty($infos)) {