Subversion Repositories eFlore/Applications.cel

Compare Revisions

Regard whitespace Rev 2461 → Rev 2462

/trunk/jrest/bibliotheque/Decoupage.class.php
File deleted
\ No newline at end of file
/trunk/jrest/bibliotheque/RechercheInfosTaxon.php
File deleted
\ No newline at end of file
/trunk/jrest/bibliotheque/DecoupageNomLatin.class.php
File deleted
\ No newline at end of file
/trunk/jrest/bibliotheque/RechercheObservation.php
1,7 → 1,7
<?php
// declare(encoding='UTF-8');
/**
* Librairie de recherche d'observations à partir de divers critères.
* Classe de recherche d'observations à partir de divers critères.
*
* @internal Mininum PHP version : 5.2
* @category CEL
/trunk/jrest/bibliotheque/GestionMotsClesChemin.php
1,14 → 1,20
<?php
// declare(encoding='UTF-8');
/**
* @package jrest
* @author Aurélien Peronnet <aurelien@tela-botania.org>
* @copyright 2010, 2013 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* Classe de liaison d'images et d'observation à des mots clés en utilisant la méthode path enumeration.
*
* Librairie de liaison d'images et d'observation à des mots clés en utilisant la méthode
* path enumeration
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
 
class GestionMotsClesChemin {
 
private $config;
54,12 → 60,9
$requete = 'SELECT id_mot_cle '.
"FROM {$this->table_mots_cles} ".
"WHERE chemin LIKE CONCAT(($sousRequete), '%') ".
"AND id_utilisateur = ".$idUtilisateurP." ".
"AND id_utilisateur = $idUtilisateurP ".
' -- '.__FILE__.':'.__LINE__;
 
$ids_enfants = Cel::db()->requeter($requete);
 
return $ids_enfants;
return Cel::db()->requeter($requete);
}
 
/**
69,12 → 72,10
public function obtenirIdsMotsClesParIdElementLie($id_element_lie) {
$idElementLieP = Cel::db()->proteger($id_element_lie);
 
$requete = "SELECT id_mot_cle FROM {$this->table_liaison} WHERE id_element_lie = $idElementLieP" .
$requete = "SELECT id_mot_cle FROM {$this->table_liaison} ".
"WHERE id_element_lie = $idElementLieP ".
' -- '.__FILE__.':'.__LINE__;
 
$ids_mots_cles = Cel::db()->requeter($requete);
 
return $ids_mots_cles;
return Cel::db()->requeter($requete);
}
 
public function insererParCheminSiInexistant($mot_cle, $chemin_parent, $id_utilisateur) {
88,7 → 89,6
"WHERE chemin = $cheminMotCleP ".
"AND id_utilisateur = $idUtilisateurP ".
' -- '.__FILE__.':'.__LINE__;
 
$infosMotCle = Cel::db()->requeter($requete);
 
if (!empty($infosMotCle)) {
110,8 → 110,8
'(chemin, id_utilisateur, mot_cle) '.
"VALUES ($cheminMotCleP, $idUtilisateurP, $motCleP ) ".
' -- '.__FILE__.':'.__LINE__;
$insertion = Cel::db()->executer($requete);
 
$insertion = Cel::db()->executer($requete);
$resultat = false;
if ($insertion !== false) {
$resultat = Cel::db()->obtenirDernierId();
137,8 → 137,8
$requete = "INSERT INTO {$this->table_mots_cles} (chemin, id_utilisateur, mot_cle) ".
"VALUES (CONCAT($sousRequete, $motCleSimpleP, '/'), $idUtilisateurP, $motCleP ) ".
' -- '.__FILE__.':'.__LINE__;
$insertion = Cel::db()->executer($requete);
 
$insertion = Cel::db()->executer($requete);
if ($insertion !== false) {
$resultat = Cel::db()->obtenirDernierId();
}
153,9 → 153,7
"VALUES ($idElementLieP, $idMotCleP) ".
'ON DUPLICATE KEY UPDATE id_element_lie = id_element_lie '.
' -- '.__FILE__.':'.__LINE__;
 
$liaison = Cel::db()->executer($requete);
return $liaison;
return Cel::db()->executer($requete);
}
 
public function lierParChemin($chemin, $id_element_lie, $id_utilisateur) {
172,9 → 170,7
"VALUES ($idElementLieP, $sousRequete) ".
'ON DUPLICATE KEY UPDATE id_element_lie = id_element_lie '.
' -- '.__FILE__.':'.__LINE__;
 
$liaison = Cel::db()->executer($requete);
return $liaison;
return Cel::db()->executer($requete);
}
 
public function lierParTableaux($ids_mots_cles, $ids_elements_lies) {
192,9 → 188,7
"VALUES $valeursGroupees ".
"ON DUPLICATE KEY UPDATE id_element_lie = id_element_lie ".
' -- '.__FILE__.':'.__LINE__;
$liaison = Cel::db()->executer($requete);
 
return $liaison;
return Cel::db()->executer($requete);
}
 
/**
206,7 → 200,6
*/
public function modifierLiaisonParTableaux($ids_mots_cles, $ids_elements_lies, $supprimer) {
$reussi = true;
 
foreach ($ids_elements_lies as $id_element_lie) {
$idElementLieP = Cel::db()->proteger($id_element_lie);
// trouver les mots clés actuels
257,7 → 250,6
$reussi = ($reussi && $resultat);
}
}
 
return $reussi;
}
 
275,9 → 267,7
$requete = "DELETE FROM {$this->table_liaison} ".
"WHERE $clauseWhere ".
' -- '.__FILE__.':'.__LINE__;
 
$suppression = Cel::db()->executer($requete);
return $suppression;
return Cel::db()->executer($requete);
}
 
public function supprimerToutesLiaisonsPourIdsElementsLies($ids_elements_lies) {
610,7 → 600,7
return $requeteTpl;
}
 
// Fonctions utilitaires
// Méthodes utilitaires
 
/**
* La profondeur d'un noeud est déterminée par le nombre de slashs
644,14 → 634,11
return $chemin;
}
function supprimerAccents($str, $charset='utf-8')
{
static function supprimerAccents($str, $charset='utf-8') {
$str = htmlentities($str, ENT_NOQUOTES, $charset);
$str = preg_replace('#&([A-za-z])(?:acute|cedil|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $str);
$str = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $str); // pour les ligatures e.g. '&oelig;'
$str = preg_replace('#&[^;]+;#', '', $str); // supprime les autres caractères
return $str;
}
 
678,11 → 665,11
return $valeur;
}
 
static public function startsWith($haystack, $needle) {
public static function startsWith($haystack, $needle) {
return $needle === '' || strpos($haystack, $needle) === 0;
}
 
static public function endsWith($haystack, $needle) {
public static function endsWith($haystack, $needle) {
return $needle === '' || substr($haystack, -strlen($needle)) === $needle;
}
 
715,5 → 702,4
$migration = ($migration !== false) ? true : false;
return $migration;
}
}
?>
}
/trunk/jrest/bibliotheque/GestionObservation.php
1,19 → 1,23
<?php
// declare(encoding='UTF-8');
/**
* Classe de gestion de l'ajout, modification et suppression des observations
* Classe de gestion de l'ajout, modification et suppression des observations.
*
* TODO: $sous_requete .= ' date_modification = now() '
* devrait être une clause ON UPDATE ou un TRIGGER
* afin de mettre à jour la date de modification uniquement lorsqu'une modification a effectivement eu lieu
*
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèque
* @author Raphaël Droz <raphael@tela-botanica.org>
* @author Aurelien Peronnet <aurelien@tela-botanica.org>
* @copyright © 2010-2014, Tela-Botanica
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt>
* @subpackage Bibliothèques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
class GestionObservation extends Cel {
 
41,7 → 45,6
'nom_referentiel' => NULL);
$parametres = array_merge($base_param, $parametres);
 
 
$parametres['ordre'] = $this->renvoyerDernierOrdreUtilisePlusUn($utilisateur);
 
$this->traiterEspece($parametres);
114,7 → 117,6
"WHERE ce_utilisateur = $idUtilisateurP ".
"AND ordre = $ordreP ".
' -- ' . __FILE__ . ':' . __LINE__;
 
$dernier_id = Cel::db()->requeter($requete);
 
$retour = null;
/trunk/jrest/bibliotheque/RechercheImage.php
1,24 → 1,20
<?php
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
// declare(encoding='UTF-8');
/**
* PHP Version 5
* Classe de recherche d'images à partir de divers critères.
*
* @category PHP
* @package jrest
* @author Aurélien Peronnet <aurelien@tela-botania.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/jrest/
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
 
/**
* in : utf8
* out : utf8
*
* Librairie recherche d'images a partir de divers critères
*
*/
class RechercheImage extends Cel {
 
function rechercherImagesEtObservationAssociees($id_utilisateur = null, $criteres = array(), $debut = 0, $limite = 50) {
85,7 → 81,6
if ($resultat_requete_nombre_images && is_array($resultat_requete_nombre_images) && count($resultat_requete_nombre_images) > 0) {
$nb_images = $resultat_requete_nombre_images[0]['nb_images'];
}
 
return $nb_images;
}
 
219,10 → 214,8
if (trim($chaine_recherche) == '') {
return '';
}
 
$chaine_recherche = strtolower($chaine_recherche);
$chaine_recherche = str_replace(' ','_',$chaine_recherche);
 
$requete = ' ('.
'ci.nom_original LIKE '.Cel::db()->proteger($chaine_recherche.'%').' OR '.
'co.nom_ret LIKE '.Cel::db()->proteger($chaine_recherche.'%').' OR '.
236,7 → 229,6
'ci.nom_utilisateur LIKE '.Cel::db()->proteger($chaine_recherche.'%').' OR '.
'ci.prenom_utilisateur LIKE '.Cel::db()->proteger($chaine_recherche.'%').' '.
') ';
 
return $requete;
}
 
