Line 17... |
Line 17... |
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.67 2007-02-28 10:18:56 alexandre_tb Exp $
|
22 |
// CVS : $Id: bazar.fonct.rss.php,v 1.68 2007-03-05 10:27:06 alexandre_tb 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.67 $
|
31 |
*@version $Revision: 1.68 $
|
32 |
// +------------------------------------------------------------------------------------------------------+
|
32 |
// +------------------------------------------------------------------------------------------------------+
|
33 |
*/
|
33 |
*/
|
Line 34... |
Line 34... |
34 |
|
34 |
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
Line 225... |
Line 225... |
225 |
for ($i=0; $i<count($tableau); $i++) {
|
225 |
for ($i=0; $i<count($tableau); $i++) {
|
226 |
if (isset($ligne[$tableau[$i]['nom_bdd']]) && ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' ) ) {
|
226 |
if (isset($ligne[$tableau[$i]['nom_bdd']]) && ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' ) ) {
|
227 |
$val=$tableau[$i]['nom_bdd'];
|
227 |
$val=$tableau[$i]['nom_bdd'];
|
228 |
if (!in_array($val, array ('bf_titre', 'bf_description'))) {
|
228 |
if (!in_array($val, array ('bf_titre', 'bf_description'))) {
|
229 |
if ($ligne[$val] != '' and $ligne[$val] != BAZ_CHOISIR and $ligne[$val] != BAZ_NON_PRECISE) {
|
229 |
if ($ligne[$val] != '' and $ligne[$val] != BAZ_CHOISIR and $ligne[$val] != BAZ_NON_PRECISE) {
|
230 |
$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
|
230 |
$res .= '<span class="rubrique" id="'.$tableau[$i]['nom_bdd'].'_rubrique">'.$tableau[$i]['label'].':</span>'."\n";
|
231 |
$res .= '<span class="description"> '.nl2br($ligne[$val]).'</span>'."\n".'<br />'."\n";
|
231 |
$res .= '<span class="description" id="'.$tableau[$i]['nom_bdd'].'_description"> '.nl2br($ligne[$val]).'</span>'."\n".'<br />'."\n";
|
232 |
}
|
232 |
}
|
233 |
}
|
233 |
}
|
234 |
}
|
234 |
}
|
235 |
elseif ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
|
235 |
elseif ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
|
236 |
//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id
|
236 |
//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id
|
Line 245... |
Line 245... |
245 |
if ($nb>0) $val .= ', ';
|
245 |
if ($nb>0) $val .= ', ';
|
246 |
$val .= $tab[0];
|
246 |
$val .= $tab[0];
|
247 |
$nb++;
|
247 |
$nb++;
|
248 |
}
|
248 |
}
|
249 |
if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
|
249 |
if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
|
250 |
$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
|
250 |
$res .= '<span class="rubrique" id="rubrique_'.$tableau[$i]['nom_bdd'].'">'.$tableau[$i]['label'].':</span>'."\n";
|
251 |
$res .= '<span class="description"> '.$val.'</span>'."\n".'<br />'."\n";
|
251 |
$res .= '<span class="description" id="description_'.$tableau[$i]['nom_bdd'].'"> '.$val.'</span>'."\n".'<br />'."\n";
|
252 |
}
|
252 |
}
|
253 |
}
|
253 |
}
|
254 |
elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
|
254 |
elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
|
255 |
$val=$tableau[$i]['nom_bdd'];
|
255 |
$val=$tableau[$i]['nom_bdd'];
|
256 |
if (!in_array($val, array ('bf_date_debut_validite_fiche', 'bf_date_fin_validite_fiche'))) {
|
256 |
if (!in_array($val, array ('bf_date_debut_validite_fiche', 'bf_date_fin_validite_fiche'))) {
|
257 |
if ($ligne[$val] != '' && $ligne[$val] != '0000-00-00') {
|
257 |
if ($ligne[$val] != '' && $ligne[$val] != '0000-00-00') {
|
258 |
$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
|
258 |
$res .= '<span class="rubrique" id="'.$tableau[$i]['nom_bdd'].'_rubrique">'.$tableau[$i]['label'].':</span>'."\n";
|
259 |
$res .= '<span class="description"> '.strftime('%d.%m.%Y',strtotime($ligne[$val])).'</span>'."\n".'<br />'."\n";
|
259 |
$res .= '<span class="description" id="'.$tableau[$i]['nom_bdd'].'_description"> '.strftime('%d.%m.%Y',strtotime($ligne[$val])).'</span>'."\n".'<br />'."\n";
|
260 |
}
|
260 |
}
|
261 |
}
|
261 |
}
|
262 |
}
|
262 |
}
|
263 |
elseif ( $tableau[$i]['type']=='wikini' ) {
|
263 |
elseif ( $tableau[$i]['type']=='wikini' ) {
|
264 |
$res .= '<div class="lien_wikini"><a href="wikini/'.baz_titre_wiki($ligne["bf_titre"]).'">'.BAZ_ENTRER_PROJET.'</a></div>'."\n";
|
264 |
$res .= '<div class="lien_wikini"><a href="wikini/'.baz_titre_wiki($ligne["bf_titre"]).'">'.BAZ_ENTRER_PROJET.'</a></div>'."\n";
|
Line 903... |
Line 903... |
903 |
}
|
903 |
}
|
904 |
if (isset($_REQUEST['nature']) && $_REQUEST['nature']!='' && $_REQUEST['nature']!='toutes') {
|
904 |
if (isset($_REQUEST['nature']) && $_REQUEST['nature']!='' && $_REQUEST['nature']!='toutes') {
|
905 |
$requeteWhere = 'bf_ce_nature="'.$_REQUEST['nature'].'" AND '.$requeteWhere;
|
905 |
$requeteWhere = 'bf_ce_nature="'.$_REQUEST['nature'].'" AND '.$requeteWhere;
|
906 |
}
|
906 |
}
|
Line -... |
Line 907... |
- |
|
907 |
|
- |
|
908 |
// Appel du template n 1
|
- |
|
909 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php' ;
|
- |
|
910 |
|
- |
|
911 |
$template = new bazarTemplate ($GLOBALS['_BAZAR_']['db']) ;
|
- |
|
912 |
$chaine = $template->getTemplate(1, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
|
- |
|
913 |
if (bazarTemplate::isError ($chaine)) return $chaine->getMessage() ;
|
- |
|
914 |
ob_start();
|
- |
|
915 |
eval ($chaine) ;
|
- |
|
916 |
$res .= ob_get_contents();
|
- |
|
917 |
ob_end_clean() ;
|
- |
|
918 |
|
- |
|
919 |
|
907 |
|
920 |
|
908 |
//affichage des resultats de la recherche si le formulaire a ete envoye
|
921 |
//affichage des resultats de la recherche si le formulaire a ete envoye
|
909 |
$requeteSQL='';
|
922 |
$requeteSQL='';
|
910 |
if (isset($_REQUEST['recherche_effectuee'])) {
|
923 |
if (isset($_REQUEST['recherche_effectuee'])) {
|
911 |
//preparation de la requete pour trouver les mots cles
|
924 |
//preparation de la requete pour trouver les mots cles
|
Line 931... |
Line 944... |
931 |
else {$valides=1;}
|
944 |
else {$valides=1;}
|
932 |
//generation de la liste de flux a afficher
|
945 |
//generation de la liste de flux a afficher
|
933 |
if (!isset($_REQUEST['personne'])) $_REQUEST['personne']='tous';
|
946 |
if (!isset($_REQUEST['personne'])) $_REQUEST['personne']='tous';
|
934 |
$res .= baz_liste_pagine_HTML($typedefiches, '', $_REQUEST['personne'], $valides, $requeteSQL, $requeteFrom, $requeteWhere);
|
947 |
$res .= baz_liste_pagine_HTML($typedefiches, '', $_REQUEST['personne'], $valides, $requeteSQL, $requeteFrom, $requeteWhere);
|
935 |
}
|
948 |
}
|
936 |
else {
|
- |
|
937 |
//on affiche toutes les annonces
|
- |
|
938 |
$res .= '<br /><p class="zone_info">'."\n".BAZ_ENTRER_VOS_CRITERES_DE_RECHERCHE.'</p>'."\n";
|
- |
|
939 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
- |
|
940 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FLUX_RSS);
|
- |
|
941 |
$GLOBALS['_BAZAR_']['url']->addQueryString('annonce', $typeannonce);
|
- |
|
942 |
$GLOBALS['_BAZAR_']['url']->addQueryString('categorie_nature', $GLOBALS['_BAZAR_']['categorie_nature']);
|
- |
|
943 |
/*$res .= '{{Syndication titre="Les dernières fiches enregistrĂ©es" url="'.preg_replace ('/&/', '&', $GLOBALS['_BAZAR_']['url']->getURL()).
|
- |
|
944 |
'" nb=10 nouvellefenetre=0 formatdate="'.BAZ_TYPE_AFFICHAGE_LISTE.'"}}';*/
|
- |
|
945 |
}
|
- |
|
946 |
|
949 |
|
947 |
// Appel du template n 1
|
- |
|
948 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php' ;
|
- |
|
949 |
include_once 'HTML/Template/IT.php';
|
- |
|
950 |
$template = new bazarTemplate ($GLOBALS['_BAZAR_']['db']) ;
|
- |
|
951 |
$chaine = $template->getTemplate(1, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
|
- |
|
952 |
if (bazarTemplate::isError ($chaine)) return $chaine->getMessage() ;
|
- |
|
953 |
$tpl = new HTML_Template_IT() ;
|
- |
|
954 |
$tpl -> setTemplate($chaine);
|
- |
|
955 |
$tpl->setVariable('formulaire', $formtemplate->toHTML()) ;
|
- |
|
956 |
$res .= $tpl->get();
|
- |
|
957 |
return $res;
|
950 |
return $res;
|
- |
|
951 |
|
958 |
}
|
952 |
}
|
Line 959... |
Line 953... |
959 |
|
953 |
|
960 |
/**
|
954 |
/**
|
961 |
* Cette fonction renvoie du HTML
|
955 |
* Cette fonction renvoie du HTML
|
962 |
*/
|
956 |
*/
|
963 |
function baz_liste_pagine_HTML($typeannonce, $nbitem, $emetteur, $valide, $requeteSQL = '', $requeteFrom = '', $requeteWhere = '') {
|
957 |
function baz_liste_pagine_HTML($typeannonce, $nbitem, $emetteur, $valide, $requeteSQL = '', $requeteFrom = '', $requeteWhere = '') {
|
964 |
// generation de la requete MySQL personnalisee
|
958 |
// generation de la requete MySQL personnalisee
|
965 |
$req_where=0;
|
959 |
$req_where=0;
|
966 |
$requete = 'SELECT DISTINCT bf_id_fiche, bf_titre, bf_ce_utilisateur, bf_date_debut_validite_fiche '.
|
960 |
$requete = 'SELECT * '.
|
967 |
'FROM bazar_fiche, bazar_nature '.$requeteFrom.' WHERE '.$requeteWhere;
|
961 |
'FROM bazar_fiche, bazar_nature '.$requeteFrom.' WHERE '.$requeteWhere;
|
968 |
if ($valide!=2) {
|
962 |
if ($valide!=2) {
|
969 |
if ($req_where==1) {$requete .= ' AND ';}
|
963 |
if ($req_where==1) {$requete .= ' AND ';}
|
970 |
$req_where=1;
|
964 |
$req_where=1;
|
Line 1013... |
Line 1007... |
1013 |
$res = '<br /><h4>'.BAZ_IL_Y_A.($resultat->numRows()).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n";
|
1007 |
$res = '<br /><h4>'.BAZ_IL_Y_A.($resultat->numRows()).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n";
|
1014 |
$res .= '<ul>' ;
|
1008 |
$res .= '<ul>' ;
|
1015 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE);
|
1009 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE);
|
Line 1016... |
Line 1010... |
1016 |
|
1010 |
|
1017 |
$donnees = array();
|
1011 |
$donnees = array();
|
1018 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
|
1012 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
1019 |
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne->bf_id_fiche) ;
|
1013 |
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne->bf_id_fiche) ;
|
1020 |
array_push ($donnees, array ($ligne->bf_id_fiche,$ligne->bf_titre,$ligne->bf_ce_utilisateur));
|
1014 |
array_push ($donnees, $ligne);
|
1021 |
}
|
1015 |
}
|
1022 |
// Mise en place du Pager
|
1016 |
// Mise en place du Pager
|
1023 |
include_once PAP_CHEMIN_API_PEAR.'Pager/Pager.php';
|
1017 |
include_once PAP_CHEMIN_API_PEAR.'Pager/Pager.php';
|
1024 |
$params = array(
|
1018 |
$params = array(
|
Line 1034... |
Line 1028... |
1034 |
'itemData' => $donnees
|
1028 |
'itemData' => $donnees
|
1035 |
);
|
1029 |
);
|
1036 |
$pager = & Pager::factory($params);
|
1030 |
$pager = & Pager::factory($params);
|
1037 |
$data = $pager->getPageData();
|
1031 |
$data = $pager->getPageData();
|
1038 |
$links = $pager->getLinks();
|
1032 |
$links = $pager->getLinks();
|
1039 |
$res .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
|
- |
|
- |
|
1033 |
|
1040 |
foreach ($data as $valeur) {
|
1034 |
// Appel du template n 2
|
1041 |
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $valeur[0]) ;
|
1035 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php' ;
|
1042 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE) ;
|
- |
|
1043 |
$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.$valeur[1].'</a>'."\n" ;
|
- |
|
1044 |
if ($utilisateur->isSuperAdmin() || $GLOBALS['id_user']==$valeur[2]) {
|
1036 |
$template = new bazarTemplate ($GLOBALS['_BAZAR_']['db']) ;
|
1045 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_MODIFIER);
|
- |
|
1046 |
$GLOBALS['_BAZAR_']['url']->addQueryString('typeannonce', $GLOBALS['_BAZAR_']['id_typeannonce']);
|
1037 |
$chaine = $template->getTemplate(2, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
|
1047 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('personnes');
|
1038 |
if (bazarTemplate::isError ($chaine)) return $chaine->getMessage() ;
|
1048 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('recherche_effectuee');
|
1039 |
ob_start();
|
1049 |
$res .= '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">('.BAZ_MODIFIER.')</a> ' ;
|
- |
|
1050 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
1040 |
eval ($chaine) ;
|
1051 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_SUPPRESSION);
|
- |
|
1052 |
$res .= '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.'\');">('.BAZ_SUPPRIMER.')</a>' ;
|
- |
|
1053 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
1041 |
$res .= ob_get_contents();
|
1054 |
}
|
- |
|
1055 |
$res .= '</li>';
|
1042 |
ob_end_clean() ;
|
1056 |
}
|
1043 |
|
1057 |
$res .= '</ul>';
|
- |
|
1058 |
$res .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
|
- |
|
Line 1059... |
Line 1044... |
1059 |
|
1044 |
|
1060 |
return $res ;
|
1045 |
return $res ;
|
Line 1061... |
Line 1046... |
1061 |
}
|
1046 |
}
|
1062 |
|
1047 |
|
1063 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
1048 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
- |
|
1049 |
*
|
- |
|
1050 |
* $Log: not supported by cvs2svn $
|
- |
|
1051 |
* Revision 1.67 2007/02/28 10:18:56 alexandre_tb
|
1064 |
*
|
1052 |
* backport de bug depuis la 1.60 de menes
|
1065 |
* $Log: not supported by cvs2svn $
|
1053 |
*
|
1066 |
* Revision 1.64 2007/02/02 14:00:41 alexandre_tb
|
1054 |
* Revision 1.64 2007/02/02 14:00:41 alexandre_tb
|
1067 |
* mise en place d'un template pour l'affichage du moteur de recherche
|
1055 |
* mise en place d'un template pour l'affichage du moteur de recherche
|
1068 |
*
|
1056 |
*
|