1 |
<?php
|
1 |
<?php
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
4 |
// | PHP version 4.1 |
|
4 |
// | PHP version 4.1 |
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
8 |
// | This library is free software; you can redistribute it and/or |
|
8 |
// | This library is free software; you can redistribute it and/or |
|
9 |
// | modify it under the terms of the GNU Lesser General Public |
|
9 |
// | modify it under the terms of the GNU Lesser General Public |
|
10 |
// | License as published by the Free Software Foundation; either |
|
10 |
// | License as published by the Free Software Foundation; either |
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
12 |
// | |
|
12 |
// | |
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 |
// | Lesser General Public License for more details. |
|
16 |
// | Lesser General Public License for more details. |
|
17 |
// | |
|
17 |
// | |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
22 |
// CVS : $Id: bazar.fonct.rss.php,v 1.51 2006-05-23 15:41:27 alexandre_tb Exp $
|
22 |
// CVS : $Id: bazar.fonct.rss.php,v 1.52 2006-06-02 09:29:07 florian Exp $
|
23 |
/**
|
23 |
/**
|
24 |
*
|
24 |
*
|
25 |
*@package bazar
|
25 |
*@package bazar
|
26 |
//Auteur original :
|
26 |
//Auteur original :
|
27 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
27 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
28 |
*@author Florian Schmitt <florian@ecole-et-nature.org>
|
28 |
*@author Florian Schmitt <florian@ecole-et-nature.org>
|
29 |
//Autres auteurs :
|
29 |
//Autres auteurs :
|
30 |
*@copyright Tela-Botanica 2000-2006
|
30 |
*@copyright Tela-Botanica 2000-2006
|
31 |
*@version $Revision: 1.51 $
|
31 |
*@version $Revision: 1.52 $
|
32 |
// +------------------------------------------------------------------------------------------------------+
|
32 |
// +------------------------------------------------------------------------------------------------------+
|
33 |
*/
|
33 |
*/
|
34 |
|
34 |
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
36 |
// | ENTETE du PROGRAMME |
|
36 |
// | ENTETE du PROGRAMME |
|
37 |
// +------------------------------------------------------------------------------------------------------+
|
37 |
// +------------------------------------------------------------------------------------------------------+
|
38 |
|
38 |
|
39 |
require_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.class.php';
|
39 |
require_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.class.php';
|
40 |
require_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.fonct.php';
|
40 |
require_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.fonct.php';
|
41 |
|
41 |
|
42 |
|
42 |
|
43 |
/** baz_valeur_template() - Renvoi des valeurs inscrite dans le fichier de template
|
43 |
/** baz_valeur_template() - Renvoi des valeurs inscrite dans le fichier de template
|
44 |
*
|
44 |
*
|
45 |
* @param string valeur du template de bazar_nature
|
45 |
* @param string valeur du template de bazar_nature
|
46 |
*
|
46 |
*
|
47 |
* @return mixed tableau contenant les champs du fichier template
|
47 |
* @return mixed tableau contenant les champs du fichier template
|
48 |
*/
|
48 |
*/
|
49 |
function baz_valeurs_template($valeur_template) {
|
49 |
function baz_valeurs_template($valeur_template) {
|
50 |
//Parcours du fichier de templates, pour mettre les champs spécifiques
|
50 |
//Parcours du fichier de templates, pour mettre les champs spécifiques
|
51 |
$tableau= array();
|
51 |
$tableau= array();
|
52 |
$nblignes=0;
|
52 |
$nblignes=0;
|
53 |
$chaine = explode ("\n", $valeur_template);
|
53 |
$chaine = explode ("\n", $valeur_template);
|
54 |
array_pop($chaine);
|
54 |
array_pop($chaine);
|
55 |
foreach ($chaine as $ligne) {
|
55 |
foreach ($chaine as $ligne) {
|
56 |
$souschaine = explode ("***", $ligne) ;
|
56 |
$souschaine = explode ("***", $ligne) ;
|
57 |
$tableau[$nblignes]['type'] = trim($souschaine[0]) ;
|
57 |
$tableau[$nblignes]['type'] = trim($souschaine[0]) ;
|
58 |
if (isset($souschaine[1])) {$tableau[$nblignes]['nom_bdd'] = trim($souschaine[1]);}
|
58 |
if (isset($souschaine[1])) {$tableau[$nblignes]['nom_bdd'] = trim($souschaine[1]);}
|
59 |
else {$tableau[$nblignes]['nom_bdd'] ='';}
|
59 |
else {$tableau[$nblignes]['nom_bdd'] ='';}
|
60 |
if (isset($souschaine[2])) $tableau[$nblignes]['label'] = trim($souschaine[2]);
|
60 |
if (isset($souschaine[2])) $tableau[$nblignes]['label'] = trim($souschaine[2]);
|
61 |
else {$tableau[$nblignes]['label'] ='';}
|
61 |
else {$tableau[$nblignes]['label'] ='';}
|
62 |
if (isset($souschaine[3])) $tableau[$nblignes]['limite1'] = trim($souschaine[3]);
|
62 |
if (isset($souschaine[3])) $tableau[$nblignes]['limite1'] = trim($souschaine[3]);
|
63 |
else {$tableau[$nblignes]['limite1'] ='';}
|
63 |
else {$tableau[$nblignes]['limite1'] ='';}
|
64 |
if (isset($souschaine[4])) $tableau[$nblignes]['limite2'] = trim($souschaine[4]);
|
64 |
if (isset($souschaine[4])) $tableau[$nblignes]['limite2'] = trim($souschaine[4]);
|
65 |
else {$tableau[$nblignes]['limite2'] ='';}
|
65 |
else {$tableau[$nblignes]['limite2'] ='';}
|
66 |
if (isset($souschaine[5])) $tableau[$nblignes]['defaut'] = trim($souschaine[5]);
|
66 |
if (isset($souschaine[5])) $tableau[$nblignes]['defaut'] = trim($souschaine[5]);
|
67 |
else {$tableau[$nblignes]['defaut'] ='';}
|
67 |
else {$tableau[$nblignes]['defaut'] ='';}
|
68 |
if (isset($souschaine[6])) $tableau[$nblignes]['table_source'] = trim($souschaine[6]);
|
68 |
if (isset($souschaine[6])) $tableau[$nblignes]['table_source'] = trim($souschaine[6]);
|
69 |
else {$tableau[$nblignes]['table_source'] ='';}
|
69 |
else {$tableau[$nblignes]['table_source'] ='';}
|
70 |
if (isset($souschaine[7])) $tableau[$nblignes]['id_source'] = trim($souschaine[7]);
|
70 |
if (isset($souschaine[7])) $tableau[$nblignes]['id_source'] = trim($souschaine[7]);
|
71 |
else {$tableau[$nblignes]['id_source'] ='';}
|
71 |
else {$tableau[$nblignes]['id_source'] ='';}
|
72 |
if (isset($souschaine[8])) $tableau[$nblignes]['obligatoire'] = trim($souschaine[8]);
|
72 |
if (isset($souschaine[8])) $tableau[$nblignes]['obligatoire'] = trim($souschaine[8]);
|
73 |
else {$tableau[$nblignes]['obligatoire'] ='';}
|
73 |
else {$tableau[$nblignes]['obligatoire'] ='';}
|
74 |
if (isset($souschaine[9])) $tableau[$nblignes]['recherche'] = trim($souschaine[9]);
|
74 |
if (isset($souschaine[9])) $tableau[$nblignes]['recherche'] = trim($souschaine[9]);
|
75 |
else {$tableau[$nblignes]['recherche'] ='';}
|
75 |
else {$tableau[$nblignes]['recherche'] ='';}
|
76 |
|
76 |
|
77 |
|
77 |
|
78 |
// traitement des cases à cocher, dans ce cas la, on a une table de jointure entre la table
|
78 |
// traitement des cases à cocher, dans ce cas la, on a une table de jointure entre la table
|
79 |
// de liste et la table bazar_fiche (elle porte un nom du genre bazar_ont_***)
|
79 |
// de liste et la table bazar_fiche (elle porte un nom du genre bazar_ont_***)
|
80 |
// dans le template, à la place d'un nom de champs dans 'nom_bdd', on a un nom de table
|
80 |
// dans le template, à la place d'un nom de champs dans 'nom_bdd', on a un nom de table
|
81 |
// et 2 noms de champs séparés par un virgule ex : bazar_ont_theme,bot_id_theme,bot_id_fiche
|
81 |
// et 2 noms de champs séparés par un virgule ex : bazar_ont_theme,bot_id_theme,bot_id_fiche
|
82 |
|
82 |
|
83 |
if (isset($tableau[$nblignes]['nom_bdd']) && preg_match('/,/', $tableau[$nblignes]['nom_bdd'])) {
|
83 |
if (isset($tableau[$nblignes]['nom_bdd']) && preg_match('/,/', $tableau[$nblignes]['nom_bdd'])) {
|
84 |
$tableau_info_jointe = explode (',', $tableau[$nblignes]['nom_bdd']) ;
|
84 |
$tableau_info_jointe = explode (',', $tableau[$nblignes]['nom_bdd']) ;
|
85 |
$tableau[$nblignes]['table_jointe'] = $tableau_info_jointe[0] ;
|
85 |
$tableau[$nblignes]['table_jointe'] = $tableau_info_jointe[0] ;
|
86 |
$tableau[$nblignes]['champs_id_fiche'] = $tableau_info_jointe[1] ;
|
86 |
$tableau[$nblignes]['champs_id_fiche'] = $tableau_info_jointe[1] ;
|
87 |
$tableau[$nblignes]['champs_id_table_jointe'] = $tableau_info_jointe[2] ;
|
87 |
$tableau[$nblignes]['champs_id_table_jointe'] = $tableau_info_jointe[2] ;
|
88 |
}
|
88 |
}
|
89 |
$nblignes++;
|
89 |
$nblignes++;
|
90 |
}
|
90 |
}
|
91 |
return $tableau;
|
91 |
return $tableau;
|
92 |
}
|
92 |
}
|
93 |
|
93 |
|
94 |
/** baz_voir_fiches() - Permet de visualiser en detail une liste de fiche au format XHTML
|
94 |
/** baz_voir_fiches() - Permet de visualiser en detail une liste de fiche au format XHTML
|
95 |
*
|
95 |
*
|
96 |
* @global boolean Rajoute des informations internes à l'application (date de modification, lien vers la page de départ de l'appli)
|
96 |
* @global boolean Rajoute des informations internes à l'application (date de modification, lien vers la page de départ de l'appli)
|
97 |
* @global integer Tableau d(Identifiant des fiches à afficher
|
97 |
* @global integer Tableau d(Identifiant des fiches à afficher
|
98 |
*
|
98 |
*
|
99 |
* @return string HTML
|
99 |
* @return string HTML
|
100 |
*/
|
100 |
*/
|
101 |
function baz_voir_fiches($danslappli, $idfiches=array()) {
|
101 |
function baz_voir_fiches($danslappli, $idfiches=array()) {
|
102 |
$res='';
|
102 |
$res='';
|
103 |
foreach($idfiches as $idfiche) {
|
103 |
foreach($idfiches as $idfiche) {
|
104 |
$res.=baz_voir_fiche($danslappli, $idfiche);
|
104 |
$res.=baz_voir_fiche($danslappli, $idfiche);
|
105 |
}
|
105 |
}
|
106 |
return $res;
|
106 |
return $res;
|
107 |
}
|
107 |
}
|
108 |
|
108 |
|
109 |
|
109 |
|
110 |
/** baz_voir_fiche() - Permet de visualiser en detail une fiche au format XHTML
|
110 |
/** baz_voir_fiche() - Permet de visualiser en detail une fiche au format XHTML
|
111 |
*
|
111 |
*
|
112 |
* @global boolean Rajoute des informations internes a l'application (date de modification, lien vers la page de départ de l'appli) si a 1
|
112 |
* @global boolean Rajoute des informations internes a l'application (date de modification, lien vers la page de départ de l'appli) si a 1
|
113 |
* @global integer Identifiant de la fiche a afficher
|
113 |
* @global integer Identifiant de la fiche a afficher
|
114 |
*
|
114 |
*
|
115 |
* @return string HTML
|
115 |
* @return string HTML
|
116 |
*/
|
116 |
*/
|
117 |
function baz_voir_fiche($danslappli, $idfiche='') {
|
117 |
function baz_voir_fiche($danslappli, $idfiche='') {
|
118 |
$res='';
|
118 |
$res='';
|
119 |
if (isset($_GET['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_GET['id_fiche'];
|
119 |
if (isset($_GET['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_GET['id_fiche'];
|
120 |
if ($idfiche!='') $GLOBALS['_BAZAR_']['id_fiche']=$idfiche;
|
120 |
if ($idfiche!='') $GLOBALS['_BAZAR_']['id_fiche']=$idfiche;
|
121 |
$url= $GLOBALS['_BAZAR_']['url'];
|
121 |
$url= $GLOBALS['_BAZAR_']['url'];
|
122 |
$url->addQueryString('action', BAZ_VOIR_FICHE);
|
122 |
$url->addQueryString('action', BAZ_VOIR_FICHE);
|
123 |
$url->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
|
123 |
$url->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
|
124 |
$url = preg_replace ('/&/', '&', $url->getURL()) ;
|
124 |
$url = preg_replace ('/&/', '&', $url->getURL()) ;
|
125 |
|
125 |
|
126 |
//cas ou la fiche a été validee
|
126 |
//cas ou la fiche a été validee
|
127 |
if (isset($_GET['publiee'])) {
|
127 |
if (isset($_GET['publiee'])) {
|
128 |
publier_fiche($_GET['publiee']);
|
128 |
publier_fiche($_GET['publiee']);
|
129 |
}
|
129 |
}
|
130 |
|
130 |
|
131 |
//cas on une structure s'approprie une ressource
|
131 |
//cas on une structure s'approprie une ressource
|
132 |
if (isset($_GET['appropriation'])) {
|
132 |
if (isset($_GET['appropriation'])) {
|
133 |
if ($_GET['appropriation']==1) {
|
133 |
if ($_GET['appropriation']==1) {
|
134 |
$requete = 'INSERT INTO bazar_appropriation VALUES ('.$GLOBALS['_BAZAR_']['id_fiche'].', '.$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID).')';
|
134 |
$requete = 'INSERT INTO bazar_appropriation VALUES ('.$GLOBALS['_BAZAR_']['id_fiche'].', '.$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID).')';
|
135 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
135 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
136 |
}
|
136 |
}
|
137 |
elseif ($_GET['appropriation']==0) {
|
137 |
elseif ($_GET['appropriation']==0) {
|
138 |
$requete = 'DELETE FROM bazar_appropriation WHERE ba_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' AND ba_ce_id_structure='.$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID);
|
138 |
$requete = 'DELETE FROM bazar_appropriation WHERE ba_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' AND ba_ce_id_structure='.$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID);
|
139 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
139 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
140 |
}
|
140 |
}
|
141 |
}
|
141 |
}
|
142 |
|
142 |
|
143 |
//cas ou un commentaire a été entre
|
143 |
//cas ou un commentaire a été entre
|
144 |
if (isset($_POST['Nom'])) {
|
144 |
if (isset($_POST['Nom'])) {
|
145 |
$requete = 'INSERT INTO bazar_commentaires VALUES ('.
|
145 |
$requete = 'INSERT INTO bazar_commentaires VALUES ('.
|
146 |
baz_nextid('bazar_commentaires', 'bc_id_commentaire', $GLOBALS['_BAZAR_']['db']).
|
146 |
baz_nextid('bazar_commentaires', 'bc_id_commentaire', $GLOBALS['_BAZAR_']['db']).
|
147 |
', '.$GLOBALS['_BAZAR_']['id_fiche'].', "'.$_POST['Nom'].'", "'.$_POST['Commentaire'].
|
147 |
', '.$GLOBALS['_BAZAR_']['id_fiche'].', "'.$_POST['Nom'].'", "'.$_POST['Commentaire'].
|
148 |
'", NOW() )';
|
148 |
'", NOW() )';
|
149 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
149 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
150 |
}
|
150 |
}
|
151 |
//cas ou un commentaire va etre supprime
|
151 |
//cas ou un commentaire va etre supprime
|
152 |
elseif (isset($_GET['id_commentaire'])) {
|
152 |
elseif (isset($_GET['id_commentaire'])) {
|
153 |
$requete = 'DELETE FROM bazar_commentaires WHERE bc_id_commentaire='.$_GET['id_commentaire'].' LIMIT 1';
|
153 |
$requete = 'DELETE FROM bazar_commentaires WHERE bc_id_commentaire='.$_GET['id_commentaire'].' LIMIT 1';
|
154 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
154 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
155 |
}
|
155 |
}
|
156 |
else {
|
156 |
else {
|
157 |
if (isset($_GET['action'])) {
|
157 |
if (isset($_GET['action'])) {
|
158 |
if ($_GET['action']==BAZ_VOIR_FICHE) {
|
158 |
if ($_GET['action']==BAZ_VOIR_FICHE) {
|
159 |
//sinon on met a jour le nb de visites pour la fiche, puisque c'est une simple consultation
|
159 |
//sinon on met a jour le nb de visites pour la fiche, puisque c'est une simple consultation
|
160 |
$requete = 'UPDATE bazar_fiche SET bf_nb_consultations=bf_nb_consultations+1 WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
|
160 |
$requete = 'UPDATE bazar_fiche SET bf_nb_consultations=bf_nb_consultations+1 WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
|
161 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
161 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
162 |
}
|
162 |
}
|
163 |
}
|
163 |
}
|
164 |
}
|
164 |
}
|
165 |
|
165 |
|
166 |
//on verifie si l'utilisateur est administrateur
|
166 |
//on verifie si l'utilisateur est administrateur
|
167 |
$est_admin=0;
|
167 |
$est_admin=0;
|
168 |
if ($GLOBALS['AUTH']->getAuth()) {
|
168 |
if ($GLOBALS['AUTH']->getAuth()) {
|
169 |
$requete='SELECT bn_id_nature FROM bazar_nature WHERE bn_label_nature="'.$GLOBALS['_BAZAR_']['typeannonce'].'"';
|
169 |
$requete='SELECT bn_id_nature FROM bazar_nature WHERE bn_label_nature="'.$GLOBALS['_BAZAR_']['typeannonce'].'"';
|
170 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
170 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
171 |
if (DB::isError($resultat)) {
|
171 |
if (DB::isError($resultat)) {
|
172 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
172 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
173 |
}
|
173 |
}
|
174 |
$result = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
174 |
$result = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
175 |
$id_nature = $result['bn_id_nature'];
|
175 |
$id_nature = $result['bn_id_nature'];
|
176 |
if ((niveau_droit($result['bn_id_nature'],$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='administrateur')
|
176 |
if ((niveau_droit($result['bn_id_nature'],$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='administrateur')
|
177 |
or(niveau_droit('0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur'))
|
177 |
or(niveau_droit('0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur'))
|
178 |
{
|
178 |
{
|
179 |
$est_admin=1;
|
179 |
$est_admin=1;
|
180 |
}
|
180 |
}
|
181 |
}
|
181 |
}
|
182 |
//affiche le titre sous forme d'image
|
182 |
//affiche le titre sous forme d'image
|
183 |
if (isset ($GLOBALS['_BAZAR_']['image_titre']) && $GLOBALS['_BAZAR_']['image_titre']!='') {
|
183 |
if (isset ($GLOBALS['_BAZAR_']['image_titre']) && $GLOBALS['_BAZAR_']['image_titre']!='') {
|
184 |
$res .= '<img id="BAZ_img_titre" src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_titre'].'" alt="'.$GLOBALS['_BAZAR_']['typeannonce'].'" />'.'<br />'."\n";
|
184 |
$res .= '<img id="BAZ_img_titre" src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_titre'].'" alt="'.$GLOBALS['_BAZAR_']['typeannonce'].'" />'.'<br />'."\n";
|
185 |
}
|
185 |
}
|
186 |
//affiche le texte sinon
|
186 |
//affiche le texte sinon
|
187 |
else {
|
187 |
else {
|
188 |
$res .= '<h2 class="BAZ_titre">'.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
|
188 |
$res .= '<h2 class="BAZ_titre">'.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
|
189 |
}
|
189 |
}
|
190 |
$res .= '<div class="BAZ_cadre_fiche">'."\n";
|
190 |
$res .= '<div class="BAZ_cadre_fiche">'."\n";
|
191 |
$requete = 'SELECT * FROM bazar_fiche WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
|
191 |
$requete = 'SELECT * FROM bazar_fiche WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
|
192 |
|
192 |
|
193 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
193 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
194 |
(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete))
|
194 |
(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete))
|
195 |
: '';
|
195 |
: '';
|
196 |
|
196 |
|
197 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
|
197 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
|
198 |
$GLOBALS['_BAZAR_']['annonceur'] = $ligne['bf_ce_utilisateur'] ;
|
198 |
$GLOBALS['_BAZAR_']['annonceur'] = $ligne['bf_ce_utilisateur'] ;
|
199 |
//si le template existe, on genere le template
|
199 |
//si le template existe, on genere le template
|
200 |
if ((file_exists(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php'))) {
|
200 |
if ((file_exists(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php'))) {
|
201 |
include_once(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php');
|
201 |
include_once(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php');
|
202 |
$res .=genere_fiche($ligne);
|
202 |
$res .=genere_fiche($ligne);
|
203 |
}
|
203 |
}
|
204 |
//on affiche ligne par ligne sinon
|
204 |
//on affiche ligne par ligne sinon
|
205 |
else {
|
205 |
else {
|
206 |
//cas d'une image personalisée
|
206 |
//cas d'une image personalisée
|
207 |
if (isset($ligne['bf_url_image'])) {
|
207 |
if (isset($ligne['bf_url_image'])) {
|
208 |
$res .= '<div id="fiche_image">'."\n";
|
208 |
$res .= '<div id="fiche_image">'."\n";
|
209 |
$res .= '<img src="client/bazar/upload/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" width="130" height="130" />'."\n";
|
209 |
$res .= '<img src="client/bazar/upload/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" width="130" height="130" />'."\n";
|
210 |
$res .= '</div>'."\n";
|
210 |
$res .= '</div>'."\n";
|
211 |
}
|
211 |
}
|
212 |
//cas d'une image par défaut
|
212 |
//cas d'une image par défaut
|
213 |
elseif (isset ($GLOBALS['_BAZAR_']['image_logo']) && $GLOBALS['_BAZAR_']['image_logo']!='') {
|
213 |
elseif (isset ($GLOBALS['_BAZAR_']['image_logo']) && $GLOBALS['_BAZAR_']['image_logo']!='') {
|
214 |
$res .= '<div id="fiche_image">'."\n";
|
214 |
$res .= '<div id="fiche_image">'."\n";
|
215 |
$res .= '<img src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_logo'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" width="130" height="130" />'."\n";
|
215 |
$res .= '<img src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_logo'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" width="130" height="130" />'."\n";
|
216 |
$res .= '</div>'."\n";
|
216 |
$res .= '</div>'."\n";
|
217 |
}
|
217 |
}
|
218 |
$res .= '<h1 id="fiche_titre">'.$ligne['bf_titre'].'</h1>'."\n";
|
218 |
$res .= '<h1 id="fiche_titre">'.$ligne['bf_titre'].'</h1>'."\n";
|
219 |
$res .= '<div id="BAZ_description">'.nl2br($ligne['bf_description']).'</div>'."\n";
|
219 |
$res .= '<div id="BAZ_description">'.nl2br($ligne['bf_description']).'</div>'."\n";
|
220 |
$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
|
220 |
$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
|
221 |
for ($i=0; $i<count($tableau); $i++) {
|
221 |
for ($i=0; $i<count($tableau); $i++) {
|
222 |
if (isset($ligne[$tableau[$i]['nom_bdd']]) && ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' ) ) {
|
222 |
if (isset($ligne[$tableau[$i]['nom_bdd']]) && ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' ) ) {
|
223 |
$val=$tableau[$i]['nom_bdd'];
|
223 |
$val=$tableau[$i]['nom_bdd'];
|
224 |
if (!in_array($val, array ('bf_titre', 'bf_description'))) {
|
224 |
if (!in_array($val, array ('bf_titre', 'bf_description'))) {
|
225 |
if ($ligne[$val] != '' and $ligne[$val] != BAZ_CHOISIR and $ligne[$val] != BAZ_NON_PRECISE) {
|
225 |
if ($ligne[$val] != '' and $ligne[$val] != BAZ_CHOISIR and $ligne[$val] != BAZ_NON_PRECISE) {
|
226 |
$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
|
226 |
$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
|
227 |
$res .= '<span class="description"> '.nl2br($ligne[$val]).'</span>'."\n".'<br />'."\n";
|
227 |
$res .= '<span class="description"> '.nl2br($ligne[$val]).'</span>'."\n".'<br />'."\n";
|
228 |
}
|
228 |
}
|
229 |
}
|
229 |
}
|
230 |
}
|
230 |
}
|
231 |
elseif ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
|
231 |
elseif ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
|
232 |
//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id
|
232 |
//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id
|
233 |
$requete = 'SELECT blv_label FROM bazar_fiche_valeur_liste, bazar_liste_valeurs WHERE bfvl_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].
|
233 |
$requete = 'SELECT blv_label FROM bazar_fiche_valeur_liste, bazar_liste_valeurs WHERE bfvl_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].
|
234 |
' AND bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND bfvl_valeur=blv_valeur AND blv_ce_liste='.$tableau[$i]['nom_bdd'].' AND blv_ce_i18n="'.$GLOBALS['_BAZAR_']['langue'].'"';
|
234 |
' AND bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND bfvl_valeur=blv_valeur AND blv_ce_liste='.$tableau[$i]['nom_bdd'].' AND blv_ce_i18n="'.$GLOBALS['_BAZAR_']['langue'].'"';
|
235 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
235 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
236 |
if (DB::isError ($resultat)) {
|
236 |
if (DB::isError ($resultat)) {
|
237 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
237 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
238 |
}
|
238 |
}
|
239 |
$val='';$nb=0;
|
239 |
$val='';$nb=0;
|
240 |
while ($tab = $resultat->fetchRow()) {
|
240 |
while ($tab = $resultat->fetchRow()) {
|
241 |
if ($nb>0) $val .= ', ';
|
241 |
if ($nb>0) $val .= ', ';
|
242 |
$val .= $tab[0];
|
242 |
$val .= $tab[0];
|
243 |
$nb++;
|
243 |
$nb++;
|
244 |
}
|
244 |
}
|
245 |
if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
|
245 |
if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
|
246 |
$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
|
246 |
$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
|
247 |
$res .= '<span class="description"> '.$val.'</span>'."\n".'<br />'."\n";
|
247 |
$res .= '<span class="description"> '.$val.'</span>'."\n".'<br />'."\n";
|
248 |
}
|
248 |
}
|
249 |
}
|
249 |
}
|
250 |
elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
|
250 |
elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
|
251 |
$val=$tableau[$i]['nom_bdd'];
|
251 |
$val=$tableau[$i]['nom_bdd'];
|
252 |
if (!in_array($val, array ('bf_date_debut_validite_fiche', 'bf_date_fin_validite_fiche'))) {
|
252 |
if (!in_array($val, array ('bf_date_debut_validite_fiche', 'bf_date_fin_validite_fiche'))) {
|
253 |
if ($ligne[$val] != '') {
|
253 |
if ($ligne[$val] != '') {
|
254 |
$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
|
254 |
$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
|
255 |
$res .= '<span class="description"> '.strftime('%d.%m.%Y',strtotime($ligne[$val])).'</span>'."\n".'<br />'."\n";
|
255 |
$res .= '<span class="description"> '.strftime('%d.%m.%Y',strtotime($ligne[$val])).'</span>'."\n".'<br />'."\n";
|
256 |
}
|
256 |
}
|
257 |
}
|
257 |
}
|
258 |
}
|
258 |
}
|
259 |
}
|
259 |
}
|
260 |
//afficher les liens pour l'annonce
|
260 |
//afficher les liens pour l'annonce
|
261 |
$requete = 'SELECT bu_url, bu_descriptif_url FROM bazar_url WHERE bu_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
|
261 |
$requete = 'SELECT bu_url, bu_descriptif_url FROM bazar_url WHERE bu_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
|
262 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
262 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
263 |
if (DB::isError($resultat)) {
|
263 |
if (DB::isError($resultat)) {
|
264 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
264 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
265 |
}
|
265 |
}
|
266 |
if ($resultat->numRows()>0) {
|
266 |
if ($resultat->numRows()>0) {
|
267 |
$res .= '<span class="rubrique">'.BAZ_LIEN_INTERNET.':</span>'."\n";
|
267 |
$res .= '<span class="rubrique">'.BAZ_LIEN_INTERNET.':</span>'."\n";
|
268 |
$res .= '<span class="description">'."\n";
|
268 |
$res .= '<span class="description">'."\n";
|
269 |
$res .= '<ul>'."\n";
|
269 |
$res .= '<ul>'."\n";
|
270 |
while ($ligne1 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
270 |
while ($ligne1 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
271 |
$res .= '<li><a href="'.$ligne1['bu_url'].'" target="_blank">'.$ligne1['bu_descriptif_url'].'</a></li>'."\n";
|
271 |
$res .= '<li><a href="'.$ligne1['bu_url'].'" target="_blank">'.$ligne1['bu_descriptif_url'].'</a></li>'."\n";
|
272 |
}
|
272 |
}
|
273 |
$res .= '</ul></span>'."\n";
|
273 |
$res .= '</ul></span>'."\n";
|
274 |
}
|
274 |
}
|
275 |
|
275 |
|
276 |
//afficher les fichiers pour l'annonce
|
276 |
//afficher les fichiers pour l'annonce
|
277 |
$requete = 'SELECT bfj_description, bfj_fichier FROM bazar_fichier_joint WHERE bfj_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
|
277 |
$requete = 'SELECT bfj_description, bfj_fichier FROM bazar_fichier_joint WHERE bfj_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
|
278 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
278 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
279 |
if (DB::isError($resultat)) {
|
279 |
if (DB::isError($resultat)) {
|
280 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
280 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
281 |
}
|
281 |
}
|
282 |
if ($resultat->numRows()>0) {
|
282 |
if ($resultat->numRows()>0) {
|
283 |
$res .= '<span class="rubrique">'.BAZ_LISTE_FICHIERS_JOINTS.':</span>'."\n";
|
283 |
$res .= '<span class="rubrique">'.BAZ_LISTE_FICHIERS_JOINTS.':</span>'."\n";
|
284 |
$res .= '<span class="description">'."\n";
|
284 |
$res .= '<span class="description">'."\n";
|
285 |
$res .= '<ul>'."\n";
|
285 |
$res .= '<ul>'."\n";
|
286 |
while ($ligne2 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
286 |
while ($ligne2 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
287 |
$res .= '<li><a href="client/bazar/upload/'.$ligne2['bfj_fichier'].'">'.$ligne2['bfj_description'].'</a></li>'."\n";
|
287 |
$res .= '<li><a href="client/bazar/upload/'.$ligne2['bfj_fichier'].'">'.$ligne2['bfj_description'].'</a></li>'."\n";
|
288 |
}
|
288 |
}
|
289 |
$res .= '</ul></span>'."\n";
|
289 |
$res .= '</ul></span>'."\n";
|
290 |
}
|
290 |
}
|
291 |
$res .= '<div class="bulle_haut"> </div>'."\n";
|
291 |
$res .= '<div class="bulle_haut"> </div>'."\n";
|
292 |
$res .= '<div class="bulle_corps">'."\n";
|
292 |
$res .= '<div class="bulle_corps">'."\n";
|
293 |
|
293 |
|
294 |
//affichage du redacteur de la fiche
|
294 |
//affichage du redacteur de la fiche
|
295 |
$requete = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.', '.BAZ_CHAMPS_EMAIL.
|
295 |
$requete = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.', '.BAZ_CHAMPS_EMAIL.
|
296 |
' FROM '.BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$ligne['bf_ce_utilisateur'];
|
296 |
' FROM '.BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$ligne['bf_ce_utilisateur'];
|
297 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
297 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
298 |
if (DB::isError($resultat)) {
|
298 |
if (DB::isError($resultat)) {
|
299 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
299 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
300 |
}
|
300 |
}
|
301 |
while ($redacteur = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
301 |
while ($redacteur = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
302 |
$res .= BAZ_FICHE_ECRITE.'<a href="mailto:'.$redacteur[BAZ_CHAMPS_EMAIL].'">'.$redacteur[BAZ_CHAMPS_PRENOM].' '.$redacteur[BAZ_CHAMPS_NOM].'</a><br />'."\n";
|
302 |
$res .= BAZ_FICHE_ECRITE.'<a href="mailto:'.$redacteur[BAZ_CHAMPS_EMAIL].'">'.$redacteur[BAZ_CHAMPS_PRENOM].' '.$redacteur[BAZ_CHAMPS_NOM].'</a><br />'."\n";
|
303 |
}
|
303 |
}
|
304 |
$res .= BAZ_NB_VUS.'<strong>'.$ligne['bf_nb_consultations'].'</strong>'.BAZ_FOIS.'<br />'."\n";
|
304 |
$res .= BAZ_NB_VUS.'<strong>'.$ligne['bf_nb_consultations'].'</strong>'.BAZ_FOIS.'<br />'."\n";
|
305 |
$res .= '</div>'."\n";
|
305 |
$res .= '</div>'."\n";
|
306 |
$res .= '<div class="bulle_bas"> </div>'."\n";
|
306 |
$res .= '<div class="bulle_bas"> </div>'."\n";
|
307 |
$res .= '<div id="BAZ_bas_page">';
|
307 |
$res .= '<div id="BAZ_bas_page">';
|
308 |
}
|
308 |
}
|
309 |
|
309 |
|
310 |
//informations complementaires (id fiche, etat publication,... )
|
310 |
//informations complementaires (id fiche, etat publication,... )
|
311 |
if ($danslappli==1) {
|
311 |
if ($danslappli==1) {
|
312 |
if ($ligne['bf_statut_fiche']==1 && $GLOBALS['_BAZAR_']['appropriation']!=1 ) {
|
312 |
if ($ligne['bf_statut_fiche']==1 && $GLOBALS['_BAZAR_']['appropriation']!=1 ) {
|
313 |
$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_DU.' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_debut_validite_fiche'])).' '.BAZ_AU.' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_fin_validite_fiche'])).'<br />'."\n";
|
313 |
$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_DU.' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_debut_validite_fiche'])).' '.BAZ_AU.' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_fin_validite_fiche'])).'<br />'."\n";
|
314 |
}
|
314 |
}
|
315 |
elseif ($GLOBALS['_BAZAR_']['appropriation']!=1 || $ligne['bf_statut_fiche']!=1) {
|
315 |
elseif ($GLOBALS['_BAZAR_']['appropriation']!=1 || $ligne['bf_statut_fiche']!=1) {
|
316 |
$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_NON;
|
316 |
$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_NON;
|
317 |
if ( $est_admin ) {
|
317 |
if ( $est_admin ) {
|
318 |
$res .= ' <strong>'.BAZ_VALIDER_PUBLICATION.' : </strong>'."\n";
|
318 |
$res .= ' <strong>'.BAZ_VALIDER_PUBLICATION.' : </strong>'."\n";
|
319 |
$lien_publie = &$GLOBALS['_BAZAR_']['url'];
|
319 |
$lien_publie = &$GLOBALS['_BAZAR_']['url'];
|
320 |
$lien_publie->addQueryString('action', BAZ_VOIR_FICHE);
|
320 |
$lien_publie->addQueryString('action', BAZ_VOIR_FICHE);
|
321 |
$lien_publie->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
|
321 |
$lien_publie->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
|
322 |
$lien_publie->addQueryString('typeannonce', $ligne['bf_ce_nature']);
|
322 |
$lien_publie->addQueryString('typeannonce', $ligne['bf_ce_nature']);
|
323 |
$lien_publie->addQueryString('publiee', 1);
|
323 |
$lien_publie->addQueryString('publiee', 1);
|
324 |
$res .= '<a href="'.$lien_publie->getURL().'">'.BAZ_OUI.'</a> / ';
|
324 |
$res .= '<a href="'.$lien_publie->getURL().'">'.BAZ_OUI.'</a> / ';
|
325 |
$lien_publie->removeQueryString('publiee');
|
325 |
$lien_publie->removeQueryString('publiee');
|
326 |
$lien_publie->addQueryString('publiee', 0);
|
326 |
$lien_publie->addQueryString('publiee', 0);
|
327 |
$res .='<a href="'.$lien_publie->getURL().'">'.BAZ_NON.'</a>'."\n";
|
327 |
$res .='<a href="'.$lien_publie->getURL().'">'.BAZ_NON.'</a>'."\n";
|
328 |
$lien_publie->removeQueryString('publiee');
|
328 |
$lien_publie->removeQueryString('publiee');
|
329 |
}
|
329 |
}
|
330 |
$res .= '<br />'."\n";
|
330 |
$res .= '<br />'."\n";
|
331 |
}
|
331 |
}
|
332 |
//affichage des infos pouvant interesser les admins
|
332 |
//affichage des infos pouvant interesser les admins
|
333 |
if ( $est_admin ) {
|
333 |
if ( $est_admin ) {
|
334 |
$res .= '<span class="rubrique">'.BAZ_NUM_FICHE.':</span> '.$GLOBALS['_BAZAR_']['id_fiche'].'<br />'."\n";
|
334 |
$res .= '<span class="rubrique">'.BAZ_NUM_FICHE.':</span> '.$GLOBALS['_BAZAR_']['id_fiche'].'<br />'."\n";
|
335 |
$res .= '<span class="rubrique">'.BAZ_DATE_CREATION.' :</span> '.strftime('%d.%m.%Y à %H:%M',strtotime($ligne['bf_date_creation_fiche'])).'<br />'."\n";
|
335 |
$res .= '<span class="rubrique">'.BAZ_DATE_CREATION.' :</span> '.strftime('%d.%m.%Y à %H:%M',strtotime($ligne['bf_date_creation_fiche'])).'<br />'."\n";
|
336 |
}
|
336 |
}
|
337 |
//affichage des infos et du lien pour la mise a jour de la fiche
|
337 |
//affichage des infos et du lien pour la mise a jour de la fiche
|
338 |
if ( $est_admin || $GLOBALS['_BAZAR_']['annonceur']==$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID) ) {
|
338 |
if ( $est_admin || $GLOBALS['_BAZAR_']['annonceur']==$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID) ) {
|
339 |
$res .= '<span class="rubrique">'.BAZ_DATE_MAJ.' :</span> '.strftime('%d.%m.%Y à %H:%M',strtotime($ligne['bf_date_maj_fiche']))."\n";
|
339 |
$res .= '<span class="rubrique">'.BAZ_DATE_MAJ.' :</span> '.strftime('%d.%m.%Y à %H:%M',strtotime($ligne['bf_date_maj_fiche']))."\n";
|
340 |
$lien_modifier=$GLOBALS['_BAZAR_']['url'];
|
340 |
$lien_modifier=$GLOBALS['_BAZAR_']['url'];
|
341 |
$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER);
|
341 |
$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER);
|
342 |
$lien_modifier->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
|
342 |
$lien_modifier->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
|
343 |
$lien_modifier->addQueryString('typeannonce', $ligne['bf_ce_nature']);
|
343 |
$lien_modifier->addQueryString('typeannonce', $ligne['bf_ce_nature']);
|
344 |
$res .= ' <a href="'.$lien_modifier->getURL().'">'.BAZ_MODIFIER_LA_FICHE.'</a>'."\n";
|
344 |
$res .= ' <a href="'.$lien_modifier->getURL().'">'.BAZ_MODIFIER_LA_FICHE.'</a>'."\n";
|
345 |
}
|
345 |
}
|
346 |
}
|
346 |
}
|
347 |
$res .= '</div>'."\n";
|
347 |
$res .= '</div>'."\n";
|
348 |
$res .= '</div>'."\n";
|
348 |
$res .= '</div>'."\n";
|
349 |
|
349 |
|
350 |
//on ajoute les appropriations, s'il le faut
|
350 |
//on ajoute les appropriations, s'il le faut
|
351 |
if (($danslappli==1)and($GLOBALS['_BAZAR_']['appropriation']==1)) {
|
351 |
if (($danslappli==1)and($GLOBALS['_BAZAR_']['appropriation']==1)) {
|
352 |
$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche">'."\n";
|
352 |
$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche">'."\n";
|
353 |
$res .= '<h3>'.BAZ_LES_STRUCTURES_POSSEDANT_UNE_RESSOURCE.'</h3>'."\n";
|
353 |
$res .= '<h3>'.BAZ_LES_STRUCTURES_POSSEDANT_UNE_RESSOURCE.'</h3>'."\n";
|
354 |
$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.' FROM bazar_appropriation,'.BAZ_ANNUAIRE.' WHERE ba_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' AND ba_ce_id_structure='.BAZ_CHAMPS_ID.' ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
|
354 |
$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.' FROM bazar_appropriation,'.BAZ_ANNUAIRE.' WHERE ba_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' AND ba_ce_id_structure='.BAZ_CHAMPS_ID.' ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
|
355 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
355 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
356 |
if (DB::isError ($resultat)) {
|
356 |
if (DB::isError ($resultat)) {
|
357 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
357 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
358 |
}
|
358 |
}
|
359 |
$possede_ressource=0;
|
359 |
$possede_ressource=0;
|
360 |
if ($resultat->numRows()>0) {
|
360 |
if ($resultat->numRows()>0) {
|
361 |
$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
|
361 |
$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
|
362 |
if ($resultat->numRows()==1) $res .= BAZ_STRUCTURE_POSSEDANT.'<br />'."\n";
|
362 |
if ($resultat->numRows()==1) $res .= BAZ_STRUCTURE_POSSEDANT.'<br />'."\n";
|
363 |
else $res .= BAZ_STRUCTURES_POSSEDANT.'<br />'."\n";
|
363 |
else $res .= BAZ_STRUCTURES_POSSEDANT.'<br />'."\n";
|
364 |
$res .= '<ul>'."\n";
|
364 |
$res .= '<ul>'."\n";
|
365 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
365 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
366 |
$res .= '<li><a href="'.BAZ_URL_ANNUAIRE.'&voir_fiche='.$ligne[BAZ_CHAMPS_ID].'" onclick="javascript:window.open(this.href);return false;">'.$ligne[BAZ_CHAMPS_NOM].'</a></li>'."\n";
|
366 |
$res .= '<li><a href="'.BAZ_URL_ANNUAIRE.'&voir_fiche='.$ligne[BAZ_CHAMPS_ID].'" onclick="javascript:window.open(this.href);return false;">'.$ligne[BAZ_CHAMPS_NOM].'</a></li>'."\n";
|
367 |
if ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)==$ligne[BAZ_CHAMPS_ID]) $possede_ressource=1;
|
367 |
if ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)==$ligne[BAZ_CHAMPS_ID]) $possede_ressource=1;
|
368 |
}
|
368 |
}
|
369 |
$res .= '</ul><br />'."\n";
|
369 |
$res .= '</ul><br />'."\n";
|
370 |
}
|
370 |
}
|
371 |
else $res .= BAZ_PAS_D_APPROPRIATION.'<br /><br />'."\n";
|
371 |
else $res .= BAZ_PAS_D_APPROPRIATION.'<br /><br />'."\n";
|
372 |
$res .='<p class="bulle_corps">'."\n";
|
372 |
$res .='<p class="bulle_corps">'."\n";
|
373 |
$lien_appropriation = $GLOBALS['_BAZAR_']['url'];
|
373 |
$lien_appropriation = $GLOBALS['_BAZAR_']['url'];
|
374 |
$lien_appropriation->addQueryString('action', BAZ_VOIR_FICHE);
|
374 |
$lien_appropriation->addQueryString('action', BAZ_VOIR_FICHE);
|
375 |
$lien_appropriation->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
|
375 |
$lien_appropriation->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
|
376 |
if ($possede_ressource) {
|
376 |
if ($possede_ressource) {
|
377 |
$lien_appropriation->addQueryString('appropriation', 0);
|
377 |
$lien_appropriation->addQueryString('appropriation', 0);
|
378 |
$res .= BAZ_POSSEDE_DEJA_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_VOUS_ENLEVER.'</a>'."\n";
|
378 |
$res .= BAZ_POSSEDE_DEJA_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_VOUS_ENLEVER.'</a>'."\n";
|
379 |
$lien_appropriation->removeQueryString('appropriation');
|
379 |
$lien_appropriation->removeQueryString('appropriation');
|
380 |
}
|
380 |
}
|
381 |
elseif ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
|
381 |
elseif ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
|
382 |
$lien_appropriation->addQueryString('appropriation', 1);
|
382 |
$lien_appropriation->addQueryString('appropriation', 1);
|
383 |
$res .= BAZ_SI_POSSEDE_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_APPARAITRE.'</a>'."\n";
|
383 |
$res .= BAZ_SI_POSSEDE_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_APPARAITRE.'</a>'."\n";
|
384 |
$lien_appropriation->removeQueryString('appropriation');
|
384 |
$lien_appropriation->removeQueryString('appropriation');
|
385 |
}
|
385 |
}
|
386 |
elseif ($GLOBALS['AUTH']->getAuth() && !$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
|
386 |
elseif ($GLOBALS['AUTH']->getAuth() && !$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
|
387 |
$res .= BAZ_IL_FAUT_ETRE_STRUCTURE."\n";
|
387 |
$res .= BAZ_IL_FAUT_ETRE_STRUCTURE."\n";
|
388 |
}
|
388 |
}
|
389 |
elseif (!$GLOBALS['AUTH']->getAuth()) {
|
389 |
elseif (!$GLOBALS['AUTH']->getAuth()) {
|
390 |
$res .= BAZ_IL_FAUT_ETRE_IDENTIFIE_STRUCTURE."\n";
|
390 |
$res .= BAZ_IL_FAUT_ETRE_IDENTIFIE_STRUCTURE."\n";
|
391 |
}
|
391 |
}
|
392 |
$res .='</p>'."\n";
|
392 |
$res .='</p>'."\n";
|
393 |
$res .= '</div>'."\n";
|
393 |
$res .= '</div>'."\n";
|
394 |
}
|
394 |
}
|
395 |
|
395 |
|
396 |
//on ajoute les commentaires, s'il le faut
|
396 |
//on ajoute les commentaires, s'il le faut
|
397 |
if (($danslappli==1)and($GLOBALS['_BAZAR_']['commentaire']==1)) {
|
397 |
if (($danslappli==1)and($GLOBALS['_BAZAR_']['commentaire']==1)) {
|
398 |
$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche">'."\n";
|
398 |
$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche">'."\n";
|
399 |
$res .= '<h3>'.BAZ_LES_COMMENTAIRES.'</h3>'."\n";
|
399 |
$res .= '<h3>'.BAZ_LES_COMMENTAIRES.'</h3>'."\n";
|
400 |
$requete = 'SELECT * FROM bazar_commentaires WHERE bc_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' ORDER BY bc_date ASC';
|
400 |
$requete = 'SELECT * FROM bazar_commentaires WHERE bc_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' ORDER BY bc_date ASC';
|
401 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
401 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
402 |
if (DB::isError ($resultat)) {
|
402 |
if (DB::isError ($resultat)) {
|
403 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
403 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
404 |
}
|
404 |
}
|
405 |
if ($resultat->numRows()>0) {
|
405 |
if ($resultat->numRows()>0) {
|
406 |
$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
|
406 |
$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
|
407 |
if ($resultat->numRows()==1) $res .= BAZ_COMMENTAIRE.'<br />'."\n";
|
407 |
if ($resultat->numRows()==1) $res .= BAZ_COMMENTAIRE.'<br />'."\n";
|
408 |
else $res .= BAZ_COMMENTAIRES.'<br />'."\n";
|
408 |
else $res .= BAZ_COMMENTAIRES.'<br />'."\n";
|
409 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
409 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
410 |
$res .= '<div class="bulle_haut"> </div>'."\n";
|
410 |
$res .= '<div class="bulle_haut"> </div>'."\n";
|
411 |
$res .= '<div class="bulle_corps">'."\n";
|
411 |
$res .= '<div class="bulle_corps">'."\n";
|
412 |
//affichage du commentaire
|
412 |
//affichage du commentaire
|
413 |
$res .= $ligne['bc_commentaire'].'<br />'."\n";
|
413 |
$res .= $ligne['bc_commentaire'].'<br />'."\n";
|
414 |
$res .= '</div>'."\n";
|
414 |
$res .= '</div>'."\n";
|
415 |
$res .= '<div class="bulle_bas">'."\n";
|
415 |
$res .= '<div class="bulle_bas">'."\n";
|
416 |
$res .= '<div style="font-size:9px;margin-left:10px;">'.BAZ_PAR.' : <strong>'.$ligne['bc_nom'].'</strong>'.BAZ_ECRIT_LE.$ligne['bc_date'].'</div>'."\n";
|
416 |
$res .= '<div style="font-size:9px;margin-left:10px;">'.BAZ_PAR.' : <strong>'.$ligne['bc_nom'].'</strong>'.BAZ_ECRIT_LE.$ligne['bc_date'].'</div>'."\n";
|
417 |
//pour les identifies seulement, administrateurs de la rubrique ou superadmins
|
417 |
//pour les identifies seulement, administrateurs de la rubrique ou superadmins
|
418 |
if ($est_admin==1) {
|
418 |
if ($est_admin==1) {
|
419 |
$url_comment= $GLOBALS['_BAZAR_']['url'];
|
419 |
$url_comment= $GLOBALS['_BAZAR_']['url'];
|
420 |
$url_comment->addQueryString('action', BAZ_VOIR_FICHE);
|
420 |
$url_comment->addQueryString('action', BAZ_VOIR_FICHE);
|
421 |
$url_comment->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
|
421 |
$url_comment->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
|
422 |
$url_comment->addQueryString('id_commentaire', $ligne['bc_id_commentaire']);
|
422 |
$url_comment->addQueryString('id_commentaire', $ligne['bc_id_commentaire']);
|
423 |
$res .= '<a href="'.$url_comment->getURL().'" style="font-size:9px;float:right;">'.BAZ_SUPPRIMER.'</a>'."\n";
|
423 |
$res .= '<a href="'.$url_comment->getURL().'" style="font-size:9px;float:right;">'.BAZ_SUPPRIMER.'</a>'."\n";
|
424 |
}
|
424 |
}
|
425 |
$res .= '</div>'."\n";
|
425 |
$res .= '</div>'."\n";
|
426 |
}
|
426 |
}
|
427 |
}
|
427 |
}
|
428 |
else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br /><br />'."\n";
|
428 |
else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br /><br />'."\n";
|
429 |
|
429 |
|
430 |
//formulaire des commentaires
|
430 |
//formulaire des commentaires
|
431 |
$form_commentaire = new HTML_QuickForm('bazar_commentaire', 'post', $url);
|
431 |
$form_commentaire = new HTML_QuickForm('bazar_commentaire', 'post', $url);
|
432 |
$squelette =& $form_commentaire->defaultRenderer();
|
432 |
$squelette =& $form_commentaire->defaultRenderer();
|
433 |
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
|
433 |
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
|
434 |
$squelette->setElementTemplate( '<label style="width:200px;">{label}'.
|
434 |
$squelette->setElementTemplate( '<label style="width:200px;">{label}'.
|
435 |
'<!-- BEGIN required --><span class="symbole_obligatoire"> *</span><!-- END required -->'."\n".
|
435 |
'<!-- BEGIN required --><span class="symbole_obligatoire"> *</span><!-- END required -->'."\n".
|
436 |
'</label><br />'."\n".'{element}<br />'."\n");
|
436 |
'</label><br />'."\n".'{element}<br />'."\n");
|
437 |
$squelette->setRequiredNoteTemplate("\n".'<span class="symbole_obligatoire"> *{requiredNote}</span>'."\n");
|
437 |
$squelette->setRequiredNoteTemplate("\n".'<span class="symbole_obligatoire"> *{requiredNote}</span>'."\n");
|
438 |
$option=array('style'=>'width:300px;border:1px solid #000;', 'maxlength'=>100);
|
438 |
$option=array('style'=>'width:300px;border:1px solid #000;', 'maxlength'=>100);
|
439 |
$form_commentaire->addElement('text', 'Nom', BAZ_ENTREZ_VOTRE_NOM, $option);
|
439 |
$form_commentaire->addElement('text', 'Nom', BAZ_ENTREZ_VOTRE_NOM, $option);
|
440 |
$option=array('style'=>'width:95%;height:100px;white-space: pre;padding:3px;border:1px solid #000;');
|
440 |
$option=array('style'=>'width:95%;height:100px;white-space: pre;padding:3px;border:1px solid #000;');
|
441 |
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php';
|
441 |
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php';
|
442 |
$formtexte= new HTML_QuickForm_textarea('Commentaire', BAZ_ENTREZ_VOTRE_COMMENTAIRE, $option);
|
442 |
$formtexte= new HTML_QuickForm_textarea('Commentaire', BAZ_ENTREZ_VOTRE_COMMENTAIRE, $option);
|
443 |
$form_commentaire->addElement($formtexte) ;
|
443 |
$form_commentaire->addElement($formtexte) ;
|
444 |
$option=array('style'=>'border:1px solid #000;');
|
444 |
$option=array('style'=>'border:1px solid #000;');
|
445 |
$form_commentaire->addElement('submit', 'Envoyer', BAZ_ENVOYER, $option);
|
445 |
$form_commentaire->addElement('submit', 'Envoyer', BAZ_ENVOYER, $option);
|
446 |
$form_commentaire->addRule('Nom', BAZ_NOM_REQUIS, 'required', '', 'client') ;
|
446 |
$form_commentaire->addRule('Nom', BAZ_NOM_REQUIS, 'required', '', 'client') ;
|
447 |
$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ;
|
447 |
$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ;
|
448 |
$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
|
448 |
$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
|
449 |
$res .= $form_commentaire->toHTML();
|
449 |
$res .= $form_commentaire->toHTML();
|
450 |
$res .= '</div>'."\n";
|
450 |
$res .= '</div>'."\n";
|
451 |
}
|
451 |
}
|
452 |
|
452 |
|
453 |
return $res ;
|
453 |
return $res ;
|
454 |
}
|
454 |
}
|
455 |
|
455 |
|
456 |
|
456 |
|
457 |
/** RSSversHTML () transforme un flux RSS (en XML) en page HTML
|
457 |
/** RSSversHTML () transforme un flux RSS (en XML) en page HTML
|
458 |
*
|
458 |
*
|
459 |
* On passe en paramètre le contenu du flux RSS, on affiche ou non la description,
|
459 |
* On passe en paramètre le contenu du flux RSS, on affiche ou non la description,
|
460 |
* et on choisit de format de la date à l'affichage. On a en sortie du code HTML à afficher
|
460 |
* et on choisit de format de la date à l'affichage. On a en sortie du code HTML à afficher
|
461 |
*
|
461 |
*
|
462 |
* @param string le contenu du flux RSS
|
462 |
* @param string le contenu du flux RSS
|
463 |
* @param boolean afficher ou non la description
|
463 |
* @param boolean afficher ou non la description
|
464 |
* @param string choisir le format de date: jmah (12/02/2004 12h34) jmh (12/02 12h34) jma (12/02/2004) jm (12/02) ou rien
|
464 |
* @param string choisir le format de date: jmah (12/02/2004 12h34) jmh (12/02 12h34) jma (12/02/2004) jm (12/02) ou rien
|
465 |
*
|
465 |
*
|
466 |
* @return string le code HTML
|
466 |
* @return string le code HTML
|
467 |
*/
|
467 |
*/
|
468 |
function RSSversHTML($rss, $voirdesc, $formatdate, $affichenb) {
|
468 |
function RSSversHTML($rss, $voirdesc, $formatdate, $affichenb) {
|
469 |
if ($rss!='') {
|
469 |
if ($rss!='') {
|
470 |
$rawitems='';$title='';$url='';$cat='';$date='';
|
470 |
$rawitems='';$title='';$url='';$cat='';$date='';
|
471 |
$res='';
|
471 |
$res='';
|
472 |
if( eregi('<item>(.*)</item>', $rss, $rawitems ) ) {
|
472 |
if( eregi('<item>(.*)</item>', $rss, $rawitems ) ) {
|
473 |
$items = explode('<item>', $rawitems[0]);
|
473 |
$items = explode('<item>', $rawitems[0]);
|
474 |
$res.='<ul id="BAZ_liste_fiche">'."\n";
|
474 |
$res.='<ul id="BAZ_liste_fiche">'."\n";
|
475 |
for( $i = 0; $i < count($items)-1; $i++ ) {
|
475 |
for( $i = 0; $i < count($items)-1; $i++ ) {
|
476 |
eregi('<title>(.*)</title>',$items[$i+1], $title );
|
476 |
eregi('<title>(.*)</title>',$items[$i+1], $title );
|
477 |
eregi('<link>(.*)</link>',$items[$i+1], $url );
|
477 |
eregi('<link>(.*)</link>',$items[$i+1], $url );
|
478 |
eregi('<description>(.*)</description>',$items[$i+1], $cat);
|
478 |
eregi('<description>(.*)</description>',$items[$i+1], $cat);
|
479 |
eregi('<pubDate>(.*)</pubDate>',$items[$i+1], $date);
|
479 |
eregi('<pubDate>(.*)</pubDate>',$items[$i+1], $date);
|
480 |
$res.='<li>';
|
480 |
$res.='<li>';
|
481 |
if ($formatdate=='jm') {$res.=strftime('%d.%m',strtotime($date[1])).': ';}
|
481 |
if ($formatdate=='jm') {$res.=strftime('%d.%m',strtotime($date[1])).': ';}
|
482 |
if ($formatdate=='jma') {$res.=strftime('%d.%m.%Y',strtotime($date[1])).': ';}
|
482 |
if ($formatdate=='jma') {$res.=strftime('%d.%m.%Y',strtotime($date[1])).': ';}
|
483 |
if ($formatdate=='jmh') {$res.=strftime('%d.%m %H:%M',strtotime($date[1])).': ';}
|
483 |
if ($formatdate=='jmh') {$res.=strftime('%d.%m %H:%M',strtotime($date[1])).': ';}
|
484 |
if ($formatdate=='jmah') {$res.=strftime('%d.%m.%Y %H:%M',strtotime($date[1])).': ';}
|
484 |
if ($formatdate=='jmah') {$res.=strftime('%d.%m.%Y %H:%M',strtotime($date[1])).': ';}
|
485 |
$res.='<a href="'.preg_replace ('/&/', '&', $url[1]).'">'.$title[1].'</a>';
|
485 |
$res.='<a href="'.preg_replace ('/&/', '&', $url[1]).'">'.$title[1].'</a>';
|
486 |
if ($voirdesc) {$res.=$cat[1];}
|
486 |
if ($voirdesc) {$res.=$cat[1];}
|
487 |
// Ajout du bouton supprimer pour les superadministrateur
|
487 |
// Ajout du bouton supprimer pour les superadministrateur
|
488 |
if (($GLOBALS['AUTH']->getAuth() && niveau_droit(0,$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur')and($url[1]!='#')) {
|
488 |
if (($GLOBALS['AUTH']->getAuth() && niveau_droit(0,$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur')and($url[1]!='#')) {
|
489 |
$mon_url = preg_replace ('/&/', '&', $url[1]) ;
|
489 |
$mon_url = preg_replace ('/&/', '&', $url[1]) ;
|
490 |
$url_suppr = new Net_URL(preg_replace ('/&/', '&', $mon_url)) ;
|
490 |
$url_suppr = new Net_URL(preg_replace ('/&/', '&', $mon_url)) ;
|
491 |
$url_suppr->addQueryString('action', BAZ_ACTION_SUPPRESSION) ;
|
491 |
$url_suppr->addQueryString('action', BAZ_ACTION_SUPPRESSION) ;
|
492 |
$res .= ' ( <a href="'.$url_suppr->getURL().
|
492 |
$res .= ' ( <a href="'.$url_suppr->getURL().
|
493 |
'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.' ?\');">'.
|
493 |
'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.' ?\');">'.
|
494 |
BAZ_SUPPRIMER.'</a> )'."\n" ;
|
494 |
BAZ_SUPPRIMER.'</a> )'."\n" ;
|
495 |
}
|
495 |
}
|
496 |
$res.='</li>'."\n";
|
496 |
$res.='</li>'."\n";
|
497 |
}
|
497 |
}
|
498 |
$res.='</ul>'."\n";
|
498 |
$res.='</ul>'."\n";
|
499 |
if ($affichenb==1) {
|
499 |
if ($affichenb==1) {
|
500 |
//une annonce trouvee, on accorde au singulier
|
500 |
//une annonce trouvee, on accorde au singulier
|
501 |
if (((count($items)-1)==1)and($title!=BAZ_PAS_D_ANNONCES)) {
|
501 |
if (((count($items)-1)==1)and($title!=BAZ_PAS_D_ANNONCES)) {
|
502 |
$res = '<br /><h4>'.BAZ_IL_Y_A.' 1 '.BAZ_FICHE_CORRESPONDANTE.'</h4><br />'."\n".$res;
|
502 |
$res = '<br /><h4>'.BAZ_IL_Y_A.' 1 '.BAZ_FICHE_CORRESPONDANTE.'</h4><br />'."\n".$res;
|
503 |
}
|
503 |
}
|
504 |
//plusieures annonces trouvees, on accorde au pluriel
|
504 |
//plusieures annonces trouvees, on accorde au pluriel
|
505 |
else {
|
505 |
else {
|
506 |
$res = '<br /><h4>'.BAZ_IL_Y_A.(count($items)-1).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n".$res;
|
506 |
$res = '<br /><h4>'.BAZ_IL_Y_A.(count($items)-1).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n".$res;
|
507 |
}
|
507 |
}
|
508 |
}
|
508 |
}
|
509 |
//cas des fiches pas trouvées
|
509 |
//cas des fiches pas trouvées
|
510 |
if (((count($items)-1)==1)and($title[1]==BAZ_PAS_D_ANNONCES)) {
|
510 |
if (((count($items)-1)==1)and($title[1]==BAZ_PAS_D_ANNONCES)) {
|
511 |
$res = '<br /><h4>'.BAZ_PAS_D_ANNONCES.'</h4><br />'."\n";
|
511 |
$res = '<br /><h4>'.BAZ_PAS_D_ANNONCES.'</h4><br />'."\n";
|
512 |
}
|
512 |
}
|
513 |
}
|
513 |
}
|
514 |
}
|
514 |
}
|
515 |
else $res = BAZ_PAS_D_ANNONCES;
|
515 |
else $res = BAZ_PAS_D_ANNONCES;
|
516 |
|
516 |
|
517 |
return $res;
|
517 |
return $res;
|
518 |
}
|
518 |
}
|
519 |
|
519 |
|
520 |
/** gen_RSS() - generer un fichier de flux RSS par type d'annonce
|
520 |
/** gen_RSS() - generer un fichier de flux RSS par type d'annonce
|
521 |
*
|
521 |
*
|
522 |
* @param string Le type de l'annonce (laisser vide pour tout type d'annonce)
|
522 |
* @param string Le type de l'annonce (laisser vide pour tout type d'annonce)
|
523 |
* @param integer Le nombre d'annonces a regrouper dans le fichier XML (laisser vide pour toutes)
|
523 |
* @param integer Le nombre d'annonces a regrouper dans le fichier XML (laisser vide pour toutes)
|
524 |
* @param integer L'identifiant de l'emetteur (laisser vide pour tous)
|
524 |
* @param integer L'identifiant de l'emetteur (laisser vide pour tous)
|
525 |
* @param integer L'etat de validation de l'annonce (laisser 1 pour les annonces validees, 0 pour les non-validees)
|
525 |
* @param integer L'etat de validation de l'annonce (laisser 1 pour les annonces validees, 0 pour les non-validees)
|
526 |
* @param string La requete SQL personnalisee
|
526 |
* @param string La requete SQL personnalisee
|
527 |
* @param integer La categorie des fiches bazar
|
527 |
* @param integer La categorie des fiches bazar
|
528 |
*
|
528 |
*
|
529 |
* @return string Le code du flux RSS
|
529 |
* @return string Le code du flux RSS
|
530 |
*/
|
530 |
*/
|
531 |
function gen_RSS($typeannonce='', $nbitem='', $emetteur='', $valide=1, $requeteSQL='', $requeteSQLFrom = '', $requeteWhereListe = '', $categorie_nature='') {
|
531 |
function gen_RSS($typeannonce='', $nbitem='', $emetteur='', $valide=1, $requeteSQL='', $requeteSQLFrom = '', $requeteWhereListe = '', $categorie_nature='') {
|
532 |
// generation de la requete MySQL personnalisee
|
532 |
// generation de la requete MySQL personnalisee
|
533 |
$req_where=0;
|
533 |
$req_where=0;
|
534 |
$requete = 'SELECT DISTINCT bf_id_fiche, bf_titre, bf_date_debut_validite_fiche, bf_description '.
|
534 |
$requete = 'SELECT DISTINCT bf_id_fiche, bf_titre, bf_date_debut_validite_fiche, bf_description '.
|
535 |
'FROM bazar_fiche, bazar_nature '.$requeteSQLFrom.' WHERE '.$requeteWhereListe;
|
535 |
'FROM bazar_fiche, bazar_nature '.$requeteSQLFrom.' WHERE '.$requeteWhereListe;
|
536 |
if ($valide!=2) {
|
536 |
if ($valide!=2) {
|
537 |
$requete .= 'bf_statut_fiche='.$valide;
|
537 |
$requete .= 'bf_statut_fiche='.$valide;
|
538 |
$req_where=1;
|
538 |
$req_where=1;
|
539 |
}
|
539 |
}
|
540 |
$nomflux=BAZ_DERNIERE_ACTU;
|
540 |
$nomflux=BAZ_DERNIERE_ACTU;
|
541 |
if (!is_array ($typeannonce) && $typeannonce!='' and $typeannonce!='toutes') {
|
541 |
if (!is_array ($typeannonce) && $typeannonce!='' and $typeannonce!='toutes') {
|
542 |
if ($req_where==1) {$requete .= ' AND ';}
|
542 |
if ($req_where==1) {$requete .= ' AND ';}
|
543 |
$requete .= 'bf_ce_nature='.$typeannonce;
|
543 |
$requete .= 'bf_ce_nature='.$typeannonce;
|
544 |
$req_where=1;
|
544 |
$req_where=1;
|
545 |
//le nom du flux devient le type d'annonce
|
545 |
//le nom du flux devient le type d'annonce
|
546 |
$nomflux = $typeannonce;
|
546 |
$nomflux = $typeannonce;
|
547 |
}
|
547 |
}
|
548 |
// Cas où il y plusieurs type d annonce demande
|
548 |
// Cas où il y plusieurs type d annonce demande
|
549 |
if (is_array ($typeannonce)) {
|
549 |
if (is_array ($typeannonce)) {
|
550 |
if ($req_where==1) {$requete .= ' AND ';}
|
550 |
if ($req_where==1) {$requete .= ' AND ';}
|
551 |
$requete .= 'bf_ce_nature IN (' ;
|
551 |
$requete .= 'bf_ce_nature IN (' ;
|
552 |
$chaine = '';
|
552 |
$chaine = '';
|
553 |
foreach ($typeannonce as $valeur) $chaine .= '"'.$valeur.'",' ;
|
553 |
foreach ($typeannonce as $valeur) $chaine .= '"'.$valeur.'",' ;
|
554 |
$requete .= substr ($chaine, 0, strlen ($chaine)-1) ;
|
554 |
$requete .= substr ($chaine, 0, strlen ($chaine)-1) ;
|
555 |
$requete .= ') ';
|
555 |
$requete .= ') ';
|
556 |
}
|
556 |
}
|
557 |
$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
|
557 |
$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
|
558 |
if ($valide!=0) {
|
558 |
if ($valide!=0) {
|
559 |
|
559 |
|
560 |
if ($utilisateur->isSuperAdmin()) {
|
560 |
if ($utilisateur->isSuperAdmin()) {
|
561 |
$req_where=1;
|
561 |
$req_where=1;
|
562 |
} else {
|
562 |
} else {
|
563 |
if ($req_where==1) {
|
563 |
if ($req_where==1) {
|
564 |
$requete .= ' AND ';
|
564 |
$requete .= ' AND ';
|
565 |
}
|
565 |
}
|
566 |
$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
|
566 |
$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
|
567 |
' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
|
567 |
' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
|
568 |
}
|
568 |
}
|
569 |
}
|
569 |
}
|
570 |
else $nomflux .= BAZ_A_MODERER;
|
570 |
else $nomflux .= BAZ_A_MODERER;
|
571 |
if ($emetteur!='' && $emetteur!='tous') {
|
571 |
if ($emetteur!='' && $emetteur!='tous') {
|
572 |
if ($req_where==1) {$requete .= ' AND ';}
|
572 |
if ($req_where==1) {$requete .= ' AND ';}
|
573 |
$requete .= 'bf_ce_utilisateur='.$emetteur;
|
573 |
$requete .= 'bf_ce_utilisateur='.$emetteur;
|
574 |
$req_where=1;
|
574 |
$req_where=1;
|
575 |
//requete pour afficher le nom de la structure
|
575 |
//requete pour afficher le nom de la structure
|
576 |
$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
|
576 |
$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
|
577 |
BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
|
577 |
BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
|
578 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
|
578 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
|
579 |
if (DB::isError($resultat)) {
|
579 |
if (DB::isError($resultat)) {
|
580 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
580 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
581 |
}
|
581 |
}
|
582 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
582 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
583 |
$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
|
583 |
$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
|
584 |
}
|
584 |
}
|
585 |
if ($requeteSQL!='') {
|
585 |
if ($requeteSQL!='') {
|
586 |
if ($req_where==1) {$requete .= ' AND ';}
|
586 |
if ($req_where==1) {$requete .= ' AND ';}
|
587 |
$requete .= '('.$requeteSQL.')';
|
587 |
$requete .= '('.$requeteSQL.')';
|
588 |
$req_where=1;
|
588 |
$req_where=1;
|
589 |
}
|
589 |
}
|
590 |
if ($categorie_nature!='') {
|
590 |
if ($categorie_nature!='') {
|
591 |
if ($req_where==1) {$requete .= ' AND ';}
|
591 |
if ($req_where==1) {$requete .= ' AND ';}
|
592 |
$requete .= 'bn_ce_id_menu='.$categorie_nature.' ';
|
592 |
$requete .= 'bn_ce_id_menu='.$categorie_nature.' ';
|
593 |
$req_where=1;
|
593 |
$req_where=1;
|
594 |
}
|
594 |
}
|
595 |
|
595 |
|
596 |
$requete .= ' ORDER BY bf_date_debut_validite_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
|
596 |
$requete .= ' ORDER BY bf_date_debut_validite_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
|
597 |
if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
|
597 |
if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
|
598 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
598 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
599 |
if (DB::isError($resultat)) {
|
599 |
if (DB::isError($resultat)) {
|
600 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
600 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
601 |
}
|
601 |
}
|
602 |
// En-tete du flux RSS version 2.0
|
602 |
// En-tete du flux RSS version 2.0
|
603 |
$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n".'<rss version="2.0">'."\n";
|
603 |
$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n".'<rss version="2.0">'."\n";
|
604 |
$xml .= '<channel>'."\n".'<title>'.$nomflux.'</title>'."\n".'<link>'.BAZ_RSS_ADRESSESITE.'</link>'."\n";
|
604 |
$xml .= '<channel>'."\n".'<title>'.$nomflux.'</title>'."\n".'<link>'.BAZ_RSS_ADRESSESITE.'</link>'."\n";
|
605 |
$xml .= '<description>'.BAZ_RSS_DESCRIPTIONSITE.'</description>'."\n".'<language>fr-FR</language>'."\n".
|
605 |
$xml .= '<description>'.BAZ_RSS_DESCRIPTIONSITE.'</description>'."\n".'<language>fr-FR</language>'."\n".
|
606 |
'<copyright>Copyright 2005 '.BAZ_RSS_NOMSITE.'</copyright>'."\n";
|
606 |
'<copyright>Copyright 2005 '.BAZ_RSS_NOMSITE.'</copyright>'."\n";
|
607 |
// Ajout de la date actuelle de publication (suivant la DTD RSS)
|
607 |
// Ajout de la date actuelle de publication (suivant la DTD RSS)
|
608 |
$xml .= '<lastBuildDate>'.strftime('%d %b %Y %H:%M:%S GMT').'</lastBuildDate>'."\n";
|
608 |
$xml .= '<lastBuildDate>'.strftime('%d %b %Y %H:%M:%S GMT').'</lastBuildDate>'."\n";
|
609 |
// En-tete suite et fin
|
609 |
// En-tete suite et fin
|
610 |
$xml .= '<docs>http://www.stervinou.com/projets/rss/</docs>'."\n".'<category>'.BAZ_RSS_CATEGORIE.'</category>'."\n".
|
610 |
$xml .= '<docs>http://www.stervinou.com/projets/rss/</docs>'."\n".'<category>'.BAZ_RSS_CATEGORIE.'</category>'."\n".
|
611 |
'<managingEditor>'.BAZ_RSS_MANAGINGEDITOR.'</managingEditor>'."\n".'<webMaster>'.BAZ_RSS_WEBMASTER.'</webMaster>'."\n";
|
611 |
'<managingEditor>'.BAZ_RSS_MANAGINGEDITOR.'</managingEditor>'."\n".'<webMaster>'.BAZ_RSS_WEBMASTER.'</webMaster>'."\n";
|
612 |
$xml .= '<ttl>60</ttl>'."\n".'<image>'."\n".'<title>'.BAZ_RSS_NOMSITE.'</title>'."\n".'<url>'.BAZ_RSS_LOGOSITE.'</url>'."\n".
|
612 |
$xml .= '<ttl>60</ttl>'."\n".'<image>'."\n".'<title>'.BAZ_RSS_NOMSITE.'</title>'."\n".'<url>'.BAZ_RSS_LOGOSITE.'</url>'."\n".
|
613 |
'<link>'.BAZ_RSS_ADRESSESITE.'</link>'."\n".'</image>'."\n";
|
613 |
'<link>'.BAZ_RSS_ADRESSESITE.'</link>'."\n".'</image>'."\n";
|
614 |
if ($resultat->numRows()>0) {
|
614 |
if ($resultat->numRows()>0) {
|
615 |
// Creation des items : titre + lien + description + date de publication
|
615 |
// Creation des items : titre + lien + description + date de publication
|
616 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
616 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
617 |
$xml .= '<item>'."\n";
|
617 |
$xml .= '<item>'."\n";
|
618 |
$xml .= '<title>'.$ligne['bf_titre'].'</title>'."\n";
|
618 |
$xml .= '<title>'.$ligne['bf_titre'].'</title>'."\n";
|
619 |
$lien=$GLOBALS['_BAZAR_']['url'];
|
619 |
$lien=$GLOBALS['_BAZAR_']['url'];
|
620 |
$lien->addQueryString('action', BAZ_VOIR_FICHE);
|
620 |
$lien->addQueryString('action', BAZ_VOIR_FICHE);
|
621 |
$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
|
621 |
$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
|
622 |
$xml .= '<link>'.str_replace ('&', '&', $lien->getURL()).'</link>'."\n";
|
622 |
$xml .= '<link>'.str_replace ('&', '&', $lien->getURL()).'</link>'."\n";
|
623 |
$xml .= '<description>'."\n".'<![CDATA[' ;
|
623 |
$xml .= '<description>'."\n".'<![CDATA[' ;
|
624 |
if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
|
624 |
if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
|
625 |
//$xml .= baz_voir_fiche(0,$ligne['bf_id_fiche']) ;
|
625 |
//$xml .= baz_voir_fiche(0,$ligne['bf_id_fiche']) ;
|
626 |
$xml .= $ligne['bf_description'] ;
|
626 |
$xml .= $ligne['bf_description'] ;
|
627 |
}
|
627 |
}
|
628 |
$xml .= ']]>'."\n".'</description>'."\n";
|
628 |
$xml .= ']]>'."\n".'</description>'."\n";
|
629 |
$xml .= '<pubDate>'.strftime('%d %b %Y %H:%M:%S GMT',strtotime($ligne['bf_date_debut_validite_fiche'])).'</pubDate>'."\n";
|
629 |
$xml .= '<pubDate>'.strftime('%d %b %Y %H:%M:%S GMT',strtotime($ligne['bf_date_debut_validite_fiche'])).'</pubDate>'."\n";
|
630 |
$xml .= '</item>'."\n";
|
630 |
$xml .= '</item>'."\n";
|
631 |
}
|
631 |
}
|
632 |
}
|
632 |
}
|
633 |
else {//pas d'annonces
|
633 |
else {//pas d'annonces
|
634 |
$xml .= '<item>'."\n";
|
634 |
$xml .= '<item>'."\n";
|
635 |
$xml .= '<title>'.BAZ_PAS_D_ANNONCES.'</title>'."\n";
|
635 |
$xml .= '<title>'.BAZ_PAS_D_ANNONCES.'</title>'."\n";
|
636 |
$xml .= '<link>#</link>'."\n";
|
636 |
$xml .= '<link>#</link>'."\n";
|
637 |
$xml .= '<description>'.BAZ_PAS_D_ANNONCES.'</description>'."\n";
|
637 |
$xml .= '<description>'.BAZ_PAS_D_ANNONCES.'</description>'."\n";
|
638 |
$xml .= '<pubDate>'.strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')).'</pubDate>'."\n";
|
638 |
$xml .= '<pubDate>'.strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')).'</pubDate>'."\n";
|
639 |
$xml .= '</item>'."\n";
|
639 |
$xml .= '</item>'."\n";
|
640 |
}
|
640 |
}
|
641 |
$xml .= '</channel>'."\n".'</rss>'."\n";
|
641 |
$xml .= '</channel>'."\n".'</rss>'."\n";
|
642 |
return $xml;
|
642 |
return $xml;
|
643 |
}
|
643 |
}
|
644 |
|
644 |
|
645 |
|
645 |
|
646 |
/** baz_liste() Formate la liste de toutes les annonces actuelles
|
646 |
/** baz_liste() Formate la liste de toutes les annonces actuelles
|
647 |
*
|
647 |
*
|
648 |
* @return string le code HTML a afficher
|
648 |
* @return string le code HTML a afficher
|
649 |
*/
|
649 |
*/
|
650 |
function baz_liste($typeannonce='toutes') {
|
650 |
function baz_liste($typeannonce='toutes') {
|
651 |
//creation du lien pour le formulaire de recherche
|
651 |
//creation du lien pour le formulaire de recherche
|
652 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
|
652 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
|
653 |
if (isset($_REQUEST['recherche_avancee'])) $GLOBALS['_BAZAR_']['url']->addQueryString ('recherche_avancee', $_REQUEST['recherche_avancee']);
|
653 |
if (isset($_REQUEST['recherche_avancee'])) $GLOBALS['_BAZAR_']['url']->addQueryString ('recherche_avancee', $_REQUEST['recherche_avancee']);
|
654 |
$lien_formulaire = preg_replace ('/&/', '&', $GLOBALS['_BAZAR_']['url']->getURL()) ;
|
654 |
$lien_formulaire = preg_replace ('/&/', '&', $GLOBALS['_BAZAR_']['url']->getURL()) ;
|
655 |
$formtemplate = new HTML_QuickForm('formulaire', 'post', $lien_formulaire) ;
|
655 |
$formtemplate = new HTML_QuickForm('formulaire', 'post', $lien_formulaire) ;
|
656 |
$squelette =& $formtemplate->defaultRenderer();
|
656 |
$squelette =& $formtemplate->defaultRenderer();
|
657 |
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'<table style="border:0;width:100%;">'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
|
657 |
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'<table style="border:0;width:100%;">'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
|
658 |
$squelette->setElementTemplate( '<tr>'."\n".'<td style="font-size:12px;width:120px;text-align:right;">'."\n".'{label}'.
|
658 |
$squelette->setElementTemplate( '<tr>'."\n".'<td style="font-size:12px;width:120px;text-align:right;">'."\n".'{label}'.
|
659 |
'<!-- BEGIN required --><span class="symbole_obligatoire"> *</span><!-- END required -->'."\n".
|
659 |
'<!-- BEGIN required --><span class="symbole_obligatoire"> *</span><!-- END required -->'."\n".
|
660 |
' :</td>'."\n".'<td style="text-align:left;padding:5px;"> '."\n".'{element}'."\n".
|
660 |
' :</td>'."\n".'<td style="text-align:left;padding:5px;"> '."\n".'{element}'."\n".
|
661 |
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
|
661 |
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
|
662 |
'</td>'."\n".'</tr>'."\n");
|
662 |
'</td>'."\n".'</tr>'."\n");
|
663 |
$squelette->setElementTemplate( '<tr>'."\n".'<td colspan="2" class="liste_a_cocher"><strong>{label} {element}</strong>'."\n".
|
663 |
$squelette->setElementTemplate( '<tr>'."\n".'<td colspan="2" class="liste_a_cocher"><strong>{label} {element}</strong>'."\n".
|
664 |
'<!-- BEGIN required --><span class="symbole_obligatoire"> *</span><!-- END required -->'."\n".'</td>'."\n".'</tr>'."\n", 'accept_condition');
|
664 |
'<!-- BEGIN required --><span class="symbole_obligatoire"> *</span><!-- END required -->'."\n".'</td>'."\n".'</tr>'."\n", 'accept_condition');
|
665 |
$squelette->setElementTemplate( '<tr><td colspan="2" class="bouton">{label}{element}</td></tr>'."\n", 'valider');
|
665 |
$squelette->setElementTemplate( '<tr><td colspan="2" class="bouton">{label}{element}</td></tr>'."\n", 'valider');
|
666 |
|
666 |
|
667 |
$squelette->setRequiredNoteTemplate("\n".'<tr>'."\n".'<td colspan="2" class="symbole_obligatoire">* {requiredNote}</td></tr>'."\n");
|
667 |
$squelette->setRequiredNoteTemplate("\n".'<tr>'."\n".'<td colspan="2" class="symbole_obligatoire">* {requiredNote}</td></tr>'."\n");
|
668 |
//Traduction de champs requis
|
668 |
//Traduction de champs requis
|
669 |
$formtemplate->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
|
669 |
$formtemplate->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
|
670 |
$formtemplate->setJsWarnings(BAZ_ERREUR_SAISIE,BAZ_VEUILLEZ_CORRIGER);
|
670 |
$formtemplate->setJsWarnings(BAZ_ERREUR_SAISIE,BAZ_VEUILLEZ_CORRIGER);
|
671 |
|
671 |
|
672 |
|
672 |
|
673 |
//cas du formulaire de recherche proposant de chercher parmis tous les types d'annonces
|
673 |
//cas du formulaire de recherche proposant de chercher parmis tous les types d'annonces
|
674 |
//requete pour obtenir l'id et le label des types d'annonces
|
674 |
//requete pour obtenir l'id et le label des types d'annonces
|
675 |
$requete = 'SELECT bn_id_nature, bn_label_nature '.
|
675 |
$requete = 'SELECT bn_id_nature, bn_label_nature '.
|
676 |
'FROM bazar_nature WHERE bn_ce_id_menu='.$GLOBALS['_BAZAR_']['categorie_nature'].' '.
|
676 |
'FROM bazar_nature WHERE bn_ce_id_menu='.$GLOBALS['_BAZAR_']['categorie_nature'].' '.
|
677 |
'ORDER BY bn_label_nature ASC';
|
677 |
'ORDER BY bn_label_nature ASC';
|
678 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
678 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
679 |
if (DB::isError($resultat)) {
|
679 |
if (DB::isError($resultat)) {
|
680 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
680 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
681 |
}
|
681 |
}
|
682 |
//on récupère le nb de types de fiches, pour plus tard
|
682 |
//on récupère le nb de types de fiches, pour plus tard
|
683 |
$nb_type_de_fiches=$resultat->numRows();
|
683 |
$nb_type_de_fiches=$resultat->numRows();
|
684 |
$type_annonce_select['toutes']=BAZ_TOUS_TYPES_FICHES;
|
684 |
$type_annonce_select['toutes']=BAZ_TOUS_TYPES_FICHES;
|
685 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
685 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
686 |
$type_annonce_select[$ligne['bn_id_nature']] = $ligne['bn_label_nature'];
|
686 |
$type_annonce_select[$ligne['bn_id_nature']] = $ligne['bn_label_nature'];
|
687 |
$tableau_typeannonces[] = $ligne['bn_id_nature'] ;
|
687 |
$tableau_typeannonces[] = $ligne['bn_id_nature'] ;
|
688 |
}
|
688 |
}
|
689 |
if ($nb_type_de_fiches>1 && $GLOBALS['_BAZAR_']['typeannonce']=='toutes') {
|
689 |
if ($nb_type_de_fiches>1 && $GLOBALS['_BAZAR_']['typeannonce']=='toutes') {
|
690 |
$res= '<h2>'.BAZ_TOUTES_LES_ANNONCES.'</h2><br />'."\n";
|
690 |
$res= '<h2>'.BAZ_TOUTES_LES_ANNONCES.'</h2><br />'."\n";
|
691 |
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;',
|
691 |
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;',
|
692 |
'onchange' => 'javascript:this.form.submit();');
|
692 |
'onchange' => 'javascript:this.form.submit();');
|
693 |
$formtemplate->addElement ('select', 'nature', BAZ_TYPEANNONCE, $type_annonce_select, $option) ;
|
693 |
$formtemplate->addElement ('select', 'nature', BAZ_TYPEANNONCE, $type_annonce_select, $option) ;
|
694 |
if (isset($_REQUEST['nature'])) {
|
694 |
if (isset($_REQUEST['nature'])) {
|
695 |
$defauts=array('nature'=>$_REQUEST['nature']);
|
695 |
$defauts=array('nature'=>$_REQUEST['nature']);
|
696 |
$formtemplate->setDefaults($defauts);
|
696 |
$formtemplate->setDefaults($defauts);
|
697 |
}
|
697 |
}
|
698 |
}
|
698 |
}
|
699 |
//cas du type d'annonces prédéfini
|
699 |
//cas du type d'annonces prédéfini
|
700 |
else {
|
700 |
else {
|
701 |
$res = '<h2>'.BAZ_TOUTES_LES_ANNONCES_DE_TYPE.' '.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
|
701 |
$res = '<h2>'.BAZ_TOUTES_LES_ANNONCES_DE_TYPE.' '.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
|
702 |
}
|
702 |
}
|
703 |
|
703 |
|
704 |
//requete pour obtenir l'id, le nom et prenom de toutes les personnes ayant depose une fiche
|
704 |
//requete pour obtenir l'id, le nom et prenom de toutes les personnes ayant depose une fiche
|
705 |
// dans le but de construire l'élément de formulaire select avec les noms des émetteurs de fiche
|
705 |
// dans le but de construire l'élément de formulaire select avec les noms des émetteurs de fiche
|
706 |
if (BAZ_RECHERCHE_PAR_EMETTEUR) {
|
706 |
if (BAZ_RECHERCHE_PAR_EMETTEUR) {
|
707 |
$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' '.
|
707 |
$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' '.
|
708 |
'FROM bazar_fiche,'.BAZ_ANNUAIRE.' where' ;
|
708 |
'FROM bazar_fiche,'.BAZ_ANNUAIRE.' WHERE ' ;
|
709 |
|
709 |
|
710 |
$requete .= ' bf_date_debut_validite_fiche<=NOW() AND bf_date_fin_validite_fiche>=NOW() and';
|
710 |
$requete .= ' bf_date_debut_validite_fiche<=NOW() AND bf_date_fin_validite_fiche>=NOW() and';
|
711 |
|
711 |
|
712 |
$requete .= ' bf_ce_utilisateur='.BAZ_CHAMPS_ID.' ';
|
712 |
$requete .= ' bf_ce_utilisateur='.BAZ_CHAMPS_ID.' ';
|
713 |
if (!isset($_REQUEST['nature'])) {
|
713 |
if (!isset($_REQUEST['nature'])) {
|
714 |
if (isset($GLOBALS['_BAZAR_']['id_typeannonce'])) {
|
714 |
if (isset($GLOBALS['_BAZAR_']['id_typeannonce'])) {
|
715 |
$requete .= 'AND bf_ce_nature="'.$GLOBALS['_BAZAR_']['id_typeannonce'].'" ';
|
715 |
$requete .= 'AND bf_ce_nature="'.$GLOBALS['_BAZAR_']['id_typeannonce'].'" ';
|
716 |
}
|
716 |
}
|
717 |
}
|
717 |
}
|
718 |
else {
|
718 |
else {
|
719 |
if ($_REQUEST['nature']!='toutes') {
|
719 |
if ($_REQUEST['nature']!='toutes') {
|
720 |
$requete .= 'AND bf_ce_nature='.$_REQUEST['nature'].' ';
|
720 |
$requete .= 'AND bf_ce_nature='.$_REQUEST['nature'].' ';
|
721 |
}
|
721 |
}
|
722 |
}
|
722 |
}
|
723 |
|
723 |
|
724 |
$requete .= 'ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
|
724 |
$requete .= 'ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
|
725 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
725 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
726 |
if (DB::isError($resultat)) {
|
726 |
if (DB::isError($resultat)) {
|
727 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
727 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
728 |
}
|
728 |
}
|
729 |
$personnes_select['tous']=BAZ_TOUS_LES_EMETTEURS;
|
729 |
$personnes_select['tous']=BAZ_TOUS_LES_EMETTEURS;
|
730 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
730 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
731 |
$personnes_select[$ligne[BAZ_CHAMPS_ID]] = $ligne[BAZ_CHAMPS_NOM]." ".$ligne[BAZ_CHAMPS_PRENOM] ;
|
731 |
$personnes_select[$ligne[BAZ_CHAMPS_ID]] = $ligne[BAZ_CHAMPS_NOM]." ".$ligne[BAZ_CHAMPS_PRENOM] ;
|
732 |
}
|
732 |
}
|
733 |
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
|
733 |
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
|
734 |
$formtemplate->addElement ('select', 'personnes', BAZ_EMETTEUR, $personnes_select, $option) ;
|
734 |
$formtemplate->addElement ('select', 'personnes', BAZ_EMETTEUR, $personnes_select, $option) ;
|
735 |
} else {
|
735 |
} else {
|
736 |
$formtemplate->addElement ('hidden', 'personnes', 'tous') ;
|
736 |
$formtemplate->addElement ('hidden', 'personnes', 'tous') ;
|
737 |
}
|
737 |
}
|
738 |
|
738 |
|
739 |
//pour les super-administrateurs, on peut voir les annonces non validées
|
739 |
//pour les super-administrateurs, on peut voir les annonces non validées
|
740 |
//on verifie si l'utilisateur est administrateur
|
740 |
//on verifie si l'utilisateur est administrateur
|
741 |
$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']) ;
|
741 |
$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']) ;
|
742 |
|
742 |
|
743 |
if ($utilisateur->isSuperAdmin()) {
|
743 |
if ($utilisateur->isSuperAdmin()) {
|
744 |
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
|
744 |
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
|
745 |
$valide_select[0] = BAZ_FICHES_PAS_VALIDEES;
|
745 |
$valide_select[0] = BAZ_FICHES_PAS_VALIDEES;
|
746 |
$valide_select[1] = BAZ_FICHES_VALIDEES;
|
746 |
$valide_select[1] = BAZ_FICHES_VALIDEES;
|
747 |
$valide_select[2] = BAZ_LES_DEUX;
|
747 |
$valide_select[2] = BAZ_LES_DEUX;
|
748 |
$formtemplate->addElement ('select', 'valides', BAZ_VALIDE, $valide_select, $option) ;
|
748 |
$formtemplate->addElement ('select', 'valides', BAZ_VALIDE, $valide_select, $option) ;
|
749 |
$defauts=array('valides'=>1);
|
749 |
$defauts=array('valides'=>1);
|
750 |
$formtemplate->setDefaults($defauts);
|
750 |
$formtemplate->setDefaults($defauts);
|
751 |
}
|
751 |
}
|
752 |
|
752 |
|
753 |
//champs texte pour entrer les mots cles
|
753 |
//champs texte pour entrer les mots cles
|
754 |
$option=array('maxlength'=>60,'style'=>'border:1px solid #000;width:200px;font:12px Myriad, Arial, sans-serif;');
|
754 |
$option=array('maxlength'=>60,'style'=>'border:1px solid #000;width:200px;font:12px Myriad, Arial, sans-serif;');
|
755 |
$formtemplate->addElement('text', 'recherche_mots_cles', BAZ_MOT_CLE, $option) ;
|
755 |
$formtemplate->addElement('text', 'recherche_mots_cles', BAZ_MOT_CLE, $option) ;
|
756 |
$defauts=array('recherche_mots_cles'=>BAZ_MOT_CLE);
|
756 |
$defauts=array('recherche_mots_cles'=>BAZ_MOT_CLE);
|
757 |
$formtemplate->setDefaults($defauts);
|
757 |
$formtemplate->setDefaults($defauts);
|
758 |
|
758 |
|
759 |
//option cachee pour savoir si le formulaire a ete appele deja
|
759 |
//option cachee pour savoir si le formulaire a ete appele deja
|
760 |
$formtemplate->addElement('hidden', 'recherche_effectuee', 1) ;
|
760 |
$formtemplate->addElement('hidden', 'recherche_effectuee', 1) ;
|
761 |
|
761 |
|
762 |
// Ajout des options si un type de fiche a ete choisie
|
762 |
// Ajout des options si un type de fiche a ete choisie
|
763 |
if ( (isset($_REQUEST['nature']) && $_REQUEST['nature'] != 'toutes') || (isset($GLOBALS['_BAZAR_']['categorie_nature']) && $nb_type_de_fiches==1) ) {
|
763 |
if ( (isset($_REQUEST['nature']) && $_REQUEST['nature'] != 'toutes') || (isset($GLOBALS['_BAZAR_']['categorie_nature']) && $nb_type_de_fiches==1) ) {
|
764 |
if ( BAZ_MOTEUR_RECHERCHE_AVANCEE || ( isset($_REQUEST['recherche_avancee'])&&$_REQUEST['recherche_avancee']==1) ) {
|
764 |
if ( BAZ_MOTEUR_RECHERCHE_AVANCEE || ( isset($_REQUEST['recherche_avancee'])&&$_REQUEST['recherche_avancee']==1) ) {
|
765 |
if ($GLOBALS['_BAZAR_']['categorie_nature'] != '') {
|
765 |
if ($GLOBALS['_BAZAR_']['categorie_nature'] != '') {
|
766 |
$champs_requete = '' ;
|
766 |
$champs_requete = '' ;
|
767 |
if (!isset($_REQUEST['nature']) || $_REQUEST['nature'] == '') {
|
767 |
if (!isset($_REQUEST['nature']) || $_REQUEST['nature'] == '') {
|
768 |
$_REQUEST['nature'] = $tableau_typeannonces[0];
|
768 |
$_REQUEST['nature'] = $tableau_typeannonces[0];
|
769 |
}
|
769 |
}
|
770 |
}
|
770 |
}
|
771 |
// Récupération du template
|
771 |
// Récupération du template
|
772 |
$requete = 'SELECT bn_template FROM bazar_nature WHERE bn_id_nature="'.$_REQUEST['nature'].'"';
|
772 |
$requete = 'SELECT bn_template FROM bazar_nature WHERE bn_id_nature="'.$_REQUEST['nature'].'"';
|
773 |
$resultat = $GLOBALS['_BAZAR_']['db']->getOne($requete) ;
|
773 |
$resultat = $GLOBALS['_BAZAR_']['db']->getOne($requete) ;
|
774 |
if (DB::isError($resultat)) {
|
774 |
if (DB::isError($resultat)) {
|
775 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
775 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
776 |
}
|
776 |
}
|
777 |
|
777 |
|
778 |
if ($_REQUEST['recherche_avancee']==1) {
|
778 |
if ($_REQUEST['recherche_avancee']==1) {
|
779 |
foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur);
|
779 |
foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur);
|
780 |
$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '0');
|
780 |
$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '0');
|
781 |
$lien_recherche_de_base = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_DE_BASE.'</a><br />';
|
781 |
$lien_recherche_de_base = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_DE_BASE.'</a><br />';
|
782 |
//lien recherche de base
|
782 |
//lien recherche de base
|
783 |
labelhtml($formtemplate,'',$lien_recherche_de_base,'','','','','');
|
783 |
labelhtml($formtemplate,'',$lien_recherche_de_base,'','','','','');
|
784 |
}
|
784 |
}
|
785 |
|
785 |
|
786 |
$tableau = baz_valeurs_template($resultat) ;
|
786 |
$tableau = baz_valeurs_template($resultat) ;
|
787 |
for ($i=0; $i<count($tableau); $i++) {
|
787 |
for ($i=0; $i<count($tableau); $i++) {
|
788 |
if (($tableau[$i]['type'] == 'liste' || $tableau[$i]['type'] == 'checkbox') && $tableau[$i]['recherche'] == 1) {
|
788 |
if (($tableau[$i]['type'] == 'liste' || $tableau[$i]['type'] == 'checkbox') && $tableau[$i]['recherche'] == 1) {
|
789 |
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
|
789 |
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
|
790 |
$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire'], 1) ;
|
790 |
$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire'], 1) ;
|
791 |
}
|
791 |
}
|
792 |
}
|
792 |
}
|
793 |
|
793 |
|
794 |
}
|
794 |
}
|
795 |
else {
|
795 |
else {
|
796 |
foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur);
|
796 |
foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur);
|
797 |
$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '1');
|
797 |
$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '1');
|
798 |
$lien_recherche_avancee = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_AVANCEE.'</a><br />';
|
798 |
$lien_recherche_avancee = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_AVANCEE.'</a><br />';
|
799 |
}
|
799 |
}
|
800 |
}
|
800 |
}
|
801 |
|
801 |
|
802 |
//lien recherche avancee
|
802 |
//lien recherche avancee
|
803 |
if (isset($lien_recherche_avancee)) {
|
803 |
if (isset($lien_recherche_avancee)) {
|
804 |
labelhtml($formtemplate,'',$lien_recherche_avancee,'','','','','');
|
804 |
labelhtml($formtemplate,'',$lien_recherche_avancee,'','','','','');
|
805 |
}
|
805 |
}
|
806 |
|
806 |
|
807 |
//Bouton de validation du formulaire
|
807 |
//Bouton de validation du formulaire
|
808 |
$option=array('style'=>'border:1px solid #000;width:80px;font:12px Myriad, Arial, sans-serif;');
|
808 |
$option=array('style'=>'border:1px solid #000;width:80px;font:12px Myriad, Arial, sans-serif;');
|
809 |
$bouton[] = &HTML_QuickForm::createElement('submit', 'rechercher', BAZ_RECHERCHER, $option);
|
809 |
$bouton[] = &HTML_QuickForm::createElement('submit', 'rechercher', BAZ_RECHERCHER, $option);
|
810 |
$formtemplate->addGroup($bouton, null, null, '');
|
810 |
$formtemplate->addGroup($bouton, null, null, '');
|
811 |
|
811 |
|
812 |
//affichage du formulaire
|
812 |
//affichage du formulaire
|
813 |
$res.=$formtemplate->toHTML()."\n";
|
813 |
$res.=$formtemplate->toHTML()."\n";
|
814 |
|
814 |
|
815 |
|
815 |
|
816 |
// Ajout de la table bazar_fiche_liste_valeur dans le from de la requete
|
816 |
// Ajout de la table bazar_fiche_liste_valeur dans le from de la requete
|
817 |
$case_coche = false ;
|
817 |
$case_coche = false ;
|
818 |
$nb_jointures=0;
|
818 |
$nb_jointures=0;
|
819 |
$requeteFrom = '' ;
|
819 |
$requeteFrom = '' ;
|
820 |
$requeteWhere = '' ;
|
820 |
$requeteWhere = '' ;
|
821 |
$requeteWhereListe = '' ;
|
821 |
$requeteWhereListe = '' ;
|
822 |
|
822 |
|
823 |
if ( isset($tableau) ) {
|
823 |
if ( isset($tableau) ) {
|
824 |
for ($i = 0; $i < count ($tableau); $i++) {
|
824 |
for ($i = 0; $i < count ($tableau); $i++) {
|
825 |
if ($tableau[$i]['type'] == 'checkbox' || $tableau[$i]['type'] == 'liste') {
|
825 |
if ($tableau[$i]['type'] == 'checkbox' || $tableau[$i]['type'] == 'liste') {
|
826 |
$nb_jointures++;
|
826 |
$nb_jointures++;
|
827 |
$nom_liste = $tableau[$i]['type'].$tableau[$i]['nom_bdd'] ;
|
827 |
$nom_liste = $tableau[$i]['type'].$tableau[$i]['nom_bdd'] ;
|
828 |
if (isset($_REQUEST[$nom_liste]) && is_array($_REQUEST[$nom_liste])) {
|
828 |
if (isset($_REQUEST[$nom_liste]) && is_array($_REQUEST[$nom_liste])) {
|
829 |
$case_coche = true;
|
829 |
$case_coche = true;
|
830 |
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
|
830 |
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
|
831 |
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur IN (' ;
|
831 |
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur IN (' ;
|
832 |
$chaine = '';
|
832 |
$chaine = '';
|
833 |
//var_dump($_REQUEST[$nom_liste]);
|
833 |
//var_dump($_REQUEST[$nom_liste]);
|
834 |
foreach ($_REQUEST[$nom_liste] as $cle =>$valeur) {
|
834 |
foreach ($_REQUEST[$nom_liste] as $cle =>$valeur) {
|
835 |
if ($valeur == 1) {
|
835 |
if ($valeur == 1) {
|
836 |
$chaine .= '"'.$cle.'",' ;
|
836 |
$chaine .= '"'.$cle.'",' ;
|
837 |
}
|
837 |
}
|
838 |
}
|
838 |
}
|
839 |
$requeteWhereListe .= substr ($chaine, 0, strlen ($chaine)-1) ;
|
839 |
$requeteWhereListe .= substr ($chaine, 0, strlen ($chaine)-1) ;
|
840 |
$requeteWhereListe .= ') AND ';
|
840 |
$requeteWhereListe .= ') AND ';
|
841 |
} else {
|
841 |
} else {
|
842 |
if (isset ($_REQUEST[$nom_liste]) && $_REQUEST[$nom_liste]!=0) {
|
842 |
if (isset ($_REQUEST[$nom_liste]) && $_REQUEST[$nom_liste]!=0) {
|
843 |
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
|
843 |
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
|
844 |
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur='.$_REQUEST[$nom_liste].' AND ';
|
844 |
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur='.$_REQUEST[$nom_liste].' AND ';
|
845 |
$case_coche = true;
|
845 |
$case_coche = true;
|
846 |
}
|
846 |
}
|
847 |
}
|
847 |
}
|
848 |
}
|
848 |
}
|
849 |
}
|
849 |
}
|
850 |
}
|
850 |
}
|
851 |
if ($case_coche) {
|
851 |
if ($case_coche) {
|
852 |
for ($i = 0; $i < $nb_jointures ; $i++) {
|
852 |
for ($i = 0; $i < $nb_jointures ; $i++) {
|
853 |
$requeteFrom .= ', bazar_fiche_valeur_liste as bfvl'.($i+1) ;
|
853 |
$requeteFrom .= ', bazar_fiche_valeur_liste as bfvl'.($i+1) ;
|
854 |
$requeteWhere .= ' bfvl'.($i+1).'.bfvl_ce_fiche=bf_id_fiche AND ';
|
854 |
$requeteWhere .= ' bfvl'.($i+1).'.bfvl_ce_fiche=bf_id_fiche AND ';
|
855 |
}
|
855 |
}
|
856 |
$requeteWhere .= $requeteWhereListe;
|
856 |
$requeteWhere .= $requeteWhereListe;
|
857 |
}
|
857 |
}
|
858 |
if (isset($_REQUEST['nature']) && $_REQUEST['nature']!='' && $_REQUEST['nature']!='toutes') {
|
858 |
if (isset($_REQUEST['nature']) && $_REQUEST['nature']!='' && $_REQUEST['nature']!='toutes') {
|
859 |
$requeteWhere = 'bf_ce_nature="'.$_REQUEST['nature'].'" AND '.$requeteWhere;
|
859 |
$requeteWhere = 'bf_ce_nature="'.$_REQUEST['nature'].'" AND '.$requeteWhere;
|
860 |
}
|
860 |
}
|
861 |
|
861 |
|
862 |
//affichage des resultats de la recherche si le formulaire a ete envoye
|
862 |
//affichage des resultats de la recherche si le formulaire a ete envoye
|
863 |
$requeteSQL='';
|
863 |
$requeteSQL='';
|
864 |
if (isset($_REQUEST['recherche_effectuee'])) {
|
864 |
if (isset($_REQUEST['recherche_effectuee'])) {
|
865 |
//preparation de la requete pour trouver les mots cles
|
865 |
//preparation de la requete pour trouver les mots cles
|
866 |
if (($_REQUEST['recherche_mots_cles']!='')and($_REQUEST['recherche_mots_cles']!=BAZ_MOT_CLE)) {
|
866 |
if (($_REQUEST['recherche_mots_cles']!='')and($_REQUEST['recherche_mots_cles']!=BAZ_MOT_CLE)) {
|
867 |
//decoupage des mots cles
|
867 |
//decoupage des mots cles
|
868 |
$recherche = split(' ', $_REQUEST['recherche_mots_cles']) ;
|
868 |
$recherche = split(' ', $_REQUEST['recherche_mots_cles']) ;
|
869 |
$nbmots=count($recherche);
|
869 |
$nbmots=count($recherche);
|
870 |
$requeteSQL='';
|
870 |
$requeteSQL='';
|
871 |
for ($i=0; $i<$nbmots; $i++) {
|
871 |
for ($i=0; $i<$nbmots; $i++) {
|
872 |
if ($i>0) $requeteSQL.=' OR ';
|
872 |
if ($i>0) $requeteSQL.=' OR ';
|
873 |
$requeteSQL.='bf_titre LIKE "%'.$recherche[$i].'%" OR bf_description LIKE "%'.$recherche[$i].'%" ';
|
873 |
$requeteSQL.='bf_titre LIKE "%'.$recherche[$i].'%" OR bf_description LIKE "%'.$recherche[$i].'%" ';
|
874 |
}
|
874 |
}
|
875 |
}
|
875 |
}
|
876 |
if (!isset($_REQUEST['nature'])) {
|
876 |
if (!isset($_REQUEST['nature'])) {
|
877 |
if (!isset ($GLOBALS['_BAZAR_']['id_nature'])) $typedefiches = $tableau_typeannonces;
|
877 |
if (!isset ($GLOBALS['_BAZAR_']['id_nature'])) $typedefiches = $tableau_typeannonces;
|
878 |
else $typedefiches = $GLOBALS['_BAZAR_']['id_nature'] ;
|
878 |
else $typedefiches = $GLOBALS['_BAZAR_']['id_nature'] ;
|
879 |
} else {
|
879 |
} else {
|
880 |
$typedefiches = $_REQUEST['nature'] ;
|
880 |
$typedefiches = $_REQUEST['nature'] ;
|
881 |
if ($typedefiches == 'toutes') $typedefiches = $tableau_typeannonces ;
|
881 |
if ($typedefiches == 'toutes') $typedefiches = $tableau_typeannonces ;
|
882 |
}
|
882 |
}
|
883 |
if ($typeannonce!='toutes') $typedefiches=$typeannonce;
|
883 |
if ($typeannonce!='toutes') $typedefiches=$typeannonce;
|
884 |
if (isset($_REQUEST['valides'])) {$valides=$_REQUEST['valides'];}
|
884 |
if (isset($_REQUEST['valides'])) {$valides=$_REQUEST['valides'];}
|
885 |
else {$valides=1;}
|
885 |
else {$valides=1;}
|
886 |
//generation de la liste de flux a afficher
|
886 |
//generation de la liste de flux a afficher
|
887 |
if (!isset($_REQUEST['personne'])) $_REQUEST['personne']='tous';
|
887 |
if (!isset($_REQUEST['personne'])) $_REQUEST['personne']='tous';
|
888 |
$res .= baz_liste_pagine_HTML($typedefiches, '', $_REQUEST['personne'], $valides, $requeteSQL, $requeteFrom, $requeteWhere);
|
888 |
$res .= baz_liste_pagine_HTML($typedefiches, '', $_REQUEST['personne'], $valides, $requeteSQL, $requeteFrom, $requeteWhere);
|
889 |
}
|
889 |
}
|
890 |
else {
|
890 |
else {
|
891 |
//on affiche toutes les annonces
|
891 |
//on affiche toutes les annonces
|
892 |
$res .= '<br /><p class="zone_info">'."\n".BAZ_ENTRER_VOS_CRITERES_DE_RECHERCHE.'</p>'."\n";
|
892 |
$res .= '<br /><p class="zone_info">'."\n".BAZ_ENTRER_VOS_CRITERES_DE_RECHERCHE.'</p>'."\n";
|
893 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
893 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
894 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FLUX_RSS);
|
894 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FLUX_RSS);
|
895 |
$GLOBALS['_BAZAR_']['url']->addQueryString('annonce', $typeannonce);
|
895 |
$GLOBALS['_BAZAR_']['url']->addQueryString('annonce', $typeannonce);
|
896 |
$GLOBALS['_BAZAR_']['url']->addQueryString('categorie_nature', $GLOBALS['_BAZAR_']['categorie_nature']);
|
896 |
$GLOBALS['_BAZAR_']['url']->addQueryString('categorie_nature', $GLOBALS['_BAZAR_']['categorie_nature']);
|
897 |
$res .= '{{Syndication titre="Les dernières fiches enregistrées" url="'.$GLOBALS['_BAZAR_']['url']->getURL().
|
897 |
$res .= '{{Syndication titre="Les dernières fiches enregistrées" url="'.$GLOBALS['_BAZAR_']['url']->getURL().
|
898 |
'" nb=10 nouvellefenetre=0 formatdate="'.BAZ_TYPE_AFFICHAGE_LISTE.'"}}';
|
898 |
'" nb=10 nouvellefenetre=0 formatdate="'.BAZ_TYPE_AFFICHAGE_LISTE.'"}}';
|
899 |
}
|
899 |
}
|
900 |
return $res;
|
900 |
return $res;
|
901 |
}
|
901 |
}
|
902 |
|
902 |
|
903 |
/**
|
903 |
/**
|
904 |
* Cette fonction renvoie du HTML
|
904 |
* Cette fonction renvoie du HTML
|
905 |
*/
|
905 |
*/
|
906 |
function baz_liste_pagine_HTML($typeannonce, $nbitem, $emetteur, $valide, $requeteSQL = '', $requeteFrom = '', $requeteWhere = '') {
|
906 |
function baz_liste_pagine_HTML($typeannonce, $nbitem, $emetteur, $valide, $requeteSQL = '', $requeteFrom = '', $requeteWhere = '') {
|
907 |
// generation de la requete MySQL personnalisee
|
907 |
// generation de la requete MySQL personnalisee
|
908 |
$req_where=0;
|
908 |
$req_where=0;
|
909 |
$requete = 'SELECT DISTINCT bf_id_fiche, bf_titre, bf_date_debut_validite_fiche '.
|
909 |
$requete = 'SELECT DISTINCT bf_id_fiche, bf_titre, bf_date_debut_validite_fiche '.
|
910 |
'FROM bazar_fiche, bazar_nature '.$requeteFrom.' WHERE '.$requeteWhere;
|
910 |
'FROM bazar_fiche, bazar_nature '.$requeteFrom.' WHERE '.$requeteWhere;
|
911 |
if ($valide!=2) {
|
911 |
if ($valide!=2) {
|
912 |
$requete .= 'bf_statut_fiche='.$valide;
|
912 |
if ($req_where==1) {$requete .= ' AND ';}
|
913 |
$req_where=1;
|
913 |
$req_where=1;
|
- |
|
914 |
$requete .= 'bf_statut_fiche='.$valide;
|
914 |
}
|
915 |
}
|
915 |
|
- |
|
916 |
$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
|
916 |
|
917 |
if ($valide!=0) {
|
- |
|
- |
|
917 |
if ($valide!=0) {
|
- |
|
918 |
if ($req_where==1) {$requete .= ' AND ';}
|
918 |
|
919 |
$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
|
919 |
if ($utilisateur->isSuperAdmin()) {
|
920 |
if ($utilisateur->isSuperAdmin()) {
|
920 |
$req_where=1;
|
921 |
$req_where=1;
|
921 |
} else {
|
922 |
} else {
|
922 |
if ($req_where==1) {
|
923 |
if ($req_where==1) {
|
923 |
$requete .= ' AND ';
|
924 |
$requete .= ' AND ';
|
924 |
}
|
925 |
}
|
925 |
$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
|
926 |
$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
|
926 |
' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
|
927 |
' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
|
927 |
}
|
928 |
}
|
928 |
}
|
929 |
}
|
929 |
if ($emetteur!='' && $emetteur!='tous') {
|
930 |
if ($emetteur!='' && $emetteur!='tous') {
|
930 |
if ($req_where==1) {$requete .= ' AND ';}
|
931 |
if ($req_where==1) {$requete .= ' AND ';}
|
931 |
$requete .= 'bf_ce_utilisateur='.$emetteur;
|
932 |
$requete .= 'bf_ce_utilisateur='.$emetteur;
|
932 |
$req_where=1;
|
933 |
$req_where=1;
|
933 |
//requete pour afficher le nom de la structure
|
934 |
//requete pour afficher le nom de la structure
|
934 |
$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
|
935 |
$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
|
935 |
BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
|
936 |
BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
|
936 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
|
937 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
|
937 |
if (DB::isError($resultat)) {
|
938 |
if (DB::isError($resultat)) {
|
938 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
939 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
939 |
}
|
940 |
}
|
940 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
941 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
941 |
$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
|
942 |
$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
|
942 |
}
|
943 |
}
|
943 |
if ($requeteSQL!='') {
|
944 |
if ($requeteSQL!='') {
|
944 |
if ($req_where==1) {$requete .= ' AND ';}
|
945 |
if ($req_where==1) {$requete .= ' AND ';}
|
945 |
$requete .= '('.$requeteSQL.')';
|
946 |
$requete .= '('.$requeteSQL.')';
|
946 |
$req_where=1;
|
947 |
$req_where=1;
|
947 |
}
|
948 |
}
|
948 |
$requete .= ' ORDER BY bf_date_debut_validite_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
|
949 |
$requete .= ' ORDER BY bf_date_debut_validite_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
|
949 |
if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
|
950 |
if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
|
950 |
|
951 |
|
951 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
952 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
952 |
if (DB::isError($resultat)) {
|
953 |
if (DB::isError($resultat)) {
|
953 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
954 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
954 |
}
|
955 |
}
|
955 |
$res = '<br /><h4>'.BAZ_IL_Y_A.($resultat->numRows()).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n";
|
956 |
$res = '<br /><h4>'.BAZ_IL_Y_A.($resultat->numRows()).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n";
|
956 |
$res .= '<ul>' ;
|
957 |
$res .= '<ul>' ;
|
957 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE);
|
958 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE);
|
958 |
|
959 |
|
959 |
$donnees = array();
|
960 |
$donnees = array();
|
960 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
|
961 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
|
961 |
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne->bf_id_fiche) ;
|
962 |
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne->bf_id_fiche) ;
|
962 |
array_push ($donnees, array ($ligne->bf_id_fiche,$ligne->bf_titre));
|
963 |
array_push ($donnees, array ($ligne->bf_id_fiche,$ligne->bf_titre));
|
963 |
}
|
964 |
}
|
964 |
// Mise en place du Pager
|
965 |
// Mise en place du Pager
|
965 |
include_once PAP_CHEMIN_API_PEAR.'Pager/Pager.php';
|
966 |
include_once PAP_CHEMIN_API_PEAR.'Pager/Pager.php';
|
966 |
$params = array(
|
967 |
$params = array(
|
967 |
'mode' => BAZ_MODE_DIVISION,
|
968 |
'mode' => BAZ_MODE_DIVISION,
|
968 |
'perPage' => BAZ_NOMBRE_RES_PAR_PAGE,
|
969 |
'perPage' => BAZ_NOMBRE_RES_PAR_PAGE,
|
969 |
'delta' => BAZ_DELTA,
|
970 |
'delta' => BAZ_DELTA,
|
970 |
'httpMethod' => 'GET',
|
971 |
'httpMethod' => 'GET',
|
971 |
'extraVars' => array_merge($_POST, $_GET),
|
972 |
'extraVars' => array_merge($_POST, $_GET),
|
972 |
'altNext' => BAZ_SUIVANT,
|
973 |
'altNext' => BAZ_SUIVANT,
|
973 |
'altPrev' => BAZ_PRECEDENT,
|
974 |
'altPrev' => BAZ_PRECEDENT,
|
974 |
'nextImg' => BAZ_SUIVANT,
|
975 |
'nextImg' => BAZ_SUIVANT,
|
975 |
'prevImg' => BAZ_PRECEDENT,
|
976 |
'prevImg' => BAZ_PRECEDENT,
|
976 |
'itemData' => $donnees
|
977 |
'itemData' => $donnees
|
977 |
);
|
978 |
);
|
978 |
$pager = & Pager::factory($params);
|
979 |
$pager = & Pager::factory($params);
|
979 |
$data = $pager->getPageData();
|
980 |
$data = $pager->getPageData();
|
980 |
$links = $pager->getLinks();
|
981 |
$links = $pager->getLinks();
|
981 |
$res .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
|
982 |
$res .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
|
982 |
foreach ($data as $valeur) {
|
983 |
foreach ($data as $valeur) {
|
983 |
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $valeur[0]) ;
|
984 |
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $valeur[0]) ;
|
984 |
$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.$valeur[1].'</a></li>'."\n" ;
|
985 |
$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.$valeur[1].'</a></li>'."\n" ;
|
985 |
}
|
986 |
}
|
986 |
$res .= '</ul>';
|
987 |
$res .= '</ul>';
|
987 |
$res .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
|
988 |
$res .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
|
988 |
|
989 |
|
989 |
return $res ;
|
990 |
return $res ;
|
990 |
}
|
991 |
}
|
991 |
|
992 |
|
992 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
993 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
993 |
*
|
994 |
*
|
994 |
* $Log: not supported by cvs2svn $
|
995 |
* $Log: not supported by cvs2svn $
|
- |
|
996 |
* Revision 1.51 2006/05/23 15:41:27 alexandre_tb
|
- |
|
997 |
* ajout de la numérotation des pages en haut et en bas ds résultats et ajout d'une div class=bazar_numero pour les entourer
|
- |
|
998 |
*
|
995 |
* Revision 1.50 2006/05/22 09:55:12 alexandre_tb
|
999 |
* Revision 1.50 2006/05/22 09:55:12 alexandre_tb
|
996 |
* ajout de la variable recherche_avancee dans l'action du formulaire
|
1000 |
* ajout de la variable recherche_avancee dans l'action du formulaire
|
997 |
*
|
1001 |
*
|
998 |
* Revision 1.49 2006/05/19 13:54:11 florian
|
1002 |
* Revision 1.49 2006/05/19 13:54:11 florian
|
999 |
* stabilisation du moteur de recherche, corrections bugs, lien recherche avancee
|
1003 |
* stabilisation du moteur de recherche, corrections bugs, lien recherche avancee
|
1000 |
*
|
1004 |
*
|
1001 |
* Revision 1.48 2006/05/17 09:50:13 alexandre_tb
|
1005 |
* Revision 1.48 2006/05/17 09:50:13 alexandre_tb
|
1002 |
* Ajout du moteur de recherche évolué et du découpage par page
|
1006 |
* Ajout du moteur de recherche évolué et du découpage par page
|
1003 |
*
|
1007 |
*
|
1004 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
1008 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
1005 |
*/
|
1009 |
*/
|
1006 |
?>
|
1010 |
?>
|