Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1435 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
// declare(encoding='UTF-8');
/**
 * Classe Mobile Wikini.
 *
 * @category    PHP 5.2
 * @package             eflore-consultation
 * @author              Jean-Pascal MILCENT <jpm@tela-botanica.org>
 * @author              Delphine CAUQUIL <delphine@tela-botanica.org>
 * @author              Isabelle NEMBROT <isabelle.nembrot@tela-botanica.org>
 * @copyright   2013 Tela-Botanica
 * @license             http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
 * @license             http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
 * @version             $Id$
 */
class Texte extends aControleur {

        private $conteneur = null;
        private $donnees = array();
        private $format = "text/html";

        public function __construct(Conteneur $conteneur) {
                $this->conteneur = $conteneur;
                $this->nomCourant = $this->conteneur->getNomCourant();
                
                parent::__construct();
        }
        
        public function getDonnees() {
                $url_wiki = $this->obtenirUrlWikini();
                $obj =  json_decode(file_get_contents($url_wiki), true);
                
                $this->donnees['sources'] = $obj['sections']['Sources'];
                unset($obj['sections']['Sources']);
                $this->donnees['corps'] = $obj['sections'];
                
                return $this->donnees;
        }
        
        public function obtenirUrlWikini() {
                $titre = urlencode(Config::get('smartFloreSectionsFiches'));
                $base_url_wiki = Config::get('smartFloreWikiTpl');
                $url_wiki = $base_url_wiki
                        . $this->obtenirTagFiche()
                        . "?txt.format=".$this->format."&txt.section.titre=".$titre;
                
                return ($url_wiki);
        }

        // retourne le "tag" de la fiche SmartFlore dans Wikini, ex: BDTFXnt664
        public function obtenirTagFiche() {
                return strtoupper($this->conteneur->getParametre('referentiel'))."nt".$this->nomCourant->getNomSelectionne()->get('num_taxonomique');
        }
}
?>