Subversion Repositories eFlore/Applications.coel-consultation

Rev

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

Rev 153 Rev 169
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * classe Controleur du module Carte.
4
 * classe Controleur du module Carte.
5
 *
5
 *
6
 * @package		Collection
6
 * @package		Collection
7
 * @category	Php5
7
 * @category	Php5
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @copyright	2010 Tela-Botanica
9
 * @copyright	2010 Tela-Botanica
10
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
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
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
12
 * @version		SVN: $Id$
12
 * @version		SVN: $Id$
13
 */
13
 */
14
class Carte extends aControleur {
14
class Carte extends aControleur {
15
	
15
	
16
	//+----------------------------------------------------------------------------------------------------------------+
16
	//+----------------------------------------------------------------------------------------------------------------+
17
	// Méthodes
17
	// Méthodes
18
	/**
18
	/**
19
	 * Fonction d'affichage par défaut, elle appelle la liste des administrateurs
19
	 * Fonction d'affichage par défaut, elle appelle la liste des administrateurs
20
	 */
20
	 */
21
	public function executerActionParDefaut() {
21
	public function executerActionParDefaut() {
22
		return $this->cartographier();
22
		return $this->cartographier();
23
	}
23
	}
24
	
24
	
25
	/**
25
	/**
26
	 * Cartographier les collections.
26
	 * Cartographier les collections.
27
	 * @return string la vue correspondante
27
	 * @return string la vue correspondante
28
	 */
28
	 */
29
	public function cartographier() {
29
	public function cartographier() {
30
		// Initialisation de variable
30
		// Initialisation de variable
31
		$donnees = array();
31
		$donnees = array();
-
 
32
		
-
 
33
		
32
		
34
		
33
		// Création de la carte
35
		// Création de la carte
34
		$options = array(
36
		$options = array(
35
			'carte_nom' => 'col_str_dep',	
37
			'carte_nom' => Config::get('carte_genere_nom'),	
36
			'formule' => Cartographie::FORMULE_PROPORTIONNEL,
38
			'formule' => Cartographie::FORMULE_PROPORTIONNEL,
37
			'couleur_claire' => Config::get('carte_couleur_claire'),
39
			'couleur_claire' => Config::get('carte_couleur_claire'),
38
			'couleur_foncee' => Config::get('carte_couleur_foncee'), 
40
			'couleur_foncee' => Config::get('carte_couleur_foncee'), 
39
			'fond_fichier' => Config::get('carte_base_nom'),
41
			'fond_fichier' => Config::get('carte_base_nom'),
40
			'fond_dossier' => Application::getChemin().Config::get('carte_fonds_chemin'),
42
			'fond_dossier' => Application::getChemin().Config::get('carte_fonds_chemin'),
41
			'stock_dossier' => Config::get('carte_sotckage_chemin'),
43
			'stock_dossier' => Config::get('carte_sotckage_chemin'),
42
			'stock_url' => Config::get('carte_sotckage_url'),
44
			'stock_url' => Config::get('carte_sotckage_url'),
43
			'debug' => Config::get('carte_mode_debug'));
45
			'debug' => Config::get('carte_mode_debug'));
44
		$cartographie = Composant::fabrique('cartographie', $options);
46
		$cartographie = Composant::fabrique('cartographie', $options);
45
		// Construction des données nécessaires à la cartographie
47
		// Construction des données nécessaires à la cartographie
46
		$zones = $cartographie->getCarteZones();
48
		$zones = $cartographie->getCarteZones();
47
		$this->chargerZonesNbre($zones);
49
		$this->chargerZonesNbre($zones);
48
		$this->chargerZonesUrls($zones);
50
		$this->chargerZonesUrls($zones);
49
		$cartographie->setCarteZones($zones);
51
		$cartographie->setCarteZones($zones);
50
		//Debug::printr($zones);
52
		//Debug::printr($zones);
51
		
53
		
52
		$cartographie->creerCarte();
54
		$cartographie->creerCarte();
53
		$donnees['map'] = $cartographie->getImageMap();
55
		$donnees['map'] = $cartographie->getImageMap();
54
		//$donnees['i18n'] = I18n::get('carte');
56
		//$donnees['i18n'] = I18n::get('carte');
55
		
57
		
56
		$resultat = $this->getVue('carte', $donnees);
58
		$resultat = $this->getVue('carte', $donnees);
57
		$this->setSortie(self::RENDU_CORPS, $resultat);
59
		$this->setSortie(self::RENDU_CORPS, $resultat);
58
		$this->chargerPiedDePage();
60
		$this->chargerPiedDePage();
59
	}
61
	}
60
	
62
	
61
	private function chargerZonesNbre(&$zones) {
63
	private function chargerZonesNbre(&$zones) {
62
		$structureDao = new StructureDao();
64
		$structureDao = new StructureDao();
63
		$zones_infos = $structureDao->getStructureParZoneGeo('FRD');
65
		$zones_infos = $structureDao->getStructureParZoneGeo('FRD');
64
		foreach ($zones as $id => &$infos) {
66
		foreach ($zones as $id => &$infos) {
65
			if (isset($zones_infos[$id])) {
67
			if (isset($zones_infos[$id])) {
66
				$nbre = $zones_infos[$id];
68
				$nbre = $zones_infos[$id];
67
				$infos['info_nombre'] = $nbre;
69
				$infos['info_nombre'] = $nbre;
68
			} else {
70
			} else {
69
				$infos['info_nombre'] = 0;
71
				$infos['info_nombre'] = 0;
70
			}
72
			}
71
		}
73
		}
72
	}
74
	}
73
	
75
	
74
	private function chargerZonesUrls(&$zones) {
76
	private function chargerZonesUrls(&$zones) {
75
		$url = $this->obtenirUrlRecherche('str-d:%s');
77
		$url = $this->obtenirUrlRecherche('str-d:%s');
76
		foreach ($zones as $id => &$infos) {
78
		foreach ($zones as $id => &$infos) {
77
			$infos['url'] = sprintf($url, $id);
79
			$infos['url'] = sprintf($url, $id);
78
		}
80
		}
79
	}
81
	}
80
}
82
}
81
?>
83
?>