Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 312 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 312 Rev 313
Line 33... Line 33...
33
		$conteneur = new Conteneur();
33
		$conteneur = new Conteneur();
34
		$cartesWs = $conteneur->getApiCartes();
34
		$cartesWs = $conteneur->getApiCartes();
35
		$cartesWs->setProjet('chorodep');
35
		$cartesWs->setProjet('chorodep');
36
		$cartesWs->setLargeur('108x101');
36
		$cartesWs->setLargeur('108x101');
37
		$urls = array();
37
		$urls = array();
38
		Debug::printr($this->noms);
-
 
39
		foreach ($this->noms as $nom) {
38
		foreach ($this->noms as $nom) {
40
			if (array_key_exists('nom_retenu.code', $nom)) {
39
			if (array_key_exists('nom_retenu.code', $nom)) {
41
				$id = $nom['nom_retenu.code'];
40
				$id = $nom['nom_retenu.code'];
42
				$id = $this->supprimerCodeReftax($id);
41
				$id = $this->supprimerCodeReftaxAvecNn($id);
43
				$cartesWs->setId("nn:$id");
42
				$cartesWs->setId("nn:$id");
44
				if (array_key_exists($id, $urls) == false) {
43
				if (array_key_exists($id, $urls) == false) {
45
					$urls[$id] = $cartesWs->getUrlPng();
44
					$urls[$id] = $cartesWs->getUrlPng();
46
				}
45
				}
47
			}
46
			}
Line 73... Line 72...
73
	private function extraireNnDesNoms() {
72
	private function extraireNnDesNoms() {
74
		$nns = array();
73
		$nns = array();
75
		foreach ($this->noms as $id => $nom) {
74
		foreach ($this->noms as $id => $nom) {
76
			if (array_key_exists('nom_retenu.code', $nom)) {
75
			if (array_key_exists('nom_retenu.code', $nom)) {
77
				if (in_array($nom['nom_retenu.code'], $nns) == false) {
76
				if (in_array($nom['nom_retenu.code'], $nns) == false) {
78
					$idAAjouter = $this->supprimerCodeReftaxDesNns($nom['nom_retenu.code']);
77
					$idAAjouter = $this->supprimerCodeReftaxAvecNn($nom['nom_retenu.code']);
79
					if (is_numeric($idAAjouter)) {
78
					if (is_numeric($idAAjouter)) {
80
						$nns[] = $idAAjouter;
79
						$nns[] = $idAAjouter;
81
					}
80
					}
82
				}
81
				}
83
			}
82
			}
84
		}
83
		}
85
		return $nns;
84
		return $nns;
86
	}
85
	}
Line 87... Line 86...
87
 
86
 
88
	private function supprimerCodeReftaxDesUrls($urls) {
87
	private function supprimerCodeReftaxDesUrls($urls) {
89
				$urlsNettoyees = array();
88
		$urlsNettoyees = array();
90
		foreach ($urls as $id => $url) {
89
		foreach ($urls as $id => $url) {
91
			$id = $this->supprimerCodeReftax($id);
90
			$id = $this->supprimerCodeReftax($id);
92
			$urlsNettoyees[$id] = $url;
91
			$urlsNettoyees[$id] = $url;
93
		}
92
		}
Line 102... Line 101...
102
 
101
 
103
 
102
 
104
	private function extraireInfosNomsPourTplDetermination() {
103
	private function extraireInfosNomsPourTplDetermination() {
105
		$taxons = array();
104
		$taxons = array();
106
		foreach ($this->noms as $idNomCourant => $nom) {
105
		foreach ($this->noms as $idNomCourant => $nom) {
107
			$nn = $this->supprimerCodeReftaxDesNns($nom['nom_retenu.code']);
106
			$nn = $this->supprimerCodeReftaxAvecNn($nom['nom_retenu.code']);
108
			if (array_key_exists($nn, $taxons) == false) {
107
			if (array_key_exists($nn, $taxons) == false) {
109
				$taxon = array();
108
				$taxon = array();
110
				$taxon['nomSci'] = $nom['taxon'];
109
				$taxon['nomSci'] = $nom['taxon'];
Line 118... Line 117...
118
			$taxons[$nn]['nomVerna'][] = $nom_verna;
117
			$taxons[$nn]['nomVerna'][] = $nom_verna;
119
		}
118
		}
120
		$this->infosPourTpl['noms'] = (count($taxons) > 0) ? $taxons : false;
119
		$this->infosPourTpl['noms'] = (count($taxons) > 0) ? $taxons : false;
121
	}
120
	}
Line 122... Line 121...
122
 
121
 
123
	private function supprimerCodeReftaxDesNns($nn) {
122
	private function supprimerCodeReftaxAvecNn($nn) {
124
		$codeReftax = $this->parametres->reftaxCourant.'.nn:';
123
		$codeReftax = $this->parametres->reftaxCourant.'.nn:';
125
		return str_replace($codeReftax, '', $nn);
124
		return str_replace($codeReftax, '', $nn);