| 302 | 
           gduche | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
           // declare(encoding='UTF-8');
  | 
        
        
            | 
            | 
           3 | 
           /**
  | 
        
        
            | 
            | 
           4 | 
           * Classe implémentant l'API d'eFlore Publications pour le projet Biblio bota.
  | 
        
        
            | 
            | 
           5 | 
           *
  | 
        
        
            | 
            | 
           6 | 
           * @see http://www.tela-botanica.org/wikini/eflore/wakka.php?wiki=EfloreApi01Publications
  | 
        
        
            | 
            | 
           7 | 
           *
  | 
        
        
            | 
            | 
           8 | 
           * @package eFlore/services
  | 
        
        
            | 
            | 
           9 | 
           * @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
  | 
        
        
            | 
            | 
           10 | 
           * @author Aurélien PERONNET <aurelien@tela-botanica.org>
  | 
        
        
            | 
            | 
           11 | 
           * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
  | 
        
        
            | 
            | 
           12 | 
           * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
  | 
        
        
            | 
            | 
           13 | 
           * @version 1.0
  | 
        
        
            | 
            | 
           14 | 
           * @copyright 1999-2011 Tela Botanica (accueil@tela-botanica.org)
  | 
        
        
            | 
            | 
           15 | 
           */
  | 
        
        
            | 
            | 
           16 | 
           // TODO : Config et Outils sont des classes statiques qui doivent poser des pb pour les tests...
  | 
        
        
           | 536 | 
           gduche | 
           17 | 
           class Publications extends Commun{
  | 
        
        
           | 302 | 
           gduche | 
           18 | 
              | 
        
        
           | 536 | 
           gduche | 
           19 | 
           	protected $parametres;
  | 
        
        
            | 
            | 
           20 | 
           	protected $ressources;
  | 
        
        
           | 302 | 
           gduche | 
           21 | 
           	private $Bdd;
  | 
        
        
            | 
            | 
           22 | 
           	private $config;
  | 
        
        
            | 
            | 
           23 | 
           	private $nbrePublications;
  | 
        
        
            | 
            | 
           24 | 
           	private $masque_taxon;
  | 
        
        
           | 536 | 
           gduche | 
           25 | 
           	protected $service = 'publications';
  | 
        
        
           | 302 | 
           gduche | 
           26 | 
              | 
        
        
            | 
            | 
           27 | 
           	public function __construct(Bdd $bdd = null, Array $config = null, Utilisateurs $utilisateurs = null, Url $url = null) {
  | 
        
        
            | 
            | 
           28 | 
           		$this->Bdd = is_null($bdd) ? new Bdd() : $bdd;
  | 
        
        
            | 
            | 
           29 | 
           		$this->UrlNavigation = is_null($url) ? new Url($this->config['url_service']) : $url;
  | 
        
        
            | 
            | 
           30 | 
           	}
  | 
        
        
            | 
            | 
           31 | 
              | 
        
        
            | 
            | 
           32 | 
           	public function consulter($ressources, $parametres) {
  | 
        
        
            | 
            | 
           33 | 
              | 
        
        
            | 
            | 
           34 | 
           		$resultat = new ResultatService();
  | 
        
        
            | 
            | 
           35 | 
           		$this->parametres = $parametres;
  | 
        
        
            | 
            | 
           36 | 
           		$this->ressources = $ressources;
  | 
        
        
            | 
            | 
           37 | 
              | 
        
        
            | 
            | 
           38 | 
           		$this->definirValeurParDefautDesParametres();
  | 
        
        
            | 
            | 
           39 | 
           		$this->verifierParametres();
  | 
        
        
            | 
            | 
           40 | 
           		$this->recupererParametresMasque();
  | 
        
        
            | 
            | 
           41 | 
           		$this->chargerNbrePublicationsTotal();
  | 
        
        
            | 
            | 
           42 | 
              | 
        
        
            | 
            | 
           43 | 
           		$publications = $this->getPublications($this->masque_taxon);
  | 
        
        
            | 
            | 
           44 | 
           		$resultat->corps = $this->formaterPublications($publications);
  | 
        
        
            | 
            | 
           45 | 
              | 
        
        
            | 
            | 
           46 | 
           		return $resultat;
  | 
        
        
            | 
            | 
           47 | 
           	}
  | 
        
        
            | 
            | 
           48 | 
              | 
        
        
            | 
            | 
           49 | 
           	public function getPublications($cherche) {
  | 
        
        
            | 
            | 
           50 | 
              | 
        
        
            | 
            | 
           51 | 
           		$depart = $this->parametres['navigation.depart'];
  | 
        
        
            | 
            | 
           52 | 
           		$limite = $this->parametres['navigation.limite'];
  | 
        
        
            | 
            | 
           53 | 
              | 
        
        
            | 
            | 
           54 | 
           		$tab_mots = preg_split('~ ~', $cherche, -1, PREG_SPLIT_NO_EMPTY);
  | 
        
        
            | 
            | 
           55 | 
           		$sql = 	'SELECT DISTINCT B_C_CRAI, B_C_NOMCOMPLET, B_C_ABREGE, ' .
  | 
        
        
            | 
            | 
           56 | 
           				'	B_F_NUMERO, B_F_TITRE, B_F_DATE, B_F_CRAICOLL, '.
  | 
        
        
            | 
            | 
           57 | 
           				'	B_SER_SOUSTITRE, '.
  | 
        
        
            | 
            | 
           58 | 
           				'	B_A_PAGEDEBUT, B_A_PAGEFIN, B_A_CRAIFASC, B_A_CRAISERIE, ' .
  | 
        
        
            | 
            | 
           59 | 
           				'	B_D_ID, B_D_LABEL, ' .
  | 
        
        
            | 
            | 
           60 | 
           				'	B_S_IDSTR, B_S_NOM, ' .
  | 
        
        
            | 
            | 
           61 | 
           				'	B_AS_LIBELLE, '.
  | 
        
        
            | 
            | 
           62 | 
           				'	biblio_serie.*, biblio_item.*, biblio_item_typlog.*, biblio_item_typphy.* '.
  | 
        
        
            | 
            | 
           63 | 
           				'FROM biblio_item '.
  | 
        
        
            | 
            | 
           64 | 
           				'	LEFT JOIN biblio_aut_saisie ON (b_i_auteursaisie = b_as_id) '.
  | 
        
        
            | 
            | 
           65 | 
           				'	LEFT JOIN biblio_article ON (b_i_iditem = b_a_idart) '.
  | 
        
        
            | 
            | 
           66 | 
           				'	LEFT JOIN biblio_fasc ON '.
  | 
        
        
            | 
            | 
           67 | 
           				'		(B_F_CRAICOLL = B_A_CRAICOLL '.
  | 
        
        
            | 
            | 
           68 | 
           				'		AND B_F_CRAISERIE = B_A_CRAISERIE '.
  | 
        
        
            | 
            | 
           69 | 
           				'		AND B_F_NUMERO = B_A_CRAIFASC)' .
  | 
        
        
            | 
            | 
           70 | 
           				'	LEFT JOIN biblio_serie ON ' .
  | 
        
        
            | 
            | 
           71 | 
           				'		(b_f_craicoll = b_ser_craicoll ' .
  | 
        
        
            | 
            | 
           72 | 
           				'		AND b_f_craiserie = b_ser_idserie) '.
  | 
        
        
            | 
            | 
           73 | 
           				'	LEFT JOIN biblio_collection ON (b_ser_craicoll = b_c_crai) '.
  | 
        
        
            | 
            | 
           74 | 
           				'	LEFT JOIN biblio_str ON (B_C_LKSTR = B_S_IDSTR) '.
  | 
        
        
            | 
            | 
           75 | 
           				'	LEFT JOIN biblio_domaine_lier ON (b_i_iditem = b_dl_iditem) ' .
  | 
        
        
            | 
            | 
           76 | 
           				'	LEFT JOIN biblio_domaine ON (b_dl_iddom = b_d_id) ' .
  | 
        
        
            | 
            | 
           77 | 
           				'	LEFT JOIN biblio_item_typphy ON (b_i_typphy = b_ip_id) ' .
  | 
        
        
            | 
            | 
           78 | 
           				'	LEFT JOIN biblio_item_typlog ON (b_i_typlog = b_il_id) ' .
  | 
        
        
            | 
            | 
           79 | 
           				'	WHERE B_I_TYPLOG = 1 AND B_I_TYPPHY = 2  AND B_I_CACHER = 0 '.
  | 
        
        
            | 
            | 
           80 | 
           				'	AND B_D_ID = 1 ';
  | 
        
        
            | 
            | 
           81 | 
              | 
        
        
            | 
            | 
           82 | 
           		foreach ($tab_mots as $mot) {
  | 
        
        
            | 
            | 
           83 | 
           			$sql .= "	AND (B_I_TITRE LIKE '%$mot%' ".
  | 
        
        
            | 
            | 
           84 | 
           					"		OR B_I_RESUMCLE LIKE '%$mot%' ".
  | 
        
        
            | 
            | 
           85 | 
           					"		OR B_I_COMMENT LIKE '%$mot%') ";
  | 
        
        
            | 
            | 
           86 | 
           		}
  | 
        
        
            | 
            | 
           87 | 
           		$sql .= 'ORDER BY B_I_AUTEURS LIMIT '.$depart.', '.$limite;
  | 
        
        
            | 
            | 
           88 | 
              | 
        
        
            | 
            | 
           89 | 
           		$publications = $this->Bdd->recupererTous($sql);
  | 
        
        
            | 
            | 
           90 | 
           		return $publications;
  | 
        
        
            | 
            | 
           91 | 
           	}
  | 
        
        
            | 
            | 
           92 | 
              | 
        
        
            | 
            | 
           93 | 
           	function formaterPublications($publications) {
  | 
        
        
            | 
            | 
           94 | 
              | 
        
        
            | 
            | 
           95 | 
           		$resultats = array();
  | 
        
        
            | 
            | 
           96 | 
              | 
        
        
            | 
            | 
           97 | 
           		foreach($publications as $publication) {
  | 
        
        
            | 
            | 
           98 | 
              | 
        
        
            | 
            | 
           99 | 
           			$id_a = $publication['B_I_IDITEM'];
  | 
        
        
            | 
            | 
           100 | 
           			$titre = $publication['B_I_TITRE'];
  | 
        
        
            | 
            | 
           101 | 
           			$auteurs = $publication['B_I_AUTEURS'];
  | 
        
        
            | 
            | 
           102 | 
           			$geo = $publication['B_I_GEO'];
  | 
        
        
            | 
            | 
           103 | 
           			$langue = $publication['B_I_LANGUE'];
  | 
        
        
            | 
            | 
           104 | 
           			$resum = $publication['B_I_RESUMCLE'];
  | 
        
        
            | 
            | 
           105 | 
           			$image = $publication['B_I_IMAGE'];
  | 
        
        
            | 
            | 
           106 | 
           			$comment = $publication['B_I_COMMENT'];
  | 
        
        
            | 
            | 
           107 | 
           			// Table Auteur Saisie
  | 
        
        
            | 
            | 
           108 | 
           			$saisie = $publication['B_AS_LIBELLE'];
  | 
        
        
            | 
            | 
           109 | 
           			// Table Domaine
  | 
        
        
            | 
            | 
           110 | 
           			$domaine_id = $publication['B_D_ID'];
  | 
        
        
            | 
            | 
           111 | 
           			$domaine_nom = $publication['B_D_LABEL'];
  | 
        
        
            | 
            | 
           112 | 
           			// Table Collection
  | 
        
        
            | 
            | 
           113 | 
           			$coll_nom = $publication['B_C_NOMCOMPLET'];
  | 
        
        
            | 
            | 
           114 | 
           			$coll_abreviation = $publication['B_C_ABREGE'];
  | 
        
        
            | 
            | 
           115 | 
           			// Table S�rie
  | 
        
        
            | 
            | 
           116 | 
           			$serie_titre = $publication['B_SER_SOUSTITRE'];
  | 
        
        
            | 
            | 
           117 | 
           			// Table Fascicule
  | 
        
        
            | 
            | 
           118 | 
           			$craicoll = $publication['B_F_CRAICOLL'];
  | 
        
        
            | 
            | 
           119 | 
           			$date = $publication['B_F_DATE'];
  | 
        
        
            | 
            | 
           120 | 
           			$fascicule_titre = $publication['B_F_TITRE'];
  | 
        
        
            | 
            | 
           121 | 
           			// Table Article
  | 
        
        
            | 
            | 
           122 | 
           			$craifasc = $publication['B_A_CRAIFASC'];
  | 
        
        
            | 
            | 
           123 | 
           			$craiserie = $publication['B_A_CRAISERIE'];
  | 
        
        
            | 
            | 
           124 | 
           			$page_debut = $publication['B_A_PAGEDEBUT'];
  | 
        
        
            | 
            | 
           125 | 
           			$page_fin = $publication['B_A_PAGEFIN'];
  | 
        
        
            | 
            | 
           126 | 
           			// Table Structure
  | 
        
        
            | 
            | 
           127 | 
           			$nomstr =  $publication['B_S_NOM'];
  | 
        
        
            | 
            | 
           128 | 
              | 
        
        
            | 
            | 
           129 | 
           			// Formatage de la chaine de publication
  | 
        
        
            | 
            | 
           130 | 
           			$chainePublication = "";
  | 
        
        
            | 
            | 
           131 | 
           			if (isset($domaine_nom)) {
  | 
        
        
            | 
            | 
           132 | 
           				$chainePublication .= '<span class="texte_inactif">['.$domaine_nom.']</span>';
  | 
        
        
            | 
            | 
           133 | 
           			}
  | 
        
        
            | 
            | 
           134 | 
              | 
        
        
            | 
            | 
           135 | 
           			if (isset($auteurs)) {
  | 
        
        
            | 
            | 
           136 | 
           				$chainePublication .= $auteurs;
  | 
        
        
            | 
            | 
           137 | 
           			}
  | 
        
        
            | 
            | 
           138 | 
              | 
        
        
            | 
            | 
           139 | 
           			if (isset($titre)) {
  | 
        
        
            | 
            | 
           140 | 
           				$chainePublication .= " - <strong>$titre</strong>";
  | 
        
        
            | 
            | 
           141 | 
           			}
  | 
        
        
            | 
            | 
           142 | 
              | 
        
        
            | 
            | 
           143 | 
           			if (isset($date)) {
  | 
        
        
            | 
            | 
           144 | 
           				$chainePublication .= " - $date";
  | 
        
        
            | 
            | 
           145 | 
           			}
  | 
        
        
            | 
            | 
           146 | 
              | 
        
        
            | 
            | 
           147 | 
           			if (isset($mots_cles)) {
  | 
        
        
            | 
            | 
           148 | 
           				$chainePublication .= " - <em>$mots_cles</em>";
  | 
        
        
            | 
            | 
           149 | 
           			}
  | 
        
        
            | 
            | 
           150 | 
              | 
        
        
           | 630 | 
           delphine | 
           151 | 
           			if (isset($page_debut)) {
  | 
        
        
            | 
            | 
           152 | 
           				$chainePublication .= ", p. $page_debut";
  | 
        
        
            | 
            | 
           153 | 
           				if (isset($page_fin)) {
  | 
        
        
            | 
            | 
           154 | 
           					$chainePublication .= "- $page_fin";
  | 
        
        
            | 
            | 
           155 | 
           				}
  | 
        
        
           | 302 | 
           gduche | 
           156 | 
           			}
  | 
        
        
            | 
            | 
           157 | 
              | 
        
        
            | 
            | 
           158 | 
           			if (isset($geo)) {
  | 
        
        
            | 
            | 
           159 | 
           				$chainePublication .= " - Départ./Région : <em>$geo</em>";
  | 
        
        
            | 
            | 
           160 | 
           			}
  | 
        
        
            | 
            | 
           161 | 
              | 
        
        
            | 
            | 
           162 | 
           			if (isset($structure)) {
  | 
        
        
            | 
            | 
           163 | 
           				$chainePublication .= " - $structure";
  | 
        
        
            | 
            | 
           164 | 
           			}
  | 
        
        
            | 
            | 
           165 | 
              | 
        
        
           | 630 | 
           delphine | 
           166 | 
           			if (isset($coll_nom)) {
  | 
        
        
            | 
            | 
           167 | 
           				$chainePublication .= ", $coll_nom";
  | 
        
        
           | 302 | 
           gduche | 
           168 | 
           			}
  | 
        
        
            | 
            | 
           169 | 
              | 
        
        
           | 630 | 
           delphine | 
           170 | 
           			if (isset($craiserie)) {
  | 
        
        
            | 
            | 
           171 | 
           				$chainePublication .= ", $craiserie";
  | 
        
        
           | 302 | 
           gduche | 
           172 | 
           			}
  | 
        
        
            | 
            | 
           173 | 
              | 
        
        
            | 
            | 
           174 | 
           			if (isset($lien)) {
  | 
        
        
            | 
            | 
           175 | 
           				$chainePublication .= ", <a class=\"lien_ext\" href=\"$lien_url\">$fascicule_titre</a>";
  | 
        
        
            | 
            | 
           176 | 
           			} else {
  | 
        
        
            | 
            | 
           177 | 
           				$chainePublication .= ", $fascicule_titre";
  | 
        
        
            | 
            | 
           178 | 
           			}
  | 
        
        
            | 
            | 
           179 | 
              | 
        
        
            | 
            | 
           180 | 
           			if (isset($saisie_auteur)) {
  | 
        
        
            | 
            | 
           181 | 
           				$chainePublication .= " - <span class=\"texte_inactif\">Saisie : $saisie_auteur - Art. n°$article_id</span>";
  | 
        
        
            | 
            | 
           182 | 
           			}
  | 
        
        
            | 
            | 
           183 | 
              | 
        
        
            | 
            | 
           184 | 
           			$resultats[$id_a]['reference_html'] = $chainePublication;
  | 
        
        
            | 
            | 
           185 | 
           		}
  | 
        
        
            | 
            | 
           186 | 
              | 
        
        
            | 
            | 
           187 | 
           		$retour = array('entete' => $this->construireEntete(), 'resultats' => $resultats);
  | 
        
        
            | 
            | 
           188 | 
           		return $retour;
  | 
        
        
            | 
            | 
           189 | 
              | 
        
        
            | 
            | 
           190 | 
           	}
  | 
        
        
            | 
            | 
           191 | 
              | 
        
        
            | 
            | 
           192 | 
           	private function definirValeurParDefautDesParametres() {
  | 
        
        
            | 
            | 
           193 | 
           		if (isset($this->parametres['navigation.depart']) == false) {
  | 
        
        
            | 
            | 
           194 | 
           			$this->parametres['navigation.depart'] = 0;
  | 
        
        
            | 
            | 
           195 | 
           		}
  | 
        
        
            | 
            | 
           196 | 
           		if (isset($this->parametres['navigation.limite']) == false) {
  | 
        
        
            | 
            | 
           197 | 
           			$this->parametres['navigation.limite'] = 10;
  | 
        
        
            | 
            | 
           198 | 
           		}
  | 
        
        
            | 
            | 
           199 | 
           	}
  | 
        
        
            | 
            | 
           200 | 
              | 
        
        
            | 
            | 
           201 | 
           	private function verifierParametres() {
  | 
        
        
            | 
            | 
           202 | 
           		$erreurs = array();
  | 
        
        
            | 
            | 
           203 | 
              | 
        
        
            | 
            | 
           204 | 
           		if ($this->verifierValeurParametreNavigationDepart() == false) {
  | 
        
        
            | 
            | 
           205 | 
           			$erreurs[] = "Le paramètre 'navigation.depart' doit possèder un valeur numérique.";
  | 
        
        
            | 
            | 
           206 | 
           		}
  | 
        
        
            | 
            | 
           207 | 
              | 
        
        
            | 
            | 
           208 | 
           		if ($this->verifierValeurParametreNavigationLimite() == false) {
  | 
        
        
            | 
            | 
           209 | 
           			$erreurs[] = "Le paramètre 'navigation.limite' doit possèder un valeur numérique supérieure à 0.";
  | 
        
        
            | 
            | 
           210 | 
           		}
  | 
        
        
            | 
            | 
           211 | 
              | 
        
        
            | 
            | 
           212 | 
           		if (count($erreurs) > 0) {
  | 
        
        
            | 
            | 
           213 | 
           			$message = implode('<br />', $erreurs);
  | 
        
        
            | 
            | 
           214 | 
           			$code = RestServeur::HTTP_CODE_MAUVAISE_REQUETE;
  | 
        
        
            | 
            | 
           215 | 
           			throw new Exception($message, $code);
  | 
        
        
            | 
            | 
           216 | 
           		}
  | 
        
        
            | 
            | 
           217 | 
           	}
  | 
        
        
            | 
            | 
           218 | 
              | 
        
        
            | 
            | 
           219 | 
           	private function verifierValeurParametreNavigationDepart() {
  | 
        
        
            | 
            | 
           220 | 
           		$depart = $this->parametres['navigation.depart'];
  | 
        
        
            | 
            | 
           221 | 
           		$ok = is_numeric($depart) ? true : false;
  | 
        
        
            | 
            | 
           222 | 
           		return $ok;
  | 
        
        
            | 
            | 
           223 | 
           	}
  | 
        
        
            | 
            | 
           224 | 
              | 
        
        
            | 
            | 
           225 | 
           	private function verifierValeurParametreNavigationLimite() {
  | 
        
        
            | 
            | 
           226 | 
           		$limite = $this->parametres['navigation.limite'];
  | 
        
        
            | 
            | 
           227 | 
           		$ok = (is_numeric($limite) && $limite != 0) ? true : false;
  | 
        
        
            | 
            | 
           228 | 
           		return $ok;
  | 
        
        
            | 
            | 
           229 | 
           	}
  | 
        
        
            | 
            | 
           230 | 
              | 
        
        
            | 
            | 
           231 | 
           	private function recupererParametresMasque() {
  | 
        
        
            | 
            | 
           232 | 
           		if (isset($this->parametres['masque.taxon'])) {
  | 
        
        
            | 
            | 
           233 | 
           			$this->masque_taxon = $this->parametres['masque.taxon'];
  | 
        
        
            | 
            | 
           234 | 
           		} else {
  | 
        
        
            | 
            | 
           235 | 
           			$this->masque_taxon = "";
  | 
        
        
            | 
            | 
           236 | 
           		}
  | 
        
        
            | 
            | 
           237 | 
           	}
  | 
        
        
            | 
            | 
           238 | 
              | 
        
        
            | 
            | 
           239 | 
           	private function chargerNbrePublicationsTotal() {
  | 
        
        
            | 
            | 
           240 | 
           		$tab_mots = preg_split('~ ~', $this->masque_taxon, -1, PREG_SPLIT_NO_EMPTY);
  | 
        
        
            | 
            | 
           241 | 
           		$requete = 'SELECT COUNT(B_I_IDITEM) AS nbre '.
  | 
        
        
            | 
            | 
           242 | 
           				'FROM biblio_item '.
  | 
        
        
            | 
            | 
           243 | 
           				'	LEFT JOIN biblio_aut_saisie ON (b_i_auteursaisie = b_as_id) '.
  | 
        
        
            | 
            | 
           244 | 
           				'	LEFT JOIN biblio_article ON (b_i_iditem = b_a_idart) '.
  | 
        
        
            | 
            | 
           245 | 
           				'	LEFT JOIN biblio_fasc ON '.
  | 
        
        
            | 
            | 
           246 | 
           				'		(B_F_CRAICOLL = B_A_CRAICOLL '.
  | 
        
        
            | 
            | 
           247 | 
           				'		AND B_F_CRAISERIE = B_A_CRAISERIE '.
  | 
        
        
            | 
            | 
           248 | 
           				'		AND B_F_NUMERO = B_A_CRAIFASC)' .
  | 
        
        
            | 
            | 
           249 | 
           				'	LEFT JOIN biblio_serie ON ' .
  | 
        
        
            | 
            | 
           250 | 
           				'		(b_f_craicoll = b_ser_craicoll ' .
  | 
        
        
            | 
            | 
           251 | 
           				'		AND b_f_craiserie = b_ser_idserie) '.
  | 
        
        
            | 
            | 
           252 | 
           				'	LEFT JOIN biblio_collection ON (b_ser_craicoll = b_c_crai) '.
  | 
        
        
            | 
            | 
           253 | 
           				'	LEFT JOIN biblio_str ON (B_C_LKSTR = B_S_IDSTR) '.
  | 
        
        
            | 
            | 
           254 | 
           				'	LEFT JOIN biblio_domaine_lier ON (b_i_iditem = b_dl_iditem) ' .
  | 
        
        
            | 
            | 
           255 | 
           				'	LEFT JOIN biblio_domaine ON (b_dl_iddom = b_d_id) ' .
  | 
        
        
            | 
            | 
           256 | 
           				'	LEFT JOIN biblio_item_typphy ON (b_i_typphy = b_ip_id) ' .
  | 
        
        
            | 
            | 
           257 | 
           				'	LEFT JOIN biblio_item_typlog ON (b_i_typlog = b_il_id) ' .
  | 
        
        
            | 
            | 
           258 | 
           				'	WHERE B_I_TYPLOG = 1 AND B_I_TYPPHY = 2  AND B_I_CACHER = 0 '.
  | 
        
        
            | 
            | 
           259 | 
           				'	AND B_D_ID = 1 ';
  | 
        
        
            | 
            | 
           260 | 
           		foreach ($tab_mots as $mot) {
  | 
        
        
            | 
            | 
           261 | 
           			$requete .= "	AND (B_I_TITRE LIKE '%$mot%' ".
  | 
        
        
            | 
            | 
           262 | 
           							"		OR B_I_RESUMCLE LIKE '%$mot%' ".
  | 
        
        
            | 
            | 
           263 | 
           							"		OR B_I_COMMENT LIKE '%$mot%') ";
  | 
        
        
            | 
            | 
           264 | 
           		}
  | 
        
        
            | 
            | 
           265 | 
           		$resultats = $this->Bdd->recuperer($requete);
  | 
        
        
            | 
            | 
           266 | 
           		$this->nbrePublications = (int) $resultats['nbre'];
  | 
        
        
            | 
            | 
           267 | 
           	}
  | 
        
        
            | 
            | 
           268 | 
              | 
        
        
            | 
            | 
           269 | 
           	private function construireEntete() {
  | 
        
        
            | 
            | 
           270 | 
           		$entete = array('masque' => '', 'depart' => 0, 'limite' => 10, 'total' => 0);
  | 
        
        
            | 
            | 
           271 | 
              | 
        
        
            | 
            | 
           272 | 
           		$entete['masque'] = $this->recupererMasque();
  | 
        
        
            | 
            | 
           273 | 
           		$entete['depart'] = (int) $this->parametres['navigation.depart'];
  | 
        
        
            | 
            | 
           274 | 
           		$entete['limite'] = (int) $this->parametres['navigation.limite'];
  | 
        
        
            | 
            | 
           275 | 
           		$entete['total'] = $this->nbrePublications;
  | 
        
        
            | 
            | 
           276 | 
           		if ($hrefPrecedent = $this->recupererHrefPrecedent()) {
  | 
        
        
            | 
            | 
           277 | 
           			$entete['href.precedent'] = $hrefPrecedent;
  | 
        
        
            | 
            | 
           278 | 
           		}
  | 
        
        
            | 
            | 
           279 | 
           		if ($hrefSuivant = $this->recupererHrefSuivant()) {
  | 
        
        
            | 
            | 
           280 | 
           			$entete['href.suivant'] = $hrefSuivant;
  | 
        
        
            | 
            | 
           281 | 
           		}
  | 
        
        
            | 
            | 
           282 | 
              | 
        
        
            | 
            | 
           283 | 
           		return $entete;
  | 
        
        
            | 
            | 
           284 | 
           	}
  | 
        
        
            | 
            | 
           285 | 
              | 
        
        
            | 
            | 
           286 | 
           	private function recupererMasque() {
  | 
        
        
            | 
            | 
           287 | 
           		$masqueEntete = '';
  | 
        
        
            | 
            | 
           288 | 
           		if ($this->masque_taxon) {
  | 
        
        
            | 
            | 
           289 | 
           			$masqueEntete = "masque.taxon=$this->masque_taxon";
  | 
        
        
            | 
            | 
           290 | 
           		}
  | 
        
        
            | 
            | 
           291 | 
           		return $masqueEntete;
  | 
        
        
            | 
            | 
           292 | 
           	}
  | 
        
        
            | 
            | 
           293 | 
              | 
        
        
            | 
            | 
           294 | 
           	private function recupererHrefPrecedent() {
  | 
        
        
            | 
            | 
           295 | 
           		$departActuel = $this->parametres['navigation.depart'];
  | 
        
        
            | 
            | 
           296 | 
           		$limite = $this->parametres['navigation.limite'];
  | 
        
        
            | 
            | 
           297 | 
           		$departPrecedent = $departActuel - $limite;
  | 
        
        
            | 
            | 
           298 | 
           		$url = null;
  | 
        
        
            | 
            | 
           299 | 
           		if ($departPrecedent >= 0) {
  | 
        
        
            | 
            | 
           300 | 
           			$url = $this->obtenirUrlNavigation($departPrecedent, $limite, array('masque.taxon' => $this->masque_taxon));
  | 
        
        
            | 
            | 
           301 | 
           		}
  | 
        
        
            | 
            | 
           302 | 
           		return $url;
  | 
        
        
            | 
            | 
           303 | 
           	}
  | 
        
        
            | 
            | 
           304 | 
              | 
        
        
            | 
            | 
           305 | 
           	private function recupererHrefSuivant() {
  | 
        
        
            | 
            | 
           306 | 
           		$departActuel = $this->parametres['navigation.depart'];
  | 
        
        
            | 
            | 
           307 | 
           		$limite = $this->parametres['navigation.limite'];
  | 
        
        
            | 
            | 
           308 | 
           		$departSuivant = $departActuel + $limite;
  | 
        
        
            | 
            | 
           309 | 
              | 
        
        
            | 
            | 
           310 | 
           		$url = null;
  | 
        
        
            | 
            | 
           311 | 
           		if ($departSuivant < $this->nbrePublications) {
  | 
        
        
            | 
            | 
           312 | 
           			$url = $this->obtenirUrlNavigation($departSuivant, $limite, array('masque.taxon' => $this->masque_taxon));
  | 
        
        
            | 
            | 
           313 | 
           		}
  | 
        
        
            | 
            | 
           314 | 
           		return $url;
  | 
        
        
            | 
            | 
           315 | 
           	}
  | 
        
        
            | 
            | 
           316 | 
              | 
        
        
            | 
            | 
           317 | 
           	private function obtenirUrlNavigation($depart, $limite, $parametresAdditionnels) {
  | 
        
        
            | 
            | 
           318 | 
           		$parametres = array(
  | 
        
        
            | 
            | 
           319 | 
           			'navigation.depart' => $depart,
  | 
        
        
            | 
            | 
           320 | 
           			'navigation.limite' => $limite);
  | 
        
        
            | 
            | 
           321 | 
              | 
        
        
            | 
            | 
           322 | 
           		if ($parametresAdditionnels != null) {
  | 
        
        
            | 
            | 
           323 | 
           			$parametres = array_merge($parametres, $parametresAdditionnels);
  | 
        
        
            | 
            | 
           324 | 
           		}
  | 
        
        
            | 
            | 
           325 | 
           		$this->UrlNavigation->setRequete($parametres);
  | 
        
        
            | 
            | 
           326 | 
           		$url = $this->UrlNavigation->getURL();
  | 
        
        
            | 
            | 
           327 | 
           		return $url;
  | 
        
        
            | 
            | 
           328 | 
           	}
  | 
        
        
            | 
            | 
           329 | 
           }
  | 
        
        
            | 
            | 
           330 | 
           ?>
  |