2097 |
drzraf |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 4.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This file is part of Papyrus. |
|
|
|
9 |
// | |
|
|
|
10 |
// | Foobar is free software; you can redistribute it and/or modify |
|
|
|
11 |
// | it under the terms of the GNU General Public License as published by |
|
|
|
12 |
// | the Free Software Foundation; either version 2 of the License, or |
|
|
|
13 |
// | (at your option) any later version. |
|
|
|
14 |
// | |
|
|
|
15 |
// | Foobar is distributed in the hope that it will be useful, |
|
|
|
16 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
17 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
|
18 |
// | GNU General Public License for more details. |
|
|
|
19 |
// | |
|
|
|
20 |
// | You should have received a copy of the GNU General Public License |
|
|
|
21 |
// | along with Foobar; if not, write to the Free Software |
|
|
|
22 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
23 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
24 |
// CVS : $Id: more_recherche_papyrus_menu.class.php,v 1.14 2008-08-08 16:04:41 jp_milcent Exp $
|
|
|
25 |
/**
|
|
|
26 |
* Classe permettant d'effectuer des recherches sur les fiches de bazar.
|
|
|
27 |
*
|
|
|
28 |
*
|
|
|
29 |
*@package Applette
|
|
|
30 |
*@subpackage Moteur_Recherche
|
|
|
31 |
//Auteur original :
|
|
|
32 |
*@author Aurélien Peronnet <aurelien@tela-botanica.org>
|
|
|
33 |
//Autres auteurs :
|
|
|
34 |
*@author aucun
|
|
|
35 |
*@copyright Tela-Botanica 2000-2004
|
|
|
36 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
37 |
*/
|
|
|
38 |
|
|
|
39 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
40 |
// | ENTETE du PROGRAMME |
|
|
|
41 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
42 |
|
|
|
43 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
44 |
// | CORPS du PROGRAMME |
|
|
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
46 |
|
|
|
47 |
class More_Recherche_Bazar extends More_Recherche{
|
|
|
48 |
|
|
|
49 |
// Constructeur
|
|
|
50 |
function Recherche_Menu_Meta($motif) {
|
|
|
51 |
$this->setMotif($motif);
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
// Accesseurs
|
|
|
55 |
function getMotif() {
|
|
|
56 |
return $this->motif;
|
|
|
57 |
}
|
|
|
58 |
function setMotif($motif) {
|
|
|
59 |
$this->motif = $motif;
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
// Méthodes
|
|
|
63 |
function rechercherMotif($motif) {
|
|
|
64 |
|
|
|
65 |
foreach ($GLOBALS['_MOTEUR_RECHERCHE_']['bazar'] as $bazar) {
|
|
|
66 |
$db = DB::connect($bazar['bdd_dsn']);
|
|
|
67 |
$requete = 'SELECT bf_id_fiche, bf_description, bf_titre '.
|
|
|
68 |
'FROM bazar_fiche ';
|
|
|
69 |
|
|
|
70 |
$resultat = $db->query($requete) ;
|
|
|
71 |
if (DB::isError($resultat)) {
|
|
|
72 |
return ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
$nb_fiches = $resultat->numRows();
|
|
|
76 |
$aso_resultat = array();
|
|
|
77 |
|
|
|
78 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
|
|
79 |
|
|
|
80 |
$aso_ligne = array('poids' => 0, 'url' => '', 'titre' => '',
|
|
|
81 |
'hreflang' => '', 'accesskey' => '', 'title' => '',
|
|
|
82 |
'date_creation' => '', 'description' => '',
|
|
|
83 |
'url_simple' => '');
|
|
|
84 |
|
|
|
85 |
$aso_ligne['poids'] += $this->retournerOccurenceMotif($motif, $ligne['bf_titre']);
|
|
|
86 |
$aso_ligne['poids'] += $this->retournerOccurenceMotif($motif, $ligne['bf_description']);
|
|
|
87 |
|
|
|
88 |
if ($aso_ligne['poids'] != 0) {
|
|
|
89 |
|
|
|
90 |
$aso_ligne['url'] = sprintf($bazar['url'],$ligne['bf_id_fiche']);
|
|
|
91 |
$aso_ligne['url_simple'] = $aso_ligne['url'] ;
|
|
|
92 |
$aso_ligne['titre'] = htmlentities($ligne['bf_titre']);
|
2104 |
drzraf |
93 |
$aso_ligne['description'] = htmlentities(More_Recherche::couperTexte($ligne['bf_description'], MORE_RESULTAT_TAILLE_DESCRIPTION));
|
2097 |
drzraf |
94 |
$aso_resultat[] = $aso_ligne;
|
|
|
95 |
}
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
return $aso_resultat;
|
|
|
99 |
}
|
|
|
100 |
}
|
|
|
101 |
}
|
|
|
102 |
|
1933 |
aperonnet |
103 |
?>
|