Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

<?php
// declare(encoding='UTF-8');
/**
 * Classe gérant les textes.
 *
 * @category    PHP 5.2
 * @package             eflore-consultation
 * @author              Jean-Pascal MILCENT <jpm@tela-botanica.org>
 * @author              Delphine CAUQUIL <delphine@tela-botanica.org>
 * @copyright   2012 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 Textes extends Eflore {
        private $id = '';
        private $format = 'htm';//Valeurs possibles : htm, txt
        private $sectionTitre = '';

        public function setId($id) {
                $this->id = $id;
        }

        public function setFormat($format) {
                $this->format = $format;
        }

        public function setSectionTitre($titre) {
                $this->sectionTitre = $titre;
        }

        public function getTexte() {
                if ($this->sectionTitre != '') {
                        $tpl = Config::get('texteTitreSectionTpl');
                        $params = array('id' => $this->id, 'txtFormat' => $this->format, 'sectionTitre' => $this->sectionTitre);
                } else {
                        $tpl = Config::get('texteTpl');
                        $params = array('id' => $this->id, 'txtFormat' => $this->format);
                }
                $url = $this->formaterUrl($tpl, $params);
                return $this->chargerDonnees($url);
        }
        
        public function getUsage() {
            $tpl = Config::get('textesTpl');
            $params = array('masque' => $this->id);
            $url = $this->formaterUrl($tpl, $params);
            $url .= "?masque=".str_replace(" ", "_", $this->id);
            return $this->chargerDonnees($url);
        }
        
        public function getPageUrl() {
                $url = '';
                if(Config::get($this->getProjet().'LienPageTpl')) {
                        $tpl = Config::get($this->getProjet().'LienPageTpl');
                        $params = array('id' => $this->id, 'langue' => 'fr');
                        $url = $this->formaterUrl($tpl, $params);
                }
                
                return $url;
        }
}
?>