Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1130 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
272 delphine 1
<?php
2
// declare(encoding='UTF-8');
3
/**
4
 * Classe mère du module Liste.
5
 *
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	2011 Tela-Botanica
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
13
 * @version		$Id$
14
 */
15
class Bibliographie extends aControleur {
321 aurelien 16
 
351 gduche 17
	private $apiBiblioBota;
18
	private $conteneur;
19
	private $nomCourant;
20
	private $meta;
21
	private $appUrls;
408 aurelien 22
	private $wikini;
955 delphine 23
	private $referentiel = 'bdtfx';
24
	private $donnees = array();
351 gduche 25
 
321 aurelien 26
	public function __construct(Conteneur $conteneur) {
27
		$this->conteneur = $conteneur;
28
		$this->nomCourant = $this->conteneur->getNomCourant();
955 delphine 29
		$this->referentiel = $this->conteneur->getParametre('referentiel');
408 aurelien 30
		$this->wikini = $this->conteneur->getApiWikini();
321 aurelien 31
		$this->meta = $this->conteneur->getApiMetaDonnees();
32
		$this->appUrls = $this->conteneur->getAppUrls();
33
	}
272 delphine 34
 
321 aurelien 35
	public function obtenirDonnees() {
955 delphine 36
		$this->donnees['bibliobota']['references'] = $this->getBiblioBota();
37
		$this->meta->setProjet('bibliobota');
321 aurelien 38
		$meta = $this->meta->getMetaDonnees();
1130 aurelien 39
		$this->donnees['bibliobota']['meta'] = $meta[0];
955 delphine 40
		$this->donnees['bibliobota']['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('bibliobota');
321 aurelien 41
 
955 delphine 42
		$this->donnees['wikini'] = $this->getWikini();
43
		return $this->donnees;
321 aurelien 44
	}
272 delphine 45
 
321 aurelien 46
	public function getBloc() {
413 delphine 47
		$references = $this->getBiblioBota();
955 delphine 48
		$this->donnees['references'] = array_slice($references, 0, 3);
49
		foreach ($this->donnees['references'] as $id=>$reference) {
461 delphine 50
			preg_match('/.*<strong>(.*)<\/strong>.*/', $reference['reference_html'], $titre);
955 delphine 51
			$this->donnees['references'][$id]['reference_html'] = $titre[1];
461 delphine 52
		}
955 delphine 53
		$this->donnees['autresReferences'] = count($references) - 3;
1387 delphine 54
		if ($this->donnees['references'] == array()) {
955 delphine 55
			$this->donnees['wikini'] = $this->getWikini();
420 delphine 56
		}
955 delphine 57
		return $this->donnees;
272 delphine 58
	}
321 aurelien 59
 
955 delphine 60
 
413 delphine 61
	//Obtention des données issues de biblio_bota
62
	private function getBiblioBota() {
63
		$this->apiBiblioBota = $this->conteneur->getApiBiblioBota();
64
		$this->apiBiblioBota->setProjet('bibliobota');
875 aurelien 65
		$interrogation = $this->nomCourant->getNomSelectionne()->get('nom_sci');
66
		$references = $this->apiBiblioBota->getReferences($interrogation);
413 delphine 67
		return $references['resultats'];
68
	}
69
 
408 aurelien 70
	private function getWikini() {
71
		$wikini = array();
72
		$wikini['titre'] = 'Wikini';
73
		$referentiel = $this->conteneur->getParametre('referentiel');
74
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
75
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
76
		$wikini['biblio'] = $this->wikini->getTexteFormate($page_wiki, 'biblio');
77
		return $wikini;
78
	}
79
 
1387 delphine 80
 
81
 
272 delphine 82
}
83
?>