/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/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 |
* |
* @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> |
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt> |
* @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 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 |
* |
* @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/ |
*/ |
/** |
* in : utf8 |
* out : utf8 |
* |
* Librairie recherche d'images a partir de divers critères |
* |
*/ |
* Classe de recherche d'images à partir de divers critères. |
* |
* @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 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; |
} |
126,12 → 121,12 |
private function fabriquerSousRequeteRecherche($id_utilisateur, $criteres) { |
$sous_requete = ' AND '; |
foreach($criteres as $nom => $valeur) { |
if($valeur == null || trim($nom) == "" || trim($valeur) == "") { |
foreach ($criteres as $nom => $valeur) { |
if ($valeur == null || trim($nom) == "" || trim($valeur) == "") { |
continue; |
} |
switch($nom) { |
switch ($nom) { |
case "id_image"; |
$sous_requete .= 'ci.id_image = '.Cel::db()->proteger($valeur) ; |
$sous_requete .= ' AND '; |
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; |
} |
254,18 → 246,18 |
} |
private function creerSousRequeteMotsCles($mot_cle) { |
//TODO: une requête plus efficace serait possible en utilisant |
// les vraies tables de mots clés et en faisant disparaitre ce champ maudit |
$requete = ''; |
//TODO: une requête plus efficace serait possible en utilisant |
// les vraies tables de mots clés et en faisant disparaitre ce champ maudit |
$requete = ''; |
if (preg_match('/.*OU.*/', $mot_cle)) { |
$mots_cles_tab = explode('OU',$mot_cle); |
foreach($mots_cles_tab as $mot_cle_item) { |
foreach ($mots_cles_tab as $mot_cle_item) { |
$requete .= '(ci.mots_cles_texte LIKE '.Cel::db()->proteger('%'.$mot_cle_item.'%').') OR '; |
} |
$requete = '('.rtrim($requete,'OR ').')'; |
} else if (preg_match('/.*ET.*/', $mot_cle)) { |
$mots_cles_tab = explode('ET',$mot_cle); |
foreach($mots_cles_tab as $mot_cle_item) { |
foreach ($mots_cles_tab as $mot_cle_item) { |
$requete .= '(ci.mots_cles_texte LIKE '.Cel::db()->proteger('%'.$mot_cle_item.'%').') AND '; |
} |
$requete = '('.rtrim($requete, 'AND ').') '; |
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 |
* @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 |
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt> |
*/ |
* 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> |
* @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; |
128,7 → 123,7 |
function getlinenb2($txt) { |
//var_dump($line, $this->pdf->GetStringWidth($line)); |
return ceil($this->pdf->GetStringWidth($txt) / $this->column_width); |
return ceil($this->pdf->GetStringWidth($txt) / $this->column_width); |
} |
function getlinenb($txt) { |
365,7 → 360,7 |
$this->pdf->MultiCell(80, 20, |
$txt = 'Observation : ' . self::elude('Observation : ', $obs['commentaire']), |
$border = 'RL', 'L', 0, 1, '', '', true); |
$border = 'RL', 'L', 0, 1, '', '', true); |
$this->pdf->Cell($w = 80, '', |
$txt = 'Date : ' . strftime("%d/%m/%Y", strtotime($obs['date_observation'])), |
428,7 → 423,7 |
$obs['commentaire'], |
strftime("%Y-%m-%d", strtotime($obs['date_observation'])) |
); |
} |
480,7 → 475,7 |
$obs['commentaire'], |
strftime("%Y-%m-%d", strtotime($obs['date_observation'])) |
); |
} |
} |
/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 à à ÿ et œ |
protected $maj = "[A-Z'\x{C0}-\x{DF}\x{152}]";// Lettres majuscules : A à Z, ' et À à ß et Œ |
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 |
* |
* @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/ |
*/ |
/** |
* Classe de gestion de l'ajout, modification et suppression des champs supplémentaires des obs et images |
*/ |
* Classe de gestion de l'ajout, modification et suppression des champs supplémentaires des obs et images. |
* |
* @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> |
*/ |
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 |
130,14 → 135,14 |
} |
/** |
* Ajoute plusieurs champs étendus à la fois. |
* Si la clé existe déjà, seule la valeur du champ est mise à jour |
* |
* @param array $champs_etendus tableau d'objets ChampEtendu |
* @return bool true si l'ajout a eu lieu |
*/ |
* Ajoute plusieurs champs étendus à la fois. |
* Si la clé existe déjà, seule la valeur du champ est mise à jour |
* |
* @param array $champs_etendus tableau d'objets ChampEtendu |
* @return bool true si l'ajout a eu lieu |
*/ |
public function ajouterParLots(Array $champs_etendus) { |
if(! $champs_etendus) return TRUE; // le tableau ... vide à été inséré |
if (! $champs_etendus) return TRUE; // le tableau ... vide à été inséré |
$lignes = array(); |
foreach ($champs_etendus as $champ_etendu) { |
151,11 → 156,11 |
// 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 |
$ajout = Cel::db()->executer(sprintf( |
"INSERT INTO %s (%s, cle, valeur) VALUES %s ON DUPLICATE KEY UPDATE valeur = VALUES(valeur) -- %s:%d", |
$this->table_champs_etendus, |
$this->champ_id, |
implode(',', $lignes), |
__FILE__, __LINE__)); |
"INSERT INTO %s (%s, cle, valeur) VALUES %s ON DUPLICATE KEY UPDATE valeur = VALUES(valeur) -- %s:%d", |
$this->table_champs_etendus, |
$this->champ_id, |
implode(',', $lignes), |
__FILE__, __LINE__)); |
return ($ajout !== false); |
} |
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) { |
246,20 → 261,20 |
public function consulterGroupesChampsEtendusPredefinis() { |
$groupes = array(); |
$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"; |
"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 ". |
' -- '.__FILE__.':'.__LINE__; |
$groupes_champs = Cel::db()->executerRequete($requete); |
$groupes_champs = Cel::db()->executerRequete($requete); |
$cle_groupe = ""; |
$cle_groupe = ''; |
$infos_groupe = null; |
foreach ($groupes_champs as $groupe_champ) { |
// les champs sont ordonnés par groupe, ce qui permet de les assembler |
// séquentiellement en créeant un nouveau groupe lorsque la clé |
// de groupe du champ actuel est différénte de la précédente |
if($cle_groupe != $groupe_champ['cle_groupe']) { |
if ($cle_groupe != $groupe_champ['cle_groupe']) { |
if($infos_groupe != null) { |
$groupes[] = $infos_groupe; |
} |
266,57 → 281,57 |
$infos_groupe = array(); |
$cle_groupe = $groupe_champ['cle_groupe']; |
} |
if(empty($infos_groupe)) { |
if (empty($infos_groupe)) { |
$infos_groupe = array( |
'cle' => $groupe_champ['cle_groupe'], |
'nom' => $groupe_champ['nom_groupe'], |
'champs' => array() |
); |
'cle' => $groupe_champ['cle_groupe'], |
'nom' => $groupe_champ['nom_groupe'], |
'champs' => array() |
); |
} |
$infos_groupe['champs'][] = array( |
'cle' => $groupe_champ['cle_champ'], |
'label' => $groupe_champ['label_champ'], |
'options' => array('invisible' => $groupe_champ['invisible'], |
'prive' => $groupe_champ['prive'] |
) |
); |
'cle' => $groupe_champ['cle_champ'], |
'label' => $groupe_champ['label_champ'], |
'options' => array( |
'invisible' => $groupe_champ['invisible'], |
'prive' => $groupe_champ['prive']) |
); |
} |
// Ajout du dernier groupe, qui serait ignoré sinon, étant donné que l'ajout |
// Ajout du dernier groupe, qui serait ignoré sinon, étant donné que l'ajout |
// au tableau se fait au début de la boucle |
//TODO: voir si on ne peut pas simplifier ça |
if(!empty($infos_groupe)) { |
if (!empty($infos_groupe)) { |
$groupes[] = $infos_groupe; |
} |
return $groupes; |
} |
/** |
* 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); |
$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) { |
if ($ordonner_par_cle) { |
$infos_champs[$champ_fmt['cle']] = $champ_fmt; |
} else { |
$infos_champs[] = $champ_fmt; |
} |
} |
} |
return $infos_champs; |
} |
330,7 → 345,7 |
* @return string la clé correspondante |
*/ |
public function transformerLabelEnCle($label) { |
//TODO: cette fonction est elle encore pertinente |
//TODO: cette fonction est elle encore pertinente |
// maintenant que la notion de label est supprimée ? |
$cle = strtolower(trim($label)); |
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 { |
32,16 → 32,16 |
// si l'espèce passée a le motif <ref>:(nt|nn):<num>, eg: isfan:nt:1591 |
public $is_notation_spe = FALSE; |
// un cache utilisé pour les requêtes effectuées sur /service:eflore:0.1/bdtfx/noms?masque= |
// qui sont lourdes, et parfois identiques (cf cas de l'import XLS) |
static $cache = array(); |
// un cache utilisé pour les requêtes effectuées sur /service:eflore:0.1/bdtfx/noms?masque= |
// qui sont lourdes, et parfois identiques (cf cas de l'import XLS) |
static $cache = array(); |
public function RechercheInfosTaxonBeta($config, $code_referentiel = 'bdtfx') { |
parent::__construct($config); |
$this->setReferentiel($code_referentiel); |
} |
$this->setReferentiel($code_referentiel); |
} |
public function setReferentiel($code_referentiel = 'bdtfx') { |
public function setReferentiel($code_referentiel = 'bdtfx') { |
$this->code_referentiel = $code_referentiel; |
$this->formaterUrlsServices($this->config); |
} |
119,20 → 119,20 |
} |
private function effectuerRequeteUrlRecherche($nom_saisi, $mode = 'stricte') { |
$url = sprintf( |
'%1$s?masque=%2$s&recherche=%3$s&ns.format=txt&retour.champs=%4$s&navigation.limite=1', |
$this->url_service_nom, |
urlencode($nom_saisi), |
$mode, |
implode(',', array("id","nom_sci","auteur","nom_retenu.id","famille","num_taxonomique","nom_retenu_complet"))); |
$url = sprintf( |
'%1$s?masque=%2$s&recherche=%3$s&ns.format=txt&retour.champs=%4$s&navigation.limite=1', |
$this->url_service_nom, |
urlencode($nom_saisi), |
$mode, |
implode(',', array("id","nom_sci","auteur","nom_retenu.id","famille","num_taxonomique","nom_retenu_complet"))); |
if(! array_key_exists($url, self::$cache)) { |
if(self::DEBUG) error_log("CEL fetch: " . $url); |
$res = @json_decode(file_get_contents($url)); |
self::$cache[$url] = $res; |
} else { |
$res = self::$cache[$url]; |
} |
if(self::DEBUG) error_log("CEL fetch: " . $url); |
$res = @json_decode(file_get_contents($url)); |
self::$cache[$url] = $res; |
} else { |
$res = self::$cache[$url]; |
} |
if(!$res) return NULL; |
$resultat = (array)$res->resultat; |
return array_pop($resultat); |
/trunk/jrest/bibliotheque/ChampEtendu.php |
---|
1,23 → 1,22 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* PHP Version 5 |
* |
* @category PHP |
* @package jrest |
* @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/ |
*/ |
/** |
* Classe conteneur servant à gérer les infos des champs étendus. |
* |
*/ |
* Classe conteneur servant à gérer les infos des champs étendus. |
* |
* @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 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,20 → 30,12 |
*/ |
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 |
*/ |
public function set($name,$value) { |
public function set($name, $value) { |
$this->$name = $value; |
} |
45,11 → 45,9 |
* @param string $str : string to reduce space |
* @return string : string with only once space between characters |
*/ |
private function reduce_spaces( $str ) { |
$str = preg_replace("/ {2,}/", ' ', $str ); |
private function reduce_spaces($str) { |
$str = preg_replace('/ {2,}/', ' ', $str ); |
$str = trim( $str ); |
return( $str ); |
} |
72,11 → 70,10 |
* @param integer $upcase : convert to uppercase if $upcase = 1 |
* @return string : parsed author string |
*/ |
public function parse_auth( $str, $upcase=1 ) { |
public function parse_auth($str, $upcase = 1) { |
$this->debug['parse_auth'][] = "1"; |
$temp = $str = trim($str); |
if ( ($str == NULL) || ($str == '') ) { |
$this->debug['parse_auth'][] = "1a"; |
return ''; |
88,11 → 85,11 |
} else { |
$this->debug['parse_auth'][] = "2b"; |
// add space after full stops, except at end (NB, will also add spece before some close brackets) |
$temp = rtrim( str_replace('.', '. ', $temp) ); |
$this->debug['parse_auth'][] = "4 (temp:$temp)"; |
//normalise "et", "and" to ampersand (et al. is a special case) |
// if ( $temp like '% et al%' ) { |
if ( preg_match('/ et al/', $temp) ) { |
99,7 → 96,7 |
$temp = str_replace(' et al','zzzzz', $temp); |
$this->debug['parse_auth'][] = "4a (temp:$temp)"; |
} |
$temp = str_replace(' et ',' & ', $temp ); |
$temp = str_replace(' and ',' & ', $temp ); |
106,7 → 103,7 |
$temp = str_replace('zzzzz',' et al', $temp); |
$this->debug['parse_auth'][] = "5 (temp:$temp)"; |
//remove commas before dates (only) |
// like '%, 17%' |
if ( preg_match('/, 17/', $temp) ) { |
113,35 → 110,34 |
$temp = str_replace(', 17',' 17', $temp); |
$this->debug['parse_auth'][] = "5a (temp:$temp)"; |
} |
// like '%, 18%' |
if ( preg_match('/, 18/', $temp) ) { |
$temp = str_replace(', 18',' 18', $temp); |
$this->debug['parse_auth'][] = "5b (temp:$temp)"; |
} |
// like '%, 19%' |
if ( preg_match('/, 19/', $temp) ) { |
$temp = str_replace(', 19',' 19', $temp); |
$this->debug['parse_auth'][] = "5c (temp:$temp)"; |
} |
// like '%, 20%' |
if ( preg_match('/, 20/', $temp) ) { |
$temp = str_replace(', 20',' 20', $temp); |
$this->debug['parse_auth'][] = "5d (temp:$temp)"; |
} |
// reduce multiple internal spaces to single space |
$temp = $this->reduce_spaces( $temp ); |
// like '% -%' |
$temp = str_replace(' -', '-', $temp); |
$this->debug['parse_auth'][] = "6 (temp:$temp)"; |
foreach( explode(' ', $temp) as $this_word ) { |
foreach (explode(' ', $temp) as $this_word) { |
//$this->debug['parse_auth'][] = "7 (this_word:$this_word)"; |
$elapsed_chars = ''; |
// like '(%' |
155,14 → 151,11 |
$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 ) ; |
} |
} |
} |
/** |
* Function: parse |
* Purpose: Produces parsed version of an input string (scientific name components) |
174,12 → 167,12 |
* Remarks: |
* (1) Removes known text elements e.g. |
* 'aff.', 'cf.', 'subsp.', subgenera if enclosed in brackets, etc. as desired |
* (2) Removes accented and non A-Z characters other than full stops |
* (2) Removes accented and non A-Z characters other than full stops |
* (in scientific name portions) |
* (3) Returns uppercase scientific name (genus + species only) |
* (3) Returns uppercase scientific name (genus + species only) |
* plus unaltered (presumed) authority |
* examples; |
* Anabaena cf. flos-aquae Ralfs ex Born. et Flah. => ANABAENA FLOSAQUAE Ralfs |
* Anabaena cf. flos-aquae Ralfs ex Born. et Flah. => ANABAENA FLOSAQUAE Ralfs |
* ex Born. et Flah. |
* Abisara lemÈe-pauli => ABISARA LEMEEPAULI |
* Fuc/us Vesiculos2us => FUCUS VESICULOSUS |
186,7 → 179,7 |
* Buffo ignicolor LacÈpËde, 1788 => BUFFO IGNICOLOR LacÈpËde, 1788 |
* Barbatia (Mesocibota) bistrigata (Dunker, 1866) => BARBATIA BISTRIGATA (Dunker, 1866) |
* (4) Thus version does not handle genus+author, or genus+species+infraspecies |
* (second" good" term is presumed to be species epithet, anything after is |
* (second" good" term is presumed to be species epithet, anything after is |
* considered to be start of the authority), however could be adapted further as required |
* and actually it was done in this version for Tela Botanica |
* (5) There is a separate function "parse_auth" for normalizing authorities when required |
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; |
207,7 → 198,7 |
$temp_genus_species = ''; |
$temp_authority = ''; |
$temp_infra = ''; |
//$this->debug['parse'][] = "1"; |
if ( ($str == NULL) || ( trim($str) == '') ) { |
232,8 → 223,8 |
//$this->debug['parse'][] = "2b1 (temp:$temp)"; |
// remove any content in angle brackets (e.g. html tags - <i>, </i>, etc.) |
$html_pattern = "(\<(/?[^\>]+)\>)"; |
//? This should not just handle html tags but all <*> |
$html_pattern = '(\<(/?[^\>]+)\>)'; |
//? This should not just handle html tags but all <*> |
$temp = preg_replace( $html_pattern, '', $temp); |
//$this->debug['parse'][] = "2b2 (temp:$temp)"; |
243,25 → 234,25 |
// (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 ); |
//? Not sure if this will catch if |
$temp = preg_replace( '/ \(\w*\W*\)/', '', $temp, 1 ); |
//? Not sure if this will catch if |
//$this->debug['parse'][] = "2b3 (temp:$temp)"; |
// 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] |
// example: Aphis [?] ficus Theobald, [1918] => Aphis ficus Theobald, [1918] |
//if ( $temp like '% [%]%' |
$temp = preg_replace( "/ \[\w*\W*\]/", '', $temp, 1 ); |
//? Not sure if this will catch if |
$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]; |
281,11 → 272,11 |
$temp_genus = $temp; |
$temp = ''; |
} |
//$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]; |
293,34 → 284,34 |
$temp_species = $temp; |
$temp_authority = ''; |
} |
// look for subspecies |
// look for subspecies |
$infras =array('subsp.','var.'); |
$infras =array('subsp.','var.'); |
$temp_authority = preg_replace( "/ssp./", "subsp.", $temp_authority); |
$temp_authority = preg_replace( "/ssp /", "subsp.", $temp_authority); |
$temp_authority = preg_replace( "/subsp /", "subsp.", $temp_authority); |
$temp_authority = preg_replace( "/var /", "var.", $temp_authority); |
$temp_authority = preg_replace( "/ssp./", "subsp.", $temp_authority); |
$temp_authority = preg_replace( "/ssp /", "subsp.", $temp_authority); |
$temp_authority = preg_replace( "/subsp /", "subsp.", $temp_authority); |
$temp_authority = preg_replace( "/var /", "var.", $temp_authority); |
$temp_infra_authority = ''; |
$temp_infra_type = ''; |
foreach ($infras as $infra) { |
$pos = strpos($temp_authority, $infra); |
if ($pos === false) { |
continue; |
} else { |
$temp_infra=substr($temp_authority,$pos+strlen($infra)); |
$temp_authority=substr($temp_authority,0,$pos); |
$temp_infra=trim($temp_infra); |
$temp_infra_type=$infra; |
// look for infra epithet and authority |
$ar = explode(" ", $temp_infra, 2); |
if ( count( $ar ) ) { |
$temp_infra = $ar[0]; |
$temp_infra_authority = @$ar[1]; |
} |
break; // on s'arrete au premier trouve |
} |
$temp_infra_authority = ''; |
$temp_infra_type = ''; |
foreach ($infras as $infra) { |
$pos = strpos($temp_authority, $infra); |
if ($pos === false) { |
continue; |
} else { |
$temp_infra=substr($temp_authority,$pos+strlen($infra)); |
$temp_authority=substr($temp_authority,0,$pos); |
$temp_infra=trim($temp_infra); |
$temp_infra_type=$infra; |
// look for infra epithet and authority |
$ar = explode(' ', $temp_infra, 2); |
if ( count( $ar ) ) { |
$temp_infra = $ar[0]; |
$temp_infra_authority = @$ar[1]; |
} |
break; // on s'arrete au premier trouve |
} |
} |
//$this->debug['parse'][] = "2b8 (temp_genus:$temp_genus) (temp_species:$temp_species) (temp_authority:$temp_authority) (temp_infra:$temp_infra) (temp_infra_authority:$temp_infra_authority) (temp:$temp)"; |
332,27 → 323,26 |
//$this->debug['parse'][] = "2b9 (temp_genus:$temp_genus) (temp_species:$temp_species) (temp_authority:$temp_authority) (temp_infra:$temp_infra) (temp_infra_authority:$temp_infra_authority) (temp:$temp)"; |
$temp_genus= trim($temp_genus); |
$temp_genus= trim($temp_genus); |
$temp_species= trim($temp_species); |
$temp_infra= trim($temp_infra ); |
// reduce any new multiple internal spaces to single space, if present |
$temp_genus= $this->reduce_spaces( $temp_genus ); |
$temp_genus= $this->reduce_spaces( $temp_genus ); |
$temp_species= $this->reduce_spaces( $temp_species ); |
$temp_infra= $this->reduce_spaces( $temp_infra ); |
//$this->debug['parse'][] = "2b10 (temp_genus:$temp_genus) (temp_species:$temp_species) (temp_authority:$temp_authority) (temp_infra:$temp_infra) (temp_infra_authority:$temp_infra_authority) (temp:$temp)"; |
if (isset($temp_authority) && ($temp_authority!='') ) { |
$temp_authority=$this->parse_auth($temp_authority); |
} |
if (isset($temp_authority) && ($temp_authority!='') ) { |
$temp_authority=$this->parse_auth($temp_authority); |
} |
if (isset($temp_infra_authority) && ($temp_infra_authority!='') ) { |
$temp_infra_authority=$this->parse_auth($temp_infra_authority); |
} |
if (isset($temp_infra_authority) && ($temp_infra_authority!='') ) { |
$temp_infra_authority=$this->parse_auth($temp_infra_authority); |
} |
//$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 |
?> |
return array("genus"=>$temp_genus, "species"=>$temp_species, "authority"=>$temp_authority, "infra"=>$temp_infra, "infra_authority"=>$temp_infra_authority, "infra_type"=>$temp_infra_type); |
} |
} |
} |
/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; |
39,7 → 55,7 |
$id = $params[0]; |
if (!is_numeric($id)) { |
return; |
return; |
} |
$dossier_fichier = $this->obtenirDossierPourFormat($id, 'O'); |
54,7 → 70,6 |
foreach ($this->formats as $format) { |
$this->creerEtStockerMiniatureFichierImageSelonFormat($id, $infos_image_originale, $format); |
}; |
} |
} |
71,37 → 86,37 |
continue; |
} |
if ($fichier_ou_dossier->isDir()) { |
$this->itererRecursivement($fichier_ou_dossier->getPathname()); |
} else { |
$nom_fichier = $fichier_ou_dossier->getFilename(); |
if ($fichier_ou_dossier->isDir()) { |
$this->itererRecursivement($fichier_ou_dossier->getPathname()); |
} else { |
$nom_fichier = $fichier_ou_dossier->getFilename(); |
$infos_image_originale = $this->obtenirImageEtInfosPourChemin($fichier_ou_dossier->getPathname()); |
$id = $this->convertirBaseNomFichierVersIdBdd($nom_fichier, $this->formats); |
$id = $this->convertirBaseNomFichierVersIdBdd($nom_fichier, $this->formats); |
// creation de miniatures pour chacuns des formats définis |
// creation de miniatures pour chacuns des formats définis |
foreach ($this->formats as $format) { |
$this->creerEtStockerMiniatureFichierImageSelonFormat($id, $infos_image_originale, $format); |
} |
} |
} |
} |
} |
public function creerOuRenvoyerImage($id, $format) { |
$dossier = $this->obtenirDossierPourFormat($id, $format); |
$nom_fichier = $this->convertirIdBddVersNomFichier($id, $format); |
$chemin_image = $dossier.'/'.$nom_fichier; |
$chemin_image = $dossier.'/'.$nom_fichier; |
$image = false; |
if(!file_exists($chemin_image)) { |
if (!file_exists($chemin_image)) { |
$chemin_image_originale = $this->obtenirCheminImageOriginale($id); |
$infos_image_originale = $this->obtenirImageEtInfosPourChemin($chemin_image_originale); |
if($infos_image_originale) { |
// le verrou est là dans le (rare) cas où l'image est déjà en train |
// d'être générée par le script de création des miniatures ou bien |
// d'être générée par le script de création des miniatures ou bien |
// un autre instance de cette classe appelée par le web service |
$fp = fopen($chemin_image_originale, "r"); |
// si le fichier est verrouillé, flock attendra qu'il se libère |
// si le fichier est verrouillé, flock attendra qu'il se libère |
$verrou = flock($fp, LOCK_EX); |
if(!file_exists($chemin_image)) { |
// si le fichier a été locké alors l'image était en train d'être générée |
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; |
} |
152,7 → 165,7 |
* Déplace une image temporaire uploadée vers le répertoire de stockage d'images, |
* en enregistrant les métadonnées et tout le tintouin. |
* Si $conserverFichiersTemporaires vaut true, l'image est copiée et non déplacée. |
* |
* |
* @param unknown $fichier |
* @param unknown $id |
* @param unknown $conserverFichiersTemporaires |
160,24 → 173,24 |
*/ |
public function stockerFichierOriginal($fichier, $id, $conserverFichiersTemporaires=false) { |
$chemin_fichier_origine = is_array($fichier) ? $fichier['tmp_name'] : $fichier; |
$chemin_base_fichier = $this->creerSiNecessaireEtRenvoyerCheminStockageFichierPourIdEtFormat($id, 'O'); |
$nom_fichier = $this->convertirIdBddVersNomFichier($id, 'O'); |
$chemin_fichier = $chemin_base_fichier.'/'.$nom_fichier; |
$deplacement_fichier = $this->stockerImageExterne($chemin_fichier_origine, $chemin_fichier, $conserverFichiersTemporaires); |
if ($deplacement_fichier) { |
$infos_image_originale = $this->obtenirImageEtInfosPourChemin($chemin_fichier); |
$taux_compression = $this->renvoyerTauxCompressionPourPoids($infos_image_originale['poids_octets']); |
if ($taux_compression < 100 && $this->mode == self::MODE_IMAGEMAGICK) { |
$this->ecrireImageSurDisqueAvecMeta($chemin_fichier, $taux_compression); |
} |
return $infos_image_originale; |
} else { |
$erreur = 'ERROR : probleme durant le déplacement du fichier temporaire \n' ; |
$this->logger('CEL_bugs',$erreur); |
184,13 → 197,12 |
return false ; |
} |
} |
public function stockerFichierEtCreerMiniatures($fichier, $id) { |
$infos_image_originale_stockee = $this->stockerFichierOriginal($fichier, $id); |
if($infos_image_originale_stockee) { |
if ($infos_image_originale_stockee) { |
$formats = $this->getFormats(); |
// creation de miniatures pour chacuns des formats définis |
foreach($formats as $format) { |
$this->creerEtStockerMiniatureFichierImageSelonFormat($id, $infos_image_originale_stockee, $format); |
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; |
} |
323,7 → 331,7 |
/** |
* Déplace un fichier temporaire vers une destination donnée. Si |
* $conserverFichiersTemporaires vaut true, le fichier est copié et non déplacé. |
* |
* |
* @param unknown $chemin_fichier_temp |
* @param unknown $chemin_destination |
* @param string $conserverFichiersTemporaires |
411,20 → 419,20 |
} |
public function calculerTailleImage($informations_images, $taille_max) { |
$HL_redimension = array(); |
$HL_redimension = array(); |
if ($this->estPaysage($informations_images)) { |
$rapport = $informations_images['hauteur']/$informations_images['largeur'] ; |
$HL_redimension['largeur'] = round($taille_max) ; |
$HL_redimension['hauteur'] = round($taille_max*$rapport) ; |
if ($this->estPaysage($informations_images)) { |
$rapport = $informations_images['hauteur']/$informations_images['largeur'] ; |
$HL_redimension['largeur'] = round($taille_max) ; |
$HL_redimension['hauteur'] = round($taille_max*$rapport) ; |
} else { |
$rapport = $informations_images['largeur']/$informations_images['hauteur'] ; |
$HL_redimension['hauteur'] = round($taille_max) ; |
$HL_redimension['largeur'] = round($taille_max*$rapport) ; |
} |
} else { |
$rapport = $informations_images['largeur']/$informations_images['hauteur'] ; |
$HL_redimension['hauteur'] = round($taille_max) ; |
$HL_redimension['largeur'] = round($taille_max*$rapport) ; |
} |
return $HL_redimension; |
return $HL_redimension; |
} |
public function getFormats() { |
452,11 → 460,11 |
$ratio_compression = 100 ; |
if ($poids_octets >= $poids_max_octets) { |
$ratio_compression = 75 ; |
} |
if ($poids_octets >= $poids_max_octets) { |
$ratio_compression = 75 ; |
} |
return $ratio_compression; |
return $ratio_compression; |
} |
public function convertirIdBddVersNomFichier($id, $format, $extension = 'jpg') { |
472,10 → 480,9 |
public function convertirBaseNomFichierVersIdBdd($nom_fichier, $formats) { |
$nom_fichier_sans_extension = trim($nom_fichier, '.jpg'); |
foreach($formats as $format) { |
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; |
} |
526,7 → 532,7 |
/** |
* Supprime une image du disque, ainsi que tous les formats générés |
* |
* |
* @param Integer $id |
* @return boolean true si tous les formats y compris l'original ont été détruits, false s'il en reste au moins un |
*/ |
552,7 → 558,7 |
// recopie de Cel->logger() (pas d'extends pour ça) |
public function logger($index,$chaine) { |
if(!class_exists('Log')) { |
if (!class_exists('Log')) { |
Log::getInstance(); |
} |
586,156 → 592,138 |
$largeur_vignette = $dimension_vignettes['largeur']; |
$hauteur_vignette = $dimension_vignettes['hauteur']; |
// source dimensions |
$largeur_image_originale = $informations_image['largeur']; |
$hauteur_image_originale = $informations_image['hauteur']; |
// source dimensions |
$largeur_image_originale = $informations_image['largeur']; |
$hauteur_image_originale = $informations_image['hauteur']; |
$chemin_image = $informations_image['chemin']; |
$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 |
$gamma = 0.2; // edge normalization parameter -- see documentation |
$ar = $largeur_vignette/$hauteur_vignette; // target aspect ratio (AR) |
$ar0 = $largeur_image_originale/$hauteur_image_originale; // original aspect ratio (AR) |
// parameters for the edge-maximizing crop algorithm |
$r = 1; // radius of edge filter |
$nk = 9; // scale count: number of crop sizes to try |
$gamma = 0.2; // edge normalization parameter -- see documentation |
$ar = $largeur_vignette/$hauteur_vignette; // target aspect ratio (AR) |
$ar0 = $largeur_image_originale/$hauteur_image_originale; // original aspect ratio (AR) |
//echo("$chemin_image: $largeur_image_originale x $hauteur_image_originale => $largeur_vignette x $hauteur_vignette"); |
$img = new Imagick($chemin_image); |
$imgcp = clone $img; |
//echo("$chemin_image: $largeur_image_originale x $hauteur_image_originale => $largeur_vignette x $hauteur_vignette"); |
$img = new Imagick($chemin_image); |
$imgcp = clone $img; |
// compute center of edginess |
$img->edgeImage($r); |
$img->modulateImage(100,0,100); // grayscale |
$img->blackThresholdImage("#0f0f0f"); |
$retour_ecriture_img = $img->writeImage($out); |
// compute center of edginess |
$img->edgeImage($r); |
$img->modulateImage(100,0,100); // grayscale |
$img->blackThresholdImage("#0f0f0f"); |
$retour_ecriture_img = $img->writeImage($out); |
if ($retour_ecriture_img !== true) { |
error_log("Erreur d'écriture Imagick : [" . $chemin_image . "] vers [" . $out . "]"); |
$erreur_ecriture = true; |
} |
// use gd for random pixel access |
$im = ImageCreateFromJpeg($out); |
if ($retour_ecriture_img !== true) { |
error_log("Erreur d'écriture Imagick : [" . $chemin_image . "] vers [" . $out . "]"); |
$erreur_ecriture = true; |
} |
// use gd for random pixel access |
$im = ImageCreateFromJpeg($out); |
if ($im === false) { |
error_log("GD ne peut pas lire l'image créée par Imagick : [" . $chemin_image . "] vers [" . $out . "]"); |
$erreur_ecriture = true; |
} |
if ($im === false) { |
error_log("GD ne peut pas lire l'image créée par Imagick : [" . $chemin_image . "] vers [" . $out . "]"); |
$erreur_ecriture = true; |
} |
if (! $erreur_ecriture) { |
$xcenter = 0; |
$ycenter = 0; |
$sum = 0; |
$n = 100000; |
for ($k=0; $k<$n; $k++) { |
$i = mt_rand(0,$largeur_image_originale-1); |
$j = mt_rand(0,$hauteur_image_originale-1); |
$val = imagecolorat($im, $i, $j) & 0xFF; |
$sum += $val; |
$xcenter += ($i+1)*$val; |
$ycenter += ($j+1)*$val; |
} |
$xcenter /= $sum; |
$ycenter /= $sum; |
// crop source img to target AR |
if ($largeur_image_originale/$hauteur_image_originale > $ar) { |
// source AR wider than target |
// crop width to target AR |
$wcrop0 = round($ar*$hauteur_image_originale); |
$hcrop0 = $hauteur_image_originale; |
} else { |
// crop height to target AR |
$wcrop0 = $largeur_image_originale; |
$hcrop0 = round($largeur_image_originale/$ar); |
} |
// crop parameters for all scales and translations |
$params = array(); |
// crop at different scales |
$hgap = $hcrop0 - $hauteur_vignette; |
$hinc = ($nk == 1) ? 0 : $hgap / ($nk - 1); |
$wgap = $wcrop0 - $largeur_vignette; |
$winc = ($nk == 1) ? 0 : $wgap / ($nk - 1); |
// find window with highest normalized edginess |
$n = 10000; |
$maxbetanorm = 0; |
$maxfile = ''; |
$maxparam = array('w'=>0, 'h'=>0, 'x'=>0, 'y'=>0); |
for ($k = 0; $k < $nk; $k++) { |
$hcrop = round($hcrop0 - $k*$hinc); |
$wcrop = round($wcrop0 - $k*$winc); |
$xcrop = $xcenter - $wcrop / 2; |
$ycrop = $ycenter - $hcrop / 2; |
//echo("crop: $wcrop, $hcrop, $xcrop, $ycrop"); |
if ($xcrop < 0) $xcrop = 0; |
if ($xcrop+$wcrop > $largeur_image_originale) $xcrop = $largeur_image_originale-$wcrop; |
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); |
$j = mt_rand(0,$hcrop-1); |
$beta += imagecolorat($im, $xcrop+$i, $ycrop+$j) & 0xFF; |
} |
$area = $wcrop * $hcrop; |
$betanorm = $beta / ($n*pow($area, $gamma-1)); |
// echo("beta: $beta; betan: $betanorm"); |
// echo("image$k.jpg:<br/>\n<img src=\"$currfile\"/>"); |
// best image found, save it |
if ($betanorm > $maxbetanorm) { |
$maxbetanorm = $betanorm; |
$maxparam['w'] = $wcrop; |
$maxparam['h'] = $hcrop; |
$maxparam['x'] = $xcrop; |
$maxparam['y'] = $ycrop; |
// $maxfile = $currfile; |
} |
} |
// écrasement de l'image par la version "croppée" |
$imgcp->cropImage($maxparam['w'], $maxparam['h'], $maxparam['x'], $maxparam['y']); |
$imgcp->scaleImage($largeur_vignette, $hauteur_vignette); |
$imgcp->writeImage($out); |
if (! $erreur_ecriture) { |
$xcenter = 0; |
$ycenter = 0; |
$sum = 0; |
$n = 100000; |
for ($k=0; $k<$n; $k++) { |
$i = mt_rand(0,$largeur_image_originale-1); |
$j = mt_rand(0,$hauteur_image_originale-1); |
$val = imagecolorat($im, $i, $j) & 0xFF; |
$sum += $val; |
$xcenter += ($i+1)*$val; |
$ycenter += ($j+1)*$val; |
} |
$xcenter /= $sum; |
$ycenter /= $sum; |
// return image |
chmod($out, 0777); |
$img->destroy(); |
$imgcp->destroy(); |
$image_sortie = ImageCreateFromJpeg($out); |
} else { |
// image n'a pas pu être croppée - on retourne l'originale |
//$image_sortie = ImageCreateFromJpeg($chemin_image); |
$image_sortie = false; |
} |
// crop source img to target AR |
if ($largeur_image_originale/$hauteur_image_originale > $ar) { |
// source AR wider than target |
// crop width to target AR |
$wcrop0 = round($ar*$hauteur_image_originale); |
$hcrop0 = $hauteur_image_originale; |
} else { |
// crop height to target AR |
$wcrop0 = $largeur_image_originale; |
$hcrop0 = round($largeur_image_originale/$ar); |
} |
// destruction fichier temporaire dans tous les cas |
unlink($out); |
// crop parameters for all scales and translations |
$params = array(); |
return $image_sortie; |
// crop at different scales |
$hgap = $hcrop0 - $hauteur_vignette; |
$hinc = ($nk == 1) ? 0 : $hgap / ($nk - 1); |
$wgap = $wcrop0 - $largeur_vignette; |
$winc = ($nk == 1) ? 0 : $wgap / ($nk - 1); |
// find window with highest normalized edginess |
$n = 10000; |
$maxbetanorm = 0; |
$maxfile = ''; |
$maxparam = array('w'=>0, 'h'=>0, 'x'=>0, 'y'=>0); |
for ($k = 0; $k < $nk; $k++) { |
$hcrop = round($hcrop0 - $k*$hinc); |
$wcrop = round($wcrop0 - $k*$winc); |
$xcrop = $xcenter - $wcrop / 2; |
$ycrop = $ycenter - $hcrop / 2; |
//echo("crop: $wcrop, $hcrop, $xcrop, $ycrop"); |
if ($xcrop < 0) $xcrop = 0; |
if ($xcrop+$wcrop > $largeur_image_originale) $xcrop = $largeur_image_originale-$wcrop; |
if ($ycrop < 0) $ycrop = 0; |
if ($ycrop+$hcrop > $hauteur_image_originale) $ycrop = $hauteur_image_originale-$hcrop; |
$beta = 0; |
for ($c=0; $c<$n; $c++) { |
$i = mt_rand(0,$wcrop-1); |
$j = mt_rand(0,$hcrop-1); |
$beta += imagecolorat($im, $xcrop+$i, $ycrop+$j) & 0xFF; |
} |
$area = $wcrop * $hcrop; |
$betanorm = $beta / ($n*pow($area, $gamma-1)); |
// echo("beta: $beta; betan: $betanorm"); |
// echo("image$k.jpg:<br/>\n<img src=\"$currfile\"/>"); |
// best image found, save it |
if ($betanorm > $maxbetanorm) { |
$maxbetanorm = $betanorm; |
$maxparam['w'] = $wcrop; |
$maxparam['h'] = $hcrop; |
$maxparam['x'] = $xcrop; |
$maxparam['y'] = $ycrop; |
// $maxfile = $currfile; |
} |
} |
// écrasement de l'image par la version "croppée" |
$imgcp->cropImage($maxparam['w'], $maxparam['h'], $maxparam['x'], $maxparam['y']); |
$imgcp->scaleImage($largeur_vignette, $hauteur_vignette); |
$imgcp->writeImage($out); |
// return image |
chmod($out, 0777); |
$img->destroy(); |
$imgcp->destroy(); |
$image_sortie = ImageCreateFromJpeg($out); |
} else { |
// image n'a pas pu être croppée - on retourne l'originale |
//$image_sortie = ImageCreateFromJpeg($chemin_image); |
$image_sortie = false; |
} |
// destruction fichier temporaire dans tous les cas |
unlink($out); |
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/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 |
* |
* Librairie de liaison d'images et d'observation à des mots clés en utilisant la méthode |
* path enumeration |
*/ |
* Classe 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); |
} |
/** |
203,10 → 197,9 |
* et ainsi de perdre la date de liaison des mots clés conservés. |
* Si $supprimer est true, les mots clefs existant mais non spécifiés dans le POST seront supprimés, |
* sinon ils seront laissés en l'état. |
*/ |
*/ |
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 |
637,21 → 627,18 |
$chemin = self::startsWith($chemin,'/') ? $chemin : '/'.$chemin; |
$chemin = self::endsWith($chemin,'/') ? $chemin : $chemin.'/'; |
$chemin = str_replace('//', '/', $chemin); |
// mise en minuscule du chemin afin d'éviter des cas où l'on aurait |
// mise en minuscule du chemin afin d'éviter des cas où l'on aurait |
// des même mots clés avec minuscule et majuscule |
$chemin = strtolower($chemin); |
$chemin = self::supprimerAccents($chemin); |
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. 'œ' |
$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/services/CelRestClient.php |
---|
File deleted |
\ No newline at end of file |
/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> |
* @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 |
* @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> |
* @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 |
* |
* @author Jean-Pascal MILCENT <jpm@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 |
* @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> |
* @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; |
/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 ) |
* |
* @author Jean-Pascal MILCENT <jpm@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 |
* @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> |
* @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é. |
* |
* @author Jean-Pascal MILCENT <jpm@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) |
* @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> |
* @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> |
* @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 |
* @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> |
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org> |
*/ |
class CelWidgetUploadImageTemp extends Cel { |
/trunk/jrest/services/CelWidgetExport.php |
---|
1,23 → 1,28 |
<?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 |
* Format du service : |
* /CelWidgetExport/format |
* /CelWidgetExport/csv |
* |
* Les paramêtres : |
* - "start" indique le numéro du premier item à afficher |
* - "limit" nombre d'items à afficher |
* |
* @author Aurélien 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 |
*/ |
* Service fournissant des exports des données publiques du CEL pour le widget. |
* |
* Format du service : |
* /CelWidgetExport/format |
* /CelWidgetExport/csv |
* |
* Les paramêtres : |
* - "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 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> |
* @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> |
* @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 |
* @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> |
* @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 |
* |
* @author Jean-Pascal MILCENT <jpm@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 |
* @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> |
* @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> |