Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

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