Subversion Repositories eFlore/Applications.cel

Rev

Rev 2459 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2459 Rev 2462
Line 1... Line 1...
1
<?php
1
<?php
2
// Encodage : UTF-8
2
// declare(encoding='UTF-8');
3
// +-------------------------------------------------------------------------------------------------------------------+
-
 
4
/**
3
/**
5
* Découpage des noms latins
4
 * Classe de découpage des noms latins.
6
*
5
 *
7
* Description : classe permettant de découper les noms latins.
6
 * @internal   Mininum PHP version : 5.2
8
* 
7
 * @category   CEL
-
 
8
 * @package    Services
-
 
9
 * @subpackage Bibliothèques
9
//Auteur original :
10
 * @version    0.1
-
 
11
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
10
* @author       Jean-Pascal MILCENT <jpm@tela-botanica.org>
12
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
11
* @copyright	Tela-Botanica 1999-2009
13
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
12
* @licence		GPL v3 & CeCILL v2
14
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
13
* @version		$Id: DecoupageNomLatin.class.php 1873 2009-03-31 10:07:24Z Jean-Pascal MILCENT $
15
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
-
 
16
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
14
*/
17
 */
15
// +-------------------------------------------------------------------------------------------------------------------+
-
 
16
class DecoupageNomLatin extends Decoupage {
18
class DecoupageNomLatin extends Decoupage {
Line 17... Line 19...
17
 
19
 
18
	private $expression_principale = array();
20
	private $expression_principale = array();
Line 19... Line 21...
19
	private $expression_complement = array();
21
	private $expression_complement = array();
20
 
-
 
21
	function DecoupageNomLatin()
22
 
Line 22... Line 23...
22
	{	
23
	public function __construct() {
23
		parent::__construct();
24
		parent::__construct();
24
 
25
 
Line 38... Line 39...
38
		// Cultivar
39
		// Cultivar
39
		$this->expression_complement[5] = "/^ ($this->Ran_ht) ((?:(?:$this->Epi_cv) ?)+)$/u";
40
		$this->expression_complement[5] = "/^ ($this->Ran_ht) ((?:(?:$this->Epi_cv) ?)+)$/u";
Line 40... Line 41...
40
		
41
 
Line 41... Line 42...
41
	}
42
	}
42
	
-
 
43
	public function decouper($nom_latin)
43
 
44
    {
44
	public function decouper($nom_latin) {
45
    	$aso_nom_decompo = array(	'nom_genre' => '', 'nom_sp' => '', 'auteur_sp' => '', 'nom_complement' => '', 
45
		$aso_nom_decompo = array('nom_genre' => '', 'nom_sp' => '', 'auteur_sp' => '', 'nom_complement' => '',
46
									'type_infrasp' => '', 'nom_infrasp' => '', 
46
			'type_infrasp' => '', 'nom_infrasp' => '',
47
									'num_nomenc' => '', 'num_taxo' => '', 'rang_taxonomique' => '',
47
			'num_nomenc' => '', 'num_taxo' => '', 'rang_taxonomique' => '',
Line 133... Line 133...
133
			}
133
			}
134
		}
134
		}
135
		return $aso_nom_decompo;
135
		return $aso_nom_decompo;
136
    }
136
    }
Line 137... Line 137...
137
	
137
 
138
	public function verifierTerminaisonLatine($nom_latin)
-
 
139
	{
-
 
140
		
138
	public function verifierTerminaisonLatine($nom_latin) {
141
		if (preg_match('/^Plantae$/', $nom_latin)) {// Règne
139
		if (preg_match('/^Plantae$/', $nom_latin)) {// Règne
142
			return 10;
140
			return 10;
143
		} else if (preg_match('/phyta$/', $nom_latin)) {// Embranchement ou Division
141
		} else if (preg_match('/phyta$/', $nom_latin)) {// Embranchement ou Division
144
			return 30;
142
			return 30;
Line 165... Line 163...
165
		} else {
163
		} else {
166
			return 1;
164
			return 1;
167
		}
165
		}
168
	}
166
	}
Line 169... Line 167...
169
	
167
 
