| 291 | 
           jpm | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
           // declare(encoding='UTF-8');
  | 
        
        
            | 
            | 
           3 | 
           /**
  | 
        
        
            | 
            | 
           4 | 
            * Classe Onglet Synthese.
  | 
        
        
            | 
            | 
           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		Grégoire DUCHÉ <gregoire@tela-botanica.org>
  | 
        
        
            | 
            | 
           11 | 
            * @copyright	2011 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 Synthese extends aControleur {
  | 
        
        
            | 
            | 
           17 | 
              | 
        
        
            | 
            | 
           18 | 
           	private $conteneur = null;
  | 
        
        
           | 294 | 
           delphine | 
           19 | 
           	private $nomCourant = null;
  | 
        
        
           | 291 | 
           jpm | 
           20 | 
              | 
        
        
            | 
            | 
           21 | 
           	public function __construct(Conteneur $conteneur) {
  | 
        
        
            | 
            | 
           22 | 
           		$this->conteneur = $conteneur;
  | 
        
        
           | 294 | 
           delphine | 
           23 | 
           		$this->nomCourant = $this->conteneur->getNomCourant();
  | 
        
        
           | 744 | 
           aurelien | 
           24 | 
              | 
        
        
            | 
            | 
           25 | 
           		parent::__construct();
  | 
        
        
           | 291 | 
           jpm | 
           26 | 
           	}
  | 
        
        
            | 
            | 
           27 | 
              | 
        
        
            | 
            | 
           28 | 
           	public function obtenirDonnees() {
  | 
        
        
            | 
            | 
           29 | 
           		$donnees = array();
  | 
        
        
           | 744 | 
           aurelien | 
           30 | 
           		$num_nom = $this->nomCourant->getNns();
  | 
        
        
           | 762 | 
           aurelien | 
           31 | 
           		if(Config::get('cache')) {
  | 
        
        
            | 
            | 
           32 | 
           			$cache = array(
  | 
        
        
            | 
            | 
           33 | 
           				'illustration' => $this->obtenirCache('infos_bloc_'.$num_nom),
  | 
        
        
            | 
            | 
           34 | 
           				'repartition' => $this->obtenirCache('repartition_bloc_'.$num_nom),
  | 
        
        
            | 
            | 
           35 | 
           				'nomenclature' => $this->obtenirCache('nomenclature_bloc_'.$num_nom),
  | 
        
        
            | 
            | 
           36 | 
           				'description' => $this->obtenirCache('description_bloc_'.$num_nom),
  | 
        
        
            | 
            | 
           37 | 
           				'ethnobotanique' => $this->obtenirCache('ethnobotanique_bloc_'.$num_nom),
  | 
        
        
            | 
            | 
           38 | 
           				'classification' => $this->obtenirCache('classification_bloc_'.$num_nom),
  | 
        
        
            | 
            | 
           39 | 
           				'bibliographie' => $this->obtenirCache('bibliographie_bloc_'.$num_nom),
  | 
        
        
            | 
            | 
           40 | 
           				'statut' => $this->obtenirCache('statut_bloc_'.$num_nom),
  | 
        
        
            | 
            | 
           41 | 
           				'ecologie' => $this->obtenirCache('ecologie_bloc_'.$num_nom)
  | 
        
        
            | 
            | 
           42 | 
           			);
  | 
        
        
            | 
            | 
           43 | 
           		}
  | 
        
        
           | 389 | 
           aurelien | 
           44 | 
              | 
        
        
            | 
            | 
           45 | 
           		$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
  | 
        
        
            | 
            | 
           46 | 
           		$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt);
  | 
        
        
           | 744 | 
           aurelien | 
           47 | 
              | 
        
        
            | 
            | 
           48 | 
           		// TODO: factoriser cette portion de code avec un tableau de classes
  | 
        
        
            | 
            | 
           49 | 
           		// et des boucles
  | 
        
        
            | 
            | 
           50 | 
           		if($cache['illustration'] != null) {
  | 
        
        
            | 
            | 
           51 | 
           			$donnees['illustration'] = $cache['illustration'];
  | 
        
        
            | 
            | 
           52 | 
           		} else {
  | 
        
        
            | 
            | 
           53 | 
           			$illustrations = new Illustrations($this->conteneur);
  | 
        
        
            | 
            | 
           54 | 
           			$donnees['illustration'] = $illustrations->getBloc();
  | 
        
        
            | 
            | 
           55 | 
           			if(!empty($donnees['illustration'])) {
  | 
        
        
            | 
            | 
           56 | 
           				$this->mettreEnCache('infos_bloc_'.$num_nom, $donnees['illustration']);
  | 
        
        
            | 
            | 
           57 | 
           			}
  | 
        
        
            | 
            | 
           58 | 
           		}
  | 
        
        
            | 
            | 
           59 | 
              | 
        
        
            | 
            | 
           60 | 
           		if($cache['repartition'] != null) {
  | 
        
        
            | 
            | 
           61 | 
           			$donnees['repartition'] = $cache['repartition'];
  | 
        
        
            | 
            | 
           62 | 
           		} else {
  | 
        
        
            | 
            | 
           63 | 
           			$repartition = new Repartition($this->conteneur);
  | 
        
        
            | 
            | 
           64 | 
           			$donnees['repartition'] = $repartition->getBloc();
  | 
        
        
            | 
            | 
           65 | 
           			$this->mettreEnCache('repartition_bloc_'.$num_nom, $donnees['repartition']);
  | 
        
        
            | 
            | 
           66 | 
           		}
  | 
        
        
            | 
            | 
           67 | 
              | 
        
        
            | 
            | 
           68 | 
           		if($cache['nomenclature'] != null) {
  | 
        
        
            | 
            | 
           69 | 
           			$donnees['nomenclature'] = $cache['nomenclature'];
  | 
        
        
            | 
            | 
           70 | 
           		} else {
  | 
        
        
            | 
            | 
           71 | 
           			$nomenclature = new Nomenclature($this->conteneur);
  | 
        
        
            | 
            | 
           72 | 
           			$donnees['nomenclature'] = $nomenclature->getBloc();
  | 
        
        
            | 
            | 
           73 | 
           			$this->mettreEnCache('nomenclature_bloc_'.$num_nom, $donnees['nomenclature']);
  | 
        
        
            | 
            | 
           74 | 
           		}
  | 
        
        
            | 
            | 
           75 | 
              | 
        
        
            | 
            | 
           76 | 
           		if($cache['description'] != null) {
  | 
        
        
            | 
            | 
           77 | 
           			$donnees['description'] = $cache['description'];
  | 
        
        
            | 
            | 
           78 | 
           		} else {
  | 
        
        
            | 
            | 
           79 | 
           			$description = new Description($this->conteneur);
  | 
        
        
            | 
            | 
           80 | 
           			$donnees['description'] = $description->getBloc();
  | 
        
        
            | 
            | 
           81 | 
           			// Le contenu des wiki ne doit pas être mis en cache dans la fiche synthèse car il est éditable en live
  | 
        
        
            | 
            | 
           82 | 
           			if($donnees['description']['titre'] != 'Description collaborative') {
  | 
        
        
            | 
            | 
           83 | 
           				$this->mettreEnCache('description_bloc_'.$num_nom, $donnees['description']);
  | 
        
        
            | 
            | 
           84 | 
           			}
  | 
        
        
            | 
            | 
           85 | 
           		}
  | 
        
        
            | 
            | 
           86 | 
              | 
        
        
            | 
            | 
           87 | 
           		if($cache['ethnobotanique'] != null) {
  | 
        
        
            | 
            | 
           88 | 
           			$donnees['ethnobotanique'] = $cache['ethnobotanique'];
  | 
        
        
            | 
            | 
           89 | 
           		} else {
  | 
        
        
            | 
            | 
           90 | 
           			$ethnobotanique = new Ethnobotanique($this->conteneur);
  | 
        
        
            | 
            | 
           91 | 
           			$donnees['ethnobotanique'] = $ethnobotanique->getBloc();
  | 
        
        
            | 
            | 
           92 | 
           			$this->mettreEnCache('ethnobotanique_bloc_'.$num_nom, $donnees['ethnobotanique']);
  | 
        
        
            | 
            | 
           93 | 
           		}
  | 
        
        
            | 
            | 
           94 | 
              | 
        
        
           | 833 | 
           mathilde | 
           95 | 
              | 
        
        
           | 744 | 
           aurelien | 
           96 | 
           		if($cache['bibliographie'] != null) {
  | 
        
        
            | 
            | 
           97 | 
           			$donnees['bibliographie'] = $cache['bibliographie'];
  | 
        
        
            | 
            | 
           98 | 
           		} else {
  | 
        
        
            | 
            | 
           99 | 
           			$bibliographie = new Bibliographie($this->conteneur);
  | 
        
        
            | 
            | 
           100 | 
           			$donnees['bibliographie'] = $bibliographie->getBloc();
  | 
        
        
            | 
            | 
           101 | 
           			$this->mettreEnCache('bibliographie_bloc_'.$num_nom, $donnees['bibliographie']);
  | 
        
        
            | 
            | 
           102 | 
           		}
  | 
        
        
            | 
            | 
           103 | 
              | 
        
        
            | 
            | 
           104 | 
           		if($cache['statut'] != null) {
  | 
        
        
            | 
            | 
           105 | 
           			$donnees['statut'] = $cache['statut'];
  | 
        
        
            | 
            | 
           106 | 
           		} else {
  | 
        
        
            | 
            | 
           107 | 
           			$statut = new Statut($this->conteneur);
  | 
        
        
           | 768 | 
           aurelien | 
           108 | 
           		$donnees['statut'] = $statut->getBloc();
  | 
        
        
           | 744 | 
           aurelien | 
           109 | 
           			$this->mettreEnCache('statut_bloc_'.$num_nom, $donnees['statut']);
  | 
        
        
            | 
            | 
           110 | 
           		}
  | 
        
        
            | 
            | 
           111 | 
              | 
        
        
            | 
            | 
           112 | 
           		if($cache['ecologie'] != null) {
  | 
        
        
            | 
            | 
           113 | 
           			$donnees['ecologie'] = $cache['ecologie'];
  | 
        
        
            | 
            | 
           114 | 
           		} else {
  | 
        
        
            | 
            | 
           115 | 
           			$ecologie = new Ecologie($this->conteneur);
  | 
        
        
            | 
            | 
           116 | 
           			$donnees['ecologie'] = $ecologie->getBloc();
  | 
        
        
            | 
            | 
           117 | 
           			$this->mettreEnCache('ecologie_bloc_'.$num_nom, $donnees['ecologie']);
  | 
        
        
            | 
            | 
           118 | 
           		}
  | 
        
        
           | 291 | 
           jpm | 
           119 | 
           		return $donnees;
  | 
        
        
            | 
            | 
           120 | 
           	}
  | 
        
        
            | 
            | 
           121 | 
              | 
        
        
            | 
            | 
           122 | 
           }
  | 
        
        
            | 
            | 
           123 | 
           ?>
  |