Subversion Repositories eFlore/Applications.coel-consultation

Rev

Rev 171 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 171 Rev 258
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
-
 
31
		$donnees = array();
-
 
-
 
30
 
32
		
-
 
33
		
-
 
34
		
-
 
35
		// Création de la carte
-
 
36
		$options = array(
-
 
37
			'carte_nom' => Config::get('carte_genere_nom'),	
-
 
38
			'formule' => Cartographie::FORMULE_PROPORTIONNEL,
-
 
39
			'couleur_claire' => Config::get('carte_couleur_claire'),
-
 
40
			'couleur_foncee' => Config::get('carte_couleur_foncee'), 
-
 
41
			'fond_fichier' => Config::get('carte_base_nom'),
-
 
42
			'fond_dossier' => Application::getChemin().Config::get('carte_fonds_chemin'),
-
 
43
			'stock_dossier' => Config::get('carte_sotckage_chemin'),
-
 
44
			'stock_url' => Config::get('carte_sotckage_url'),
-
 
45
			'debug' => Config::get('carte_mode_debug'));
-
 
46
		$cartographie = Composant::fabrique('cartographie', $options);
-
 
47
		// Construction des données nécessaires à la cartographie
-
 
48
		$zones = $cartographie->getCarteZones();
-
 
49
		$this->chargerZonesNbre($zones);
-
 
50
		$this->chargerZonesUrls($zones);
-
 
51
		$cartographie->setCarteZones($zones);
-
 
52
		//Debug::printr($zones);
-
 
53
		
-
 
54
		$cartographie->creerCarte();
-
 
55
		$donnees['map'] = $cartographie->getImageMap();
-
 
56
		//$donnees['i18n'] = I18n::get('carte');
-
 
57
		
31
		
58
		$resultat = $this->getVue('carte', $donnees);
32
		$resultat = $this->getVue('carte', array());
59
		$this->setSortie(self::RENDU_CORPS, $resultat);
33
		$this->setSortie(self::RENDU_CORPS, $resultat);
60
		$this->chargerPiedDePage();
34
		$this->chargerPiedDePage();
61
	}
35
	}
62
	
-
 
63
	private function chargerZonesNbre(&$zones) {
-
 
64
		$paca = array("04" => '', "05" => '', "06" => '', 13 => '', 83 => '', 84 => '');
-
 
65
		$structureDao = new StructureDao();
-
 
66
		$zones_infos = $structureDao->getStructureParZoneGeo('FRD');
-
 
67
		foreach ($zones as $id => &$infos) {
-
 
68
			if ($this->registre->get('contexte') == 'paca') {
-
 
69
				if (isset($zones_infos[$id]) && isset($paca[$id])) {
-
 
70
					$nbre = $zones_infos[$id];
-
 
71
					$infos['info_nombre'] = $nbre;
-
 
72
				} else {
-
 
73
					$infos['info_nombre'] = 0;
-
 
74
				}
-
 
75
			} else {
-
 
76
				if (isset($zones_infos[$id])) {
-
 
77
					$nbre = $zones_infos[$id];
-
 
78
					$infos['info_nombre'] = $nbre;
-
 
79
				} else {
-
 
80
					$infos['info_nombre'] = 0;
-
 
81
				}
-
 
82
			}	
-
 
83
		}
-
 
84
	}
-
 
85
	
-
 
86
	private function chargerZonesUrls(&$zones) {
-
 
87
		$url = $this->obtenirUrlRecherche('str-d:%s');
-
 
88
		foreach ($zones as $id => &$infos) {
-
 
89
			$infos['url'] = sprintf($url, $id);
-
 
90
		}
-
 
91
	}
-
 
92
}
36
}
93
?>
37
?>