Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 1452 Rev 1477
Line 98... Line 98...
98
 
98
 
99
		$this->setSortie('tags', $this->nom_retenu->get('nom_sci').",".$verna.
99
		$this->setSortie('tags', $this->nom_retenu->get('nom_sci').",".$verna.
Line 100... Line 100...
100
			",botanique,plante,description,ecologie,reconnaitre,fiche espece");
100
			",botanique,plante,description,ecologie,reconnaitre,fiche espece");
101
 
101
 
102
		$nom_sci_html = $this->nom_retenu->get('nom_sci_html');
102
		$nom_sci_html = $this->nom_retenu->get('nom_sci_html');
103
		// la recherche avancée à partir du clic sur le nom ne fonctionne pas sur les hybrides
103
		// la recherche avancée à partir du clic sur le nom ne fonctionne pas sur les hybrides
Line 104... Line 104...
104
		$nom_sci_html = strpos($nom_sci_html, 'class="hyb"') === false ?
104
		$nom_sci_html = strpos($nom_sci_html, 'class="hyb"') === false ?
105
							$this->formaterLiensNomsHtml($nom_sci_html) : $nom_sci_html;
105
							$this->formaterLiensNomsHtml($nom_sci_html) : $nom_sci_html;
Line 123... Line 123...
123
		$blocs_niveaux = $this->conteneur->getParametreTableau('blocs_fiche_defaut');
123
		$blocs_niveaux = $this->conteneur->getParametreTableau('blocs_fiche_defaut');
124
		$donnees['blocs'] = '"'.str_replace('|', '","', $blocs_niveaux[Registre::get('parametres.niveau')]).'"';
124
		$donnees['blocs'] = '"'.str_replace('|', '","', $blocs_niveaux[Registre::get('parametres.niveau')]).'"';
Line 125... Line 125...
125
 
125
 
126
		// onglet
126
		// onglet
127
		$donnees['onglet'] = $this->onglet;
127
		$donnees['onglet'] = $this->onglet;
128
		$donnees['niveau'] = $niveau;
128
		$donnees['niveau'] = $niveau;
Line 129... Line 129...
129
		$donnees['base_url_onglets'] = Config::get('base_url_application_onglets');
129
		$donnees['base_url_onglets'] = Config::get('base_url_application_onglets');
130
		
130
		
Line 140... Line 140...
140
		$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_accueil_niveau'.$niveau, $donnees), true);
140
		$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_accueil_niveau'.$niveau, $donnees), true);
141
		$this->ajouterPiedDePage();
141
		$this->ajouterPiedDePage();
142
	}
142
	}
Line 143... Line 143...
143
	
143
	
144
	public function executerTemplateAjax() {
144
	public function executerTemplateAjax() {
145
		$classe = ucfirst($this->onglet);
145
		$classe = ucfirst($this->onglet);
146
		$onglet = new $classe($this->conteneur);
146
		$onglet = new $classe($this->conteneur);
147
		$action = 'obtenir'.ucfirst($_GET['sous_action']);
147
		$action = 'obtenir'.ucfirst($_GET['sous_action']);
148
		$html_ajax = $onglet->$action();
148
		$html_ajax = $onglet->$action();
149
		header('Content-type : text/html');
149
		header('Content-type : text/html');
150
		echo $html_ajax;
150
		echo $html_ajax;
151
		exit;
151
		exit;
Line 152... Line 152...
152
	}
152
	}
153
	
153
	
