990 |
isa |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
/**
|
|
|
4 |
* Classe Mobile Wikini.
|
|
|
5 |
*
|
|
|
6 |
* @category PHP 5.2
|
|
|
7 |
* @package eflore-consultation
|
|
|
8 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
|
|
9 |
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
|
|
|
10 |
* @author Isabelle NEMBROT <isabelle.nembrot@tela-botanica.org>
|
|
|
11 |
* @copyright 2013 Tela-Botanica
|
|
|
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
|
|
|
14 |
* @version $Id$
|
|
|
15 |
*/
|
|
|
16 |
class Texte extends aControleur {
|
|
|
17 |
|
|
|
18 |
private $conteneur = null;
|
|
|
19 |
private $donnees = array();
|
|
|
20 |
private $format = "text/html";
|
|
|
21 |
|
|
|
22 |
public function __construct(Conteneur $conteneur) {
|
|
|
23 |
$this->conteneur = $conteneur;
|
|
|
24 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
|
|
25 |
|
|
|
26 |
parent::__construct();
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
public function getDonnees() {
|
|
|
30 |
$url_wiki = $this->obtenirUrlWikini();
|
1435 |
aurelien |
31 |
$obj = json_decode(file_get_contents($url_wiki), true);
|
990 |
isa |
32 |
|
1435 |
aurelien |
33 |
$this->donnees['sources'] = $obj['sections']['Sources'];
|
|
|
34 |
unset($obj['sections']['Sources']);
|
|
|
35 |
$this->donnees['corps'] = $obj['sections'];
|
1410 |
aurelien |
36 |
|
990 |
isa |
37 |
return $this->donnees;
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
public function obtenirUrlWikini() {
|
1435 |
aurelien |
41 |
$titre = urlencode(Config::get('smartFloreSectionsFiches'));
|
1388 |
aurelien |
42 |
$base_url_wiki = Config::get('smartFloreWikiTpl');
|
|
|
43 |
$url_wiki = $base_url_wiki
|
1450 |
mathias |
44 |
. $this->obtenirTagFiche()
|
|
|
45 |
. "?txt.format=".$this->format."&txt.section.titre=".$titre;
|
990 |
isa |
46 |
|
|
|
47 |
return ($url_wiki);
|
|
|
48 |
}
|
1450 |
mathias |
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 |
}
|
990 |
isa |
54 |
}
|
|
|
55 |
?>
|