/trunk/jrest/jrest.ini.php.defaut |
---|
9,7 → 9,7 |
password = |
hostspec = localhost |
database = tb_coel |
guid = "urn:lsid:tela-botanica.org:%s:%s" |
guid = "urn:lsid:tela-botanica.org:%s" |
editeur = "Tela Botanica" |
urlBaseCoel = "http://www.tela-botanica.org/eflore/coel/Coel.html" |
urlBaseJrest = "http://www.tela-botanica.org/eflore/coel/jrest/" |
19,6 → 19,5 |
mdpAnnuaire = |
correctionLogin = |
correctionMdp = |
idProjetUtilisateurs = 3 |
;*/?> |
/trunk/jrest/services/CoelProjet.php |
---|
File deleted |
\ No newline at end of file |
/trunk/jrest/services/CoelCollectionAPersonne.php |
---|
32,7 → 32,7 |
$requete = (($this->distinct) ? 'SELECT DISTINCT ' : 'SELECT '). |
' ccap.*, '. |
(isset($p['id_personne']) ? ' cc_nom, ' : ''). |
' cp_ce_projet, cp_fmt_nom_complet, cp_prenom, cp_nom, cp_naissance_date, cp_naissance_lieu, cp_ce_deces, cp_deces_date, cp_deces_lieu '. |
' cp_fmt_nom_complet, cp_prenom, cp_nom, cp_naissance_date, cp_naissance_lieu, cp_ce_deces, cp_deces_date, cp_deces_lieu '. |
'FROM coel_collection_a_personne AS ccap '. |
' LEFT JOIN coel_meta_historique_ligne ON (ccap_ce_meta = cmhl_id_historique_ligne) '. |
' LEFT JOIN coel_personne ON (ccap_id_personne = cp_id_personne) '. |
/trunk/jrest/services/CoelPublication.php |
---|
24,7 → 24,7 |
$info = array(); |
// Pré traitement des paramêtres |
$p = $this->traiterParametresUrl(array('id_publication', 'id_projet', 'recherche'), $param); |
$p = $this->traiterParametresUrl(array('id_publication', 'recherche'), $param); |
// Construction de la requête |
$requete = (($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' cp.*, cmhl.*, cs_nom '. |
32,7 → 32,6 |
' LEFT JOIN coel_meta_historique_ligne AS cmhl ON (cpu_ce_meta = cmhl_id_historique_ligne) '. |
' LEFT JOIN coel_structure ON (cpu_ce_truk_editeur = cs_id_structure) '. |
((count($p) != 0) ? 'WHERE ' : ''). |
(isset($p['id_projet']) ? "AND cpu_ce_projet = {$p['id_projet']} " : ''). |
(isset($p['id_publication']) ? "AND cpu_id_publication = {$p['id_publication']} " : ''). |
(isset($p['recherche']) ? $this->construireWhereRecherche($p['recherche']) : ''). |
'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby : 'cpu_id_publication ASC').' '; |
/trunk/jrest/services/CoelUtilisateur.php |
---|
273,7 → 273,6 |
private function verifierPresenceUtilisateur($id) { |
$present = false; |
$cp_ce_projet = $this->config['coel']['idProjetUtilisateurs']; |
$requete = 'SELECT COUNT(cp_id_personne) AS nbre '. |
'FROM coel_personne '. |
"WHERE cp_ce_annuaire = {$this->bdd->quote($id)} ". |
296,7 → 295,6 |
} |
private function recupererLicenceUtilisateur($id) { |
$cp_ce_projet = $this->config['coel']['idProjetUtilisateurs']; |
$requete = 'SELECT cp_mark_licence '. |
'FROM coel_personne '. |
"WHERE cp_ce_annuaire = {$this->bdd->quote($id)} ". |
316,7 → 314,6 |
private function mettreAJourMotDePasse($login, $mot_de_passe_md5, $mot_de_passe_sha1) { |
try { |
$cp_ce_projet = $this->config['coel']['idProjetUtilisateurs']; |
$requete = 'UPDATE coel_personne '. |
"SET cp_mot_de_passe = '$mot_de_passe_sha1' ". |
"WHERE cp_login = '$login' ". |
333,7 → 330,6 |
private function mettreAJourUtilisateur($login, $mot_de_passe_sha1, $infos) { |
try { |
$cp_ce_projet = $this->config['coel']['idProjetUtilisateurs']; |
$cp_fmt_nom_complet = $infos['prenom'].' '.$infos['nom']; |
$requete = 'UPDATE coel_personne '. |
"SET cp_id_personne = '{$infos['id']}', ". |
358,13 → 354,12 |
// Construction de la requête d'ajout |
// Notes : pour rester compatibles avec l'annuaire de Tela, les utilisateurs sont ajoutés directement avec l'id |
// de l'annuaire Tela. Dans CoelPersonne, les personnes qui ne sont pas utilisateur sont ajoutés avec un id supérieur à 100 000 |
$cp_ce_projet = $this->config['coel']['idProjetUtilisateurs']; |
$cp_fmt_nom_complet = $infos['prenom'].' '.$infos['nom']; |
$cp_mark_licence = '0'; |
$requete = 'INSERT INTO coel_personne '. |
' (cp_id_personne, cp_ce_projet, cp_fmt_nom_complet, cp_prenom, cp_nom, cp_code_postal, '. |
' (cp_id_personne, cp_fmt_nom_complet, cp_prenom, cp_nom, cp_code_postal, '. |
' cp_ville, cp_truk_courriel, cp_login, cp_mot_de_passe, cp_ce_annuaire, cp_mark_licence) '. |
"VALUES ('{$infos['id']}', '$cp_ce_projet', '$cp_fmt_nom_complet', '{$infos['prenom']}', '{$infos['nom']}', ". |
"VALUES ('{$infos['id']}', '$cp_fmt_nom_complet', '{$infos['prenom']}', '{$infos['nom']}', ". |
"'{$infos['code_postal']}', '{$infos['ville']}', '{$infos['courriel']}', '{$infos['courriel']}', '".$mot_de_passe_sha1."', ". |
"'{$infos['id']}', $cp_mark_licence) "; |
//$this->debug[] = $requete; |
421,7 → 416,6 |
private function accepterLicence($login) { |
$sortie = false; |
try { |
$cp_ce_projet = $this->config['coel']['idProjetUtilisateurs']; |
$requete = 'UPDATE coel_personne '. |
'SET cp_mark_licence = 1 '. |
"WHERE cp_login = {$this->bdd->quote($login)} "; |
/trunk/jrest/services/CoelStructureAPersonne.php |
---|
35,7 → 35,7 |
$requete = (($this->distinct) ? 'SELECT DISTINCT ' : 'SELECT '). |
' csap.*, '. |
(isset($p['id_personne']) ? ' cs_nom, ' : ''). |
' cp_ce_projet, cp_fmt_nom_complet, cp_prenom, cp_nom, cp_truk_telephone, cp_truk_courriel, cp_ce_truk_specialite '. |
' cp_fmt_nom_complet, cp_prenom, cp_nom, cp_truk_telephone, cp_truk_courriel, cp_ce_truk_specialite '. |
'FROM coel_structure_a_personne AS csap '. |
' LEFT JOIN coel_meta_historique_ligne ON (csap_ce_meta = cmhl_id_historique_ligne) '. |
' LEFT JOIN coel_personne ON (csap_id_personne = cp_id_personne) '. |
/trunk/jrest/services/Coel.php |
---|
554,7 → 554,6 |
protected function chargerUtilisateur($login, $mot_de_passe = null) { |
$sortie = false; |
$cp_ce_projet = $this->config['coel']['idProjetUtilisateurs']; |
$requete = 'SELECT cp_id_personne AS id, cp_fmt_nom_complet AS nom_complet, cp_prenom AS prenom, '. |
' cp_nom AS nom, cp_login AS login, cp_mot_de_passe AS mot_de_passe, cp_parametre AS parametre, '. |
' cp_ville AS ville, cp_code_postal AS code_postal, '. |
/trunk/jrest/services/CoelStatistique.php |
---|
6,8 → 6,6 |
* |
* Cas d'utilisation : |
* /CoelStatistique/MonTypeDeStat : retourne la balise html image du graphique pour le type de statistique demandé |
* /CoelStatistique/MonTypeDeStat/MonIdProjet : retourne la balise html image du graphique pour le type de statistique |
* demandé et le projet indiqué. |
* ?html=non : ce paramètre ajouté en fin d'url, force le retour de l'url du graphique sans la balise html img |
* |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
131,12 → 129,9 |
private function executerRequeteNombre($entite, $abr) { |
$table = 'coel_'.$entite; |
$champ_id = $abr.'_id_'.$entite; |
$champ_projet = $abr.'_ce_projet'; |
$projet_id = (isset($this->parametres[0]) ? $this->bdd->quote($this->parametres[0]) : null); |
$requete = "SELECT COUNT($champ_id) AS nbre ". |
"FROM $table ". |
(is_null($projet_id) ? '' : "WHERE $champ_projet = $projet_id "); |
"FROM $table "; |
try { |
$nbre = $this->bdd->query($requete)->fetchColumn(); |
if ($nbre === false) { |
188,7 → 183,6 |
$legende = implode('|', $etats); |
$etiquettes_x = "0|$moitier|$maximum"; |
$titre = $this->existerParametre(0) ? 'Ma participation' : 'Participation'; |
$titre .= $this->existerParametre(1) ? ' au projet' : ' tous projets confondus'; |
// Paramètres du graphique |
$graph = array( |
211,26 → 205,13 |
private function executerRequeteNombreDansHistorique($tables_infos, $etat) { |
// Récupération des paramêtres |
$personne_id = (isset($this->parametres[0]) && $this->parametres[0] != '*') ? $this->bdd->quote($this->parametres[0]) : null; |
$projet_id = (isset($this->parametres[1]) && $this->parametres[1] != '*') ? $this->bdd->quote($this->parametres[1]) : null; |
// Construction du Xpath si nécessaire |
if (isset($projet_id)) { |
$squelette = '//row[1]/%s_ce_projet'; |
$abreviations = explode(',', $tables_infos['abreviations']); |
$xpath = array(); |
foreach ($abreviations as $abr) { |
$xpath[] = sprintf($squelette, $abr); |
} |
$xpath = implode(' | ', $xpath); |
} |
// Récupération des données |
$requete = "SELECT COUNT(cmhl_date_modification) AS nbre ". |
"FROM coel_meta_historique_ligne ". |
"WHERE cmhl_ce_table IN ({$tables_infos['identifiants']}) ". |
" AND cmhl_ce_etat = $etat ". |
(isset($personne_id) ? " AND cmhl_ce_modifier_par = $personne_id " : ''). |
(isset($projet_id) ? " AND ExtractValue(cmhl_enregistrement, '$xpath') = $projet_id " : ''); |
(isset($personne_id) ? " AND cmhl_ce_modifier_par = $personne_id " : ''); |
try { |
$nbre = $this->bdd->query($requete)->fetchColumn(); |
if ($nbre === false) { |
243,14 → 224,11 |
} |
private function getTypeDepot() { |
// Récupération des paramêtres |
$projet_id = (isset($this->parametres[0]) ? $this->bdd->quote($this->parametres[0]) : null); |
// Récupération des données |
$requete = 'SELECT cmlv_nom AS type, COUNT(cc_ce_type_depot) AS nbre '. |
'FROM coel_collection '. |
' LEFT JOIN coel_meta_liste_valeur ON (cc_ce_type_depot = cmlv_id_valeur) '. |
( is_null($projet_id) ? '' : "WHERE cc_ce_projet = $projet_id "). |
'GROUP BY cc_ce_type_depot'; |
try { |
$infos = $this->bdd->query($requete)->fetchAll(PDO::FETCH_ASSOC); |
293,13 → 271,10 |
} |
private function getNombreCollectionParStructure() { |
// Récupération des paramêtres |
$projet_id = (isset($this->parametres[0]) ? $this->bdd->quote($this->parametres[0]) : null); |
// Récupération des données |
$requete = 'SELECT COUNT(cc_id_collection) AS nbre '. |
'FROM coel_collection '. |
( is_null($projet_id) ? '' : "WHERE cc_ce_projet = $projet_id "). |
'GROUP BY cc_ce_structure '; |
try { |
307,7 → 282,7 |
if ($infos === false) { |
$this->messages[] = "La requête a retourné aucun résultat."; |
} else if (count($infos) == 0) { |
$this->messages[] = "Aucune collection n'est référencée dans ce projet."; |
$this->messages[] = "Aucune collection n'est référencée."; |
} |
} catch (PDOException $e) { |
$this->messages[] = sprintf($this->getTxt('sql_erreur'), $e->getFile(), $e->getLine(), $e->getMessage()); |
361,21 → 336,17 |
} |
private function getNombrePartParStructure() { |
// Récupération des paramêtres |
$projet_id = (isset($this->parametres[0]) ? $this->bdd->quote($this->parametres[0]) : null); |
// Récupération des données |
$requete = 'SELECT cc_ce_structure, ccb_truk_unite_base '. |
'FROM coel_collection_botanique '. |
' LEFT JOIN coel_collection ON (ccb_id_collection = cc_id_collection) '. |
( is_null($projet_id) ? '' : "WHERE cc_ce_projet = $projet_id "); |
' LEFT JOIN coel_collection ON (ccb_id_collection = cc_id_collection) '; |
try { |
$infos = $this->bdd->query($requete)->fetchAll(PDO::FETCH_ASSOC); |
if ($infos === false) { |
$this->messages[] = "La requête a retourné aucun résultat."; |
} else if (count($infos) == 0) { |
$this->messages[] = "Aucune collection n'est référencée dans ce projet."; |
$this->messages[] = "Aucune collection n'est référencée."; |
} |
} catch (PDOException $e) { |
$this->messages[] = sprintf($this->getTxt('sql_erreur'), $e->getFile(), $e->getLine(), $e->getMessage()); |
443,14 → 414,10 |
} |
private function getNombrePartParCollection() { |
// Récupération des paramêtres |
$projet_id = (isset($this->parametres[0]) ? $this->bdd->quote($this->parametres[0]) : null); |
// Récupération des données |
$requete = 'SELECT ccb_truk_unite_base '. |
'FROM coel_collection_botanique '. |
( is_null($projet_id) ? '' : ' LEFT JOIN coel_collection ON (ccb_id_collection = cc_id_collection) '). |
( is_null($projet_id) ? '' : "WHERE cc_ce_projet = $projet_id "); |
'FROM coel_collection_botanique '; |
try { |
$infos = $this->bdd->query($requete)->fetchAll(PDO::FETCH_ASSOC); |
457,7 → 424,7 |
if ($infos === false) { |
$this->messages[] = "La requête a retourné aucun résultat."; |
} else if (count($infos) == 0) { |
$this->messages[] = "Aucune collection n'est référencée dans ce projet."; |
$this->messages[] = "Aucune collection n'est référencée."; |
$infos == false; |
} |
} catch (PDOException $e) { |
525,15 → 492,11 |
} |
private function getNombreCollectionParDepartement() { |
// Récupération des paramêtres |
$projet_id = (isset($this->parametres[0]) ? $this->bdd->quote($this->parametres[0]) : null); |
if ($projet_id !== null) { |
// Récupération des données |
$requete = 'SELECT cs_code_postal '. |
'FROM coel_collection '. |
' LEFT JOIN coel_structure ON (cc_ce_structure = cs_id_structure) '. |
'WHERE cs_ce_truk_pays = '.self::META_CODE_FRANCE.' '. |
( is_null($projet_id) ? '' : " AND cc_ce_projet = $projet_id "); |
'WHERE cs_ce_truk_pays = '.self::META_CODE_FRANCE.' '; |
try { |
$infos = $this->bdd->query($requete)->fetchAll(PDO::FETCH_ASSOC); |
540,7 → 503,7 |
if ($infos === false) { |
$this->messages[] = "La requête a retourné aucun résultat."; |
} else if (count($infos) == 0) { |
$this->messages[] = "Aucune collection n'est référencée dans ce projet."; |
$this->messages[] = "Aucune collection n'est référencée."; |
$infos == false; |
} |
} catch (PDOException $e) { |
584,15 → 547,10 |
'chts' => '000000,11.5', |
'chts' => '000000,12'); |
} |
} else { |
$this->messages[] = "Veuillez sélectionner un projet pour voir le graphique."; |
} |
return $graph; |
} |
private function getNombreCollectionParTypeStructure() { |
// Récupération des paramêtres |
$projet_id = (isset($this->parametres[0]) ? $this->bdd->quote($this->parametres[0]) : null); |
// Récupération des données |
$requete = 'SELECT cmlv_prive.cmlv_nom AS type_prive, cmlv_public.cmlv_nom AS type_public '. |
599,8 → 557,7 |
'FROM coel_collection '. |
' LEFT JOIN coel_structure ON (cc_ce_structure = cs_id_structure) '. |
' LEFT JOIN coel_meta_liste_valeur AS cmlv_prive ON (cs_ce_truk_type_prive = cmlv_prive.cmlv_id_valeur) '. |
' LEFT JOIN coel_meta_liste_valeur AS cmlv_public ON (cs_ce_truk_type_public = cmlv_public.cmlv_id_valeur) '. |
( is_null($projet_id) ? '' : "WHERE cc_ce_projet = $projet_id "); |
' LEFT JOIN coel_meta_liste_valeur AS cmlv_public ON (cs_ce_truk_type_public = cmlv_public.cmlv_id_valeur) '; |
try { |
$infos = $this->bdd->query($requete)->fetchAll(PDO::FETCH_ASSOC); |
607,7 → 564,7 |
if ($infos === false) { |
$this->messages[] = "La requête a retourné aucun résultat."; |
} else if (count($infos) == 0) { |
$this->messages[] = "Aucune collection n'est référencée dans ce projet."; |
$this->messages[] = "Aucune collection n'est référencée."; |
$infos == false; |
} |
} catch (PDOException $e) { |
660,19 → 617,16 |
} |
private function getNombreCollectionParPeriode() { |
// Récupération des paramêtres |
$projet_id = (isset($this->parametres[0]) ? $this->bdd->quote($this->parametres[0]) : null); |
// Récupération des données |
$requete = 'SELECT cc_truk_periode_constitution '. |
'FROM coel_collection '. |
( is_null($projet_id) ? '' : "WHERE cc_ce_projet = $projet_id "); |
'FROM coel_collection '; |
try { |
$infos = $this->bdd->query($requete)->fetchAll(PDO::FETCH_ASSOC); |
if ($infos === false) { |
$this->messages[] = "La requête a retourné aucun résultat."; |
} else if (count($infos) == 0) { |
$this->messages[] = "Aucune collection n'est référencée dans ce projet."; |
$this->messages[] = "Aucune collection n'est référencée."; |
$infos == false; |
} |
} catch (PDOException $e) { |
751,20 → 705,16 |
} |
private function getNombreHerbierParType() { |
// Récupération des paramêtres |
$projet_id = (isset($this->parametres[0]) ? $this->bdd->quote($this->parametres[0]) : null); |
// Récupération des données |
$requete = 'SELECT ccb_ce_truk_type '. |
'FROM coel_collection_botanique '. |
( is_null($projet_id) ? '' : ' LEFT JOIN coel_collection ON (ccb_id_collection = cc_id_collection) '). |
( is_null($projet_id) ? '' : "WHERE cc_ce_projet = $projet_id "); |
'FROM coel_collection_botanique '; |
try { |
$infos = $this->bdd->query($requete)->fetchAll(PDO::FETCH_ASSOC); |
if ($infos === false) { |
$this->messages[] = "La requête a retourné aucun résultat."; |
} else if (count($infos) == 0) { |
$this->messages[] = "Aucune collection n'est référencée dans ce projet."; |
$this->messages[] = "Aucune collection n'est référencée."; |
$infos == false; |
} |
} catch (PDOException $e) { |
779,7 → 729,7 |
try { |
$metadonnees = $this->bdd->query($requete)->fetchAll(PDO::FETCH_ASSOC); |
if ($metadonnees === false) { |
$this->messages[] = "La requête de recherche des métadonnées a retourné aucun résultat."; |
$this->messages[] = "La requête de recherche des métadonnées n'a retourné aucun résultat."; |
} |
} catch (PDOException $e) { |
$this->messages[] = sprintf($this->getTxt('sql_erreur'), $e->getFile(), $e->getLine(), $e->getMessage()); |
/trunk/jrest/services/CoelExport.php |
---|
31,7 → 31,7 |
// Pré traitement des paramêtres |
$pour_bdd = false; |
$this->parametres = $this->traiterParametresUrl(array('service', 'format', 'projet'), $params, $pour_bdd); |
$this->parametres = $this->traiterParametresUrl(array('service', 'format'), $params, $pour_bdd); |
// Chargement du bon type de service demandé |
if (isset($this->parametres['service'])) { |
117,7 → 117,6 |
private function getServiceStructureExpertise() { |
$donnees = array(); |
$projet_id = $this->parametres['projet']; |
// Construction de la requête |
$requete = 'SELECT '.(($this->distinct) ? 'DISTINCT' : '').' '. |
128,7 → 127,6 |
' LEFT JOIN coel_structure_a_personne ON (cs_id_structure = csap_id_structure) '. |
' LEFT JOIN coel_structure_conservation ON (cs_id_structure = csc_id_structure) '. |
' LEFT JOIN coel_structure_valorisation ON (cs_id_structure = csv_id_structure) '. |
( is_null($projet_id) ? '' : "WHERE cs_ce_projet = $projet_id "). |
'GROUP BY cs_id_structure '. |
'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby : 'cs_nom ASC').' '; |
$message_echec = "La requête a retourné aucun résultat."; |
140,7 → 138,6 |
' COUNT(cc_id_collection) AS collection_nbre '. |
'FROM coel_structure '. |
' LEFT JOIN coel_collection ON (cs_id_structure = cc_ce_structure) '. |
( is_null($projet_id) ? '' : "WHERE cs_ce_projet = $projet_id "). |
'GROUP BY cs_id_structure '; |
$message_echec = "La requête comptant le nombre de collection a retourné aucun résultat."; |
$collections_nbre = $this->executerRequete($requete, $message_echec); |
196,7 → 193,6 |
} |
private function getServiceCollectionExpertise() { |
$projet_id = $this->parametres['projet']; |
// Construction de la requête |
$requete = 'SELECT '.(($this->distinct) ? 'DISTINCT' : '').' '. |
210,7 → 206,6 |
'FROM coel_collection '. |
' LEFT JOIN coel_collection_botanique ON (cc_id_collection = ccb_id_collection) '. |
' LEFT JOIN coel_structure ON (cs_id_structure = cc_ce_structure) '. |
( is_null($projet_id) ? '' : "WHERE cc_ce_projet = $projet_id "). |
'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby : 'cc_nom ASC').' '; |
$message_echec = "La requête a retourné aucun résultat."; |
$collections = $this->executerRequete($requete, $message_echec); |
/trunk/jrest/services/CoelPublicationAPersonne.php |
---|
36,7 → 36,7 |
// Construction de la requête |
$requete = (($this->distinct) ? 'SELECT DISTINCT ' : 'SELECT '). |
' cpu.*, cpuap.*, cp_id_personne, cp_ce_projet, cp_prenom, cp_nom, cp_fmt_nom_complet, cp_code_postal, cp_truk_courriel, cp_ville '. |
' cpu.*, cpuap.*, cp_id_personne, cp_prenom, cp_nom, cp_fmt_nom_complet, cp_code_postal, cp_truk_courriel, cp_ville '. |
'FROM coel_publication_a_personne AS cpuap '. |
' LEFT JOIN coel_meta_historique_ligne ON (cpuap_ce_meta = cmhl_id_historique_ligne) '. |
' LEFT JOIN coel_personne AS cp ON (cpuap_id_personne = cp_id_personne) '. |
/trunk/jrest/services/CoelSyndication.php |
---|
130,9 → 130,6 |
} |
private function chargerListeDesFlux() { |
$this->setFlux('projet', 'Flux de syndication des projets', |
'Ce flux fournit des informations sur les mises à jour des projets saisis dans COEL.'); |
$this->setFlux('structure','Flux de syndication des institutions', |
'Ce flux fournit des informations sur les mises à jour des institutions saisies dans COEL.'); |
$this->setFlux('collection', 'Flux de syndication des Collections', |
149,34 → 146,6 |
return $this->flux; |
} |
private function getServiceProjet() { |
// Construction de la requête |
$requete = (($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' '. |
' h1.cmhl_id_historique_ligne, h1.cmhl_ce_table, h1.cmhl_cle_ligne, '. |
' h1.cmhl_enregistrement, '. |
' h1.cmhl_date_modification, h1.cmhl_ce_etat, h1.cmhl_ip, '. |
' h1.cmhl_cle_ligne AS guid, '. |
" 'prj' AS guid_type, ". |
' cp_fmt_nom_complet AS modifier_par '. |
'FROM coel_meta_historique_ligne AS h1 '. |
' LEFT JOIN coel_meta_historique_ligne AS h2 '. |
' ON (h1.cmhl_ce_table = h2.cmhl_ce_table '. |
' AND h1.cmhl_cle_ligne = h2.cmhl_cle_ligne '. |
' AND h1.cmhl_date_modification <= h2.cmhl_date_modification ) '. |
' LEFT JOIN coel_personne ON (h1.cmhl_ce_modifier_par = cp_id_personne) '. |
'WHERE h1.cmhl_ce_table = 115 %s '. |
'GROUP BY h1.cmhl_cle_ligne, h1.cmhl_date_modification, h1.cmhl_date_modification '. |
'HAVING COUNT(*) = %s '. |
'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby : 'h1.cmhl_date_modification DESC').' '. |
"LIMIT $this->start,$this->limit "; |
$elements = $this->executerRequeteHistorique($requete); |
// Création du contenu |
$contenu = $this->executerService('cpr_nom', $elements); |
return $contenu; |
} |
private function getServiceStructure() { |
$elements = array(); |
$elements = array_merge($elements, $this->getHistoriqueTableStructure(120)); |
/trunk/jrest/services/CoelRecherche.php |
---|
241,8 → 241,7 |
'p' => 'str', |
'pr' => 'int', |
'str-d' => 'frdepliste', |
'veg' => 'int', |
'projets' => 'int' |
'veg' => 'int' |
); |
return $this->pretraiterParametresUrl($param, $qs, $params_passes); |
} |
427,12 → 426,7 |
} |
} |
if (isset($p['projets'])) { |
$where[] = "cc_ce_projet IN ({$p['projets']})"; |
$where[] = "cs_ce_projet IN ({$p['projets']})"; |
} |
if (isset($p['sci'])) { |
$join[] = 'LEFT JOIN coel_structure_valorisation ON (cs_id_structure = csv_id_structure)'; |
} |
/trunk/jrest/services/CoelPersonne.php |
---|
19,10 → 19,9 |
* Méthode appelée avec une requête de type GET. |
* |
* Liste des paramètres : |
* /Personne_Id/Projet_id/Nom_Complet/ |
* /Personne_Id/Nom_Complet/ |
* Attention : pour avoir toutes les personnes, il faut éxécuter : CoelPersonneListe |
* Pour avoir toutes les personnes d'un projet, il faut éxécuter : CoelPersonneListe/* /projet_id |
* Pour avoir toutes les personnes d'un projet, dont le nom complet comment par NomComplet il faut éxécuter : CoelPersonneListe/* /projet_id/NomComplet |
* Pour avoir toutes les personnes dont le nom complet comment par NomComplet il faut éxécuter : CoelPersonneListe/* /NomComplet |
*/ |
function getElement($param = array()) { |
// Initialisation de variables |
29,7 → 28,7 |
$info = array(); |
// Pré traitement des paramêtres |
$p = $this->traiterParametresUrl(array('id_personne', 'ce_projet', 'recherche'), $param); |
$p = $this->traiterParametresUrl(array('id_personne', 'recherche'), $param); |
// Construction de la requête |
$requete = (($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' cp.*, '. |
38,7 → 37,6 |
' LEFT JOIN coel_meta_historique_ligne ON (cp_ce_meta = cmhl_id_historique_ligne) '. |
((count($p) != 0) ? 'WHERE ' : ''). |
(isset($p['id_personne']) ? "AND cp_id_personne = {$p['id_personne']} " : ''). |
(isset($p['ce_projet']) ? "AND cp_ce_projet = {$p['ce_projet']} " : ''). |
(isset($p['recherche']) ? $this->construireWhereRecherche($p['recherche']) : ''). |
'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby : 'TRIM(cp_nom) ASC').' '; |
/trunk/jrest/services/CoelCollection.php |
---|
51,7 → 51,7 |
* Méthode par défaut pour garder la compatibilité avec Coel. |
* Appelée avec les paramêtres d'url suivant : |
* /CoelCollection/_/_/_ |
* ou les _ représentent dans l'ordre : id_projet, id_collection ou nom |
* ou les _ représentent dans l'ordre : id_collection ou nom |
* Si un des paramêtres est abscent, il prendre la valeur * |
*/ |
public function getElementParDefaut($param) { |
59,7 → 59,7 |
$info = array(); |
// Pré traitement des paramêtres |
$p = $this->traiterParametresUrl(array('id_projet', 'id_collection', 'recherche'), $param); |
$p = $this->traiterParametresUrl(array('id_collection', 'recherche'), $param); |
// Construction de la requête |
$requete = (($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' c.*, cb.*, '. |
72,7 → 72,6 |
' LEFT JOIN coel_collection AS ccm ON (c.cc_ce_mere = ccm.cc_id_collection) '. |
' LEFT JOIN coel_collection_botanique AS cb ON (c.cc_id_collection = ccb_id_collection) '. |
((count($p) != 0) ? 'WHERE ' : ''). |
((isset($p['id_projet'])) ? "AND c.cc_ce_projet = {$p['id_projet']} " : ''). |
((isset($p['id_collection'])) ? "AND c.cc_id_collection = {$p['id_collection']} " : ''). |
(isset($p['recherche']) ? $this->construireWhereRecherche($p['recherche']) : ''). |
'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby : 'c.cc_nom ASC').' '; |
323,11 → 322,11 |
$this->envoyer(); |
} |
private function ajouterGuid($abr_projet, $id_collection) { |
private function ajouterGuid($id_collection) { |
if ($id_collection !== false) { |
$table_guid = $this->tables[101]; |
$table_guid['champs_valeurs_id']['cc_id_collection'] = $id_collection; |
$table_guid['champs_valeurs_protege']['cc_guid'] = $this->bdd->quote(sprintf($this->config['coel']['guid'], $abr_projet, 'coll'.$id_collection)); |
$table_guid['champs_valeurs_protege']['cc_guid'] = $this->bdd->quote(sprintf($this->config['coel']['guid'], 'coll'.$id_collection)); |
$this->modifier($table_guid); |
} |
} |
/trunk/jrest/services/CoelStructure.php |
---|
45,7 → 45,7 |
if ($type == '*' || is_numeric($type)) { |
// Pré traitement des paramêtres |
$p = $this->traiterParametresUrl(array('id_projet', 'id_structure', 'recherche'), $param); |
$p = $this->traiterParametresUrl(array('id_structure', 'recherche'), $param); |
$info = $this->getElementParDefaut($p); |
} else { |
$methode = 'getElement'.$type; |
65,7 → 65,7 |
* Méthode par défaut pour garder la compatibilité avec Coel. |
* Appelée avec les paramêtres d'url suivant : |
* /CoelStructure/_/_/_ |
* ou les _ représentent dans l'ordre : id_projet, id_structure et nom |
* ou les _ représentent dans l'ordre : id_structure et nom |
* Si un des paramêtres est abscent, il prendre la valeur * |
*/ |
public function getElementParDefaut($p) { |
73,7 → 73,6 |
$info = array(); |
$whereClause = array(); |
if(isset($p['id_projet'])) $whereClause[] = "cs_ce_projet = {$p['id_projet']}"; |
if(isset($p['id_structure'])) $whereClause[] = "cs_id_structure = {$p['id_structure']}"; |
if(isset($p['recherche'])) { |
139,7 → 138,7 |
*/ |
public function getElementParZoneGeo($param) { |
// Pré traitement des paramêtres |
$p = $this->traiterParametresUrl(array('type', 'projets'), $param); |
$p = $this->traiterParametresUrl(array('type'), $param); |
if (!isset($p['type'])) { |
$this->messages[] = "Il est obligatoire d'indiquer type de recherche pour utiliser ce service."; |
return array(); |
153,7 → 152,6 |
' COUNT( cs_id_structure ) AS nbre '. |
'FROM coel_structure '. |
'WHERE cs_ce_truk_pays = 2654 '. |
(isset($p['projets']) ? " AND cs_ce_projet IN ({$p['projets']}) " : ''). |
'GROUP BY IF ( SUBSTRING( cs_code_postal FROM 1 FOR 2 ) >= 96, '. |
' SUBSTRING( cs_code_postal FROM 1 FOR 3 ), '. |
' SUBSTRING( cs_code_postal FROM 1 FOR 2 ) ) '. |
295,7 → 293,7 |
$this->mettreAJourAvecCle($id_utilisateur, $id_session, $table_id, $table); |
} |
} catch (PDOException $e) { |
$this->messages[] = sprintf($this->getTxt('sql_erreur'), $e->getFile(), $e->getLine(), $e->getMessage(), $requete); |
$this->messages[] = sprintf($this->getTxt('sql_erreur'), $e->getFile(), $e->getLine(), $e->getMessage()); |
} |
// Envoie sur la sortie standard |
400,11 → 398,11 |
return FALSE; |
} |
private function ajouterGuid($abr_projet, $id_structure) { |
private function ajouterGuid($id_structure) { |
if ($id_structure !== false) { |
$table_guid = $this->tables[120]; |
$table_guid['champs_valeurs_id']['cs_id_structure'] = $id_structure; |
$table_guid['champs_valeurs_protege']['cs_guid'] = $this->bdd->quote(sprintf($this->config['coel']['guid'], $abr_projet, 'str'.$id_structure)); |
$table_guid['champs_valeurs_protege']['cs_guid'] = $this->bdd->quote(sprintf($this->config['coel']['guid'], 'str'.$id_structure)); |
$this->modifier($table_guid); |
} |
} |
/trunk/jrest/services/CoelCommentaire.php |
---|
23,7 → 23,7 |
$info = array(); |
// Pré traitement des paramêtres |
$p = $this->traiterParametresUrl(array('id_projet', 'id_commentaire', 'recherche'), $param); |
$p = $this->traiterParametresUrl(array('id_commentaire', 'recherche'), $param); |
// Construction de la requête |
$requete = (($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' ccm.*, '. |
34,7 → 34,6 |
' LEFT JOIN coel_collection_a_commentaire AS ccac ON (ccm_id_commentaire = ccac_id_commentaire) '. |
' LEFT JOIN coel_collection ON (ccac_id_collection = cc_id_collection) '. |
((count($p) != 0) ? 'WHERE ' : ''). |
(isset($p['id_projet']) ? "AND ccm_ce_projet = {$p['id_projet']} " : ''). |
(isset($p['id_commentaire']) ? "AND ccm_id_commentaire = {$p['id_commentaire']} " : ''). |
(isset($p['recherche']) ? $this->construireWhereRecherche($p['recherche']) : ''). |
'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby : 'ccm_id_commentaire ASC').' '; |