Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 408 Rev 413
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
		$flores = $this->nomCourant->getNomRetenu()->get('flores');
-
 
34
		
-
 
35
		$flores = explode(',', $flores);
-
 
36
 
-
 
37
		$donnees['flores']['liste_flores'] = $this->remplacerCorrespondancesFlores($flores);
33
		$donnees['flores']['liste_flores'] = $this->getFlores();
38
		
-
 
39
		$meta = $this->meta->getMetaDonnees();
34
		$meta = $this->meta->getMetaDonnees();
40
		$titreMeta = $meta[0]['titre'];
35
		$titreMeta = $meta[0]['titre'];
41
		$donnees['flores']['meta']['titre'] = $titreMeta;
36
		$donnees['flores']['meta']['titre'] = $titreMeta;
42
		$donnees['flores']['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('bdtfx');
37
		$donnees['flores']['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('bdtfx');
43
		$this->meta->setProjet('bdtfx');
38
		$this->meta->setProjet('bdtfx');
44
		
-
 
45
		//Obtention des données issues de biblio_bota
-
 
46
		$this->apiBiblioBota = $this->conteneur->getApiBiblioBota();
-
 
47
		$this->apiBiblioBota->setProjet('bibliobota');
-
 
48
		$references = $this->apiBiblioBota->getReferences($this->conteneur->getParametre('nom'));
39
		
49
		$donnees['bibliobota']['references'] = $references['resultats'];
40
		$donnees['bibliobota']['references'] = $this->getBiblioBota();
50
		$donnees['wikini'] = $this->getWikini();
41
		$donnees['wikini'] = $this->getWikini();
51
		return $donnees;
42
		return $donnees;
52
	}
43
	}
53
	
44
	
54
	public function getBloc() {
45
	public function getBloc() {
55
		$flores = $this->obtenirDonnees();
46
		$flores = $this->getFlores();
-
 
47
		$donnees['flores'] = array_slice($flores, 0, 3);
56
		$donnees = $flores;
48
		$donnees['autresFlores'] = count($flores) - 3;
-
 
49
		$references = $this->getBiblioBota();
-
 
50
		$donnees['references'] = array_slice($references, 0, 3);
-
 
51
		$donnees['autresReferences'] = count($references) - 3;
57
		return $donnees;
52
		return $donnees;
58
	}
53
	}
59
	
54
	
60
	private function remplacerCorrespondancesFlores($flores) {
55
	private function remplacerCorrespondancesFlores($flores) {
61
		
-
 
62
		$correspondance_code_flores = $this->getCorrespondancesBiblio();
56
		$correspondance_code_flores = $this->getCorrespondancesBiblio();
63
		
-
 
64
		$flores_texte = array();
57
		$flores_texte = array();
65
		
58
		
66
		foreach($flores as $code_flore) {
59
		foreach($flores as $code_flore) {
67
			$code_flore = trim($code_flore);
60
			$code_flore = trim($code_flore);
68
			if(isset($correspondance_code_flores[$code_flore])) {
61
			if(isset($correspondance_code_flores[$code_flore])) {
69
				$flores_texte[] = $correspondance_code_flores[$code_flore];
62
				$flores_texte[] = $correspondance_code_flores[$code_flore];
70
			}
63
			}
71
		}
64
		}
72
		
-
 
73
		return $flores_texte;
65
		return $flores_texte;
74
	}
66
	}
-
 
67
	
-
 
68
	// Récupération des données flores présentes dans le référentiel
-
 
69
	private function getFlores() {
-
 
70
		$flores = $this->nomCourant->getNomRetenu()->get('flores');
-
 
71
		$flores = explode(',', $flores);
-
 
72
		return $this->remplacerCorrespondancesFlores($flores);
-
 
73
	}
-
 
74
	
-
 
75
	//Obtention des données issues de biblio_bota
-
 
76
	private function getBiblioBota() {
-
 
77
		$this->apiBiblioBota = $this->conteneur->getApiBiblioBota();
-
 
78
		$this->apiBiblioBota->setProjet('bibliobota');
-
 
79
		$references = $this->apiBiblioBota->getReferences($this->conteneur->getParametre('nom'));
-
 
80
		return $references['resultats'];
-
 
81
	}
75
	
82
	
76
	private function getWikini() {
83
	private function getWikini() {
77
		$wikini = array();
84
		$wikini = array();
78
		$wikini['titre'] = 'Wikini';
85
		$wikini['titre'] = 'Wikini';
79
		$referentiel = $this->conteneur->getParametre('referentiel');
86
		$referentiel = $this->conteneur->getParametre('referentiel');
80
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
87
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
81
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
88
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
82
		$wikini['biblio'] = $this->wikini->getTexteFormate($page_wiki, 'biblio');
89
		$wikini['biblio'] = $this->wikini->getTexteFormate($page_wiki, 'biblio');
83
		return $wikini;
90
		return $wikini;
84
	}
91
	}
85
	
92
	
86
	//TODO: faire une ontologie mais pas de tache prévue dans ce sprint
93
	//TODO: faire une ontologie mais pas de tache prévue dans ce sprint
87
	private function getCorrespondancesBiblio() {
94
	private function getCorrespondancesBiblio() {
88
		
95
		
89
		$correspondance = array(
96
		$correspondance = array(
90
		'1' => 'BONNIER & LAYENS, 1894. Tables synoptiques des plantes vasculaires de la flore de France.',
97
		'1' => 'BONNIER & LAYENS, 1894. Tables synoptiques des plantes vasculaires de la flore de France.',
91
		'2' => 'COSTE, 1899-1906. Flore illustrée France, (3 vol.).',
98
		'2' => 'COSTE, 1899-1906. Flore illustrée France, (3 vol.).',
92
		'3' => 'FOURNIER, 1934-1940. Quatre Flores de France.',
99
		'3' => 'FOURNIER, 1934-1940. Quatre Flores de France.',
93
		'3*' => 'FOURNIER, additions dans l\'édition de 1961.',
100
		'3*' => 'FOURNIER, additions dans l\'édition de 1961.',
94
		'4' =>  'TUTIN & al., 1964-1980. Flora Europaea, (5 vol.).',
101
		'4' =>  'TUTIN & al., 1964-1980. Flora Europaea, (5 vol.).',
95
		'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).',
102
		'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).',
96
		'5' => 'GUINOCHET & VILMORIN, 1973-1984. Flore de France, éd. C.N.R.S., (5 vol.).',
103
		'5' => 'GUINOCHET & VILMORIN, 1973-1984. Flore de France, éd. C.N.R.S., (5 vol.).',
97
		'6' => 'KERGUÉLEN, 1993. Liste synonymique de la flore de France.'
104
		'6' => 'KERGUÉLEN, 1993. Liste synonymique de la flore de France.'
98
		);
105
		);
99
		
106
		
100
		return $correspondance;
107
		return $correspondance;
101
	}
108
	}
102
}
109
}
103
?>
110
?>