170
	static function fournirTableauAbreviationRang($type = 'tout')
-
 
171
	{
168
	static function fournirTableauAbreviationRang($type = 'tout') {
172
		$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 
169
		$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
173
		$rang_supra_gr = array('gr.');// l'abréviation du rang est suivi par un nom ne commençant pas par une majuscule
170
		$rang_supra_gr = array('gr.');// l'abréviation du rang est suivi par un nom ne commençant pas par une majuscule
174
		$rang_supra_agg = array('agg.');// le nom latin est terminé par l'abréviation du rang
171
		$rang_supra_agg = array('agg.');// le nom latin est terminé par l'abréviation du rang
175
		$rang_infra_sp = array(	'subsp.', 'n-subsp.', '[subsp.]', '[n-subsp.]',
172
		$rang_infra_sp = array('subsp.', 'n-subsp.', '[subsp.]', '[n-subsp.]',
Line 191... Line 188...
191
		} else if ($type == 'tout') {
188
		} else if ($type == 'tout') {
192
			return array_merge($rang_supra_sp, $rang_supra_gr, $rang_supra_agg, $rang_infra_sp);
189
			return array_merge($rang_supra_sp, $rang_supra_gr, $rang_supra_agg, $rang_infra_sp);
193
		}
190
		}
194
	}
191
	}
Line 195... Line 192...
195
 
192
 
196
	static function actualiserCodeRang($code_rang)
-
 
197
	{
193
	static function actualiserCodeRang($code_rang) {
198
		$aso_rang = array(	'1' => '10', // Règne
194
		$aso_rang = array('1' => '10', // Règne
199
							'3' => '20', // Sous-Règne
195
			'3' => '20', // Sous-Règne
200
							'5' => '30', // Phylum
196
			'5' => '30', // Phylum
201
							'7' => '40', // Sub-Phylum
197
			'7' => '40', // Sub-Phylum
Line 248... Line 244...
248
							'0' => '480' // clade
244
			'0' => '480' // clade
249
							);
245
			);
250
		return $aso_rang[$code_rang];
246
		return $aso_rang[$code_rang];
251
	}
247
	}
Line 252... Line 248...
252
 
248
 
253
	public function attribuerCodeInfra($str_abreviation_type_infra)
-
 
254
	{
249
	public function attribuerCodeInfra($str_abreviation_type_infra) {
255
		$aso_code_infra = array('type' => '', 'code' => 0, 'rang' => 2 );
-
 
256
	    
250
		$aso_code_infra = array('type' => '', 'code' => 0, 'rang' => 2 );
257
		switch ($str_abreviation_type_infra) {
251
		switch ($str_abreviation_type_infra) {
258
			case 'subgen.' :
252
			case 'subgen.' :
259
			case 'subg.' :
253
			case 'subg.' :
260
				$aso_code_infra['rang'] = 180;
254
				$aso_code_infra['rang'] = 180;
Line 363... Line 357...
363
	        default:
357
			default:
364
				$aso_code_infra['erreur_mark'] = 'erreur';
358
				$aso_code_infra['erreur_mark'] = 'erreur';
365
				$aso_code_infra['erreur_notes'] =  $str_abreviation_type_infra;
359
				$aso_code_infra['erreur_notes'] =  $str_abreviation_type_infra;
366
				$aso_code_infra['rang'] = 2;
360
				$aso_code_infra['rang'] = 2;
367
	    }
361
		}
368
	    
-
 
369
	    return $aso_code_infra;
362
		return $aso_code_infra;
370
	}
363
	}
Line 371... Line 364...
371
	
364
 
372
	public function attribuerCodeRang($str_abreviation_type_infra)
-
 
373
	{
365
	public function attribuerCodeRang($str_abreviation_type_infra) {
374
		$aso_code_infra = $this->attribuerCodeInfra($str_abreviation_type_infra);
366
		$aso_code_infra = $this->attribuerCodeInfra($str_abreviation_type_infra);
375
    	return $aso_code_infra['rang'];
367
		return $aso_code_infra['rang'];
376
	}
368
	}
377
}
-
 
378
?>
369
}