| 3 | 
           jpm | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
           /**
  | 
        
        
            | 
            | 
           3 | 
           * Description :
  | 
        
        
            | 
            | 
           4 | 
           * Classe MetaDonnees.php fournit des informations sur le projet.
  | 
        
        
           | 8 | 
           jpm | 
           5 | 
           * Le but étant de fournir un ensemble minimal d'information comprenant :
  | 
        
        
           | 3 | 
           jpm | 
           6 | 
           * la version, la langue, le nom, le créateur et l'éditeur du projet.
  | 
        
        
            | 
            | 
           7 | 
           * Si l'url finit par /meta-donnees on retourne une liste de termes (seulement les 100 premières par défaut).
  | 
        
        
            | 
            | 
           8 | 
           * L'url peut contenir des paramètres optionnels passés après le ? : /meta-donnees?param1=val1¶m2=val2&...
  | 
        
        
           | 8 | 
           jpm | 
           9 | 
           *
  | 
        
        
            | 
            | 
           10 | 
           * Les paramètres de requête disponibles sont : masque, , recherche,
  | 
        
        
           | 3 | 
           jpm | 
           11 | 
           * distinct, retour.format, navigation.depart et navigation.limite.
  | 
        
        
           | 8 | 
           jpm | 
           12 | 
           *
  | 
        
        
           | 3 | 
           jpm | 
           13 | 
           * Encodage en entrée : utf8
  | 
        
        
            | 
            | 
           14 | 
           * Encodage en sortie : utf8
  | 
        
        
            | 
            | 
           15 | 
           * @package framework-v3
  | 
        
        
            | 
            | 
           16 | 
           * @author Jennifer Dhé <jennifer.dhe@tela-botanica.org>
  | 
        
        
            | 
            | 
           17 | 
           * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
  | 
        
        
            | 
            | 
           18 | 
           * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
  | 
        
        
            | 
            | 
           19 | 
           * @version 1.0
  | 
        
        
            | 
            | 
           20 | 
           * @copyright 1999-${year} Tela Botanica (accueil@tela-botanica.org)
  | 
        
        
            | 
            | 
           21 | 
           */
  | 
        
        
            | 
            | 
           22 | 
              | 
        
        
            | 
            | 
           23 | 
           class MetaDonnees extends Commun {
  | 
        
        
           | 8 | 
           jpm | 
           24 | 
              | 
        
        
           | 3 | 
           jpm | 
           25 | 
           	protected $requete_champ = '*';
  | 
        
        
           | 1300 | 
           delphine | 
           26 | 
           	protected $requete_condition = [];
  | 
        
        
           | 3 | 
           jpm | 
           27 | 
           	protected $retour_format = 'max';
  | 
        
        
            | 
            | 
           28 | 
           	protected $table_retour = array();
  | 
        
        
            | 
            | 
           29 | 
           	protected $format_reponse = 'metaDonnees';
  | 
        
        
            | 
            | 
           30 | 
           	protected $table_ressources;
  | 
        
        
           | 837 | 
           raphael | 
           31 | 
           	static $cache_ontologies = array();
  | 
        
        
           | 8 | 
           jpm | 
           32 | 
              | 
        
        
            | 
            | 
           33 | 
              | 
        
        
           | 3 | 
           jpm | 
           34 | 
           	public function consulter($ressources, $parametres) {
  | 
        
        
           | 236 | 
           delphine | 
           35 | 
           		$this->ressources = $ressources;
  | 
        
        
            | 
            | 
           36 | 
           		$this->parametres = $parametres;
  | 
        
        
           | 536 | 
           gduche | 
           37 | 
           		$this->service = 'meta-donnees';
  | 
        
        
           | 278 | 
           jpm | 
           38 | 
              | 
        
        
           | 236 | 
           delphine | 
           39 | 
           		$resultats = '';
  | 
        
        
           | 3 | 
           jpm | 
           40 | 
           		// on traite en premier la version dans le cas ou un langage est demandé pr une version
  | 
        
        
           | 236 | 
           delphine | 
           41 | 
           		$this->traiterVersionProjet();
  | 
        
        
           | 3 | 
           jpm | 
           42 | 
           		$this->traiterParametres($parametres);
  | 
        
        
            | 
            | 
           43 | 
           		$this->traiterRessources($ressources);
  | 
        
        
            | 
            | 
           44 | 
           		if ($this->corps_http == '' && $this->entete_http == '') {
  | 
        
        
           | 8 | 
           jpm | 
           45 | 
           			$requete_meta  = $this->assemblerLaRequete();
  | 
        
        
            | 
            | 
           46 | 
           			$resultat_meta = $this->getBdd()->recupererTous($requete_meta);
  | 
        
        
           | 236 | 
           delphine | 
           47 | 
           			$resultats = $this->formerResultat($resultat_meta, $requete_meta);
  | 
        
        
           | 3 | 
           jpm | 
           48 | 
           		}
  | 
        
        
           | 236 | 
           delphine | 
           49 | 
           		return $resultats;
  | 
        
        
           | 3 | 
           jpm | 
           50 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           51 | 
              | 
        
        
           | 236 | 
           delphine | 
           52 | 
           	public function formerResultat($resultat_meta, $requete_meta) {
  | 
        
        
           | 3 | 
           jpm | 
           53 | 
           		if ($resultat_meta == '') {
  | 
        
        
            | 
            | 
           54 | 
           			$e = 'La requête formée comporte une erreur!';
  | 
        
        
            | 
            | 
           55 | 
           			$this->renvoyerErreur(RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE,$e);
  | 
        
        
            | 
            | 
           56 | 
           			Debug::printr($requete);
  | 
        
        
            | 
            | 
           57 | 
           		} elseif ($resultat_meta) {
  | 
        
        
           | 236 | 
           delphine | 
           58 | 
           			$resultat_formate = $this->retournerResultatFormate($resultat_meta);
  | 
        
        
           | 3 | 
           jpm | 
           59 | 
           		} else {
  | 
        
        
            | 
            | 
           60 | 
           			$m = "Données introuvables dans la base $this->table";
  | 
        
        
            | 
            | 
           61 | 
           			$this->renvoyerErreur(RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE, $m);
  | 
        
        
            | 
            | 
           62 | 
           			Debug::printr($requete_meta);
  | 
        
        
            | 
            | 
           63 | 
           		}
  | 
        
        
            | 
            | 
           64 | 
           		return $resultat_formate;
  | 
        
        
            | 
            | 
           65 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           66 | 
              | 
        
        
           | 3 | 
           jpm | 
           67 | 
           //--------------------FONCTIONS TRAITEMENT DES PARAMETRES---------------------------------------------------------------
  | 
        
        
           | 8 | 
           jpm | 
           68 | 
              | 
        
        
           | 3 | 
           jpm | 
           69 | 
           	public function traiterParametres($parametres) {
  | 
        
        
            | 
            | 
           70 | 
           		if (isset($parametres) && !empty($parametres)) {
  | 
        
        
            | 
            | 
           71 | 
           			foreach ($parametres as $param => $val) {
  | 
        
        
           | 8 | 
           jpm | 
           72 | 
           				switch ($param) {
  | 
        
        
           | 239 | 
           delphine | 
           73 | 
           					case 'version.projet' : $this->ajouterFiltreVersion($val);	break;
  | 
        
        
           | 8 | 
           jpm | 
           74 | 
           					case 'retour.langue' : $this->rechercherLangueDispo($val);	break;
  | 
        
        
            | 
            | 
           75 | 
           					case 'retour.format' : $this->retour_format = $val;			break;
  | 
        
        
            | 
            | 
           76 | 
           					default				 :
  | 
        
        
           | 3 | 
           jpm | 
           77 | 
           						$e = 'Erreur dans les paramètres de recherche de votre requête : </br> Le paramètre " '
  | 
        
        
            | 
            | 
           78 | 
           							.$param.' " n\'existe pas.';
  | 
        
        
            | 
            | 
           79 | 
           						$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
  | 
        
        
            | 
            | 
           80 | 
           						break;
  | 
        
        
            | 
            | 
           81 | 
           				}
  | 
        
        
            | 
            | 
           82 | 
           			}
  | 
        
        
            | 
            | 
           83 | 
           		}
  | 
        
        
            | 
            | 
           84 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           85 | 
              | 
        
        
           | 239 | 
           delphine | 
           86 | 
           	/** Détermine quelles métadonnées doivent etre retournées :
  | 
        
        
            | 
            | 
           87 | 
           	*  - "*" : (/#projet/* /meta-donnees) Renvoi les meta-données de toutes les versions du projet
  | 
        
        
            | 
            | 
           88 | 
           	*  - "numero de la version" : (/#projet/2.00/meta-donnees) Renvoi les meta-données de la version 2.00 du projet
  | 
        
        
            | 
            | 
           89 | 
           	*  - non renseignée : (/#projet/meta-donnees) Renvoi les meta-données de la dernière version du projet
  | 
        
        
            | 
            | 
           90 | 
           	*  Cette info est stockée dans par la classe RestServeur dans la variable $ressources ($ressources[0])
  | 
        
        
            | 
            | 
           91 | 
           	*/
  | 
        
        
            | 
            | 
           92 | 
           	public function ajouterFiltreVersion($val) {
  | 
        
        
            | 
            | 
           93 | 
           		if (preg_match('/(?:[0-9]+(?:_|[.])[0-9]+|[*]| )/', $val)) {
  | 
        
        
            | 
            | 
           94 | 
           			$this->version_projet = ($val == ' ') ? '+' : $val;
  | 
        
        
           | 3 | 
           jpm | 
           95 | 
           		}
  | 
        
        
           | 239 | 
           delphine | 
           96 | 
           		switch ($this->version_projet) {
  | 
        
        
            | 
            | 
           97 | 
           			case '+' :
  | 
        
        
            | 
            | 
           98 | 
           				$this->requete_condition[] = 'version = (SELECT MAX(version) FROM '.Config::get('bdd_table_meta').')';
  | 
        
        
            | 
            | 
           99 | 
           				break;
  | 
        
        
            | 
            | 
           100 | 
           			case '*' :
  | 
        
        
            | 
            | 
           101 | 
           				break;
  | 
        
        
            | 
            | 
           102 | 
           			default :
  | 
        
        
            | 
            | 
           103 | 
           				if (is_numeric($this->version_projet)) {
  | 
        
        
            | 
            | 
           104 | 
           					$versions_dispo = $this->rechercherVersionsDispos();
  | 
        
        
            | 
            | 
           105 | 
           					if (in_array($val, $versions_dispo)) {
  | 
        
        
            | 
            | 
           106 | 
           						$this->requete_condition[] = 'version = '.$this->getBdd()->proteger($val);
  | 
        
        
            | 
            | 
           107 | 
           					} else {
  | 
        
        
            | 
            | 
           108 | 
           						$e = 'La version demandée n\'existe pas actuellement. </br>Les versions disponibles sont : '
  | 
        
        
            | 
            | 
           109 | 
           						.implode(', ', $versions_dispo);
  | 
        
        
            | 
            | 
           110 | 
           						$this->renvoyerErreur(RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE, $e);
  | 
        
        
           | 3 | 
           jpm | 
           111 | 
           					}
  | 
        
        
           | 239 | 
           delphine | 
           112 | 
           				}
  | 
        
        
            | 
            | 
           113 | 
           				break;
  | 
        
        
           | 3 | 
           jpm | 
           114 | 
           		}
  | 
        
        
            | 
            | 
           115 | 
           	}
  | 
        
        
           | 278 | 
           jpm | 
           116 | 
              | 
        
        
           | 3 | 
           jpm | 
           117 | 
           	/**
  | 
        
        
           | 239 | 
           delphine | 
           118 | 
           	* Vérifie que le numéro de la version passée en paramètre correspond à une version existante.
  | 
        
        
            | 
            | 
           119 | 
           	* Si oui remplit la condition de la requete SQL
  | 
        
        
            | 
            | 
           120 | 
           	*/
  | 
        
        
            | 
            | 
           121 | 
           	public function rechercherVersionsDispos() {
  | 
        
        
           | 236 | 
           delphine | 
           122 | 
           		$val = str_replace('_', '.', $this->version_projet);
  | 
        
        
           | 3 | 
           jpm | 
           123 | 
           		$req_version = 'SELECT version FROM '.Config::get('bdd_table_meta');
  | 
        
        
            | 
            | 
           124 | 
           		$res_version = $this->getBdd()->recupererTous($req_version);
  | 
        
        
            | 
            | 
           125 | 
           		foreach ($res_version as $version) {
  | 
        
        
            | 
            | 
           126 | 
           			$versions_dispo[] = $version['version'];
  | 
        
        
            | 
            | 
           127 | 
           		}
  | 
        
        
           | 239 | 
           delphine | 
           128 | 
           		return $versions_dispo;
  | 
        
        
           | 3 | 
           jpm | 
           129 | 
           	}
  | 
        
        
           | 278 | 
           jpm | 
           130 | 
              | 
        
        
           | 3 | 
           jpm | 
           131 | 
           	/** Vérifie que les meta-donnees existe dans la langue passée en paramètre, Si oui remplit la condition de la requete SQL */
  | 
        
        
            | 
            | 
           132 | 
           	public function rechercherLangueDispo($val) {
  | 
        
        
            | 
            | 
           133 | 
           		//on recherche les langues_meta disponibles pour la version demandée : (d'ou ajout de la condition)
  | 
        
        
            | 
            | 
           134 | 
           		$req_langue = 'SELECT langue_meta FROM '
  | 
        
        
           | 239 | 
           delphine | 
           135 | 
           		.Config::get('bdd_table_meta')
  | 
        
        
            | 
            | 
           136 | 
           		.$this->formerRequeteCondition();
  | 
        
        
           | 3 | 
           jpm | 
           137 | 
           		$res_langue = $this->getBdd()->recupererTous($req_langue);
  | 
        
        
            | 
            | 
           138 | 
           		foreach ($res_langue as $langue) {
  | 
        
        
            | 
            | 
           139 | 
           			$langue_dispo[] = $langue['langue_meta'];
  | 
        
        
            | 
            | 
           140 | 
           		}
  | 
        
        
            | 
            | 
           141 | 
           		if (in_array($val, $langue_dispo)) {
  | 
        
        
           | 8 | 
           jpm | 
           142 | 
           			$this->requete_condition[] = 'langue_meta = '.$this->getBdd()->proteger($val);
  | 
        
        
           | 3 | 
           jpm | 
           143 | 
           		} else {
  | 
        
        
            | 
            | 
           144 | 
           			$e = 'La langue demandée n\'existe pas actuellement. </br>Les langues disponibles sont : '
  | 
        
        
           | 239 | 
           delphine | 
           145 | 
           			.implode($langue_dispo);
  | 
        
        
           | 3 | 
           jpm | 
           146 | 
           			$this->renvoyerErreur(RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE, $e);
  | 
        
        
            | 
            | 
           147 | 
           		}
  | 
        
        
            | 
            | 
           148 | 
           	}
  | 
        
        
           | 239 | 
           delphine | 
           149 | 
           //----------------------FONCTIONS TRAITEMENT DES RESSOURCES-------------------------------------------------------------
  | 
        
        
           | 8 | 
           jpm | 
           150 | 
              | 
        
        
           | 239 | 
           delphine | 
           151 | 
           	public function traiterRessources($ressources) {
  | 
        
        
            | 
            | 
           152 | 
           		// /meta-donnees (liste des meta-données. Toutes les info de la table sont affichées) ou /meta-donnees/#champ
  | 
        
        
            | 
            | 
           153 | 
           		if (isset($ressources) && !empty($ressources)) {
  | 
        
        
            | 
            | 
           154 | 
           			$this->table_ressources = $ressources;
  | 
        
        
            | 
            | 
           155 | 
           			if (isset($ressources) && !empty($ressources)) {
  | 
        
        
            | 
            | 
           156 | 
           				$this->format_reponse = 'metaDonnees/champ';
  | 
        
        
            | 
            | 
           157 | 
           			}
  | 
        
        
            | 
            | 
           158 | 
           		}
  | 
        
        
            | 
            | 
           159 | 
           	}
  | 
        
        
            | 
            | 
           160 | 
              | 
        
        
           | 3 | 
           jpm | 
           161 | 
           //------------------------------Fonction d'assemblage de la requete------------------------------------------------------
  | 
        
        
           | 8 | 
           jpm | 
           162 | 
              | 
        
        
           | 3 | 
           jpm | 
           163 | 
           	public function assemblerLaRequete() {
  | 
        
        
           | 239 | 
           delphine | 
           164 | 
           		$req = 'SELECT '.$this->requete_champ.' FROM '.Config::get('bdd_table_meta').$this->formerRequeteCondition();
  | 
        
        
            | 
            | 
           165 | 
           		return $req;
  | 
        
        
            | 
            | 
           166 | 
           	}
  | 
        
        
           | 278 | 
           jpm | 
           167 | 
              | 
        
        
           | 239 | 
           delphine | 
           168 | 
           	public  function formerRequeteCondition() {
  | 
        
        
           | 3 | 
           jpm | 
           169 | 
           		$condition = '';
  | 
        
        
           | 239 | 
           delphine | 
           170 | 
           		if ($this->requete_condition != null) {
  | 
        
        
           | 3 | 
           jpm | 
           171 | 
           			$condition = ' WHERE '.implode(' AND ', $this->requete_condition);
  | 
        
        
           | 8 | 
           jpm | 
           172 | 
           		}
  | 
        
        
           | 239 | 
           delphine | 
           173 | 
           		return $condition;
  | 
        
        
           | 3 | 
           jpm | 
           174 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           175 | 
              | 
        
        
           | 3 | 
           jpm | 
           176 | 
           //--------------------------------------Fonction de formatage des resultats ---------------------------------------------
  | 
        
        
           | 8 | 
           jpm | 
           177 | 
              | 
        
        
           | 236 | 
           delphine | 
           178 | 
           	public function retournerResultatFormate($resultat) {
  | 
        
        
           | 3 | 
           jpm | 
           179 | 
           		switch ($this->format_reponse) {
  | 
        
        
            | 
            | 
           180 | 
           			case 'metaDonnees/champ' : $reponse = $this->formaterMetaDonneesChamp($resultat);  	break;
  | 
        
        
            | 
            | 
           181 | 
           			case 'metaDonnees'		 : $reponse = $this->formaterMetaDonnees($resultat); 		break;
  | 
        
        
            | 
            | 
           182 | 
           			default					 : 															break;
  | 
        
        
            | 
            | 
           183 | 
           		}
  | 
        
        
           | 236 | 
           delphine | 
           184 | 
           		return $reponse;
  | 
        
        
           | 8 | 
           jpm | 
           185 | 
           	}
  | 
        
        
            | 
            | 
           186 | 
              | 
        
        
           | 3 | 
           jpm | 
           187 | 
           //--------------------------------------Fonction de formatage des resultats de /metaDonnees/----------------------------
  | 
        
        
           | 8 | 
           jpm | 
           188 | 
              | 
        
        
           | 3 | 
           jpm | 
           189 | 
           	public function formaterMetaDonnees($resultat) {
  | 
        
        
            | 
            | 
           190 | 
           		foreach ($resultat as $version) {
  | 
        
        
            | 
            | 
           191 | 
           			foreach ($version as $key => $val) {
  | 
        
        
            | 
            | 
           192 | 
           				if ($val != '') {
  | 
        
        
            | 
            | 
           193 | 
           					$this->afficherDonnees($key, $val);
  | 
        
        
           | 8 | 
           jpm | 
           194 | 
           				}
  | 
        
        
           | 3 | 
           jpm | 
           195 | 
           			}
  | 
        
        
            | 
            | 
           196 | 
           			if ($this->retour_format == 'max' && $this->version_projet == '*') {
  | 
        
        
            | 
            | 
           197 | 
           				$this->table_retour['href'] = Config::get('url_service_base').Config::get('nom_projet')
  | 
        
        
           | 236 | 
           delphine | 
           198 | 
           											 .'/'.$version['version'].'/'.$this->serviceNom;
  | 
        
        
           | 8 | 
           jpm | 
           199 | 
           			}
  | 
        
        
           | 3 | 
           jpm | 
           200 | 
           			$table[] = $this->table_retour;
  | 
        
        
            | 
            | 
           201 | 
           			$this->table_retour = array();
  | 
        
        
            | 
            | 
           202 | 
           		}
  | 
        
        
            | 
            | 
           203 | 
           		return $table;
  | 
        
        
            | 
            | 
           204 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           205 | 
              | 
        
        
            | 
            | 
           206 | 
              | 
        
        
           | 3 | 
           jpm | 
           207 | 
           	public function afficherDonnees($key, $valeur) {
  | 
        
        
            | 
            | 
           208 | 
           		if ($valeur != '') {
  | 
        
        
            | 
            | 
           209 | 
           			$tab = array();
  | 
        
        
            | 
            | 
           210 | 
           			if ($this->retour_format == 'min') {
  | 
        
        
            | 
            | 
           211 | 
           				if (in_array($key, array('editeur','createurs',	'contributeurs','couverture_spatiale','couverture_temporelle'))) {
  | 
        
        
           | 8 | 
           jpm | 
           212 | 
           					//Pour les données comprenant plusieurs infos (...=...,...=...;...)
  | 
        
        
           | 3 | 
           jpm | 
           213 | 
           					$tab = $this->recupererTableauResultat($valeur);
  | 
        
        
            | 
            | 
           214 | 
           					$this->afficherConcatenationValeur($key, $tab);
  | 
        
        
            | 
            | 
           215 | 
           				} else {
  | 
        
        
           | 8 | 
           jpm | 
           216 | 
           					$this->table_retour[$key] = trim($valeur);
  | 
        
        
           | 3 | 
           jpm | 
           217 | 
           				}
  | 
        
        
            | 
            | 
           218 | 
           			} else {
  | 
        
        
           | 8 | 
           jpm | 
           219 | 
           				if (in_array($key, array('editeur','createurs',	'contributeurs','couverture_spatiale','couverture_temporelle','langue','langue_meta'))) {
  | 
        
        
            | 
            | 
           220 | 
           					$tab = $this->recupererTableauResultat($valeur);
  | 
        
        
           | 3 | 
           jpm | 
           221 | 
           					$this->afficherConcatenationValeur($key, $tab);
  | 
        
        
            | 
            | 
           222 | 
           					$this->afficherDonneesMax($key,$valeur,$tab);
  | 
        
        
            | 
            | 
           223 | 
           				} else {
  | 
        
        
            | 
            | 
           224 | 
           					$this->table_retour[$key] = trim($valeur);
  | 
        
        
           | 8 | 
           jpm | 
           225 | 
           				}
  | 
        
        
           | 3 | 
           jpm | 
           226 | 
           			}
  | 
        
        
            | 
            | 
           227 | 
           		}
  | 
        
        
            | 
            | 
           228 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           229 | 
              | 
        
        
           | 3 | 
           jpm | 
           230 | 
           	/**
  | 
        
        
            | 
            | 
           231 | 
           	 * Recupère à partir de la valeur du champ les différentes informations séparées par ';' (stocke ds un tableau)
  | 
        
        
            | 
            | 
           232 | 
           	 * pour éditeurs, créateurs, contributeurs,...
  | 
        
        
            | 
            | 
           233 | 
           	 * (ex : nom=Tela Botanica,guid=urn:lsid:tela-botanica.org,courriel=accueil@tela-botanica.org,...
  | 
        
        
           | 8 | 
           jpm | 
           234 | 
           	 */
  | 
        
        
           | 3 | 
           jpm | 
           235 | 
           	public function recupererTableauResultat($val) {
  | 
        
        
           | 8 | 
           jpm | 
           236 | 
           		$tab = array();
  | 
        
        
           | 3 | 
           jpm | 
           237 | 
           		$num_entite = 0;
  | 
        
        
            | 
            | 
           238 | 
           		// découpe chaque participant
  | 
        
        
           | 8 | 
           jpm | 
           239 | 
           		$tab_entites = explode(';', $val);
  | 
        
        
           | 3 | 
           jpm | 
           240 | 
           		foreach ($tab_entites as $entite) {
  | 
        
        
            | 
            | 
           241 | 
           			$tab[$num_entite] = array();
  | 
        
        
            | 
            | 
           242 | 
           			if ($entite != '') { // découpe les informations du participant
  | 
        
        
           | 8 | 
           jpm | 
           243 | 
           				$entite_detail = explode(',', $entite);
  | 
        
        
           | 3 | 
           jpm | 
           244 | 
           				foreach ($entite_detail as $detail) {
  | 
        
        
            | 
            | 
           245 | 
           					if ($detail != '') {
  | 
        
        
            | 
            | 
           246 | 
           						if (preg_match('/^([^=]+)=([^=]*)$/', $detail, $match)) {
  | 
        
        
            | 
            | 
           247 | 
           							$tab[$num_entite][$match[1]] = $match[2];
  | 
        
        
            | 
            | 
           248 | 
           						} else {
  | 
        
        
            | 
            | 
           249 | 
           							$tab[$num_entite][] = $detail;
  | 
        
        
            | 
            | 
           250 | 
           						}
  | 
        
        
            | 
            | 
           251 | 
           					}
  | 
        
        
            | 
            | 
           252 | 
           				}
  | 
        
        
            | 
            | 
           253 | 
           			}
  | 
        
        
            | 
            | 
           254 | 
           			$num_entite++;
  | 
        
        
            | 
            | 
           255 | 
           		}
  | 
        
        
            | 
            | 
           256 | 
           		return $tab;
  | 
        
        
            | 
            | 
           257 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           258 | 
              | 
        
        
            | 
            | 
           259 | 
              | 
        
        
            | 
            | 
           260 | 
           	/** Retourne :
  | 
        
        
            | 
            | 
           261 | 
           	 *  - le nom de l'editeur
  | 
        
        
           | 3 | 
           jpm | 
           262 | 
           	 *  - les coordonnées de l'éditeur sous la forme [latitude]N,[longitude]S [datum]
  | 
        
        
            | 
            | 
           263 | 
           	 *  - la couverture temporelle sous la forme xxxx à xxxx
  | 
        
        
            | 
            | 
           264 | 
           	 *  - la concaténation des noms pour les contributeurs et les créateurs (machin chouette, truc bidule...)
  | 
        
        
            | 
            | 
           265 | 
           	 *  - la liste des liste des couvertures spatiales (le nom et pas le code) (France, allemagne..) */
  | 
        
        
            | 
            | 
           266 | 
           	public function afficherConcatenationValeur($champ, $tab) {
  | 
        
        
            | 
            | 
           267 | 
           		if (strrpos($champ, '.coordonnees') !== false) {
  | 
        
        
            | 
            | 
           268 | 
           			if (isset($tab[0]['latitude']) && isset($tab[0]['longitude']) && isset($tab[0]['datum'])) {
  | 
        
        
            | 
            | 
           269 | 
           				$this->table_retour[$champ] = $tab[0]['latitude'].' N, '.$tab[0]['longitude'].' S ['.$tab[0]['datum'].']';
  | 
        
        
            | 
            | 
           270 | 
           			}
  | 
        
        
            | 
            | 
           271 | 
           		} else {
  | 
        
        
            | 
            | 
           272 | 
           			$concat = '';
  | 
        
        
            | 
            | 
           273 | 
           			foreach ($tab as $entite) {
  | 
        
        
            | 
            | 
           274 | 
           				foreach ($entite as $key => $val) {
  | 
        
        
            | 
            | 
           275 | 
           					if ($champ == 'couverture_spatiale') {
  | 
        
        
            | 
            | 
           276 | 
           							$concat .= ', '.$this->ajouterSignification($champ, $val);
  | 
        
        
            | 
            | 
           277 | 
           					} else {
  | 
        
        
            | 
            | 
           278 | 
           						if (strrpos($key, '.prenom') !== false) {
  | 
        
        
           | 8 | 
           jpm | 
           279 | 
           							$concat .= ', '.$val;
  | 
        
        
           | 3 | 
           jpm | 
           280 | 
           						} elseif (strrpos($key, 'nom') !== false) {
  | 
        
        
           | 8 | 
           jpm | 
           281 | 
              | 
        
        
            | 
            | 
           282 | 
           							$concat .= ' '.$val;
  | 
        
        
           | 3 | 
           jpm | 
           283 | 
           							break;
  | 
        
        
            | 
            | 
           284 | 
           						}
  | 
        
        
            | 
            | 
           285 | 
           					}
  | 
        
        
            | 
            | 
           286 | 
           				}
  | 
        
        
            | 
            | 
           287 | 
           			}
  | 
        
        
            | 
            | 
           288 | 
           			$res = trim($concat, ',');
  | 
        
        
            | 
            | 
           289 | 
           			$res = trim($res);
  | 
        
        
            | 
            | 
           290 | 
           			if ($champ == 'couverture_temporelle') $res = str_replace(' ', ' à ',$res);
  | 
        
        
            | 
            | 
           291 | 
           			$this->table_retour[$champ] = $res;
  | 
        
        
            | 
            | 
           292 | 
           		}
  | 
        
        
            | 
            | 
           293 | 
           	}
  | 
        
        
            | 
            | 
           294 | 
              | 
        
        
           | 8 | 
           jpm | 
           295 | 
              | 
        
        
           | 3 | 
           jpm | 
           296 | 
           	public function afficherDonneesMax($champ,$valeur,$tab) {
  | 
        
        
            | 
            | 
           297 | 
           		switch ($champ) {
  | 
        
        
            | 
            | 
           298 | 
           			case 'couverture_temporelle' : $this->afficherInfosPrecises($champ, 'start,end', $valeur, $tab); 		break;
  | 
        
        
            | 
            | 
           299 | 
           			case 'langue' 				 : $this->afficherInfosPrecises($champ,'signification,code,href', $valeur); break;
  | 
        
        
            | 
            | 
           300 | 
           			case 'langue_meta' 			 : $this->afficherInfosPrecises($champ,'signification,code,href', $valeur); break;
  | 
        
        
            | 
            | 
           301 | 
           			case 'couverture_spatiale' 	 : $this->afficherInfosPrecises($champ, 'details', $valeur, $tab); 			break;
  | 
        
        
            | 
            | 
           302 | 
           			case 'createurs' 			 : $this->afficherInfosPrecises($champ, 'details', $valeur, $tab);			break;
  | 
        
        
            | 
            | 
           303 | 
           			case 'contributeurs' 		 : $this->afficherInfosPrecises($champ, 'details', $valeur, $tab); 			break;
  | 
        
        
            | 
            | 
           304 | 
           			case 'editeur' 				 : $this->afficherEditeur($champ, $tab);									break;
  | 
        
        
            | 
            | 
           305 | 
           			default 					 : $this->table_retour[$champ] = $valeur; 									break;
  | 
        
        
            | 
            | 
           306 | 
           		}
  | 
        
        
            | 
            | 
           307 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           308 | 
              | 
        
        
            | 
            | 
           309 | 
              | 
        
        
            | 
            | 
           310 | 
           	public function afficherEditeur($key, $tab) {
  | 
        
        
            | 
            | 
           311 | 
           		// infos générales sur l'éditeur
  | 
        
        
           | 3 | 
           jpm | 
           312 | 
           		foreach ($tab[0] as $k => $val) {
  | 
        
        
            | 
            | 
           313 | 
           			if ((strrpos($k, 'contact.') === false) && (strrpos($k, '.wgs84') === false)) {
  | 
        
        
           | 8 | 
           jpm | 
           314 | 
           				$this->table_retour[$key.'.'.$k] = $val;
  | 
        
        
           | 3 | 
           jpm | 
           315 | 
           			}
  | 
        
        
           | 8 | 
           jpm | 
           316 | 
           		}
  | 
        
        
            | 
            | 
           317 | 
           		//on récupère dans un premier temps les tableaux des coordonnées.
  | 
        
        
           | 3 | 
           jpm | 
           318 | 
           		$table_coordonnees = $this->recupererTableCoordonnees($tab);
  | 
        
        
           | 8 | 
           jpm | 
           319 | 
           		//on affiche les informations sur les coordonnees : concaténation + détails
  | 
        
        
           | 3 | 
           jpm | 
           320 | 
           		if ($table_coordonnees[0] != array()) {
  | 
        
        
            | 
            | 
           321 | 
           			$this->afficherConcatenationValeur($key.'.coordonnees', $table_coordonnees);
  | 
        
        
            | 
            | 
           322 | 
           			if (isset($table_coordonnees[0]['datum'])) {
  | 
        
        
           | 8 | 
           jpm | 
           323 | 
           				$this->afficherInfosPrecises($key.'.coordonnees.datum',
  | 
        
        
           | 3 | 
           jpm | 
           324 | 
           					'signification,code,href',$table_coordonnees[0]['datum'],
  | 
        
        
            | 
            | 
           325 | 
           					$table_coordonnees);
  | 
        
        
            | 
            | 
           326 | 
           			}
  | 
        
        
           | 8 | 
           jpm | 
           327 | 
           		}
  | 
        
        
            | 
            | 
           328 | 
           		$table_contact = $this->recupererTableContact($tab);
  | 
        
        
           | 3 | 
           jpm | 
           329 | 
           		//on affiche le premier contact en dehors de la table de détail:
  | 
        
        
            | 
            | 
           330 | 
           		if ($table_contact[0] != array()) {
  | 
        
        
           | 8 | 
           jpm | 
           331 | 
           			$this->table_retour[$key.'.contact'] = '';
  | 
        
        
           | 3 | 
           jpm | 
           332 | 
           			foreach ($table_contact as $info => $valeur) {
  | 
        
        
           | 1300 | 
           delphine | 
           333 | 
           			    $this->table_retour[$key.'.contact'] .=  ($valeur['contact.prenom'] ?? '')." ". ($valeur['contact.nom'] ?? '');
  | 
        
        
           | 3 | 
           jpm | 
           334 | 
           			}
  | 
        
        
           | 8 | 
           jpm | 
           335 | 
           			//on affiche les détails des autres contacts :
  | 
        
        
            | 
            | 
           336 | 
           			$this->afficherTableDetails($key.'.contact', $table_contact);
  | 
        
        
            | 
            | 
           337 | 
           		}
  | 
        
        
           | 3 | 
           jpm | 
           338 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           339 | 
              | 
        
        
            | 
            | 
           340 | 
              | 
        
        
            | 
            | 
           341 | 
              | 
        
        
           | 3 | 
           jpm | 
           342 | 
           	public function afficherInfosPrecises($champ, $pts, $val, $tab = null) {
  | 
        
        
            | 
            | 
           343 | 
           		//permet d'afficher les informations précises telles que les .details, .start, .end...
  | 
        
        
            | 
            | 
           344 | 
           		$pts = explode(',', $pts);
  | 
        
        
            | 
            | 
           345 | 
           		foreach ($pts as $pt) {
  | 
        
        
            | 
            | 
           346 | 
           			switch ($pt) {
  | 
        
        
           | 278 | 
           jpm | 
           347 | 
           				case 'start' :
  | 
        
        
            | 
            | 
           348 | 
           					if (isset($this->table_retour[$champ.'.start'])) {
  | 
        
        
            | 
            | 
           349 | 
           						$this->table_retour[$champ.'.start'] = $tab['start'];
  | 
        
        
            | 
            | 
           350 | 
           					}
  | 
        
        
            | 
            | 
           351 | 
           					break;
  | 
        
        
            | 
            | 
           352 | 
           				case 'end' :
  | 
        
        
            | 
            | 
           353 | 
           					if (isset($this->table_retour[$champ.'.end'])) {
  | 
        
        
            | 
            | 
           354 | 
           						$this->table_retour[$champ.'.end'] = $tab['end'];
  | 
        
        
            | 
            | 
           355 | 
           					}
  | 
        
        
            | 
            | 
           356 | 
           					break;
  | 
        
        
            | 
            | 
           357 | 
           				case 'code' :
  | 
        
        
            | 
            | 
           358 | 
           					$this->table_retour[$champ.'.code'] = $val;
  | 
        
        
            | 
            | 
           359 | 
           					break;
  | 
        
        
            | 
            | 
           360 | 
           				case 'href' :
  | 
        
        
            | 
            | 
           361 | 
           					$this->table_retour[$champ.'.href'] = $this->ajouterHrefAutreProjet($champ, '', $val);
  | 
        
        
            | 
            | 
           362 | 
           					break;
  | 
        
        
            | 
            | 
           363 | 
           				case 'signification' :
  | 
        
        
            | 
            | 
           364 | 
           					$this->table_retour[$champ] = $this->ajouterSignification($champ, $val);
  | 
        
        
            | 
            | 
           365 | 
           					break;
  | 
        
        
            | 
            | 
           366 | 
           				case 'details' :
  | 
        
        
            | 
            | 
           367 | 
           					if ($champ == 'couverture_spatiale') {
  | 
        
        
            | 
            | 
           368 | 
           						$this->afficherCouvertureSpatiale($champ, $tab);
  | 
        
        
            | 
            | 
           369 | 
           					} else {
  | 
        
        
            | 
            | 
           370 | 
           						$this->afficherTableDetails($champ, $tab);
  | 
        
        
            | 
            | 
           371 | 
           					}
  | 
        
        
            | 
            | 
           372 | 
           					break;
  | 
        
        
            | 
            | 
           373 | 
           				default :
  | 
        
        
            | 
            | 
           374 | 
           					$this->table_retour[$champ.'.'.$pt] = $tab[$pt];
  | 
        
        
           | 3 | 
           jpm | 
           375 | 
           			}
  | 
        
        
            | 
            | 
           376 | 
           		}
  | 
        
        
            | 
            | 
           377 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           378 | 
              | 
        
        
            | 
            | 
           379 | 
              | 
        
        
            | 
            | 
           380 | 
              | 
        
        
           | 3 | 
           jpm | 
           381 | 
           	public function afficherCouvertureSpatiale($key, $tab) {
  | 
        
        
            | 
            | 
           382 | 
           		$res = $this->table_retour;
  | 
        
        
            | 
            | 
           383 | 
           		$this->table_retour = array();
  | 
        
        
            | 
            | 
           384 | 
           		foreach ($tab as $iso) {
  | 
        
        
            | 
            | 
           385 | 
           			foreach ($iso as $val) {
  | 
        
        
           | 8 | 
           jpm | 
           386 | 
           				$this->afficherInfosPrecises($key, 'signification,code,href',$val);
  | 
        
        
           | 3 | 
           jpm | 
           387 | 
           				$res[$key.'.detail'][] = $this->table_retour;
  | 
        
        
            | 
            | 
           388 | 
           				$this->table_retour = array();
  | 
        
        
            | 
            | 
           389 | 
           			}
  | 
        
        
            | 
            | 
           390 | 
           		}
  | 
        
        
            | 
            | 
           391 | 
           		$this->table_retour = $res;
  | 
        
        
            | 
            | 
           392 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           393 | 
              | 
        
        
           | 3 | 
           jpm | 
           394 | 
           	public function afficherTableDetails($champ, $tab) {
  | 
        
        
            | 
            | 
           395 | 
           		$res = $this->table_retour;
  | 
        
        
            | 
            | 
           396 | 
           		$this->table_retour = array();
  | 
        
        
            | 
            | 
           397 | 
           		foreach ($tab as $num_entite => $entite) { // $t et $type valent p ou o
  | 
        
        
            | 
            | 
           398 | 
           			$t = '';
  | 
        
        
           | 8 | 
           jpm | 
           399 | 
           			$type = '.';
  | 
        
        
           | 3 | 
           jpm | 
           400 | 
           			foreach ($entite as $key => $infos) {
  | 
        
        
            | 
            | 
           401 | 
           				list($type, $info) = explode('.', trim($key));
  | 
        
        
           | 8 | 
           jpm | 
           402 | 
           				if ($type == 'contact') $type = 'p';
  | 
        
        
           | 3 | 
           jpm | 
           403 | 
           				if ($type != $t) { // cherche et ajoute la signification du type
  | 
        
        
            | 
            | 
           404 | 
           					$this->afficherInfosPrecises('type', 'signification,code,href', trim($type));
  | 
        
        
            | 
            | 
           405 | 
           					foreach ($this->table_retour as $k => $val) {
  | 
        
        
            | 
            | 
           406 | 
           						$res[$champ.'.details'][$num_entite][$type.'.'.$k] = $val;
  | 
        
        
            | 
            | 
           407 | 
           					}
  | 
        
        
            | 
            | 
           408 | 
           					$table_retour = array();
  | 
        
        
            | 
            | 
           409 | 
           					$this->table_retour = array(); // rempli par afficherInfosPrecises
  | 
        
        
            | 
            | 
           410 | 
           					$t = $type;
  | 
        
        
           | 8 | 
           jpm | 
           411 | 
           				}
  | 
        
        
           | 3 | 
           jpm | 
           412 | 
           				$res[$champ.'.details'][$num_entite][$key] = $infos;
  | 
        
        
            | 
            | 
           413 | 
           			}
  | 
        
        
            | 
            | 
           414 | 
           		}
  | 
        
        
            | 
            | 
           415 | 
           		$this->table_retour = $res;
  | 
        
        
            | 
            | 
           416 | 
           	}
  | 
        
        
            | 
            | 
           417 | 
              | 
        
        
            | 
            | 
           418 | 
           	public function ajouterSignification($champ, $val, $nom = 'nom') {
  | 
        
        
            | 
            | 
           419 | 
           		$url = $this->ajouterHrefAutreProjet($champ, '', $val);
  | 
        
        
            | 
            | 
           420 | 
           		if (in_array($champ, array('langue', 'langue_meta', 'couverture_spatiale'))) {
  | 
        
        
            | 
            | 
           421 | 
           			$url .= '/'.$nom;
  | 
        
        
            | 
            | 
           422 | 
           		}
  | 
        
        
           | 837 | 
           raphael | 
           423 | 
           		if(array_key_exists($url, self::$cache_ontologies)) {
  | 
        
        
            | 
            | 
           424 | 
           			return self::$cache_ontologies[$url];
  | 
        
        
            | 
            | 
           425 | 
           		}
  | 
        
        
           | 3 | 
           jpm | 
           426 | 
           		$signification = $this->consulterHref($url);
  | 
        
        
            | 
            | 
           427 | 
           		if (isset($signification->$nom)) {
  | 
        
        
            | 
            | 
           428 | 
           			$res = $signification->$nom;
  | 
        
        
            | 
            | 
           429 | 
           		} else {
  | 
        
        
            | 
            | 
           430 | 
           			$nom = 'nom.fr';
  | 
        
        
            | 
            | 
           431 | 
           			$res = $signification->$nom;
  | 
        
        
            | 
            | 
           432 | 
           		}
  | 
        
        
           | 837 | 
           raphael | 
           433 | 
           		self::$cache_ontologies[$url] = $res;
  | 
        
        
           | 3 | 
           jpm | 
           434 | 
           		return $res ;
  | 
        
        
            | 
            | 
           435 | 
           	}
  | 
        
        
            | 
            | 
           436 | 
              | 
        
        
           | 8 | 
           jpm | 
           437 | 
              | 
        
        
           | 3 | 
           jpm | 
           438 | 
           	public function recupererTableContact(&$tab) {
  | 
        
        
            | 
            | 
           439 | 
           		$res = array();
  | 
        
        
            | 
            | 
           440 | 
           		foreach ($tab[0] as $key => $val) {
  | 
        
        
            | 
            | 
           441 | 
           			if (strrpos($key, 'contact.') !== false) {
  | 
        
        
            | 
            | 
           442 | 
           				while (array_key_exists($key, $res)) { $key = ' '.$key; }
  | 
        
        
            | 
            | 
           443 | 
           				$res[$key] = $val;
  | 
        
        
            | 
            | 
           444 | 
           				unset($tab[0][$key]); //suppression des premiers contacts qui seront affichés après
  | 
        
        
            | 
            | 
           445 | 
           			}
  | 
        
        
            | 
            | 
           446 | 
           		}
  | 
        
        
            | 
            | 
           447 | 
           		$resultat[0] = $res;
  | 
        
        
            | 
            | 
           448 | 
           		return $resultat;
  | 
        
        
            | 
            | 
           449 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           450 | 
              | 
        
        
            | 
            | 
           451 | 
              | 
        
        
           | 3 | 
           jpm | 
           452 | 
           	public function recupererTableCoordonnees(&$tab) {
  | 
        
        
            | 
            | 
           453 | 
           		$res = array();
  | 
        
        
            | 
            | 
           454 | 
           		foreach ($tab[0] as $key => $val) {
  | 
        
        
            | 
            | 
           455 | 
           			if (strrpos($key, 'latitude') !== false || strrpos($key, 'longitude') !== false) {
  | 
        
        
            | 
            | 
           456 | 
           				list ($coord, $datum) = explode('.', $key);
  | 
        
        
            | 
            | 
           457 | 
           				$res[$coord]  = $val;
  | 
        
        
            | 
            | 
           458 | 
           				$res['datum'] = $datum;
  | 
        
        
            | 
            | 
           459 | 
           			}
  | 
        
        
            | 
            | 
           460 | 
           		}
  | 
        
        
            | 
            | 
           461 | 
           		$resultat[0] = $res;
  | 
        
        
            | 
            | 
           462 | 
           		return $resultat;
  | 
        
        
            | 
            | 
           463 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           464 | 
              | 
        
        
           | 3 | 
           jpm | 
           465 | 
           //-------------------------------------Fonction de formatage des resultats de /metaDonnees/#champs+champs----------------
  | 
        
        
           | 8 | 
           jpm | 
           466 | 
              | 
        
        
           | 3 | 
           jpm | 
           467 | 
           	public function formaterMetaDonneesChamp($resultat) {
  | 
        
        
            | 
            | 
           468 | 
           		$this->recupererNomChamp(Config::get('bdd_table_meta'));
  | 
        
        
            | 
            | 
           469 | 
           		//On récupère dans un premier temps toutes les données existantes puis on pioche les champs recherchés
  | 
        
        
            | 
            | 
           470 | 
           		$table_Meta = $this->formaterMetaDonnees($resultat);
  | 
        
        
            | 
            | 
           471 | 
           		foreach ($table_Meta as $version) {
  | 
        
        
            | 
            | 
           472 | 
           			//on affiche les informations par defaut : la version, la langue_meta et le guid :
  | 
        
        
            | 
            | 
           473 | 
           			$this->afficherVersionLangueMetaGuid($version);
  | 
        
        
            | 
            | 
           474 | 
           			$tab_ress = explode(' ', $this->table_ressources[0]);
  | 
        
        
           | 8 | 
           jpm | 
           475 | 
           			foreach ($tab_ress as $champ) {//on recupere le radical pour comparaison avec les nom des champs de la bdd :
  | 
        
        
           | 3 | 
           jpm | 
           476 | 
           				$this->afficherChampRecherche($champ, $version);
  | 
        
        
            | 
            | 
           477 | 
           			}
  | 
        
        
            | 
            | 
           478 | 
           			$table[] = $this->table_retour;
  | 
        
        
            | 
            | 
           479 | 
           			$this->table_retour = array();
  | 
        
        
            | 
            | 
           480 | 
           		}
  | 
        
        
            | 
            | 
           481 | 
           		return $table;
  | 
        
        
            | 
            | 
           482 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           483 | 
              | 
        
        
           | 3 | 
           jpm | 
           484 | 
           	public function afficherChampRecherche(&$champ, &$version) {
  | 
        
        
            | 
            | 
           485 | 
           		preg_match('/^([^.]+)(?:[.][^.]+)?$/', $champ, $match);
  | 
        
        
            | 
            | 
           486 | 
           		if (preg_match('/(.+)[.][*]$/', $champ, $match_2)) {
  | 
        
        
            | 
            | 
           487 | 
           			$this->afficherPointEtoile($match_2, $version, $champ);
  | 
        
        
            | 
            | 
           488 | 
           		} elseif (array_key_exists($champ, $version)) {
  | 
        
        
            | 
            | 
           489 | 
           			$this->table_retour[$champ] = $version[$champ];
  | 
        
        
           | 8 | 
           jpm | 
           490 | 
           		} elseif (in_array($match[1], $this->champs_table)) {
  | 
        
        
           | 3 | 
           jpm | 
           491 | 
           			//si le champ est vide dans cette version on retourne null (comparaison avec les champs existants)
  | 
        
        
           | 8 | 
           jpm | 
           492 | 
           			$this->table_retour[$champ] = null;
  | 
        
        
           | 3 | 
           jpm | 
           493 | 
           		} else {
  | 
        
        
            | 
            | 
           494 | 
           			$champs = implode('</li><li>', array_keys($version));
  | 
        
        
            | 
            | 
           495 | 
           			$e = 'Erreur dans votre requête : </br> Le champ "'.$champ.'" n\'existe pas'.
  | 
        
        
            | 
            | 
           496 | 
           				'. Les champs disponibles sont : <li>'.$champs.'</li>';
  | 
        
        
            | 
            | 
           497 | 
           			$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
  | 
        
        
            | 
            | 
           498 | 
           		}
  | 
        
        
            | 
            | 
           499 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           500 | 
              | 
        
        
           | 3 | 
           jpm | 
           501 | 
           	public function afficherPointEtoile($match, $version, $ressource) {
  | 
        
        
            | 
            | 
           502 | 
           		$existe = false;
  | 
        
        
            | 
            | 
           503 | 
           		foreach ($version as $key => $valeur) {
  | 
        
        
            | 
            | 
           504 | 
           			if (strrpos($key, $match[1].'.') !== false) {
  | 
        
        
            | 
            | 
           505 | 
           				$this->table_retour[$key] = $valeur;
  | 
        
        
            | 
            | 
           506 | 
           				$existe = true;
  | 
        
        
            | 
            | 
           507 | 
           			}
  | 
        
        
           | 8 | 
           jpm | 
           508 | 
           		}
  | 
        
        
           | 3 | 
           jpm | 
           509 | 
           		if (!$existe) {
  | 
        
        
            | 
            | 
           510 | 
           			$champs = implode('</li><li>', array_keys($version));
  | 
        
        
            | 
            | 
           511 | 
           			$e = 'Erreur dans votre requête : </br> Le champ " '.$ressource.' " n\'existe pas dans la version '
  | 
        
        
            | 
            | 
           512 | 
           				.$version['version'].'. Les champs disponibles sont : <li>'.$champs.'</li>';
  | 
        
        
            | 
            | 
           513 | 
           			$this->renvoyerErreur(RestServeur::HTTP_CODE_MAUVAISE_REQUETE, $e);
  | 
        
        
            | 
            | 
           514 | 
           		}
  | 
        
        
            | 
            | 
           515 | 
           	}
  | 
        
        
           | 8 | 
           jpm | 
           516 | 
              | 
        
        
           | 3 | 
           jpm | 
           517 | 
           	public function afficherVersionLangueMetaGuid(&$version) {
  | 
        
        
           | 8 | 
           jpm | 
           518 | 
           		$this->table_retour['version'] = $version['version'];
  | 
        
        
           | 3 | 
           jpm | 
           519 | 
           		$this->table_retour['langue_meta'] = $version['langue_meta'];
  | 
        
        
           | 8 | 
           jpm | 
           520 | 
           		$this->table_retour['guid'] = $version['guid'];
  | 
        
        
           | 3 | 
           jpm | 
           521 | 
           	}
  | 
        
        
            | 
            | 
           522 | 
           }
  |