Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 1435 Rev 1450
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe Mobile Wikini.
4
 * Classe Mobile Wikini.
5
 *
5
 *
6
 * @category	PHP 5.2
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @author		Isabelle NEMBROT <isabelle.nembrot@tela-botanica.org>
10
 * @author		Isabelle NEMBROT <isabelle.nembrot@tela-botanica.org>
11
 * @copyright	2013 Tela-Botanica
11
 * @copyright	2013 Tela-Botanica
12
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
12
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
13
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
13
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
14
 * @version		$Id$
14
 * @version		$Id$
15
 */
15
 */
16
class Texte extends aControleur {
16
class Texte extends aControleur {
17
 
17
 
18
	private $conteneur = null;
18
	private $conteneur = null;
19
	private $donnees = array();
19
	private $donnees = array();
20
	private $format = "text/html";
20
	private $format = "text/html";
21
 
21
 
22
	public function __construct(Conteneur $conteneur) {
22
	public function __construct(Conteneur $conteneur) {
23
		$this->conteneur = $conteneur;
23
		$this->conteneur = $conteneur;
24
		$this->nomCourant = $this->conteneur->getNomCourant();
24
		$this->nomCourant = $this->conteneur->getNomCourant();
25
		
25
		
26
		parent::__construct();
26
		parent::__construct();
27
	}
27
	}
28
	
28
	
29
	public function getDonnees() {
29
	public function getDonnees() {
30
		$url_wiki = $this->obtenirUrlWikini();
30
		$url_wiki = $this->obtenirUrlWikini();
31
		$obj =  json_decode(file_get_contents($url_wiki), true);
31
		$obj =  json_decode(file_get_contents($url_wiki), true);
32
		
32
		
33
		$this->donnees['sources'] = $obj['sections']['Sources'];
33
		$this->donnees['sources'] = $obj['sections']['Sources'];
34
		unset($obj['sections']['Sources']);
34
		unset($obj['sections']['Sources']);
35
		$this->donnees['corps'] = $obj['sections'];
35
		$this->donnees['corps'] = $obj['sections'];
36
		
36
		
37
		return $this->donnees;
37
		return $this->donnees;
38
	}
38
	}
39
	
39
	
40
	public function obtenirUrlWikini() {
40
	public function obtenirUrlWikini() {
41
		$titre = urlencode(Config::get('smartFloreSectionsFiches'));
41
		$titre = urlencode(Config::get('smartFloreSectionsFiches'));
42
		$base_url_wiki = Config::get('smartFloreWikiTpl');
42
		$base_url_wiki = Config::get('smartFloreWikiTpl');
43
		$url_wiki = $base_url_wiki
43
		$url_wiki = $base_url_wiki
44
			.strtoupper($this->conteneur->getParametre('referentiel'))."nt".$this->nomCourant->getNomSelectionne()->get('num_taxonomique')
44
			. $this->obtenirTagFiche()
45
			."?txt.format=".$this->format."&txt.section.titre=".$titre;
45
			. "?txt.format=".$this->format."&txt.section.titre=".$titre;
46
		
46
		
47
		return ($url_wiki);
47
		return ($url_wiki);
48
	}
48
	}
-
 
49
 
-
 
50
	// retourne le "tag" de la fiche SmartFlore dans Wikini, ex: BDTFXnt664
-
 
51
	public function obtenirTagFiche() {
-
 
52
		return strtoupper($this->conteneur->getParametre('referentiel'))."nt".$this->nomCourant->getNomSelectionne()->get('num_taxonomique');
-
 
53
	}
49
}
54
}
50
?>
55
?>