286,13 → 278,15
$mots_cles_chaine = rtrim($mots_cles_chaine,',');
$image['mots_cles'] = $mots_cles_chaine;
}
 
return $tableau_images;
}
 
public function obtenirCourrielUtilisateurPourIdImage($id_image) {
$requete = 'SELECT courriel_utilisateur FROM cel_images WHERE id_image = '.Cel::db()->proteger($id_image);
 
$idImageP = Cel::db()->proteger($id_image);
$requete = 'SELECT courriel_utilisateur '.
'FROM cel_images '.
"WHERE id_image = $idImageP ".
' -- '.__FILE__.':'.__LINE__;
$utilisateur_courriel = Cel::db()->requeter($requete);
 
$retour = false;
305,18 → 299,8
private function getIdsMotsClesImage($id_image) {
$requete = 'SELECT DISTINCT id_mot_cle '.
'FROM cel_mots_cles_images_liaison '.
"WHERE id_element_lie = $id_image ";
 
"WHERE id_element_lie = $id_image ".
' -- '.__FILE__.':'.__LINE__;
return Cel::db()->requeter($requete);
}
 
// TODO: fonction temporaire
private function formaterDateSqlVersDateAvecSlash($date_sql) {
$date_formatee = '';
$date = explode('-', $date_sql) ;
if (count($date) > 2) {
$date_formatee = $date[2].'/'.$date[1].'/'.$date[0] ;
}
return $date_formatee;
}
}
/trunk/jrest/bibliotheque/GenerateurPDF.php
1,16 → 1,23
<?php
 
