Subversion Repositories Applications.referentiel

Rev

Rev 82 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
78 delphine 1
<?php
2
// declare(encoding='UTF-8');
3
/**
4
 * Classe Controleur du module Fiche Taxon.
5
 *
6
 * @category	Php 5.2
7
 * @package		Taxon
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @copyright	2010 Tela-Botanica
10
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
12
 * @version		SVN: $Id: Fiche.php 96 2010-06-21 16:46:31Z jpm $
13
 */
14
class FicheTaxon extends AppliControleur {
15
 
16
	private $donnees = array();
17
	protected $taxonDao = null;
18
 
19
	//+----------------------------------------------------------------------------------------------------------------+
20
	// Méthodes
21
	/**
22
	 * Fonction d'affichage par défaut
23
	 */
24
	public function executerActionParDefaut() {
25
		return $this->afficherTaxon();
26
	}
27
 
28
	// +---------------------------------------------------------------------------------------------------------------+
29
	// FICHE COLLECTION
30
	public function afficherTaxon() {
31
		// Récupération du référentiel
32
		if (isset($_GET['ref'])) {
33
			$this->referentiel = strtolower($_GET['ref']);
34
		}
35
		// Gestion des actions par défaut
36
		$this->taxonDao = new TaxonDao();
37
		$this->definirCommeModulePrincipal(get_class($this));
38
		$this->construireMenu($this->referentiel);
39
		$this->construireFilAriane($this->referentiel);
40
		$this->executerActionReferentiel('Recherche', 'chargerMoteurRecherche', $this->referentiel);
41
 
42
		// Gestion des données de la requête
43
		if (!isset($_GET['num_nom'])) {
44
 
45
		} else {
46
			// Récupération des données
47
			$this->donnees['referentiel'] = $this->referentiel;
48
			$this->donnees['num_nom'] = $_GET['num_nom'];
49
			$this->donnees['num_nom_retenu'] = $_GET['num_nom_retenu'];
50
			$this->donnees['nom'] = $_GET['nom'];
51
			//$this->donnees['info'] = $this->taxonDao->getTaxon($this->referentiel, $this->donnees['num_nom']);
52
 
53
			// Chargement des données des onglets
54
			$this->chargerNomenclature();
55
			//print_r($this->donnees);
56
			/*$this->chargerSynonymie();
57
			$this->chargerClassification();
58
			$this->chargerNotes();
59
			$this->chargerChorologie();
60
			$this->chargerComplements();*/
61
 
62
			$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_taxon', $this->donnees));
63
			//$this->chargerPiedDePage();
64
		}
65
	}
66
 
67
	public static function getUrlFicheTaxon($params, $type) {
68
		$taxon = null;
69
		switch ($type) {
70
			case 'bas' :
71
				$taxon['num_nom'] = $params['bas_num'];
72
				$taxon['num_nom_retenu'] = $params['bas_num_retenu'];
73
				$taxon['nom_complet'] = $params['bas_nom'];
74
				break;
75
			case 'p1' :
76
				$taxon['num_nom'] = $params['p1_num'];
77
				$taxon['num_nom_retenu'] = $params['p1_num'];
78
				$taxon['nom_complet'] = $params['p1_nom'];
79
				break;
80
			case 'p2' :
81
				$taxon['num_nom'] = $params['p2_num'];
82
				$taxon['num_nom_retenu'] = $params['p2_num'];
83
				$taxon['nom_complet'] = $params['p2_nom'];
84
				break;
85
			default : break;
86
		}
87
		return Recherche::getUrlFicheTaxon($taxon);
88
	}
89
 
90
 
91
	private function chargerNomenclature() {
92
		$this->donnees['selectionne'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom']);
93
		if (strpos($this->donnees['nom'], ' x ') ) {
94
			if ($this->donnees['num_nom'] != $this->donnees['num_nom_retenu']) {
95
				$this->donnees['retenu'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom_retenu']);
96
				$this->donnees['parents'] = $this->taxonDao->getParentsHybride($this->referentiel, $this->donnees['num_nom_retenu']);
97
			} else {
98
				$this->donnees['parents'] = $this->taxonDao->getParentsHybride($this->referentiel, $this->donnees['num_nom']);
99
			}
100
		} else {
101
			if ($this->donnees['num_nom'] != $this->donnees['num_nom_retenu']) {
102
				$this->donnees['retenu'] = $this->taxonDao->getNomenclature($this->referentiel, $this->donnees['num_nom_retenu']);
103
			}
104
		}
105
	}
106
 
107
}