Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 420 | Rev 461 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 420 Rev 460
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe mère du module Liste.
4
 * Classe mère du module Liste.
5
 *
5
 *
6
 * @category	PHP 5.2
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	2011 Tela-Botanica
10
 * @copyright	2011 Tela-Botanica
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
13
 * @version		$Id$
13
 * @version		$Id$
14
 */
14
 */
15
class Bibliographie extends aControleur {
15
class Bibliographie extends aControleur {
16
		
16
		
17
	private $apiBiblioBota;
17
	private $apiBiblioBota;
18
	private $conteneur;
18
	private $conteneur;
19
	private $nomCourant;
19
	private $nomCourant;
20
	private $meta;
20
	private $meta;
21
	private $appUrls;
21
	private $appUrls;
22
	private $wikini;
22
	private $wikini;
23
	
23
	
24
	public function __construct(Conteneur $conteneur) {
24
	public function __construct(Conteneur $conteneur) {
25
		$this->conteneur = $conteneur;
25
		$this->conteneur = $conteneur;
26
		$this->nomCourant = $this->conteneur->getNomCourant();
26
		$this->nomCourant = $this->conteneur->getNomCourant();
27
		$this->wikini = $this->conteneur->getApiWikini();
27
		$this->wikini = $this->conteneur->getApiWikini();
28
		$this->meta = $this->conteneur->getApiMetaDonnees();
28
		$this->meta = $this->conteneur->getApiMetaDonnees();
29
		$this->appUrls = $this->conteneur->getAppUrls();
29
		$this->appUrls = $this->conteneur->getAppUrls();
30
	}
30
	}
31
	
31
	
32
	public function obtenirDonnees() {
32
	public function obtenirDonnees() {
33
		$donnees['flores']['liste_flores'] = $this->getFlores();
33
		$donnees['flores']['liste_flores'] = $this->getFlores();
-
 
34
		$this->meta->setProjet('bdtfx');
34
		$meta = $this->meta->getMetaDonnees();
35
		$meta = $this->meta->getMetaDonnees();
35
		$titreMeta = $meta[0]['titre'];
36
		$titreMeta = $meta[0]['titre'];
36
		$donnees['flores']['meta']['titre'] = $titreMeta;
37
		$donnees['flores']['meta']['titre'] = $titreMeta;
37
		$donnees['flores']['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('bdtfx');
38
		$donnees['flores']['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('bdtfx');
38
		$this->meta->setProjet('bdtfx');
-
 
39
		
39
		
-
 
40
		$donnees['bibliobota']['references'] = $this->getBiblioBota();
-
 
41
		$this->meta->setProjet('bibliobota');
-
 
42
		$meta = $this->meta->getMetaDonnees();
-
 
43
		$titreMeta = $meta[0]['titre'];
-
 
44
		$donnees['bibliobota']['meta']['titre'] = $titreMeta;
40
		$donnees['bibliobota']['references'] = $this->getBiblioBota();
45
		$donnees['bibliobota']['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('bibliobota');
41
		$donnees['wikini'] = $this->getWikini();
46
		$donnees['wikini'] = $this->getWikini();
42
		return $donnees;
47
		return $donnees;
43
	}
48
	}
44
	
49
	
45
	public function getBloc() {
50
	public function getBloc() {
46
		$flores = $this->getFlores();
51
		$flores = $this->getFlores();
47
		$donnees['flores'] = array_slice($flores, 0, 3);
52
		$donnees['flores'] = array_slice($flores, 0, 3);
48
		$donnees['autresFlores'] = count($flores) - 3;
53
		$donnees['autresFlores'] = count($flores) - 3;
49
		$references = $this->getBiblioBota();
54
		$references = $this->getBiblioBota();
50
		$donnees['references'] = array_slice($references, 0, 3);
55
		$donnees['references'] = array_slice($references, 0, 3);
51
		$donnees['autresReferences'] = count($references) - 3;
56
		$donnees['autresReferences'] = count($references) - 3;
52
		if ($donnees['flores'] == array() && $donnees['references'] == array()) {
57
		if ($donnees['flores'] == array() && $donnees['references'] == array()) {
53
			$donnees['wikini'] = $this->getWikini();
58
			$donnees['wikini'] = $this->getWikini();
54
		}
59
		}
55
		return $donnees;
60
		return $donnees;
56
	}
61
	}
57
	
-
 
58
	private function remplacerCorrespondancesFlores($flores) {
-
 
59
		$correspondance_code_flores = $this->getCorrespondancesBiblio();
-
 
60
		$flores_texte = array();
-
 
61
		
-
 
62
		foreach($flores as $code_flore) {
-
 
63
			$code_flore = trim($code_flore);
-
 
64
			if(isset($correspondance_code_flores[$code_flore])) {
-
 
65
				$flores_texte[] = $correspondance_code_flores[$code_flore];
-
 
66
			}
-
 
67
		}
-
 
68
		return $flores_texte;
-
 
69
	}
-
 
70
	
62
	
71
	// Récupération des données flores présentes dans le référentiel
63
	// Récupération des données flores présentes dans le référentiel
72
	private function getFlores() {
64
	private function getFlores() {
73
		$flores = $this->nomCourant->getNomRetenu()->get('flores');
65
		$flores = $this->nomCourant->getNomRetenu()->get('flores');
74
		$flores = explode(',', $flores);
66
		$flores = explode(',', $flores);
75
		return $this->remplacerCorrespondancesFlores($flores);
67
		return $this->remplacerCorrespondancesFlores($flores);
76
	}
68
	}
77
	
69
	
78
	//Obtention des données issues de biblio_bota
70
	//Obtention des données issues de biblio_bota
79
	private function getBiblioBota() {
71
	private function getBiblioBota() {
80
		$this->apiBiblioBota = $this->conteneur->getApiBiblioBota();
72
		$this->apiBiblioBota = $this->conteneur->getApiBiblioBota();
81
		$this->apiBiblioBota->setProjet('bibliobota');
73
		$this->apiBiblioBota->setProjet('bibliobota');
82
		$references = $this->apiBiblioBota->getReferences($this->conteneur->getParametre('nom'));
74
		$references = $this->apiBiblioBota->getReferences($this->conteneur->getParametre('nom'));
83
		return $references['resultats'];
75
		return $references['resultats'];
84
	}
76
	}
85
	
77
	
86
	private function getWikini() {
78
	private function getWikini() {
87
		$wikini = array();
79
		$wikini = array();
88
		$wikini['titre'] = 'Wikini';
80
		$wikini['titre'] = 'Wikini';
89
		$referentiel = $this->conteneur->getParametre('referentiel');
81
		$referentiel = $this->conteneur->getParametre('referentiel');
90
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
82
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
91
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
83
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
92
		$wikini['biblio'] = $this->wikini->getTexteFormate($page_wiki, 'biblio');
84
		$wikini['biblio'] = $this->wikini->getTexteFormate($page_wiki, 'biblio');
93
		return $wikini;
85
		return $wikini;
94
	}
86
	}
95
	
87
	
96
	//TODO: faire une ontologie mais pas de tache prévue dans ce sprint
88
	//TODO: faire une ontologie mais pas de tache prévue dans ce sprint
97
	private function getCorrespondancesBiblio() {
89
	private function getCorrespondancesBiblio() {
98
		
90
		
99
		$correspondance = array(
91
		$correspondance = array(
100
		'1' => 'BONNIER & LAYENS, 1894. Tables synoptiques des plantes vasculaires de la flore de France.',
92
		'1' => 'BONNIER & LAYENS, 1894. Tables synoptiques des plantes vasculaires de la flore de France.',
101
		'2' => 'COSTE, 1899-1906. Flore illustrée France, (3 vol.).',
93
		'2' => 'COSTE, 1899-1906. Flore illustrée France, (3 vol.).',
102
		'3' => 'FOURNIER, 1934-1940. Quatre Flores de France.',
94
		'3' => 'FOURNIER, 1934-1940. Quatre Flores de France.',
103
		'3*' => 'FOURNIER, additions dans l\'édition de 1961.',
95
		'3*' => 'FOURNIER, additions dans l\'édition de 1961.',
104
		'4' =>  'TUTIN & al., 1964-1980. Flora Europaea, (5 vol.).',
96
		'4' =>  'TUTIN & al., 1964-1980. Flora Europaea, (5 vol.).',
105
		'4*' => 'Flora Europaea, édition 2 (Vol. 1), voir TUTIN & al. (1993), abrégée en FE2. L\'indication est surtout donnée quand la citation n\'a pas été faite dans 4 (supplémentaire ou modifiée).',
97
		'4*' => 'Flora Europaea, édition 2 (Vol. 1), voir TUTIN & al. (1993), abrégée en FE2. L\'indication est surtout donnée quand la citation n\'a pas été faite dans 4 (supplémentaire ou modifiée).',
106
		'5' => 'GUINOCHET & VILMORIN, 1973-1984. Flore de France, éd. C.N.R.S., (5 vol.).',
98
		'5' => 'GUINOCHET & VILMORIN, 1973-1984. Flore de France, éd. C.N.R.S., (5 vol.).',
107
		'6' => 'KERGUÉLEN, 1993. Liste synonymique de la flore de France.'
99
		'6' => 'KERGUÉLEN, 1993. Liste synonymique de la flore de France.'
108
		);
100
		);
109
		
101
		
110
		return $correspondance;
102
		return $correspondance;
111
	}
103
	}
-
 
104
	
-
 
105
	private function remplacerCorrespondancesFlores($flores) {
-
 
106
		$correspondance_code_flores = $this->getCorrespondancesBiblio();
-
 
107
		$flores_texte = array();
-
 
108
	
-
 
109
		foreach($flores as $code_flore) {
-
 
110
			$code_flore = trim($code_flore);
-
 
111
			if(isset($correspondance_code_flores[$code_flore])) {
-
 
112
				$flores_texte[] = $correspondance_code_flores[$code_flore];
-
 
113
			}
-
 
114
		}
-
 
115
		return $flores_texte;
-
 
116
	}
112
}
117
}
113
?>
118
?>