Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 291 | Rev 1357 | Go to most recent revision | 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() {
                $url = $this->getUrlTexte();
                return $this->chargerDonnees($url);
        }

        public function getUrlTexte() {
                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 $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;
        }
}
?>