// declare(encoding='UTF-8');
/**
* @category PHP
* @package jrest
* Classe permettant de générer des PDFs.
*
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Raphaël Droz <raphael@tela-botania.org>
* @copyright 2013 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
 
// Include the main TCPDF library (search for installation path).
date_default_timezone_set("Europe/Paris");
date_default_timezone_set('Europe/Paris');
require_once('tcpdf_config.php');
require_once('tcpdf/tcpdf.php');
 
29,14 → 36,6
$pdf->SetSubject('Étiquettes des observations');
$pdf->SetKeywords('botaniques, observations, étiquettes, cel, tela-botanica');
 
// set default header data
// $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 005', PDF_HEADER_STRING);
 
// set header and footer fonts
// $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
// $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
 
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
 
// set margins
44,8 → 43,6
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
 
// set auto page breaks
// $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->SetAutoPageBreak(FALSE, PDF_MARGIN_BOTTOM);
 
$pdf->SetFont('times', '', 11);
58,9 → 55,7
$this->pdf = $pdf;
}
 
 
 
function export($obs) {
public function export($obs) {
$pdf = &$this->pdf;
 
$i = 0;
/trunk/jrest/bibliotheque/Decoupage.php
New file
0,0 → 1,160
<?php
// declare(encoding='UTF-8');
/**
* Classe abstraite mettant en comun des expressions régulière pour le découpage des noms latins.
*
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
abstract class Decoupage {
 
protected $min = '[a-z\x{E0}-\x{FF}\x{153}]';// Lettres minuscules : a à z et &#224; à &#255 et &#339;
protected $maj = "[A-Z'\x{C0}-\x{DF}\x{152}]";// Lettres majuscules : A à Z, ' et &#192; à &#223; et &#338;
protected $hyb = '[+xX]';
 
protected $SupraSp;// Nom de type suprasp.
protected $GenHy;// Hybride intergénérique
protected $Gen;// Genre
protected $Dou = '(?:\(\?\)|\?)';// Doute
protected $Epi_cv;// Epithete de cultivar
protected $Epi_nn_hy = '(?:nsp\.|)';// Epithète non nommé hybride
protected $Epi_nn = '(?:sp\.[1-9]?|spp\.|)';// Epithète non nommé
protected $Epi;// Epithete
//------------------------------------------------------------------------------------------------------------//
protected $Ran_ig = '[Ss]ect\.|subg(?:en|)\.|ser\.|subser\.';// Rang taxonomique infragénérique de type : sous-genre
protected $Ran_ig_gr = 'gr\.';// Rang taxonomique infragénérique de type : groupe
protected $Ran_ig_agg = 'agg\.';// Rang taxonomique infragénérique de type : aggrégat
protected $Ran_bo_i1 = 'subsp\.';// Rang taxonomique infraspécifique de niveau 1
protected $Ran_bo_i2 = 'var\.|subvar\.';// Rang taxonomique infraspécifique de niveau 2
protected $Ran_bo_i3 = 'f\.|fa\.|fa|forma';// Rang taxonomique infraspécifique de niveau 3
protected $Ran_bo_i4 = 'race|prole|proles|prol\.';// Rang taxonomique infraspécifique de niveau 4
protected $Ran_bo;// Rang taxonomique infraspécifique botanique non hybride
protected $Ran_hy_i1 = 'n-subsp\.|\[subsp\.\]|\[n-subsp\.\]';// Rang taxonomique infraspécifique hybride de niveau 1
protected $Ran_hy_i2 = '\[var\.\]|n-var\.|\[n-var\.\]';// Rang taxonomique infraspécifique hybride de niveau 2
protected $Ran_hy_i3 = '';// Rang taxonomique infraspécifique hybride de niveau 3
protected $Ran_hy_i4 = 'n-proles\.';// Rang taxonomique infraspécifique hybride de niveau 4
protected $Ran_hy;// Rang taxonomique infraspécifique hybridre
protected $Ran_ht = 'convar\.|[cC]v\.';// Rang taxonomique horticole
protected $Ran;// Rang taxonomique infraspécifique non hybride, hybride et horticole
//------------------------------------------------------------------------------------------------------------//
protected $Ini;// Initiale de prénoms
protected $Pre;// Prénoms
protected $Par = '(?i:de|des|le|la|de la|von|van|st\.|el)';// Particules
protected $ParSsEs = "(?i:st\.-|d)";// Particules sans espace après
protected $Nom; // Abreviation d'un nom d'auteur. Le "f." c'est pour "filius" et c'est collé au nom
protected $NomSpe = '(?:[A-Z]\. (?:DC\.|St\.-Hil\.))|\(?hort\.\)?|al\.';// Prénom + nom spéciaux : "hort." est utilisé comme un nom d'auteur mais cela signifie "des jardins". "DC." est une exception deux majuscule suivi d'un point.
protected $Int;// Intitulé d'auteurs (Prénom + Nom)
//------------------------------------------------------------------------------------------------------------//
protected $AutNo;// Intitulé auteur sans "ex", ni "&", ni "et", ni parenthèses
protected $AutNoTa;// Intitulé auteur sans "ex", ni "&", ni "et" mais avec parenthèses possible pour la nomenclature
protected $AutEx;// Intitulé auteur avec "ex"
protected $et = '(?:&|et)';
protected $AutExEt;// Intitulé auteur avec "ex" et "&" ou "et"
protected $AutEt;// Intitulé auteur avec "&" ou "et" et sans parenthèse spécifique à la nomenclature
protected $AutEtTa;// Intitulé auteur avec "&" ou "et" et avec ou sans parenthèse spécifique à la nomenclature
protected $AutBib;// Intitulés auteurs pour la biblio
protected $AutInc = 'AUTEUR\?';// Intitulé auteur spéciaux pouvant être trouvés entre parenthèses
protected $AutSpe;// Intitulé auteur spéciaux pouvant être trouvés entre parenthèses
protected $AutSpeSe;// Intitulé auteur spéciaux type "sensu"
protected $AutSpeTa;// Intitulé auteur spéciaux propre à la nomenclature
protected $Aut;// Tous les intitulés auteurs possibles
protected $Auteur;// Tous les intitulés auteurs possibles
//------------------------------------------------------------------------------------------------------------//
protected $ComEmend;// Commentaires nomenclaturaux
protected $ComPp = 'p\.p\.';// Commentaires nomenclaturaux
protected $Com;// Intitulé auteur spéciaux type "sensu"
protected $ComNom = '\(?(?:hort\. non .*|sensu .*|auct\..*|comb\.\s*(?:nov\.|ined\.)|comb?\.\s*nov\.\s*provis\.|stat\.\s*provis\.|nov\.\s*stat\.|stat\.\s*nov\.|p\.p\.|emend\.)\)?';
//------------------------------------------------------------------------------------------------------------//
protected $In;// In auteur
protected $AneMoCo = 'janvier|fevrier|mars|avril|mai|juin|juillet|ao\x{FB}t|septembre|octobre|novembre|decembre'; //Mois devant l'année
protected $AneMoAb = 'janv\.|f[e\x{E9}]v\.|sept\.|oct\.|d\x{E9}c\.'; //Mois devant l'année
protected $AneBaSi = '(?:\d{4}|\d{4} ?\?|DATE \?)';// Date
protected $AneBaCo = '(?:\d{4}-\d{4}|\d{4}-\d{2})';// Date
protected $AneDo = '\?';// Doute
protected $AneBa;// Date
protected $AneSpe;// Date
protected $Ane;// Date
//------------------------------------------------------------------------------------------------------------//
// Spécial BDNFF :
protected $Date = ' \[.*\]';
protected $Num = '[0-9]|3\*|4\*';# Gestion des numéros de flore
protected $NumAuteur;# Gestion des numéros de flore mélangés ou pas au nom d'auteur
 
//------------------------------------------------------------------------------------------------------------//
protected $BibBa;// Biblio de base : \x{B0} = ° \x{AB}\x{BB} = «» \x{26} = &
protected $Bib;// Biblio de taxon
protected $BibAu = '.+';// Biblio supplémentaire
//------------------------------------------------------------------------------------------------------------//
protected $ErrDet;// Biblio à exclure base
//------------------------------------------------------------------------------------------------------------//
protected $HomNon = 'non';// Homonymes à exclure : négation
protected $HomBa;// Homonymes à exclure base
protected $Hom;// Homonymes à exclure avec non et nec
protected $HomCourt;// Homonymes à exclure avec non et nec avec expression régulière plus courte!
//------------------------------------------------------------------------------------------------------------//
protected $Inf = '.*';// Informations supplémentaires
 
public function __construct() {
//mb_internal_encoding('UTF-8');
//mb_regex_encoding('UTF-8');
//setlocale(LC_ALL, 'fr-fr');
 
$this->SupraSp = '(?:'.$this->maj.$this->min.'+|'.$this->maj.$this->min.'+-'.$this->maj.$this->min.'+)';// Nom de type suprasp.
$this->GenHy = "[Xx] $this->SupraSp";// Hybride intergénérique
$this->Gen = "$this->SupraSp|$this->GenHy";
$this->Epi_cv = "$this->maj.(?:$this->min|-)+";// Epithete de cultivar
$this->Epi_nn = $this->Epi_nn.$this->Epi_nn_hy;
$this->Epi = "(?:(?:$this->min|-|')+|$this->Epi_nn)";// Epithete
 
$this->Ran_ig = $this->Ran_ig.'|'.$this->Ran_ig_gr;
$this->Ran_bo = "$this->Ran_bo_i1|$this->Ran_bo_i2|$this->Ran_bo_i3|$this->Ran_bo_i4";// Rang taxonomique infraspécifique botanique non hybride
$this->Ran_hy = "$this->Ran_hy_i1|$this->Ran_hy_i2|$this->Ran_hy_i3|$this->Ran_hy_i4";// Rang taxonomique infraspécifique hybridre
$this->Ran = "(?:$this->Ran_ig|$this->Ran_bo|$this->Ran_hy|$this->Ran_ht)";// Rang taxonomique infraspécifique non hybride, hybride et horticole
 
$this->Ini = '(?:'.$this->maj.'[.]|'.$this->maj.$this->min.'+[.]?)';// Initiale de prénoms
$this->Pre = $this->Ini.'{1,3}|'.$this->Ini.'[\- ]'.$this->Ini;// Prénoms
$this->Nom = '(?:'.$this->maj."'".$this->maj.'|'.$this->maj.'|'.$this->maj.$this->min."+'".$this->min.'+)'.$this->min.'*[.]?(?: ?f\.|)';
$this->Int = "(?:(?:$this->Pre ?|)(?:$this->Par |$this->ParSsEs|)(?:$this->Nom|$this->Nom".'[\- .]'."$this->Nom)|$this->NomSpe)";// Intitulé d'auteurs (Prénom + Nom)
 
$this->AutNo = "$this->Int";// Intitulé auteur sans "ex", ni "&", ni "et", ni parenthèses
$this->AutNoTa = "$this->AutNo|$this->NomSpe $this->Int|\($this->Int\) $this->Int";// Intitulé auteur sans "ex", ni "&", ni "et" mais avec parenthèses possible pour la nomenclature
$this->AutEx = "\($this->Int\) $this->Int ex $this->Int|\($this->Int ex $this->Int\) $this->Int|$this->Int ex $this->Int";// Intitulé auteur avec "ex"
$this->AutExEt = "$this->Int $this->et $this->Int ex $this->Int|$this->Int $this->et $this->Int ex $this->Int $this->et $this->Int|$this->Int ex $this->Int $this->et $this->Int|\($this->Int ex $this->Int $this->et $this->Int\) $this->Int|\($this->Int ex $this->Int\) $this->Int $this->et $this->Int|\($this->Int $this->et $this->Int\) $this->Int ex $this->Int|$this->NomSpe $this->Int ex $this->Int";// Intitulé auteur avec "ex" et "&" ou "et"
$this->AutEt = "$this->Int $this->et $this->Int";// Intitulé auteur avec "&" ou "et" et sans parenthèse spécifique à la nomenclature
$this->AutEtTa = "\($this->Int\) $this->Int $this->et $this->Int|\($this->Int $this->et $this->Int\) $this->Int|$this->AutEt";// Intitulé auteur avec "&" ou "et" et avec ou sans parenthèse spécifique à la nomenclature
$this->AutBib = "(?:$this->AutNo|$this->AutEt)";// Intitulés auteurs pour la biblio
$this->AutSpe = "(?:sensu |)auct\.|auct\. mult\.|$this->AutInc";// Intitulé auteur spéciaux pouvant être trouvés entre parenthèses
$this->AutSpeSe = "sensu $this->AutBib";// Intitulé auteur spéciaux type "sensu"
$this->AutSpeTa = "$this->AutSpe|\((?:$this->AutSpe)\)|$this->AutSpeSe";// Intitulé auteur spéciaux propre à la nomenclature
$this->Aut = "(?:$this->AutExEt|$this->AutEx|$this->AutEtTa|$this->AutSpeTa|$this->AutNoTa)";// Tous les intitulés auteurs possibles
$this->Auteur = $this->Int.'|'.$this->Int.' '.$this->et.' '.$this->Int.'|(?:'.$this->Int.', )+'.$this->Int.' '.$this->et.' '.$this->Int;// Intitulé auteur avec "&" ou "et";
 
$this->ComEmend = "emend\. $this->AutBib";// Commentaires nomenclaturaux
$this->Com = "$this->ComEmend|$this->ComPp";// Intitulé auteur spéciaux type "sensu"
 
$this->In = "[iI]n $this->AutBib";// In auteur
$this->AneBa = "$this->AneBaSi|$this->AneBaCo";// Date
$this->AneSpe = "(?:$this->AneBa ?\[$this->AneBa\]|(?:$this->AneMoCo|$this->AneMoAb) $this->AneBaSi|$this->AneBaSi $this->AneBaSi)";// Date
$this->Ane = "$this->AneBa||$this->AneDo|$this->AneSpe";// Date
 
$this->BibBa = "(?:$this->maj$this->min*[.]?|in|hort\.)(?:$this->min*[.]?|[\d\/\- ,()'\x{B0}\x{26}\x{AB}\x{BB}[\]?])*";// Biblio de base : \x{B0} = ° \x{AB}\x{BB} = «» \x{26} = &
$this->Bib = "([^:]+):(.+?)\(($this->Ane)\)";// Biblio de taxon
 
$this->ErrDet = "($this->AutSpe,? non $this->Aut): ($this->Bib;?)+";// Biblio à exclure base
 
$this->HomBa = "$this->Aut \($this->Ane\)";// Homonymes à exclure base
$this->Hom = "$this->HomNon $this->HomBa(?: nec $this->HomBa)*?";// Homonymes à exclure avec non et nec
$this->HomCourt = "$this->HomNon .+?(?: nec .+?)*?";// Homonymes à exclure avec non et nec avec expression régulière plus courte!
 
$this->NumAuteur = $this->Num.'|(?:(?:'.$this->Num.'|'.$this->Auteur.'), )+(?:'.$this->Num.'|'.$this->Auteur.')';# Gestion des numéros de flore mélangés ou pas au nom d'auteur
}
}
/trunk/jrest/bibliotheque/GestionChampsEtendus.php
1,21 → 1,21
<?php
// declare(encoding='UTF-8');
/**
* PHP Version 5
* in=utf8
* out=utf8
* Classe de gestion de l'ajout, modification et suppression des champs supplémentaires des obs et images.
*
* @category PHP
* @package jrest
* @author Aurelien Peronnet <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/jrest/
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Raphaël Droz <raphael@tela-botania.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
 
/**
* Classe de gestion de l'ajout, modification et suppression des champs supplémentaires des obs et images
*/
class GestionChampsEtendus extends Cel {
 
private $mode = null;
54,7 → 54,8
$requete = 'SELECT COUNT(*) >= 1 AS existe '.
"FROM {$this->table_champs_etendus} ".
"WHERE {$this->champ_id} = $id ".
" AND cle = $cle ";
" AND cle = $cle ".
' -- '.__FILE__.':'.__LINE__;;
 
$resultat = Cel::db()->requeter($requete);
return ($resultat[0]['existe'] == '1');
68,7 → 69,10
*/
public function consulter($id_element_lie) {
$id = Cel::db()->proteger($id_element_lie);
$requete = "SELECT * FROM {$this->table_champs_etendus} WHERE {$this->champ_id} = $id ";
$requete = 'SELECT * '.
"FROM {$this->table_champs_etendus} ".
"WHERE {$this->champ_id} = $id ".
' -- '.__FILE__.':'.__LINE__;
$resultat = Cel::db()->requeter($requete);
return $resultat;
}
121,7 → 125,8
$requete = "INSERT INTO {$this->table_champs_etendus} ".
"( {$this->champ_id}, cle, valeur) ".
"VALUES ($id, $cle, $valeur) ".
"ON DUPLICATE KEY UPDATE valeur = VALUES(valeur)";
"ON DUPLICATE KEY UPDATE valeur = VALUES(valeur) ".
' -- '.__FILE__.':'.__LINE__;
 
// la partie on duplicate key est spécifique mysql mais il sera facile de s'en passer le jour
// où l'on change de sgbd
173,8 → 178,8
$requete = "UPDATE {$this->table_champs_etendus} ".
"SET valeur = $valeur ".
"WHERE cle = $cle".
" AND {$this->champ_id} = $id ";
 
" AND {$this->champ_id} = $id ".
' -- '.__FILE__.':'.__LINE__;
$modif = Cel::db()->executer($requete);
return ($modif !== false);
}
189,7 → 194,10
public function supprimer($id_element_lie, $cle) {
$id = Cel::db()->proteger($id_element_lie);
$cle = Cel::db()->proteger($cle);
$requete = "DELETE FROM {$this->table_champs_etendus} WHERE cle = $cle AND {$this->champ_id} = $id ";
$requete = "DELETE FROM {$this->table_champs_etendus} ".
"WHERE cle = $cle ".
"AND {$this->champ_id} = $id ".
' -- '.__FILE__.':'.__LINE__;
$suppr = Cel::db()->executer($requete);
return ($suppr !== false);
}
202,7 → 210,9
*/
public function vider($id_element_lie) {
$id = Cel::db()->proteger($id_element_lie);
$requete = "DELETE FROM {$this->table_champs_etendus} WHERE {$this->champ_id} = $id ";
$requete = "DELETE FROM {$this->table_champs_etendus} ".
"WHERE {$this->champ_id} = $id ".
' -- '.__FILE__.':'.__LINE__;
$suppr = Cel::db()->executer($requete);
return ($suppr !== false);
}
215,7 → 225,9
*/
public function viderParLots($ids_elements_lies) {
$ids = $this->protegerTableau($ids_elements_lies);
$requete = "DELETE FROM {$this->table_champs_etendus} WHERE {$this->champ_id} IN (".implode(',',$ids).") ";
$requete = "DELETE FROM {$this->table_champs_etendus} ".
"WHERE {$this->champ_id} IN (".implode(',',$ids).") ".
' -- '.__FILE__.':'.__LINE__;
$suppr = Cel::db()->executer($requete);
return ($suppr !== false);
}
230,7 → 242,10
$cles_fmt = array();
if(!empty($ids_elements_lies)) {
$ids = $this->protegerTableau($ids_elements_lies);
$requete = "SELECT cle FROM {$this->table_champs_etendus} WHERE {$this->champ_id} IN (".implode(',',$ids).") ";
$requete = 'SELECT cle '.
"FROM {$this->table_champs_etendus} ".
"WHERE {$this->champ_id} IN (".implode(',',$ids).") ".
' -- '.__FILE__.':'.__LINE__;
$cles = Cel::db()->requeter($requete);
$i = 0;
foreach($cles as &$cle) {
248,11 → 263,11
$requete = "SELECT cc.cle as cle_groupe, cc.label as nom_groupe, ccc.cle as cle_champ, ccc.label as label_champ, ccc.invisible, ccc.prive ".
"FROM `cel_catalogue_champs_etendus` cc ".
"INNER JOIN cel_catalogue_champs_etendus_liaison cl ON cc.cle = cl.groupe ".
"INNER JOIN cel_catalogue_champs_etendus ccc ON ccc.cle = cl.champ";
 
"INNER JOIN cel_catalogue_champs_etendus ccc ON ccc.cle = cl.champ ".
' -- '.__FILE__.':'.__LINE__;
$groupes_champs = Cel::db()->executerRequete($requete);
$cle_groupe = "";
$cle_groupe = '';
$infos_groupe = null;
foreach ($groupes_champs as $groupe_champ) {
278,9 → 293,9
$infos_groupe['champs'][] = array(
'cle' => $groupe_champ['cle_champ'],
'label' => $groupe_champ['label_champ'],
'options' => array('invisible' => $groupe_champ['invisible'],
'prive' => $groupe_champ['prive']
)
'options' => array(
'invisible' => $groupe_champ['invisible'],
'prive' => $groupe_champ['prive'])
);
}
298,19 → 313,19
* Renvoie le catalogue des champs étendus
*/
public function consulterCatalogueChampsEtendusPredefinis($ordonner_par_cle = false) {
$requete = "SELECT cle, label, invisible, prive ".
"FROM cel_catalogue_champs_etendus cc ";
$requete = 'SELECT cle, label, invisible, prive '.
'FROM cel_catalogue_champs_etendus AS cc '.
' -- '.__FILE__.':'.__LINE__;
$catalogue = Cel::db()->executerRequete($requete);
$catalogue = Cel::db()->executerRequete($requete);
$infos_champs = array();
foreach ($catalogue as $champ) {
$champ_fmt = array(
'cle' => $champ['cle'],
'label' => $champ['label'],
'options' => array('invisible' => $champ['invisible'],
'prive' => $champ['prive']
)
'options' => array(
'invisible' => $champ['invisible'],
'prive' => $champ['prive'])
);
if($ordonner_par_cle) {
$infos_champs[$champ_fmt['cle']] = $champ_fmt;
359,5 → 374,4
 
return $cle;
}
}
?>
}
/trunk/jrest/bibliotheque/RechercheInfosTaxonBeta.php
1,21 → 1,21
<?php
// declare(encoding='UTF-8');
/**
* PHP Version 5
* Classe recherchant des infos sur un taxon.
*
* @category PHP
* @package jrest
* @author David Delon <david@tela-botania.org>
* @author Aurélien Peronnet <aurelien@tela-botania.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/jrest/
*/
 
/**
* Elle appelle les web service d'eflore pour éviter que le code client ne soit dépendant de la BDD d'eFlore.
*
* La classe appelle les web service d'eflore pour éviter que le code client
* ne soit dépendant de la version d'eflore
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
class RechercheInfosTaxonBeta extends Cel {
 
/trunk/jrest/bibliotheque/ChampEtendu.php
1,23 → 1,22
<?php
// declare(encoding='UTF-8');
/**
* PHP Version 5
* Classe conteneur servant à gérer les infos des champs étendus.
*
* @category PHP
* @package jrest
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/jrest/
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
 
/**
* Classe conteneur servant à gérer les infos des champs étendus.
*
*/
class ChampEtendu {
public $id = '';
public $cle = '';
public $valeur = '';
}
?>
}
/trunk/jrest/bibliotheque/NameParser.php
1,19 → 1,27
<?php
 
// declare(encoding='UTF-8');
/**
* Classe permettant de convertir une chaine d'un nom scientifique en un format standard.
*
* Source orignale :
* Taxamatch-Webservice PHP v1.0.0
* @author Michael Giddens
* @link http://www.silverbiology.com
*
*
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author David DELON <david@clapas.net>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
 
/* Adapation par David Delon Decembre 2010 : gestion sous espece
*/
 
 
/**
* Class NameParser
* Used to convert a string to a standarized format.
*/
class NameParser {
 
/**
22,15 → 30,7
*/
public $debug_flag;
 
 
 
/**
* Constructor
*/
public function __construct( ) {
}
 
/**
* Sets value to the method property
* @param mixed $name class property name
* @param mixed $value class property value
46,10 → 46,8
* @return string : string with only once space between characters
*/
private function reduce_spaces( $str ) {
$str = preg_replace("/ {2,}/", ' ', $str );
$str = preg_replace('/ {2,}/', ' ', $str );
$str = trim( $str );
return( $str );
}
 
73,7 → 71,6
* @return string : parsed author string
*/
public function parse_auth( $str, $upcase=1 ) {
 
$this->debug['parse_auth'][] = "1";
$temp = $str = trim($str);
141,7 → 138,6
$this->debug['parse_auth'][] = "6 (temp:$temp)";
foreach( explode(' ', $temp) as $this_word ) {
//$this->debug['parse_auth'][] = "7 (this_word:$this_word)";
$elapsed_chars = '';
// like '(%'
155,12 → 151,9
$elapsed_chars .= $this_word . ' ';
//$this->debug['parse_auth'][] = "7c (this_word:$this_word) (elapsed_chars:$elapsed_chars)";
}
$elapsed_chars = $this->reduce_spaces( str_replace(' )', ')', $elapsed_chars) );
return trim( $elapsed_chars ) ;
}
 
}
/**
196,9 → 189,7
* @return string : parsed string
*/
public function parse( $str = NULL ) {
unset($this->debug['parse']);
 
$temp = '';
$first_str_part = NULL;
$second_str_part = NULL;
232,7 → 223,7
//$this->debug['parse'][] = "2b1 (temp:$temp)";
 
// remove any content in angle brackets (e.g. html tags - <i>, </i>, etc.)
$html_pattern = "(\<(/?[^\>]+)\>)";
$html_pattern = '(\<(/?[^\>]+)\>)';
//? This should not just handle html tags but all <*>
$temp = preg_replace( $html_pattern, '', $temp);
//$this->debug['parse'][] = "2b2 (temp:$temp)";
243,7 → 234,7
// (obviously this will not suit genus + author alone, where first part of authorname is in brackets,
// however this is very rare?? and in any case we are not supporting genus+authority in this version)
//if ( $temp like '% (%)%'
$temp = preg_replace( "/ \(\w*\W*\)/", '', $temp, 1 );
$temp = preg_replace( '/ \(\w*\W*\)/', '', $temp, 1 );
//? Not sure if this will catch if
//$this->debug['parse'][] = "2b3 (temp:$temp)";
 
250,18 → 241,18
// if second term (only) is in square brackets, presume it is a comment and remove it
// example: Aphis [?] ficus Theobald, [1918] => Aphis ficus Theobald, [1918]
//if ( $temp like '% [%]%'
$temp = preg_replace( "/ \[\w*\W*\]/", '', $temp, 1 );
$temp = preg_replace( '/ \[\w*\W*\]/', '', $temp, 1 );
//? Not sure if this will catch if
//$this->debug['parse'][] = "2b4 (temp:$temp)";
 
// drop indicators of questionable id's - presume all are lowercase for now (could extend as needed)
$temp = preg_replace( "/ cf /", " ", $temp );
$temp = preg_replace( "/ cf\. /", " ", $temp );
$temp = preg_replace( "/ near /", " ", $temp );
$temp = preg_replace( "/ aff\. /", " ", $temp );
$temp = preg_replace( "/ sp\. /", " ", $temp );
$temp = preg_replace( "/ spp\. /", " ", $temp );
$temp = preg_replace( "/ spp /", " ", $temp );
$temp = preg_replace('/ cf /', ' ', $temp );
$temp = preg_replace('/ cf\. /', ' ', $temp );
$temp = preg_replace('/ near /', ' ', $temp );
$temp = preg_replace('/ aff\. /', ' ', $temp );
$temp = preg_replace('/ sp\. /', ' ', $temp );
$temp = preg_replace('/ spp\. /', ' ', $temp );
$temp = preg_replace('/ spp /', ' ', $temp );
 
//$this->debug['parse'][] = "2b5 (temp:$temp)";
 
273,7 → 264,7
// now presume first element is genus, second (if present) is species, remainder
// (if present) is authority
// look for genus name
$ar = explode( " ", $temp, 2);
$ar = explode(' ', $temp, 2);
if ( count( $ar ) ) {
$temp_genus = $ar[0];
$temp = @$ar[1];
285,7 → 276,7
//$this->debug['parse'][] = "2b7 (temp_genus:$temp_genus) (temp:$temp)";
 
// look for species epithet and authority
$ar = explode( " ", $temp, 2);
$ar = explode(' ', $temp, 2);
if ( count( $ar ) ) {
$temp_species = $ar[0];
$temp_authority = @$ar[1];
314,7 → 305,7
$temp_infra=trim($temp_infra);
$temp_infra_type=$infra;
// look for infra epithet and authority
$ar = explode(" ", $temp_infra, 2);
$ar = explode(' ', $temp_infra, 2);
if ( count( $ar ) ) {
$temp_infra = $ar[0];
$temp_infra_authority = @$ar[1];
353,6 → 344,5
//$this->debug['parse'][] = "2b11 (temp_genus:$temp_genus) (temp_species:$temp_species) (temp_authority:$temp_authority) (temp_infra:$temp_infra) (temp_infra_authority:$temp_infra_authority) (temp:$temp)";
return array("genus"=>$temp_genus, "species"=>$temp_species, "authority"=>$temp_authority, "infra"=>$temp_infra, "infra_authority"=>$temp_infra_authority, "infra_type"=>$temp_infra_type);
}
} // End NameParser
} // End Class
?>
}
}
/trunk/jrest/bibliotheque/DecoupageNomLatin.php
New file
0,0 → 1,369
<?php
// declare(encoding='UTF-8');
/**
* Classe de découpage des noms latins.
*
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
class DecoupageNomLatin extends Decoupage {
 
private $expression_principale = array();
private $expression_complement = array();
 
public function __construct() {
parent::__construct();
 
// Genre et nom supragénérique
$this->expression_principale[1] = "/^((?:$this->hyb |)$this->Gen)(?:( $this->Inf)|)$/u";
// Sp
$this->expression_principale[2] = "/^((?:$this->hyb |)$this->Gen) ((?:($this->hyb) |$this->Dou|)(?:$this->Epi|$this->Dou))(?:((?:,| $this->Ran) $this->Inf)| agg\.|)$/u";
// Rang infragénérique et supraspécifique
$this->expression_principale[3] = '/^('.$this->Gen.') ('.$this->Ran.') ('.$this->Gen.'|.'.$this->Epi.')(?:(, '.$this->Inf.')|)$/u';
// Hybride interspécifique
$this->expression_principale[4] = "/^((?:$this->Gen) $this->Epi (?:($this->Ran) $this->Epi )?x $this->Epi(?: ($this->Ran) $this->Epi)?)$/u";
// Aggrégat
$this->expression_principale[5] = "/^($this->Gen) ($this->Epi) (agg\.)(?:( $this->Inf)|)$/u";//
 
// Epithète infra-spécifique
$this->expression_complement[1] = "/^ ($this->Ran) ((?:($this->hyb) |$this->Dou|)(?:$this->Epi|$this->Dou))(?:((?:,| $this->Ran) $this->Inf)|)$/Uu";
// Cultivar
$this->expression_complement[5] = "/^ ($this->Ran_ht) ((?:(?:$this->Epi_cv) ?)+)$/u";
 
}
 
public function decouper($nom_latin) {
$aso_nom_decompo = array('nom_genre' => '', 'nom_sp' => '', 'auteur_sp' => '', 'nom_complement' => '',
'type_infrasp' => '', 'nom_infrasp' => '',
'num_nomenc' => '', 'num_taxo' => '', 'rang_taxonomique' => '',
'nom_courant' => '', 'nom_superieur' => '', 'agg' => '');
$aso_nom_decompo['nom_complet'] = $nom_latin;
while ($nom_latin != '') {
$morceau = array();
if (preg_match($this->expression_principale[4], $nom_latin, $morceau)) {// Formule d'hybridation
// Nous tentons de déterminer le rang de l'hybride
if (isset($morceau[2]) && isset($morceau[3]) && $morceau[2] == $morceau[3]) {
$aso_nom_decompo['rang_taxonomique'] = $this->attribuerCodeRang('n-'.$morceau[2]);
} else {
$aso_nom_decompo['rang_taxonomique'] = 260;// Hybride instersp.
}
$aso_nom_decompo['mark_hybride_interspecifique'] = 'x';
$aso_nom_decompo['formule_hybridation'] = $morceau[0];
$nom_latin = '';
} else if (preg_match($this->expression_principale[5], $nom_latin, $morceau)) {// agg.
$aso_nom_decompo['rang_taxonomique'] = 240;// agg.
$aso_nom_decompo['nom_genre'] = $morceau[1];
$aso_nom_decompo['nom_sp'] = $morceau[2];
$aso_nom_decompo['agg'] = $morceau[3];
$nom_latin = $morceau[4];
$aso_nom_decompo['nom_superieur'] = $morceau[1];
$aso_nom_decompo['nom_courant'] = $morceau[2];
} else if (preg_match($this->expression_principale[2], $nom_latin, $morceau)) {// Nom d'sp.
// Nous regardons si nous avons à faire à un hybride
if (preg_match('/^'.$this->hyb.'$/', $morceau[3])) {
$aso_nom_decompo['rang_taxonomique'] = 260;// hybride intersp.
$aso_nom_decompo['mark_hybride_interspecifique'] = strtolower($morceau[3]);
} else if (preg_match('/^'.$this->Epi_nn_hy.'$/', $morceau[2])) {
$aso_nom_decompo['rang_taxonomique'] = 260;// hybride intersp.
$aso_nom_decompo['mark_hybride_interspecifique'] = 'x';
} else {
$aso_nom_decompo['rang_taxonomique'] = 250;// sp.
}
// Nous atribuons le genre
$aso_nom_decompo['nom_genre'] = $morceau[1];
// Nous regardons si nous avons à faire à une phrase non nommé (ex : sp.1, spp., nsp.)
if (preg_match('/^'.$this->Epi_nn.'$/', $morceau[2])) {
$aso_nom_decompo['phrase_nom_non_nomme'] = $morceau[2];// hybride intersp.
$aso_nom_decompo['nom_sp'] = '';
} else {
$aso_nom_decompo['nom_sp'] = $morceau[2];
}
$nom_latin = $morceau[4];
$aso_nom_decompo['nom_superieur'] = $morceau[1];
$aso_nom_decompo['nom_courant'] = $morceau[2];
} else if (preg_match($this->expression_principale[3], $nom_latin, $morceau)) {// Nom infragénérique et supraspécifique
$aso_nom_decompo['nom_genre'] = $morceau[1];
$aso_nom_decompo['rang_taxonomique'] = $this->attribuerCodeRang($morceau[2]);
// Nous regardons si nous avons à faire à un groupe
if (preg_match('/^'.$this->Ran_ig_gr.'$/', $morceau[2])) {
$aso_nom_decompo['nom_sp'] = $morceau[3];
} else {
$aso_nom_decompo['nom_infra_genre'] = $morceau[3];
}
$nom_latin = $morceau[4];
$aso_nom_decompo['nom_superieur'] = $morceau[1];
$aso_nom_decompo['nom_courant'] = $morceau[3];
} else if (preg_match($this->expression_principale[1], $nom_latin, $morceau)) {// Nom de genre et supragénérique
$aso_nom_decompo['rang_taxonomique'] = $this->verifierTerminaisonLatine($nom_latin);
$aso_nom_decompo['nom_suprasp'] = $morceau[1];
$nom_latin = $morceau[2];
$aso_nom_decompo['nom_superieur'] = null;
$aso_nom_decompo['nom_courant'] = $morceau[1];
} else if (preg_match($this->expression_complement[5], $nom_latin, $morceau)) {// Cultivar
$aso_nom_decompo['rang_cultivar'] = $this->attribuerCodeRang($morceau[1]);
// Nous vérifions si nous avons à faire à un cultivar d'hybride
if ($aso_nom_decompo['mark_hybride_interspecifique'] == 'x' && $aso_nom_decompo['rang_cultivar'] == 460) {
$aso_nom_decompo['rang_cultivar'] = 470;
}
$aso_nom_decompo['cultivar'] = $morceau[2];
$nom_latin = '';
} else if (preg_match($this->expression_complement[1], $nom_latin, $morceau)) {// Nom infrasp.
if (preg_match('/^'.$this->hyb.'$/', $morceau[3])) {
$aso_nom_decompo['mark_hybride_interspecifique'] = strtolower($morceau[3]);
}
$aso_nom_decompo['rang_taxonomique'] = $this->attribuerCodeRang($morceau[1]);
$aso_nom_decompo['type_infrasp'] = $morceau[1];
$aso_nom_decompo['nom_infrasp'] = $morceau[2];
$nom_latin = $morceau[4];
$aso_nom_decompo['nom_superieur'] = $aso_nom_decompo['nom_courant'];
$aso_nom_decompo['nom_courant'] = $morceau[2];
} else {// Erreurs
$aso_nom_decompo['erreur_mark'] = 'erreur';
$aso_nom_decompo['erreur_notes'] = $nom_latin;
$nom_latin = '';
}
}
return $aso_nom_decompo;
}
 
public function verifierTerminaisonLatine($nom_latin) {
if (preg_match('/^Plantae$/', $nom_latin)) {// Règne
return 10;
} else if (preg_match('/phyta$/', $nom_latin)) {// Embranchement ou Division
return 30;
} else if (preg_match('/phytina$/', $nom_latin)) {// Sous-Embranchement ou Sous-Division
return 40;
} if (preg_match('/opsida$/', $nom_latin)) {// Classe
return 70;
} else if (preg_match('/idae$/', $nom_latin)) {// Sous-Classe
return 80;
} else if (preg_match('/ales$/', $nom_latin)) {// Ordre
return 100;
} else if (preg_match('/ineae$/', $nom_latin)) {// Sous-Ordre
return 110;
} else if (preg_match('/aceae$/', $nom_latin)) {// Famille
return 120;
} else if (preg_match('/oideae$/', $nom_latin)) {// Sous-Famille
return 130;
} else if (preg_match('/eae$/', $nom_latin)) {// Tribu
return 140;
} else if (preg_match('/inae$/', $nom_latin)) {// Sous-Tribu
return 150;
} else if (preg_match('/^[A-Z]/', $nom_latin)) {// Genre
return 160;
} else {
return 1;
}
}
 
static function fournirTableauAbreviationRang($type = 'tout') {
$rang_supra_sp = array('subgen.', 'subg.', 'sect.');// l'abréviation du rang est suivi par un nom supra spécifique commençant par une majuscule
$rang_supra_gr = array('gr.');// l'abréviation du rang est suivi par un nom ne commençant pas par une majuscule
$rang_supra_agg = array('agg.');// le nom latin est terminé par l'abréviation du rang
$rang_infra_sp = array('subsp.', 'n-subsp.', '[subsp.]', '[n-subsp.]',
'var.', 'nvar.', '[var.]',
'prol.', 'proles', 'n-proles.',
'f.', 'fa', 'fa.', 'forma',
'subvar.', 'convar.',
'cv.', 'Cv.',
'n-f.', 'n-fa', 'n-fa.',
'subf.', 'subfa', 'subfa.');
if ($type == 'supra') {
return $rang_supra_sp;
} else if ($type == 'supra-gr') {
return $rang_supra_gr;
} else if ($type == 'supra-agg') {
return $rang_supra_agg;
} else if ($type == 'infra') {
return $rang_infra_sp;
} else if ($type == 'tout') {
return array_merge($rang_supra_sp, $rang_supra_gr, $rang_supra_agg, $rang_infra_sp);
}
}
 
static function actualiserCodeRang($code_rang) {
$aso_rang = array('1' => '10', // Règne
'3' => '20', // Sous-Règne
'5' => '30', // Phylum
'7' => '40', // Sub-Phylum
'9' => '50', // division
'15' => '60', // sous-division
'20' => '70', // classe
'25' => '80', // sous-classe
'30' => '100', // ordre
'35' => '110', // sous-ordre
'40' => '120', // famille
'45' => '130', // sous-famille
'50' => '140', // tribu
'55' => '150', // sous-tribu
'60' => '160', // genre
'62' => '170', // genre hybride (nouveau compatibilité flore Réunion)
'65' => '180', // sous-genre
'65' => '190', // section
'75' => '200', // sous-section
'80' => '210', // série
'85' => '220', // sous-série
'90' => '230', // groupe
'95' => '240', // aggrégat
'100' => '250', // espèce
'102' => '260', // espèce hybride intragénérique
'104' => '260', // espèce hybride intergénérique
'110' => '280', // sous-espèce
'112' => '300', // sous-espèce hybride : hybride entre deux sous-espèces d'une espèce non hybride ; exemple : Polypodium vulgare L. nsubsp. mantoniae (Rothm.) Schidlay (Polypodium vulgare L. subsp. vulgare x Polypodium vulgare L. subsp. prionodes (Aschers.) Rothm.).
'113' => '310', // sous-espèce hybride : sous-espèce d'espèce hybride sans spécification du rang parental (subspecies) (voir ICBN, art. H.12.1).
'114' => '300', // sous-espèce hybride : sous-espèce hybride d'espèce hybride (nothosubspecies) (voir ICBN, art. H.12.1) ; exemple : Mentha x piperita L. nsubsp. piperita (Mentha aquatica L. x Mentha spicata L. subsp. glabrata (Lej. et Court.) Lebeau).
'115' => '300', // sous-espèce hybride
'120' => '1', // infra2
'122' => '330', // prole, race : peu employé souvent issu de nom ancien (antérieur au code).
'124' => '340', // prole, race hybride : peu employé souvent issu de nom ancien (antérieur au code).
'132' => '350', // convarietas : si on le conscidère comme un rang intermédiaire entre la sous-espèce et la variété. Voir aussi n°200.
'130' => '1', // infra3 : niveau infra-spécifique de troisième niveau, sans plus de précision.
'140' => '360', // variété
'142' => '380', // variété : hybride entre deux variétés d'une espèce non hybride.
'143' => '390', // variété : variété d'espèce hybride sans spécification du rang parental (varietas) (voir ICBN, art. H.12.1); exemple : Populus x canadensis Moench var. marilandica (Poir.) Rehder.
'144' => '380', // variété : variété hybride d'espèce hybride (nothovarietas) ; exemple : Salix x sepulcralis Simonk. nvar. chrysocoma (Dode) Meikle.
'145' => '380', // variété hybride
'150' => '410', // sous-variété
'160' => '420', // forme
'162' => '430', // forme : hybride entre deux formes d'une espèce non hybride.
'163' => '430', // forme : forme d'espèce hybride sans spécification du rang parental (forma) (voir ICBN, art. H.12.1); exemple : Mentha x piperita L. f. hirsuta Sole.
'164' => '430', // forme : forme hybride d'espèce hybride (nothoforma).
'170' => '440', // sous-forme
'200' => '450', // groupe de cultivar
'210' => '460', // cultivar
'220' => '470', // cultivar d'hybride
'0' => '480' // clade
);
return $aso_rang[$code_rang];
}
 
public function attribuerCodeInfra($str_abreviation_type_infra) {
$aso_code_infra = array('type' => '', 'code' => 0, 'rang' => 2 );
switch ($str_abreviation_type_infra) {
case 'subgen.' :
case 'subg.' :
$aso_code_infra['rang'] = 180;
break;
case 'sect.' :
$aso_code_infra['rang'] = 190;
break;
case 'gr.' :
$aso_code_infra['rang'] = 230;
break;
case 'subsp.' :
$aso_code_infra['type'] = 'infra1';
$aso_code_infra['code'] = 1;
$aso_code_infra['rang'] = 280;
break;
case 'n-subsp.' :
$aso_code_infra['type'] = 'infra1';
$aso_code_infra['code'] = 2;
$aso_code_infra['rang'] = 300;
break;
case '[subsp.]' :
$aso_code_infra['type'] = 'infra1';
$aso_code_infra['code'] = 3;
$aso_code_infra['rang'] = 290;
break;
case '[n-subsp.]' :
$aso_code_infra['type'] = 'infra1';
$aso_code_infra['code'] = 4;
$aso_code_infra['rang'] = 310;
break;
case 'var.' :
$aso_code_infra['type'] = 'infra2';
$aso_code_infra['code'] = 1;
$aso_code_infra['rang'] = 360;
break;
case '[var.]' :
$aso_code_infra['type'] = 'infra2';
$aso_code_infra['code'] = 2;
$aso_code_infra['rang'] = 370;
break;
case 'n-var.' :
$aso_code_infra['type'] = 'infra2';
$aso_code_infra['code'] = 3;
$aso_code_infra['rang'] = 380;
break;
case 'nvar.' :
$aso_code_infra['type'] = 'infra2';
$aso_code_infra['code'] = 3;
$aso_code_infra['rang'] = 384;
break;
case '[n-var.]' :
$aso_code_infra['type'] = 'infra2';
$aso_code_infra['code'] = 5;
$aso_code_infra['rang'] = 390;
break;
case 'prol.' :
case 'proles' :
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 2;
$aso_code_infra['rang'] = 330;
break;
case 'n-proles' :
case 'n-proles.' :
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 1;
$aso_code_infra['rang'] = 340;
break;
case 'f.':
case 'fa':
case 'fa.':
case 'forma':
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 3;
$aso_code_infra['rang'] = 420;
break;
case 'subvar.' :
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 4;
$aso_code_infra['rang'] = 410;
break;
case 'convar.' :
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 5;
$aso_code_infra['rang'] = 350;
break;
case 'cv.':
case 'Cv.':
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 6;
$aso_code_infra['rang'] = 460;
break;
case 'n-f.':
case 'n-fa':
case 'n-fa.':
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 7;
$aso_code_infra['rang'] = 430;
break;
case 'subf.':
case 'subfa':
case 'subfa.':
$aso_code_infra['type'] = 'infra3';
$aso_code_infra['code'] = 8;
$aso_code_infra['rang'] = 440;
break;
default:
$aso_code_infra['erreur_mark'] = 'erreur';
$aso_code_infra['erreur_notes'] = $str_abreviation_type_infra;
$aso_code_infra['rang'] = 2;
}
return $aso_code_infra;
}
 
public function attribuerCodeRang($str_abreviation_type_infra) {
$aso_code_infra = $this->attribuerCodeInfra($str_abreviation_type_infra);
return $aso_code_infra['rang'];
}
}
/trunk/jrest/bibliotheque/ImageRecreation.php
1,4 → 1,20
<?php
// declare(encoding='UTF-8');
/**
* Classe de manipulation des fichiers images JPEG.
*
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
Class ImageRecreation {
 
private $droits = 0755;
54,7 → 70,6
foreach ($this->formats as $format) {
$this->creerEtStockerMiniatureFichierImageSelonFormat($id, $infos_image_originale, $format);
};
 
}
}
 
123,7 → 138,6
if ($format == 'O') {
// format original : rien à faire
$image_redimensionnee = $infos_image_originale['image'];
 
} else {
if ($this->estUnFormatRogne($format)) {
if ($this->mode == self::MODE_IMAGEMAGICK) {
144,7 → 158,6
$image_redimensionnee = $this->creerMiniature($infos_image_originale, $format);
}
}
 
return $image_redimensionnee;
}
 
186,7 → 199,6
}
public function stockerFichierEtCreerMiniatures($fichier, $id) {
$infos_image_originale_stockee = $this->stockerFichierOriginal($fichier, $id);
if($infos_image_originale_stockee) {
$formats = $this->getFormats();
200,16 → 212,13
$this->logger('CEL_bugs',$erreur);
return false ;
}
return true ;
}
 
public function creerEtStockerMiniatureFichierImageSelonFormat($id ,$infos_image_originale, $format = 'O') {
$image_redimensionnee = $this->creerMiniatureImageSelonFormat($infos_image_originale, $format);
 
$taux_compression = $this->renvoyerTauxCompressionPourPoids($infos_image_originale['poids_octets']);
$this->ecrireImageSurDisque($image_redimensionnee, $id, $format, $taux_compression);
 
return true;
}
 
225,7 → 234,6
$infos_image_originale['largeur'],
$infos_image_originale['hauteur']
);
 
return $image_redimensionnee;
}
 
475,7 → 483,6
foreach($formats as $format) {
$nom_fichier_sans_extension = trim($nom_fichier_sans_extension, '_'.$format);
}
 
$id_image = str_replace('_', '', $nom_fichier_sans_extension);
 
// suppression des 0 devant
503,7 → 510,7
$img = new Imagick($chemin_image_a_stocker);
 
// l'utilisation d'image magick préserve les métadonnées lors d'une recompression
$img->setformat("jpeg");
$img->setformat('jpeg');
$img->setImageCompression(imagick::COMPRESSION_JPEG);
$img->setCompressionQuality($compression);
$img->writeImage($chemin_image_a_stocker);
516,7 → 523,6
$image_blanche = imagecreatetruecolor($cote, $cote);
$blanc = imagecolorallocate($image_blanche, 255, 255, 255);
imagefilledrectangle($image_blanche, 0, 0, $cote, $cote, $blanc);
 
return $image_blanche;
}
 
592,9 → 598,6
 
$chemin_image = $informations_image['chemin'];
 
//if ($largeur_vignette > $largeur_image_originale || $hauteur_vignette > $hauteur_image_originale)
// die("Target dimensions must be smaller or equal to source dimensions.");
 
// parameters for the edge-maximizing crop algorithm
$r = 1; // radius of edge filter
$nk = 9; // scale count: number of crop sizes to try
679,20 → 682,6
if ($ycrop < 0) $ycrop = 0;
if ($ycrop+$hcrop > $hauteur_image_originale) $ycrop = $hauteur_image_originale-$hcrop;
/*if (self::MODE_DEBUG) {
// debug
$currfile = '/home/aurelien/web/file_tmp/'."image$k.jpg";
$currimg = clone $img;
$c= new ImagickDraw();
$c->setFillColor("red");
$c->circle($xcenter, $ycenter, $xcenter, $ycenter+4);
$currimg->drawImage($c);
$currimg->cropImage($wcrop, $hcrop, $xcrop, $ycrop);
$currimg->writeImage($currfile);
$currimg->destroy();
}*/
$beta = 0;
for ($c=0; $c<$n; $c++) {
$i = mt_rand(0,$wcrop-1);
737,5 → 726,4
 
return $image_sortie;
}
}
?>
}
/trunk/jrest/bibliotheque/CelRestClient.php
New file
0,0 → 1,161
<?php
// declare(encoding='UTF-8');
/**
* Client REST chargé depuis la classe CEL.
*
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
// TODO : remplacer les trigger_error par des exceptions qui pourrait être attrapées...
class CelRestClient {
const HTTP_URL_REQUETE_SEPARATEUR = '&';
const HTTP_URL_REQUETE_CLE_VALEUR_SEPARATEUR = '=';
private $http_methodes = array('GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'OPTIONS', 'CONNECT', 'TRACE');
protected $parametres = null;
private $url = null;
private $reponse_entetes = null;
 
//+----------------------------------------------------------------------------------------------------------------+
// ACCESSEURS
 
public function getReponseEntetes($cle) {
return $this->reponse_entetes;
}
 
public function getParametre($cle) {
$valeur = (isset($this->parametres[$cle])) ? $this->parametres[$cle] : null;
return $valeur;
}
 
public function ajouterParametre($cle, $valeur) {
$this->parametres[$cle] = $valeur;
}
 
public function supprimerParametre($cle) {
unset($this->parametres[$cle]);
}
 
public function nettoyerParametres() {
$this->parametres = null;
}
 
//+----------------------------------------------------------------------------------------------------------------+
// MÉTHODES
 
public function consulter($url) {
$retour = $this->envoyerRequete($url, 'GET');
return $retour;
}
 
public function ajouter($url, Array $donnees) {
$retour = $this->envoyerRequete($url, 'PUT', $donnees);
return $retour;
}
 
public function modifier($url, Array $donnees) {
$retour = $this->envoyerRequete($url, 'POST', $donnees);
return $retour;
}
 
public function supprimer($url) {
$retour = $this->envoyerRequete($url, 'DELETE');
return $retour;
}
 
public function envoyerRequete($url, $mode, Array $donnees = array()) {
$this->url = $url;
$contenu = false;
if (! in_array($mode, $this->http_methodes)) {
$e = "Le mode de requête '$mode' n'est pas accepté!";
trigger_error($e, E_USER_WARNING);
} else {
if ($mode == 'GET') {
$this->traiterUrlParametres();
}
$contexte = stream_context_create(array(
'http' => array(
'method' => $mode,
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'content' => http_build_query($donnees, null, self::HTTP_URL_REQUETE_SEPARATEUR))));
$flux = @fopen($this->url, 'r', false, $contexte);
if (!$flux) {
$this->reponse_entetes = $http_response_header;
$e = "L'ouverture de l'url '{$this->url}' par la méthode HTTP '$mode' a échoué!";
trigger_error($e, E_USER_WARNING);
} else {
// Informations sur les en-têtes et métadonnées du flux
$this->reponse_entetes = stream_get_meta_data($flux);
 
// Contenu actuel de $url
$contenu = stream_get_contents($flux);
 
fclose($flux);
}
$this->traiterEntete();
}
$this->reinitialiser();
return $contenu;
}
 
private function traiterUrlParametres() {
$parametres = array();
if (count($this->parametres) > 0) {
foreach ($this->parametres as $cle => $valeur) {
$cle = rawurlencode($cle);
$valeur = rawurlencode($valeur);
$parametres[] = $cle.self::HTTP_URL_REQUETE_CLE_VALEUR_SEPARATEUR.$valeur;
}
$url_parametres = implode(self::HTTP_URL_REQUETE_SEPARATEUR, $parametres);
$this->url = $this->url.'?'.$url_parametres;
}
}
 
private function traiterEntete() {
$infos = $this->analyserEntete();
$this->traiterEnteteDebogage($infos);
}
 
private function analyserEntete() {
$entetes = $this->reponse_entetes;
$infos = array('date' => null, 'uri' => $this->url, 'debogages' => null);
if (isset($entetes)) {
if (isset($entetes['wrapper_data'])) {
$entetes = $entetes['wrapper_data'];
}
foreach ($entetes as $entete) {
if (preg_match('/^X_REST_DEBOGAGE_MESSAGES: (.+)$/', $entete, $match)) {
$infos['debogages'] = json_decode($match[1]);
}
if (preg_match('/^Date: .+ ([012][0-9]:[012345][0-9]:[012345][0-9]) .*$/', $entete, $match)) {
$infos['date'] = $match[1];
}
}
}
return $infos;
}
 
private function traiterEnteteDebogage($entetes_analyses) {
if (isset($entetes['debogages'])) {
$date = $entetes['date'];
$uri = $entetes['uri'];
$debogages = $entetes['debogages'];
foreach ($debogages as $debogage) {
$e = "DEBOGAGE : $date - $uri :\n$debogage";
trigger_error($e, E_USER_NOTICE);
}
}
}
 
private function reinitialiser() {
$this->nettoyerParametres();
}
}
/trunk/jrest/services/CelRestClient.php
File deleted
\ No newline at end of file
/trunk/jrest/services/CelStatistique.php
1,4 → 1,5
<?php
// declare(encoding='UTF-8');
/**
* Service fournissant des urls vers des images de graphiques sur les statistiques de l'application CEL.
* Encodage en entrée : utf8
9,11 → 10,17
* Paramêtres :
* serveur=[0-9] : retourne le graphique demandé sur le serveur numéro 0 à 9 (voir http://code.google.com/intl/fr/apis/chart/docs/making_charts.html#enhancements )
*
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Statistiques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version $Id$
* @copyright 2009
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
class CelStatistique extends Cel {
 
/trunk/jrest/services/CelStatistiqueTxt.php
1,4 → 1,5
<?php
// declare(encoding='UTF-8');
/**
* Service fournissant des statistiques de l'application CEL au format texte (JSON).
* Encodage en entrée : utf8
9,11 → 10,17
* Paramêtres :
* utilisateur=courriel : retourne les statistiques d'un utilisateur donné.
*
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Statistiques
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version $Id$
* @copyright Copyright (c) 2011, Tela Botanica (accueil@tela-botanica.org)
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
class CelStatistiqueTxt extends Cel {
 
/trunk/jrest/services/CelWidgetUploadImageTemp.php
6,11 → 6,17
* Cas d'utilisation :
* POST /CelWidgetUploadImageTemp : écriture d'une image dans le répertoire temporaire
*
* @author Mathias Chouet <mathias@tela-botanica.org>
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Widget
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version $Id$
* @copyright © 2013, Tela-Botanica
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
class CelWidgetUploadImageTemp extends Cel {
 
/trunk/jrest/services/CelWidgetExport.php
1,8 → 1,8
<?php
// declare(encoding='UTF-8');
/**
* Service fournissant des informations concernant le CEL au format RSS1, RSS2 ou ATOM.
* Encodage en entrée : utf8
* Encodage en sortie : utf8
* Service fournissant des exports des données publiques du CEL pour le widget.
*
* Format du service :
* /CelWidgetExport/format
* /CelWidgetExport/csv
11,13 → 11,18
* - "start" indique le numéro du premier item à afficher
* - "limit" nombre d'items à afficher
*
* @author Aurélien Peronnet <aurelien@tela-botanica.org>
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Widget
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version $Id$
* @copyright 2012
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
 
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(realpath(__FILE__))) . '/lib');
// la sortie est binaire (xls), mais OLE n'est pas compatible E_ALL en PHP-5.4
error_reporting(error_reporting() & ~E_STRICT);
/trunk/jrest/services/CelWidgetMapPoint.php
1,9 → 1,7
<?php
// declare(encoding='UTF-8');
/**
* Service fournissant une carte dynamique des obsertions publiques du CEL.
* Encodage en entrée : utf8
* Encodage en sortie : utf8
* Service fournissant une carte dynamique (communes + points) des obsertions publiques du CEL.
*
* Cas d'utilisation :
* /CelWidgetMap/Carte/Utilisateur : carte des observations publiques d'un utilisateur.
20,11 → 18,17
* ATTENTION
* machin ET bidule OU chose donne un résultat indéterminé pour l'instant
*
* @author Jean-Pascal MILCENT <jpm@clapas.org>
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Widget
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version $Id$
* @copyright © 2010, Jean-Pascal MILCENT
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
// TODO : supprimer le TRIM quand les obs seront reliées correctements aux localisations (sur le code INSEE par exemple)
class CelWidgetMapPoint extends Cel {
/trunk/jrest/services/CelSyndicationObservation.php
1,4 → 1,5
<?php
// declare(encoding='UTF-8');
/**
* Service fournissant des informations concernant le CEL au format RSS1, RSS2 ou ATOM.
* Encodage en entrée : utf8
15,11 → 16,17
* - "start" indique le numéro du premier item à afficher
* - "limit" nombre d'items à afficher
*
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Syndication
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version $Id$
* @copyright 2010
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
class CelSyndicationObservation extends Cel {
 
/trunk/jrest/services/CatalogueChampsEtendus.php
7,7 → 7,7
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Champs-étendus
* @subpackage Auto-complétions
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
/trunk/jrest/services/CelImageDoublon.php
2,8 → 2,6
// declare(encoding='UTF-8');
/**
* Service fournissant une liste d'images doublon pour l'utilisateur qui s'authentifie.
* Encodage en entrée : utf8
* Encodage en sortie : utf8
*
* Cas d'utilisation :
* /CelImageDoublon/Sortie : images doublon de l'utilisateur authentifié.
/trunk/jrest/services/CoordSearch.php
6,7 → 6,7
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Images
* @subpackage Cartes
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
/trunk/jrest/services/CelWidgetSaisie.php
2,8 → 2,6
// declare(encoding='UTF-8');
/**
* Service permettant d'insérer les informations fournie par le widget Saisie dans le CEL.
* Encodage en entrée : utf8
* Encodage en sortie : utf8
*
* Cas d'utilisation :
* PUT /CelWidgetSaisie : ajout de données en les passant via $_POST
11,7 → 9,7
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèques
* @subpackage Widget
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
/trunk/jrest/services/CelWidgetMap.php
1,9 → 1,7
<?php
// declare(encoding='UTF-8');
/**
* Service fournissant une carte dynamique des obsertions publiques du CEL.
* Encodage en entrée : utf8
* Encodage en sortie : utf8
* Service fournissant une carte dynamique (communes)des obsertions publiques du CEL.
*
* Cas d'utilisation :
* /CelWidgetMap/Carte/Utilisateur : carte des observations publiques d'un utilisateur.
15,11 → 13,17
* Utilisateur = identifiant (= courriel) de l'utilisateur ou * pour tous les utilisateurs.
* Projet = mot-clé du projet
*
* @author Jean-Pascal MILCENT <jpm@clapas.org>
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Widget
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version $Id$
* @copyright © 2010, Jean-Pascal MILCENT
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
// TODO : supprimer le TRIM quand les obs seront reliées correctements aux localisations (sur le code INSEE par exemple)
class CelWidgetMap extends Cel {
/trunk/jrest/services/CelImage.php
2,8 → 2,6
// declare(encoding='UTF-8');
/**
* Service générique permettant de manipuler les Images.
* Encodage en entrée : utf8
* Encodage en sortie : utf8
*
* Cas d'utilisation GET :
* /CelImage/liste-ids?obsId=[0-9]+ : ids des images liées à l'observation possédant l'identifiant 'obsId'.
/trunk/jrest/services/CelRadiusPoints.php
6,7 → 6,7
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Bibliothèques
* @subpackage Cartes
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
/trunk/jrest/services/CelSyndicationImage.php
1,18 → 1,21
<?php
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
 
// declare(encoding='UTF-8');
/**
* Service fournissant des informations concernant les images du CEL au format RSS1, RSS2 ou ATOM.
* Encodage en entrée : utf8
* Encodage en sortie : utf8
 
*
* @internal Mininum PHP version : 5.2
* @category CEL
* @package Services
* @subpackage Syndication
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version $Id$
* @copyright 2010
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
// TODO : résoudre le problème des images liées à plusieurs obs. Cela créé plusieurs item avec le même id pour atom...
class CelSyndicationImage extends Cel {
 
private $parametres_origines = null;