154
	private function formaterLiensNomsHtml($nom_sci_html) {		
154
	private function formaterLiensNomsHtml($nom_sci_html) {		
155
		$app_urls = new AppUrls();
155
		$app_urls = new AppUrls();
Line 156... Line 156...
156
		$params = array();
156
		$params = array();
157
		$classes_recherche = array("fam" => "fam", "gen" => "gen", "sp" => "sp", "infra-sp" => "ssp");
157
		$classes_recherche = array("fam" => "fam", "gen" => "gen", "sp" => "sp", "infra-sp" => "ssp");
158
		
158
		
159
		$doc = new DOMDocument();
159
		$doc = new DOMDocument();
Line 160... Line 160...
160
		$doc->loadHTML($nom_sci_html);
160
		$doc->loadHTML($nom_sci_html);
Line 161... Line 161...
161
		$spans = $doc->getElementsByTagName('span');
161
		$spans = $doc->getElementsByTagName('span');
Line 162... Line 162...
162
		$abbrs = $doc->getElementsByTagName('abbr');
162
		$abbrs = $doc->getElementsByTagName('abbr');
163
		
163
		
164
		$params_subsp = array();
164
		$params_subsp = array();
165
		
165
		
166
		$i18n =  I18n::get('Fiche');
166
		$i18n =  I18n::get('Fiche');
Line 167... Line 167...
167
		
167
		
168
		//TODO: c'est un peu moche, la fonction est surement factorisable
168
		//TODO: c'est un peu moche, la fonction est surement factorisable
169
		if ($spans->length > 0) {
169
		if ($spans->length > 0) {
170
			foreach($spans as $span) {
170
			foreach($spans as $span) {
171
				$classe = $span->getAttribute('class');
171
				$classe = $span->getAttribute('class');
172
				if(in_array($classe, array_keys($classes_recherche))) {
172
				if(in_array($classe, array_keys($classes_recherche))) {
Line 173... Line 173...
173
					
173
					
174
					$params[$classes_recherche[$classe]] = $span->nodeValue;	
174
					$params[$classes_recherche[$classe]] = $span->nodeValue;	
175
					if($classe == "sp") {
175
					if($classe == "sp") {
176
						$params_subsp = $params;
176
						$params_subsp = $params;
177
					}				
177
					}				
178
					$lien_tpl = html_entity_decode($this->url->obtenirUrlRechercheAvancee($params));
178
					$lien_tpl = html_entity_decode($this->url->obtenirUrlRechercheAvancee($params));
179
					$texte_lien = $span->nodeValue;	
179
					$texte_lien = $span->nodeValue;	
180
					
180
					
181
					$span->nodeValue = "";
181
					$span->nodeValue = "";
Line 182... Line 182...
182
					$text = $doc->createElement('a', $texte_lien);
182
					$text = $doc->createElement('a', $texte_lien);
183
					$text->setAttribute('href', $lien_tpl);
183
					$text->setAttribute('href', $lien_tpl);
184
					$text->setAttribute('title', $i18n["lien-recherche-hier-".$classe]);
184
					$text->setAttribute('title', $i18n["lien-recherche-hier-".$classe]);
185
					$text->setAttribute('class', 'lien_recherche_hier');
185
					$text->setAttribute('class', 'lien_recherche_hier');
186
					$span->appendChild($text);
186
					$span->appendChild($text);
187
				}
187
				}
188
			}
188
			}
189
		}
189
		}
190
			
190
			
191
		if ($abbrs->length > 0) {
191
		if ($abbrs->length > 0) {
192
			foreach($abbrs as $abbr) {
192
			foreach($abbrs as $abbr) {
193
				$classe = $abbr->getAttribute('class');
193
				$classe = $abbr->getAttribute('class');
194
				$params_subsp["type"] = $abbr->nodeValue;
194
				$params_subsp["type"] = $abbr->nodeValue;
195
				$lien_tpl = html_entity_decode($this->url->obtenirUrlRechercheAvancee($params_subsp));
195
				$lien_tpl = html_entity_decode($this->url->obtenirUrlRechercheAvancee($params_subsp));
196
				$texte_lien = $abbr->nodeValue;
196
				$texte_lien = $abbr->nodeValue;
Line 197... Line 197...
197
					
197
					
Line 231... Line 231...
231
			'nnr' => $this->conteneur->getNomCourant()->getNnr(),
231
			'nnr' => $this->conteneur->getNomCourant()->getNnr(),
232
			'inpn' => $this->conteneur->getNomCourant()->getInpn(),
232
			'inpn' => $this->conteneur->getNomCourant()->getInpn(),
233
			'wiki' => $description->getLienWikini(),
233
			'wiki' => $description->getLienWikini(),
234
			'nom_retenu' => $this->nom_retenu->get('nom_sci'),
234
			'nom_retenu' => $this->nom_retenu->get('nom_sci'),
235
			'mobile' => $urlMobile,
235
			'mobile' => $urlMobile,
-
 
236
			'baseUrlIco' => Registre::get('eFlore.urlBaseDossier')->getUrl() . '/',
236
			'qr_code_png' => $this->obtenirUrlQrCode($urlMobile)
237
			'qr_code_png' => $this->obtenirUrlQrCode($urlMobile)
237
		);
238
		);
238
		$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_pied_page', $donnees), true);
239
		$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_pied_page', $donnees), true);
239
	}
240
	}