Subversion Repositories Applications.bazar

Compare Revisions

Ignore whitespace Rev 224 → Rev 225

/trunk/bibliotheque/bazar.class.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.class.php,v 1.4 2007-03-08 15:12:13 jp_milcent Exp $
// CVS : $Id: bazar.class.php,v 1.5 2007-04-11 08:30:12 neiluj Exp $
/**
*
*@package bazar
27,7 → 27,7
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Florian Schmitt <florian@ecole-et-nature.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
 
/trunk/bibliotheque/bazar.fonct.cal.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.fonct.cal.php,v 1.16 2007-03-22 14:29:27 jp_milcent Exp $
// CVS : $Id: bazar.fonct.cal.php,v 1.17 2007-04-11 08:30:12 neiluj Exp $
/**
*
* Fonctions calendrier du module bazar
29,7 → 29,7
*@author David Delon <david.delon@clapas.net>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.16 $ $Date: 2007-03-22 14:29:27 $
*@version $Revision: 1.17 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
36,6 → 36,7
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Month/Weekdays.php';
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Day.php';
require_once PAP_CHEMIN_RACINE.'api/pear/Calendar/Decorator.php';
68,22 → 69,11
function GestionAffichageCalendrier($type = 'calendrier') {
$retour = '';
 
$url = $GLOBALS['_GEN_commun']['url'] ;
$db =& $GLOBALS['_GEN_commun']['pear_db'] ;
$auth =& $GLOBALS['_GEN_commun']['pear_auth'] ;
// Nettoyage de l'url de la query string
$chaine_url = $url->getQueryString();
$tab_params = explode('&amp;', $chaine_url);
if (count($tab_params) == 0) {
$tab_params = explode('&', $chaine_url);
}
foreach ($tab_params as $param) {
$tab_parametre = explode('=', $param);
$url->removeQueryString($tab_parametre[0]);
}
if (!isset($_GET['y'])) {
$_GET['y'] = date('Y');
}
100,31 → 90,6
$url->addQueryString('m', date('n',$curStamp));
$url->addQueryString('d', date('j',$curStamp));
$cur = $url->getUrl();
 
// Gestion de l'affichage des titres des évènements
if (isset($_GET['ctt']) && $_GET['ctt'] == '1') {
$url->addQueryString('tt', '0');
if ($_GET['tt'] == '0') {
$url->addQueryString('tt', '1');
}
$tc_lien = $url->getUrl();
} else {
$url->addQueryString('tt', '0');
if ($_GET['tt'] == '0') {
$url->addQueryString('tt', '1');
}
$url->addQueryString('ctt', '1');
$tc_lien = $url->getUrl();
}
$url->removeQueryString('ctt');
$url->removeQueryString('tt');
$tc_txt = 'Afficher les titres complets des évènements';
if (isset($_GET['tt'])) {
if ($_GET['tt'] == '0') {
$tc_txt = 'Tronquer les titres des évènements';
$url->addQueryString('tt', $_GET['tt']);
}
}
// Navigation
$prevStamp = $month->prevMonth(true);
139,168 → 104,79
$url->addQueryString('d', date('j',$nextStamp));
$next = $url->getUrl();
// Suppression du paramêtre de troncage des titres
$url->removeQueryString('tt');
$fr_month = array( "1"=>BAZ_JANVIER,"2"=>BAZ_FEVRIER,"3"=>BAZ_MARS,"4"=>BAZ_AVRIL,"5"=>BAZ_MAI,"6"=>BAZ_JUIN,
"7"=>BAZ_JUILLET,"8"=>BAZ_AOUT,"9"=>BAZ_SEPTEMBRE,"10"=>BAZ_OCTOBRE,"11"=>BAZ_NOVEMBRE,"12"=>BAZ_DECEMBRE);
 
// Titre
if ($type=='calendrier') {
// Ajout des styles du bazar
if (defined('PAP_VERSION')) { //si on est dans Papyrus
GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
GEN_stockerFichierScript('domLib', '/api/js/domtooltip/domLib.js');
GEN_stockerFichierScript('domTT', '/api/js/domtooltip/domTT.js');
// DomToolTip
$script = 'var domTT_styleClass = "niceTitle";'."\n";
$script .= 'function nicetitleDecorator(el) {'."\n";
$script .= ' var result = el.title;'."\n";
$script .= ' result = result.replace(new RegExp("\n", "g"), "<br />");'."\n";
$script .= ' if (el.href) {'."\n";
$script .= ' result += "<p>" + el.href + "</p>";'."\n";
$script .= ' }'."\n";
$script .= ' return result;'."\n";
$script .= '}'."\n";
$script .= 'domTT_replaceTitles(nicetitleDecorator);'."\n";
GEN_stockerCodeScript('var domTT_styleClass = "niceTitle";'."\n");
}
$retour .= '<div id="cal_entete">';
$retour .= '<span class="cal_navigation">';
$retour .= '<a id="cal_precedent_lien" href="'.$prev.'" title="Allez au mois précédent"><img id="cal_precedent_img" src="client/bazar/images/cal_precedent.png" alt="&lt;&lt;"/></a>';
$retour .= '&nbsp;&nbsp;';
$retour .= '<span id="cal_encadre_mois_courrant"><a id="cal_mois_courrant" href="'.$cur.'">';
$retour .= $fr_month[(date('n',$curStamp))];
$retour .= '&nbsp;';
$retour .= (date('Y',$curStamp));
$retour .= '</a></span>';
$retour .= '&nbsp;&nbsp;';
$retour .= '<a id="cal_suivant_lien" href="'.$next.'" title="Allez au mois suivant"><img id="cal_suivant_img" src="client/bazar/images/cal_suivant.png" alt="&gt;&gt;"/></a>';
$retour .= '</span>';
$retour .= '<h1 id="cal_titre"><img id="cal_titre_img" src="client/bazar/images/cal_titre.png" alt="Calendrier"/></h1>';
$retour .= '</div>';
$retour .= '<p>'.'<a href="'.$tc_lien.'">'.$tc_txt.'</a>'.'</p>';
} else {
$retour.= "<div class=\"navi\">";
$retour.= "<a href=\"".$prev."\"> &lt;&lt; </a>";
$retour.= "&nbsp;&nbsp;";
$retour.= "<a href=\"".$cur;
$retour.= "\"> ";
$retour.= $fr_month[(date('n',$curStamp))];
$retour.= "&nbsp;";
$retour.= (date('Y',$curStamp));
$retour.= "</a>";
$retour.= "&nbsp;&nbsp;";
$retour.= "<a href=\"".$next."\"> &gt;&gt; </a>";
$retour.= "</div>";
}
$retour.= "<div class=\"navi\">";
$retour.= "<a href=\"".$prev."\"> &lt;&lt; </a>";
 
$retour.= "&nbsp;&nbsp;";
$retour.= "<a href=\"".$cur;
$retour.= "\"> ";
$retour.= $fr_month[(date('n',$curStamp))];
$retour.= "&nbsp;";
$retour.= (date('Y',$curStamp));
$retour.= "</a>";
$retour.= "&nbsp;&nbsp;";
$retour.= "<a href=\"".$next."\"> &gt;&gt; </a>";
 
$retour.= "</div>";
 
$retour.="<br></br>";
 
// Vue Mois calendrier ou vue applette
if ((!isset($_GET['id_fiche']) && ($type=='calendrier')) || ($type=='calendrier_applette')){
// Recherche evenement de la periode selectionnée
$ts_jour_fin_mois = $month->nextMonth('timestamp');
$ts_jour_debut_mois = $month->thisMonth('timestamp');;
$requete_evenements = "SELECT DISTINCT bf_id_fiche, bf_titre, bf_lieu_evenement, DAY(bf_date_debut_evenement) AS bf_jour_debut_evenement, bf_date_debut_evenement, bf_date_fin_evenement, bf_description ".
// TODO : Selectionner element du mois en cours
$requete_evenements = "SELECT DISTINCT bf_id_fiche, bf_titre, bf_lieu_evenement, DAY(bf_date_debut_evenement) AS bf_jour_debut_evenement , bf_date_fin_evenement, bf_description ".
"FROM bazar_fiche, bazar_nature ".
"WHERE bf_date_debut_evenement < '".date('Y-m-d', $ts_jour_fin_mois)."' ".
"AND bf_date_fin_evenement >= '".date('Y-m-d', $ts_jour_debut_mois)."' ".
"WHERE YEAR(bf_date_debut_evenement) = ".date('Y',$curStamp)." ".
"AND month(bf_date_debut_evenement) = ".date('m',$curStamp)." ".
"AND bf_ce_nature = bn_id_nature ".
"AND bn_id_nature IN (".BAZ_NUM_ANNONCE_CALENDRIER.") ".
"AND bf_statut_fiche = 1";
$resultat_evenement = $db->query($requete_evenements);
(DB::isError($resultat_evenement))
? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_evenement->getMessage(), $requete_evenements))
: '';
 
$selection = array();
$evenements = array();
$annee = date('Y', $curStamp);
$mois = date('m', $curStamp);
$tablo_jours = array();
$calcom="";
$selection=array();
$evenements=array();
$prev_curday_ymd=0;
while ($ligne_evenements = $resultat_evenement->fetchRow(DB_FETCHMODE_OBJECT)) {
list($annee_debut, $mois_debut, $jour_debut) = explode('-', $ligne_evenements->bf_date_debut_evenement);
list($annee_fin, $mois_fin, $jour_fin) = explode('-', $ligne_evenements->bf_date_fin_evenement);
$curday_ymd=date('Ym',$curStamp).$ligne_evenements->bf_jour_debut_evenement;
if ($curday_ymd!=$prev_curday_ymd) {
$Day = new Calendar_Day(date('Y',$curStamp),date('m',$curStamp), $ligne_evenements->bf_jour_debut_evenement);
$DiaryEvent = new DiaryEvent($Day);
$prev_curday_ymd=$curday_ymd;
}
$Calendrier = new Calendar($annee_debut, $mois_debut, $jour_debut);
$ts_jour_suivant = $Calendrier->thisDay('timestamp');
$ts_jour_fin = mktime(0,0,0,$mois_fin, $jour_fin, $annee_fin);
$DiaryEvent->setEntry($ligne_evenements);
if ($ts_jour_suivant < $ts_jour_fin) {
//echo "$ts_jour_suivant-";
$naviguer = true;
while ($naviguer) {
// Si le jours suivant est inférieur à la date de fin, on continue...
if ($ts_jour_suivant <= $ts_jour_fin) {
// Si le jours suivant est inférieur à la date de fin du mois courrant, on continue...
if ($ts_jour_suivant < $ts_jour_fin_mois) {
$cle_j = date('Y-m-d', $ts_jour_suivant);
if (!isset($tablo_jours[$cle_j])) {
$tablo_jours[$cle_j]['Calendar_Day'] = new Calendar_Day(date('Y', $ts_jour_suivant),date('m', $ts_jour_suivant), date('d', $ts_jour_suivant));
$tablo_jours[$cle_j]['Diary_Event'] = new DiaryEvent($tablo_jours[$cle_j]['Calendar_Day']);
}
$tablo_jours[$cle_j]['Diary_Event']->setEntry($ligne_evenements);
$ts_jour_suivant = $Calendrier->nextDay('timestamp');
//echo "ici$ts_jour_suivant-";
$Calendrier->setTimestamp($ts_jour_suivant);
//echo "la".$Calendrier->thisDay('timestamp')."-";
} else {
$naviguer = false;
}
} else {
$naviguer = false;
}
}
} else {
$curday_ymd = $annee.$mois.$ligne_evenements->bf_jour_debut_evenement;
$cle_j = $annee.'-'.$mois.'-'.$ligne_evenements->bf_jour_debut_evenement;
if (!isset($tablo_jours[$cle_j])) {
$tablo_jours[$cle_j]['Calendar_Day'] = new Calendar_Day($annee, $mois, $ligne_evenements->bf_jour_debut_evenement);
$tablo_jours[$cle_j]['Diary_Event'] = new DiaryEvent($tablo_jours[$cle_j]['Calendar_Day']);
}
$tablo_jours[$cle_j]['Diary_Event']->setEntry($ligne_evenements);
}
// Add the decorator to the selection
$selection[] = $DiaryEvent;
}
// Add the decorator to the selection
foreach ($tablo_jours as $jour) {
$selection[] = $jour['Diary_Event'];
}
// $calcom = "";
// $selection = array();
// $evenements = array();
// $prev_curday_ymd=0;
// while ($ligne_evenements = $resultat_evenement->fetchRow(DB_FETCHMODE_OBJECT)) {
//
// $curday_ymd=date('Ym',$curStamp).$ligne_evenements->bf_jour_debut_evenement;
// if ($curday_ymd!=$prev_curday_ymd) {
// $Day = new Calendar_Day(date('Y',$curStamp),date('m',$curStamp), $ligne_evenements->bf_jour_debut_evenement);
// $DiaryEvent = new DiaryEvent($Day);
// $prev_curday_ymd=$curday_ymd;
// }
// $DiaryEvent->setEntry($ligne_evenements);
//
// // Add the decorator to the selection
// $selection[] = $DiaryEvent;
// }
// Affichage Calendrier
$month->build($selection);
if ($type == 'calendrier') {
$retour.= '<table class="calendrier">'.
'<colgroup>'.
'<col class="cal_lundi"/>'.
'<col class="cal_mardi"/>'.
'<col class="cal_mercredi"/>'.
'<col class="cal_jeudi"/>'.
'<col class="cal_vendredi"/>'.
'<col class="cal_samedi"/>'.
'<col class="cal_dimanche"/>'.
'</colgroup>'.
'<thead>'.
"<tr>
if ($type=='calendrier') {
$retour.= "<table class=\"calendar\">
<tr>
<th> ". BAZ_LUNDI ."</th>
<th> ". BAZ_MARDI ."</th>
310,21 → 186,11
<th> ". BAZ_SAMEDI ."</th>
<th> ". BAZ_DIMANCHE ."</th>
</tr>
".'</thead>'.'<tbody>';
";
}
else {
$retour.= '<table class="calendrier_applette">'.
'<colgroup>'.
'<col class="cal_lundi"/>'.
'<col class="cal_mardi"/>'.
'<col class="cal_mercredi"/>'.
'<col class="cal_jeudi"/>'.
'<col class="cal_vendredi"/>'.
'<col class="cal_samedi"/>'.
'<col class="cal_dimanche"/>'.
'</colgroup>'.
'<thead>'.
"<tr>
$retour.= "<table class=\"calendar\">
<tr>
<th> ". BAZ_LUNDI_COURT ."</th>
<th> ". BAZ_MARDI_COURT ."</th>
334,7 → 200,7
<th> ". BAZ_SAMEDI_COURT ."</th>
<th> ". BAZ_DIMANCHE_COURT ."</th>
</tr>
".'</thead>'.'<tbody>';
";
}
351,18 → 217,18
$day_ymd=date('Ymd',$dayStamp);
if ( $day->isEmpty() ) {
$class = "cal_ma";
$class = "other_month";
}
else {
if (($day_ymd < $today_ymd)) {
$class= "cal_mp";
$class= "previous_month";
}
else {
if ($day_ymd == $today_ymd) {
$class= "cal_jc";
$class= "current_day";
}
else {
$class="cal_mc";
$class="current_month";
}
}
}
370,40 → 236,30
$url->addQueryString ('y', date('Y',$dayStamp));
$url->addQueryString ('m', date('n',$dayStamp));
$url->addQueryString ('d', date('j',$dayStamp));
$link = $url->getUrl();
// isFirst() to find start of week
if ($day->isFirst()) {
if ($day->isFirst())
$retour.= ( "<tr>\n" );
}
if ($type == 'calendrier') {
$retour.= "<td class=\"".$class."\">".'<span class="cal_j">'.$day->thisDay().'</span>'."\n";
//$retour.= ( "<td class=\"".$class."\"><a href=\"".$link."\">".$day->thisDay()."</a>\n" );
if ($type=='calendrier') {
$retour.= "<td class=\"".$class."\">".$day->thisDay()."\n";
if ($day->isSelected() ) {
$evenements = $day->getEntry();
$evenements_nbre = count($evenements);
$evenemt_xhtml = '';
while ($ligne_evenement = array_pop($evenements)) {
$id_fiches = array();
$id_fiches[] = $ligne_evenement->bf_id_fiche;
$evenements=$day->getEntry();
while ($ligne_evenement=array_pop($evenements)) {
$id_fiches=array();
$id_fiches[]=$ligne_evenement->bf_id_fiche;
$url->addQueryString ('id_fiches',$id_fiches);
$link = $url->getUrl();
if (!isset($_GET['tt']) || (isset($_GET['tt']) && $_GET['tt'] == '1')) {
$titre_taille = strlen($ligne_evenement->bf_titre);
$titre = ($titre_taille > 20)?substr($ligne_evenement->bf_titre, 0, 20).'...':$ligne_evenement->bf_titre;
} else {
$titre = $ligne_evenement->bf_titre;
}
$evenemt_xhtml .= '<li class="tooltip" title="'.$ligne_evenement->bf_titre.'"><a class="cal_evenemt" href="'.$link.'">'.$titre.'</a></li>'."\n";
$retour.= "<a href=\"".$link."\">".$ligne_evenement->bf_titre."</a>\n";
$url->removeQueryString ('id_fiches');
}
if ($evenements_nbre > 0) {
$retour .= '<ul class="cal_evenemt_liste">';
$retour .= $evenemt_xhtml;
$retour .= '</ul>';
}
}
} else {
}
else {
$lien_date= "<td class=\"".$class."\">".$day->thisDay()."\n";
if ($day->isSelected() ) {
$evenements=$day->getEntry();
426,27 → 282,27
$retour.= ( "</tr>\n" );
}
$retour.= "</tbody></table>";
$retour.= "</table>";
}
$retour.= '<script type="text/javascript">//<![CDATA['."\n".$script.'//]]></script>'."\n";
// Vue detail
if ((isset($_GET['id_fiches']))) {
// Ajout des styles du bazar
if (defined('PAP_VERSION')) { //si on est dans Papyrus
GEN_stockerStyleExterne( 'bazar_interne2', 'client/bazar/bazar.interne.css');
}
// Ajout d'un titre pour la page avec la date
$jours = array ('lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche') ;
$mois = array ('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre',
'octobre', 'novembre', 'décembre') ;
$timestamp = strtotime ($_GET['y'].'/'.$_GET['m'].'/'.$_GET['d']) ;
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_NAVIGATION'] = '';
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_TETE'] = '';
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] = '<h1>'.$jours[date('w', $timestamp)].
' '.$_GET['d'].' '.$mois[$_GET['m']-1].' '.$_GET['y'].'</h1>' ;
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_CORPS'] .= baz_voir_fiches(0,$_GET['id_fiches'] );
$GLOBALS['_PAPYRUS_']['rendu']['CONTENU_PIED'] = '';
$GLOBALS['_GEN_commun']['info_menu'] = '';
}
 
// Nettoyage de l'url
/trunk/bibliotheque/bazar.fonct.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.fonct.php,v 1.62 2007-03-08 15:12:13 jp_milcent Exp $
// CVS : $Id: bazar.fonct.php,v 1.63 2007-04-11 08:30:12 neiluj Exp $
/**
*
* Fonctions du module bazar
31,7 → 31,7
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.62 $ $Date: 2007-03-08 15:12:13 $
*@version $Revision: 1.63 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
418,6 → 418,7
}
}
$table->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire'));
$table->updateColAttributes(0, array('align' => 'left'));
$table->updateColAttributes(1, array('align' => 'left'));
555,7 → 556,8
if ($mode == BAZ_ACTION_NOUVEAU) {
unset ($_SESSION['formulaire_annonce_valide']) ;
$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU_V);
$formtemplate->updateAttributes(array('action' => str_replace('&amp;', '&', $lien_formulaire->getURL())));
$formtemplate->updateAttributes(array('action' => str_replace('&amp;', '&', $lien_formulaire->getURL())));
 
$res = baz_afficher_formulaire_annonce('insertion',$formtemplate);
}
608,6 → 610,7
</fieldset>
</form>';
}
 
return $res;
}
 
748,7 → 751,20
}
//cas des dates
elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
$val=$valeur[$tableau[$i]['nom_bdd']]['Y'].'-'.$valeur[$tableau[$i]['nom_bdd']]['m'].'-'.$valeur[$tableau[$i]['nom_bdd']]['d'] ;
// On construit la date selon le format YYYY-mm-dd
$date = $valeur[$tableau[$i]['nom_bdd']]['Y'].'-'.$valeur[$tableau[$i]['nom_bdd']]['m'].'-'.$valeur[$tableau[$i]['nom_bdd']]['d'] ;
// si la date de fin evenement est anterieure a la date de debut, on met la date de debut
// pour eviter les incoherence
if ($tableau[$i]['nom_bdd'] == 'bf_date_fin_evenement' &&
mktime(0,0,0, $valeur['bf_date_debut_evenement']['m'], $valeur['bf_date_debut_evenement']['d'], $valeur['bf_date_debut_evenement']['Y']) >
mktime(0,0,0, $valeur['bf_date_fin_evenement']['m'], $valeur['bf_date_fin_evenement']['d'], $valeur['bf_date_fin_evenement']['Y'])) {
$val = $valeur['bf_date_debut_evenement']['Y'].'-'.$valeur['bf_date_debut_evenement']['m'].'-'.$valeur['bf_date_debut_evenement']['d'] ;
} else {
$val = $valeur[$tableau[$i]['nom_bdd']]['Y'].'-'.$valeur[$tableau[$i]['nom_bdd']]['m'].'-'.$valeur[$tableau[$i]['nom_bdd']]['d'] ;
}
$requete .= $tableau[$i]['nom_bdd'].'="'.$val.'", ' ;
}
//cas des champs texte
1278,6 → 1294,10
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.57.2.12 2007/03/16 14:49:24 alexandre_tb
* si la date de debut d evenement est superieure a la date de fin alors on met
* la meme date dans les deux champs (coherence)
*
* Revision 1.57.2.11 2007/03/07 17:40:57 jp_milcent
* Ajout d'id sur les colonnes et gestion par les CSS des styles du tableau des abonnements.
*
1293,15 → 1313,6
* Revision 1.57.2.7 2007/03/05 10:28:03 alexandre_tb
* correction d un commentaire
*
* Revision 1.61 2007/02/28 10:23:46 alexandre_tb
* backport de bug depuis menes
*
* Revision 1.60 2007/02/15 14:18:38 jp_milcent
* Fusion avec la livraison Menes : 15 février 2007
*
* Revision 1.59 2007/01/22 16:05:56 alexandre_tb
* backport : insertion de la date du jour dans bf_date_debut_validite_fiche quand il n'y a pas ce champs dans le formulaire (évite le 0000-00-00)
*
* Revision 1.57.2.6 2007/02/15 13:42:16 jp_milcent
* Utilisation de IN à la place du = dans les requêtes traitant les catégories de fiches.
* Permet d'utiliser la syntaxe 1,2,3 dans la configuration de categorie_nature.
/trunk/bibliotheque/bazar.fonct.formulaire.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.fonct.formulaire.php,v 1.24 2007-03-08 15:12:13 jp_milcent Exp $
// CVS : $Id: bazar.fonct.formulaire.php,v 1.25 2007-04-11 08:30:12 neiluj Exp $
/**
* Formulaire
*
31,7 → 31,7
//Autres auteurs :
*@author Aleandre GRANIER <alexandre@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.24 $ $Date: 2007-03-08 15:12:13 $
*@version $Revision: 1.25 $ $Date: 2007-04-11 08:30:12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
144,7 → 144,11
);
$formtemplate->addElement('date', $nom_bdd, $label, $optiondate) ;
//gestion des valeurs par défaut (date du jour)
if (isset($defaut) && $defaut!='') $formtemplate->setDefaults(array($nom_bdd => $defaut));
if (isset($defaut) && $defaut!='') {
$tableau_date = explode ('-', $defaut);
$formtemplate->setDefaults(array($nom_bdd => array ('d'=> $tableau_date[2], 'm'=> $tableau_date[1], 'Y'=> $tableau_date[0])));
}
else {
$defauts=array($nom_bdd => array ('d'=>date('d'), 'm'=>date('m'), 'Y'=>date('Y')));
$formtemplate->setDefaults($defauts);
436,17 → 440,16
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.22.2.2 2007/03/07 17:20:19 jp_milcent
* Ajout du nettoyage systématique des URLs.
*
* Revision 1.23 2007/01/18 14:39:28 alexandre_tb
* backport
* Revision 1.22.2.3 2007/03/16 14:48:32 alexandre_tb
* on peut maintenant saisir une date par défaut
* et 0000-00-00 pour des champs vide
*
* Revision 1.22.2.2 2007/03/07 17:20:19 jp_milcent
* Ajout du nettoyage systématique des URLs.
*
* Revision 1.22.2.1 2007/01/17 16:01:37 alexandre_tb
* les dates ne s'affichent pas si elles sont vides.
* les champs dates propose 4 années avant l'année actuelle
*
* Revision 1.22.2.1 2007/01/17 16:01:37 alexandre_tb
* les dates ne s'affichent pas si elles sont vides.
* les champs dates propose 4 années avant l'année actuelle
*
* Revision 1.22 2006/06/02 09:29:07 florian
* debut d'integration de wikini
/trunk/bibliotheque/bazar.fonct.rss.php
1,1206 → 1,1087
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.fonct.rss.php,v 1.77 2007-04-04 15:15:22 neiluj Exp $
/**
*
*@package bazar
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.77 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.class.php';
require_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.fonct.php';
 
 
/** baz_valeur_template() - Renvoi des valeurs inscrite dans le fichier de template
*
* @param string valeur du template de bazar_nature
*
* @return mixed tableau contenant les champs du fichier template
*/
function baz_valeurs_template($valeur_template) {
//Parcours du fichier de templates, pour mettre les champs specifiques
$tableau= array();
$nblignes=0;
$chaine = explode ("\n", $valeur_template);
array_pop($chaine);
foreach ($chaine as $ligne) {
$souschaine = explode ("***", $ligne) ;
$tableau[$nblignes]['type'] = trim($souschaine[0]) ;
if (isset($souschaine[1])) {$tableau[$nblignes]['nom_bdd'] = trim($souschaine[1]);}
else {$tableau[$nblignes]['nom_bdd'] ='';}
if (isset($souschaine[2])) $tableau[$nblignes]['label'] = trim($souschaine[2]);
else {$tableau[$nblignes]['label'] ='';}
if (isset($souschaine[3])) $tableau[$nblignes]['limite1'] = trim($souschaine[3]);
else {$tableau[$nblignes]['limite1'] ='';}
if (isset($souschaine[4])) $tableau[$nblignes]['limite2'] = trim($souschaine[4]);
else {$tableau[$nblignes]['limite2'] ='';}
if (isset($souschaine[5])) $tableau[$nblignes]['defaut'] = trim($souschaine[5]);
else {$tableau[$nblignes]['defaut'] ='';}
if (isset($souschaine[6])) $tableau[$nblignes]['table_source'] = trim($souschaine[6]);
else {$tableau[$nblignes]['table_source'] ='';}
if (isset($souschaine[7])) $tableau[$nblignes]['id_source'] = trim($souschaine[7]);
else {$tableau[$nblignes]['id_source'] ='';}
if (isset($souschaine[8])) $tableau[$nblignes]['obligatoire'] = trim($souschaine[8]);
else {$tableau[$nblignes]['obligatoire'] ='';}
if (isset($souschaine[9])) $tableau[$nblignes]['recherche'] = trim($souschaine[9]);
else {$tableau[$nblignes]['recherche'] ='';}
// traitement des cases à cocher, dans ce cas la, on a une table de jointure entre la table
// de liste et la table bazar_fiche (elle porte un nom du genre bazar_ont_***)
// dans le template, à la place d'un nom de champs dans 'nom_bdd', on a un nom de table
// et 2 noms de champs séparés par un virgule ex : bazar_ont_theme,bot_id_theme,bot_id_fiche
if (isset($tableau[$nblignes]['nom_bdd']) && preg_match('/,/', $tableau[$nblignes]['nom_bdd'])) {
$tableau_info_jointe = explode (',', $tableau[$nblignes]['nom_bdd']) ;
$tableau[$nblignes]['table_jointe'] = $tableau_info_jointe[0] ;
$tableau[$nblignes]['champs_id_fiche'] = $tableau_info_jointe[1] ;
$tableau[$nblignes]['champs_id_table_jointe'] = $tableau_info_jointe[2] ;
}
$nblignes++;
}
return $tableau;
}
 
/** baz_voir_fiches() - Permet de visualiser en detail une liste de fiche au format XHTML
*
* @global boolean Rajoute des informations internes à l'application (date de modification, lien vers la page de départ de l'appli)
* @global integer Tableau d(Identifiant des fiches à afficher
*
* @return string HTML
*/
function baz_voir_fiches($danslappli, $idfiches=array()) {
$res='';
foreach($idfiches as $idfiche) {
$res.=baz_voir_fiche($danslappli, $idfiche);
}
return $res;
}
 
 
/** baz_voir_fiche() - Permet de visualiser en detail une fiche au format XHTML
*
* @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
* @global integer Identifiant de la fiche a afficher
*
* @return string HTML
*/
function baz_voir_fiche($danslappli, $idfiche='') {
$res='';
if (isset($_GET['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_GET['id_fiche'];
if ($idfiche!='') $GLOBALS['_BAZAR_']['id_fiche']=$idfiche;
$url= $GLOBALS['_BAZAR_']['url'];
$url->addQueryString('action', BAZ_VOIR_FICHE);
$url->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
$url = preg_replace ('/&amp;/', '&', $url->getURL()) ;
//cas ou la fiche a ete validee
if (isset($_GET['publiee'])) {
publier_fiche($_GET['publiee']);
}
//cas on une structure s'approprie une ressource
if (isset($_GET['appropriation'])) {
if ($_GET['appropriation']==1) {
$requete = 'INSERT INTO bazar_appropriation VALUES ('.$GLOBALS['_BAZAR_']['id_fiche'].', '.$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID).')';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
elseif ($_GET['appropriation']==0) {
$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);
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
}
//cas ou un commentaire a ete entre
if (isset($_POST['Nom'])) {
$requete = 'INSERT INTO bazar_commentaires VALUES ('.
baz_nextid('bazar_commentaires', 'bc_id_commentaire', $GLOBALS['_BAZAR_']['db']).
', '.$GLOBALS['_BAZAR_']['id_fiche'].', "'.$_POST['Nom'].'", "'.$_POST['Commentaire'].
'", NOW() )';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
//cas ou un commentaire va etre supprime
elseif (isset($_GET['id_commentaire'])) {
$requete = 'DELETE FROM bazar_commentaires WHERE bc_id_commentaire='.$_GET['id_commentaire'].' LIMIT 1';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
else {
if (isset($_GET['action'])) {
if ($_GET['action']==BAZ_VOIR_FICHE) {
//sinon on met a jour le nb de visites pour la fiche, puisque c'est une simple consultation
$requete = 'UPDATE bazar_fiche SET bf_nb_consultations=bf_nb_consultations+1 WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
}
}
$requete = 'SELECT * FROM bazar_fiche WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete))
: '';
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
if (!isset($GLOBALS['_BAZAR_']['typeannonce'])) $GLOBALS['_BAZAR_']['typeannonce'] = $ligne['bf_ce_nature'];
if (!isset($GLOBALS['_BAZAR_']['fiche_valide'])) $GLOBALS['_BAZAR_']['fiche_valide'] = $ligne['bf_statut_fiche'];
//on verifie si l'utilisateur est administrateur
$est_admin=0;
$requete='SELECT bn_id_nature, bn_template, bn_commentaire, bn_label_class FROM bazar_nature WHERE bn_id_nature='.$GLOBALS['_BAZAR_']['id_typeannonce'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$result = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
$id_nature = $result['bn_id_nature'];
if (!isset($GLOBALS['_BAZAR_']['template'])) $GLOBALS['_BAZAR_']['template'] = $result['bn_template'];
if (!isset($GLOBALS['_BAZAR_']['commentaire'])) $GLOBALS['_BAZAR_']['commentaire'] = $result['bn_commentaire'];
if (!isset($GLOBALS['_BAZAR_']['class'])) $GLOBALS['_BAZAR_']['class'] = $result['bn_label_class'];
if ($GLOBALS['AUTH']->getAuth()) {
if ((niveau_droit($result['bn_id_nature'],$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='administrateur')
or(niveau_droit('0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur'))
{
$est_admin=1;
}
}
//debut de la fiche
$res .= '<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
//affiche le titre sous forme d'image
if (isset ($GLOBALS['_BAZAR_']['image_titre']) && $GLOBALS['_BAZAR_']['image_titre']!='') {
$res .= '<img class="BAZ_img_titre" src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_titre'].'" alt="'.$result['bn_label_nature'].'" />'.'<br />'."\n";
}
//affiche le texte sinon
else {
$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
}
$GLOBALS['_BAZAR_']['annonceur'] = $ligne['bf_ce_utilisateur'] ;
//si le template existe, on genere le template
if ((file_exists(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php'))) {
include_once(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php');
$res .=genere_fiche($ligne);
}
//on affiche ligne par ligne sinon
else {
//cas d'une image personalisee
if (isset($ligne['bf_url_image'])) {
$res .= '<div class="BAZ_fiche_image BAZ_fiche_image_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<img class="BAZ_image" src="client/bazar/upload/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" />'."\n";
$res .= '</div>'."\n";
}
//cas d'une image par defaut
elseif (isset ($GLOBALS['_BAZAR_']['image_logo']) && $GLOBALS['_BAZAR_']['image_logo']!='') {
$res .= '<div class="BAZ_fiche_image BAZ_fiche_image_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<img class="BAZ_image" src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_logo'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" width="130" height="130" />'."\n";
$res .= '</div>'."\n";
}
$res .= '<h1 class="BAZ_fiche_titre BAZ_fiche_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.$ligne['bf_titre'].'</h1>'."\n";
$res .= '<div class="BAZ_description BAZ_description_'.$GLOBALS['_BAZAR_']['class'].'">'.nl2br($ligne['bf_description']).'</div>'."\n";
$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
for ($i=0; $i<count($tableau); $i++) {
if (isset($ligne[$tableau[$i]['nom_bdd']]) && ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' ) ) {
$val=$tableau[$i]['nom_bdd'];
if (!in_array($val, array ('bf_titre', 'bf_description'))) {
if ($ligne[$val] != '' and $ligne[$val] != BAZ_CHOISIR and $ligne[$val] != BAZ_NON_PRECISE) {
$res .= '<div class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'">'."\n".'<span class="BAZ_label" id="'.$tableau[$i]['nom_bdd'].'_rubrique">'.$tableau[$i]['label'].':</span>'."\n";
$res .= '<span class="BAZ_texte BAZ_texte_'.$GLOBALS['_BAZAR_']['class'].'" id="'.$tableau[$i]['nom_bdd'].'_description"> '.nl2br($ligne[$val]).'</span>'."\n".'</div>'."\n";
}
}
}
elseif ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id
$requete = 'SELECT blv_label FROM bazar_fiche_valeur_liste, bazar_liste_valeurs WHERE bfvl_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].
' 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'].'"';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
$val='';$nb=0;
while ($tab = $resultat->fetchRow()) {
if ($nb>0) $val .= ', ';
$val .= $tab[0];
$nb++;
}
if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
$res .= '<div class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'">'."\n".'<span class="BAZ_label" id="rubrique_'.$tableau[$i]['nom_bdd'].'">'.$tableau[$i]['label'].':</span>'."\n";
$res .= '<span class="BAZ_texte BAZ_texte_'.$GLOBALS['_BAZAR_']['class'].'" id="description_'.$tableau[$i]['nom_bdd'].'"> '.$val.'</span>'."\n".'</div>'."\n";
}
}
elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
$val=$tableau[$i]['nom_bdd'];
if (!in_array($val, array ('bf_date_debut_validite_fiche', 'bf_date_fin_validite_fiche'))) {
if ($ligne[$val] != '' && $ligne[$val] != '0000-00-00') {
$res .= '<div class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'">'."\n".'<span class="BAZ_label" id="'.$tableau[$i]['nom_bdd'].'_rubrique">'.$tableau[$i]['label'].':</span>'."\n";
$res .= '<span class="BAZ_texte BAZ_texte_'.$GLOBALS['_BAZAR_']['class'].'" id="'.$tableau[$i]['nom_bdd'].'_description"> '.strftime('%d.%m.%Y',strtotime($ligne[$val])).'</span>'."\n".'</div>'."\n";
}
}
}
elseif ( $tableau[$i]['type']=='wikini' ) {
$res .= '<div class="BAZ_lien_wikini BAZ_lien_wikini_'.$GLOBALS['_BAZAR_']['class'].'"><a href="wikini/'.genere_nom_wiki($ligne["bf_titre"], TRUE).'">'.BAZ_ENTRER_PROJET.'</a></div>'."\n";
}
}
//afficher les liens pour l'annonce
$requete = 'SELECT bu_url, bu_descriptif_url FROM bazar_url WHERE bu_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$res .= '<span class="BAZ_label BAZ_label_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LIEN_INTERNET.':</span>'."\n";
$res .= '<span class="BAZ_description BAZ_description_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<ul class="BAZ_liste BAZ_liste_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
while ($ligne1 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li class="BAZ_liste_lien BAZ_liste_lien_'.$GLOBALS['_BAZAR_']['class'].'"><a href="'.$ligne1['bu_url'].'" class="BAZ_lien" target="_blank">'.$ligne1['bu_descriptif_url'].'</a></li>'."\n";
}
$res .= '</ul></span>'."\n";
}
//afficher les fichiers pour l'annonce
$requete = 'SELECT bfj_description, bfj_fichier FROM bazar_fichier_joint WHERE bfj_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$res .= '<span class="BAZ_label BAZ_label_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LISTE_FICHIERS_JOINTS.':</span>'."\n";
$res .= '<span class="BAZ_description BAZ_description_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<ul class="BAZ_liste BAZ_liste_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
while ($ligne2 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li class="BAZ_liste_fichier BAZ_liste_fichier_'.$GLOBALS['_BAZAR_']['class'].'"><a href="client/bazar/upload/'.$ligne2['bfj_fichier'].'">'.$ligne2['bfj_description'].'</a></li>'."\n";
}
$res .= '</ul></span>'."\n";
}
$res .= '<div class="BAZ_bulle_corps BAZ_bulle_corps_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<div class="BAZ_infos_fiche BAZ_infos_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<span class="BAZ_nb_vues BAZ_nb_vues_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_NB_VUS.$ligne['bf_nb_consultations'].BAZ_FOIS.'</span><br />'."\n";
//affichage du redacteur de la fiche
$requete = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.', '.BAZ_CHAMPS_EMAIL.
' FROM '.BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$ligne['bf_ce_utilisateur'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
while ($redacteur = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= BAZ_FICHE_NUMERO.$GLOBALS['_BAZAR_']['id_fiche'].BAZ_ECRITE.'<a href="mailto:'.$redacteur[BAZ_CHAMPS_EMAIL].'">'.$redacteur[BAZ_CHAMPS_PRENOM].' '.$redacteur[BAZ_CHAMPS_NOM].'</a><br />'."\n";
}
//informations complementaires (id fiche, etat publication,... )
if ($danslappli==1) {
if ($GLOBALS['_BAZAR_']['fiche_valide']==1 && $GLOBALS['_BAZAR_']['appropriation']!=1) {
if ($ligne['bf_date_debut_validite_fiche'] != '0000-00-00' && $ligne['bf_date_fin_validite_fiche'] != '0000-00-00') {
$res .= '<span class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'">'.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";
}
}
elseif ($GLOBALS['_BAZAR_']['appropriation']!=1 || $GLOBALS['_BAZAR_']['fiche_valide']!=1) {
$res .= '<span class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_PUBLIEE.':</span> '.BAZ_NON.'<br />'."\n";
}
//affichage des infos et du lien pour la mise a jour de la fiche
if ( $est_admin || $GLOBALS['_BAZAR_']['annonceur']==$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID) ) {
$res .= '<span class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'" id="date_creation">'.BAZ_DATE_CREATION.'</span> '.strftime('%d.%m.%Y %H:%M',strtotime($ligne['bf_date_creation_fiche']))."\n";
$res .= '<span class="BAZ_rubrique BAZ_rubrique_'.$GLOBALS['_BAZAR_']['class'].'" id="date_mise_a_jour">'.BAZ_DATE_MAJ.'</span> '.strftime('%d.%m.%Y %H:%M',strtotime($ligne['bf_date_maj_fiche']))."\n";
}
$res .= '</div>'."\n";
if ( $est_admin || $GLOBALS['_BAZAR_']['annonceur']==$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID) ) {
$res .='<div class="BAZ_actions_fiche BAZ_actions_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
if ( $est_admin ) {
$res .= '<ul>'."\n";
$lien_publie = &$GLOBALS['_BAZAR_']['url'];
$lien_publie->addQueryString('action', BAZ_VOIR_FICHE);
$lien_publie->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
$lien_publie->addQueryString('typeannonce', $ligne['bf_ce_nature']);
if ($GLOBALS['_BAZAR_']['fiche_valide']==0||$GLOBALS['_BAZAR_']['fiche_valide']==2) {
$lien_publie->addQueryString('publiee', 1);
$label_publie=BAZ_VALIDER_LA_FICHE;
$class_publie='_valider';
} elseif ($GLOBALS['_BAZAR_']['fiche_valide']==1) {
$lien_publie->addQueryString('publiee', 0);
$label_publie=BAZ_INVALIDER_LA_FICHE;
$class_publie='_invalider';
}
$res .= '<li class="BAZ_liste'.$class_publie.'"><a href="'.$lien_publie->getURL().'">'.$label_publie.'</a></li>'."\n";
$lien_publie->removeQueryString('publiee');
}
$lien_modifier=$GLOBALS['_BAZAR_']['url'];
$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER);
$lien_modifier->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
$lien_modifier->addQueryString('typeannonce', $ligne['bf_ce_nature']);
$res .= '<li class="BAZ_liste_modifier"><a href="'.$lien_modifier->getURL().'" id="modifier_fiche">'.BAZ_MODIFIER_LA_FICHE.'</a></li>'."\n";
$lien_supprimer=$GLOBALS['_BAZAR_']['url'];
$lien_supprimer->addQueryString('action', BAZ_ACTION_SUPPRESSION);
$lien_supprimer->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
$lien_supprimer->addQueryString('typeannonce', $ligne['bf_ce_nature']);
$res .= '<li class="BAZ_liste_supprimer"><a href="'.$lien_supprimer->getURL().'" id="supprimer_fiche">'.BAZ_SUPPRIMER_LA_FICHE.'</a></li>'."\n";
$res .= '</ul>'."\n";
$res .= '</div>'."\n";
}
}
$res .= '</div>'."\n";
}
$res .= '</div>'."\n";
//on ajoute les appropriations, s'il le faut
if (($danslappli==1)and($GLOBALS['_BAZAR_']['appropriation']==1)) {
$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LES_STRUCTURES_POSSEDANT_UNE_RESSOURCE.'</h2>'."\n";
$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';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
$possede_ressource=0;
if ($resultat->numRows()>0) {
$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
if ($resultat->numRows()==1) $res .= BAZ_STRUCTURE_POSSEDANT.'<br />'."\n";
else $res .= BAZ_STRUCTURES_POSSEDANT.'<br />'."\n";
$res .= '<ul>'."\n";
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li><a href="'.BAZ_URL_ANNUAIRE.'&amp;voir_fiche='.$ligne[BAZ_CHAMPS_ID].'" onclick="javascript:window.open(this.href);return false;">'.$ligne[BAZ_CHAMPS_NOM].'</a></li>'."\n";
if ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)==$ligne[BAZ_CHAMPS_ID]) $possede_ressource=1;
}
$res .= '</ul><br />'."\n";
}
else $res .= BAZ_PAS_D_APPROPRIATION.'<br /><br />'."\n";
$res .='<p class="BAZ_bulle_corps BAZ_bulle_corps_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$lien_appropriation = $GLOBALS['_BAZAR_']['url'];
$lien_appropriation->addQueryString('action', BAZ_VOIR_FICHE);
$lien_appropriation->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
if ($possede_ressource) {
$lien_appropriation->addQueryString('appropriation', 0);
$res .= BAZ_POSSEDE_DEJA_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_VOUS_ENLEVER.'</a>'."\n";
$lien_appropriation->removeQueryString('appropriation');
}
elseif ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
$lien_appropriation->addQueryString('appropriation', 1);
$res .= BAZ_SI_POSSEDE_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_APPARAITRE.'</a>'."\n";
$lien_appropriation->removeQueryString('appropriation');
}
elseif ($GLOBALS['AUTH']->getAuth() && !$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
$res .= BAZ_IL_FAUT_ETRE_STRUCTURE."\n";
}
elseif (!$GLOBALS['AUTH']->getAuth()) {
$res .= BAZ_IL_FAUT_ETRE_IDENTIFIE_STRUCTURE."\n";
}
$res .='</p>'."\n";
$res .= '</div>'."\n";
}
//on ajoute les commentaires, s'il le faut
if (($danslappli==1)and($GLOBALS['_BAZAR_']['commentaire']==1)) {
$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LES_COMMENTAIRES.'</h2>'."\n";
$requete = 'SELECT * FROM bazar_commentaires WHERE bc_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' ORDER BY bc_date ASC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
if ($resultat->numRows()==1) $res .= BAZ_COMMENTAIRE.'<br />'."\n";
else $res .= BAZ_COMMENTAIRES.'<br />'."\n";
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<div class="BAZ_bulle_corps BAZ_bulle_corps_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
//affichage du commentaire
$res .= $ligne['bc_commentaire'].'<br />'."\n";
$res .= '<div class="BAZ_commentaire_admin">'.BAZ_PAR.' : <strong>'.$ligne['bc_nom'].'</strong>'.BAZ_ECRIT_LE.strftime('%d.%m.%Y %H:%M',strtotime($ligne['bc_date']));
//pour les identifies seulement, administrateurs de la rubrique ou superadmins
if ($est_admin==1) {
$url_comment= $GLOBALS['_BAZAR_']['url'];
$url_comment->addQueryString('action', BAZ_VOIR_FICHE);
$url_comment->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
$url_comment->addQueryString('id_commentaire', $ligne['bc_id_commentaire']);
$res .= '&nbsp;&nbsp;<a href="'.$url_comment->getURL().'">'.BAZ_SUPPRIMER.'</a>'."\n";
}
$res .= '</div>'."\n";
$res .= '</div>'."\n";
}
}
else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br /><br />'."\n";
//formulaire des commentaires
$form_commentaire = new HTML_QuickForm('bazar_commentaire', 'post', $url);
$squelette =& $form_commentaire->defaultRenderer();
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<label style="width:200px;">{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
'</label><br />'."\n".'{element}<br />'."\n");
$squelette->setRequiredNoteTemplate("\n".'<span class="symbole_obligatoire"> *{requiredNote}</span>'."\n");
$option=array('style'=>'width:300px;border:1px solid #000;', 'maxlength'=>100);
$form_commentaire->addElement('text', 'Nom', BAZ_ENTREZ_VOTRE_NOM, $option);
$option=array('style'=>'width:95%;height:100px;white-space: pre;padding:3px;border:1px solid #000;');
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php';
$formtexte= new HTML_QuickForm_textarea('Commentaire', BAZ_ENTREZ_VOTRE_COMMENTAIRE, $option);
$form_commentaire->addElement($formtexte) ;
$option=array('style'=>'border:1px solid #000;');
$form_commentaire->addElement('submit', 'Envoyer', BAZ_ENVOYER, $option);
$form_commentaire->addRule('Nom', BAZ_NOM_REQUIS, 'required', '', 'client') ;
$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ;
$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
$res .= $form_commentaire->toHTML();
$res .= '</div>'."\n";
}
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_commentaire');
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
return $res ;
}
 
// merci PHP 5 ...
function mb_str_split($str, $length = 1) {
if ($length < 1) return FALSE;
 
$result = array();
 
for ($i = 0; $i < strlen($str); $i += $length) {
$result[] = substr($str, $i, $length);
}
 
return $result;
}
//
 
function genere_nom_wiki($nom, $spaces = FALSE)
{
// traitement des accents
$nom = str_replace(array('é','è','ë','ê','É','È','Ë','Ê','&','£'), 'e', $nom);
$nom = str_replace(array('à','ä','â','Â','Ä','À','@'), 'a', $nom);
$nom = str_replace(array('ç','Ç'), 'c', $nom);
$nom = str_replace(array('ÿ','¾'), 'y', $nom);
$nom = str_replace(array('ô','ö','ò','Ô','Ò','Ö'), 'o', $nom);
$nom = str_replace(array('ï','î','ì','Î','Ï','Ì'), 'i', $nom);
$nom = str_replace('$', 's', $nom);
$temp = mb_str_split($nom);
$count = 0;
$final = NULL;
foreach($temp as $letter)
{
if(preg_match('/([[:space:]]|[[:punct:]])/', $letter))
{
$final .= ($spaces ? '_' : '');
} elseif(preg_match ('/[a-zA-Z0-9]/', $letter)) {
$final .= (($count == 0 || $count == (strlen($nom) - 1)) ? strtoupper($letter) : strtolower($letter));
}
$count++;
}
// vérifions que le retour n'est pas uniquement un underscore
if(preg_match('/^[[:punct:]]+$/', $final)) return FALSE;
 
// sinon retour du nom formaté
return($final);
}
 
 
 
/** RSSversHTML () transforme un flux RSS (en XML) en page HTML
*
* On passe en paramètre le contenu du flux RSS, on affiche ou non la description,
* et on choisit de format de la date à l'affichage. On a en sortie du code HTML à afficher
*
* @param string le contenu du flux RSS
* @param boolean afficher ou non la description
* @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
*
* @return string le code HTML
*/
function RSSversHTML($rss, $voirdesc, $formatdate, $affichenb) {
if ($rss!='') {
$rawitems='';$title='';$url='';$cat='';$date='';
$res='';
if( eregi('<item>(.*)</item>', $rss, $rawitems ) ) {
$items = explode('<item>', $rawitems[0]);
$res.='<ul id="BAZ_liste_fiche">'."\n";
for( $i = 0; $i < count($items)-1; $i++ ) {
eregi('<title>(.*)</title>',$items[$i+1], $title );
eregi('<link>(.*)</link>',$items[$i+1], $url );
eregi('<description>(.*)</description>',$items[$i+1], $cat);
eregi('<pubDate>(.*)</pubDate>',$items[$i+1], $date);
$res.='<li>';
if ($formatdate=='jm') {$res.=strftime('%d.%m',strtotime($date[1])).': ';}
if ($formatdate=='jma') {$res.=strftime('%d.%m.%Y',strtotime($date[1])).': ';}
if ($formatdate=='jmh') {$res.=strftime('%d.%m %H:%M',strtotime($date[1])).': ';}
if ($formatdate=='jmah') {$res.=strftime('%d.%m.%Y %H:%M',strtotime($date[1])).': ';}
$res.='<a href="'.preg_replace ('/&amp;/', '&', $url[1]).'">'.$title[1].'</a>';
if ($voirdesc) {$res.=$cat[1];}
// Ajout du bouton supprimer pour les superadministrateur
if (($GLOBALS['AUTH']->getAuth() && niveau_droit(0,$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur')and($url[1]!='#')) {
$mon_url = preg_replace ('/&amp;/', '&', $url[1]) ;
$url_suppr = new Net_URL(preg_replace ('/&amp;/', '&', $mon_url)) ;
$url_suppr->addQueryString('action', BAZ_ACTION_SUPPRESSION) ;
$res .= ' ( <a href="'.$url_suppr->getURL().
'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.' ?\');">'.
BAZ_SUPPRIMER.'</a> )'."\n" ;
}
$res.='</li>'."\n";
}
$res.='</ul>'."\n";
if ($affichenb==1) {
//une annonce trouvee, on accorde au singulier
if (((count($items)-1)==1)and($title!=BAZ_PAS_D_ANNONCES)) {
$res = '<br /><h4>'.BAZ_IL_Y_A.' 1 '.BAZ_FICHE_CORRESPONDANTE.'</h4><br />'."\n".$res;
}
//plusieures annonces trouvees, on accorde au pluriel
else {
$res = '<br /><h4>'.BAZ_IL_Y_A.(count($items)-1).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n".$res;
}
}
//cas des fiches pas trouvées
if (((count($items)-1)==1)and($title[1]==BAZ_PAS_D_ANNONCES)) {
$res = '<br /><h4>'.BAZ_PAS_D_ANNONCES.'</h4><br />'."\n";
}
}
}
else $res = BAZ_PAS_D_ANNONCES;
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
return $res;
}
 
/** gen_RSS() - generer un fichier de flux RSS par type d'annonce
*
* @param string Le type de l'annonce (laisser vide pour tout type d'annonce)
* @param integer Le nombre d'annonces a regrouper dans le fichier XML (laisser vide pour toutes)
* @param integer L'identifiant de l'emetteur (laisser vide pour tous)
* @param integer L'etat de validation de l'annonce (laisser 1 pour les annonces validees, 0 pour les non-validees)
* @param string La requete SQL personnalisee
* @param integer La categorie des fiches bazar
*
* @return string Le code du flux RSS
*/
function gen_RSS($typeannonce='', $nbitem='', $emetteur='', $valide=1, $requeteSQL='', $requeteSQLFrom = '', $requeteWhereListe = '', $categorie_nature='') {
// generation de la requete MySQL personnalisee
$req_where=0;
$requete = 'SELECT DISTINCT bf_id_fiche, bf_titre, bf_date_debut_validite_fiche, bf_description, bn_label_nature, bf_date_creation_fiche '.
'FROM bazar_fiche, bazar_nature '.$requeteSQLFrom.' WHERE '.$requeteWhereListe;
if ($valide!=2) {
$requete .= 'bf_statut_fiche='.$valide;
$req_where=1;
}
$nomflux=html_entity_decode(BAZ_DERNIERE_ACTU);
if (!is_array ($typeannonce) && $typeannonce!='' and $typeannonce!='toutes') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bf_ce_nature='.$typeannonce.' and bf_ce_nature=bn_id_nature ';;
$req_where=1;
//le nom du flux devient le type d'annonce
$requete_nom_flux = 'select bn_label_nature from bazar_nature where bn_id_nature = '.$typeannonce;
$nomflux = $GLOBALS['_BAZAR_']['db']->getOne($requete_nom_flux) ;
}
// Cas où il y plusieurs type d annonce demande
if (is_array ($typeannonce)) {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bf_ce_nature IN (' ;
$chaine = '';
foreach ($typeannonce as $valeur) $chaine .= '"'.$valeur.'",' ;
$requete .= substr ($chaine, 0, strlen ($chaine)-1) ;
$requete .= ') and bf_ce_nature=bn_id_nature ';
}
$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
if ($valide!=0) {
if ($utilisateur->isSuperAdmin()) {
$req_where=1;
} else {
if ($req_where==1) {
$requete .= ' AND ';
}
$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
}
}
else $nomflux .= BAZ_A_MODERER;
if ($emetteur!='' && $emetteur!='tous') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bf_ce_utilisateur='.$emetteur;
$req_where=1;
//requete pour afficher le nom de la structure
$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
}
if ($requeteSQL!='') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= '('.$requeteSQL.')';
$req_where=1;
}
if ($categorie_nature!='') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bn_ce_id_menu IN ('.$categorie_nature.') and bf_ce_nature=bn_id_nature ';
$req_where=1;
}
$requete .= ' ORDER BY bf_date_creation_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
include_once PAP_CHEMIN_API_PEAR . 'XML/Util.php' ;
// passage en utf-8 --julien
// --
// setlocale() pour avoir les formats de date valides (w3c) --julien
setlocale(LC_TIME, "C");
$xml = XML_Util::getXMLDeclaration('1.0', 'UTF-8', 'yes') ;
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ;
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('channel');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, utf8_encode(html_entity_decode($nomflux)));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('description', null, BAZ_RSS_DESCRIPTIONSITE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('language', null, 'fr-FR');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('copyright', null, 'Copyright (c) '. date('Y') .' '. BAZ_RSS_NOMSITE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('lastBuildDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT'));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('docs', null, 'http://www.stervinou.com/projets/rss/');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('category', null, BAZ_RSS_CATEGORIE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('managingEditor', null, BAZ_RSS_MANAGINGEDITOR);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('webMaster', null, BAZ_RSS_WEBMASTER);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('ttl', null, '60');
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('image');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, utf8_encode(html_entity_decode(BAZ_RSS_NOMSITE)));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('url', null, BAZ_RSS_LOGOSITE);
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('image');
if ($resultat->numRows() > 0) {
// Creation des items : titre + lien + description + date de publication
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('item');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, utf8_encode(html_entity_decode(($ligne['bf_titre']))));
$xml .= "\r\n ";
$lien=$GLOBALS['_BAZAR_']['url'];
$lien->addQueryString('action', BAZ_VOIR_FICHE);
$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
$xml .= XML_Util::createTag ('link', null, utf8_encode(html_entity_decode($lien->getURL())));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('guid', null, utf8_encode(html_entity_decode($lien->getURL())));
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('description');
$xml .= "\r\n ";
if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
$xml .= XML_Util::createCDataSection ( utf8_encode(html_entity_decode(($ligne['bf_description']))));
}
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('description');
$xml .= "\r\n ";
if ($ligne['bf_date_debut_validite_fiche'] != '0000-00-00' &&
$ligne['bf_date_debut_validite_fiche']>$ligne['bf_date_creation_fiche']) {
$date_pub = $ligne['bf_date_debut_validite_fiche'];
} else $date_pub = $ligne['bf_date_creation_fiche'] ;
$xml .= XML_Util::createTag ('pubDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('item');
}
}
else {//pas d'annonces
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('item');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, utf8_encode(html_entity_decode(BAZ_PAS_D_ANNONCES)));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('link', null, utf8_encode(html_entity_decode($GLOBALS['_BAZAR_']['url']->getUrl())));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('guid', null, utf8_encode(html_entity_decode($GLOBALS['_BAZAR_']['url']->getUrl())));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('description', null, utf8_encode(html_entity_decode(BAZ_PAS_D_ANNONCES)));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('pubDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT',strtotime("01/01/%Y")));
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('item');
}
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement ('channel');
$xml .= "\r\n ";
$xml .= XML_Util::createEndElement('rss') ;
 
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
return $xml;
}
 
 
/** baz_liste() Formate la liste de toutes les annonces actuelles
*
* @return string le code HTML a afficher
*/
function baz_liste($typeannonce='toutes') {
//creation du lien pour le formulaire de recherche
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
if (isset($_REQUEST['recherche_avancee'])) $GLOBALS['_BAZAR_']['url']->addQueryString ('recherche_avancee', $_REQUEST['recherche_avancee']);
$lien_formulaire = preg_replace ('/&amp;/', '&', $GLOBALS['_BAZAR_']['url']->getURL()) ;
$formtemplate = new HTML_QuickForm('formulaire', 'post', $lien_formulaire) ;
$squelette =& $formtemplate->defaultRenderer();
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'<table style="border:0;width:100%;">'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".'<td style="font-size:12px;width:120px;text-align:right;">'."\n".'{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
' :</td>'."\n".'<td style="text-align:left;padding:5px;"> '."\n".'{element}'."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
'</td>'."\n".'</tr>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".'<td colspan="2" class="liste_a_cocher"><strong>{label}&nbsp;{element}</strong>'."\n".
'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".'</td>'."\n".'</tr>'."\n", 'accept_condition');
$squelette->setElementTemplate( '<tr><td colspan="2">{label}{element}</td></tr>'."\n", 'rechercher');
$squelette->setRequiredNoteTemplate("\n".'<tr>'."\n".'<td colspan="2" class="symbole_obligatoire">* {requiredNote}</td></tr>'."\n");
//Traduction de champs requis
$formtemplate->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
$formtemplate->setJsWarnings(BAZ_ERREUR_SAISIE,BAZ_VEUILLEZ_CORRIGER);
//cas du formulaire de recherche proposant de chercher parmis tous les types d'annonces
//requete pour obtenir l'id et le label des types d'annonces
$requete = 'SELECT bn_id_nature, bn_label_nature '.
'FROM bazar_nature WHERE bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') '.
'ORDER BY bn_label_nature ASC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
//on recupere le nb de types de fiches, pour plus tard
$nb_type_de_fiches=$resultat->numRows();
$type_annonce_select['toutes']=BAZ_TOUS_TYPES_FICHES;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$type_annonce_select[$ligne['bn_id_nature']] = $ligne['bn_label_nature'];
$tableau_typeannonces[] = $ligne['bn_id_nature'] ;
}
if ($nb_type_de_fiches>1 && $GLOBALS['_BAZAR_']['typeannonce']=='toutes') {
$res= '<h2>'.BAZ_TOUTES_LES_ANNONCES.'</h2><br />'."\n";
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;',
'onchange' => 'javascript:this.form.submit();');
$formtemplate->addElement ('select', 'nature', BAZ_TYPEANNONCE, $type_annonce_select, $option) ;
if (isset($_REQUEST['nature'])) {
$defauts=array('nature'=>$_REQUEST['nature']);
$formtemplate->setDefaults($defauts);
}
}
//cas du type d'annonces predefini
else {
if ($nb_type_de_fiches==1) {
$GLOBALS['_BAZAR_']['typeannonce']=end($type_annonce_select);
$GLOBALS['_BAZAR_']['id_typeannonce']=key($type_annonce_select);
}
$res = '<h2>'.BAZ_TOUTES_LES_ANNONCES_DE_TYPE.' '.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
}
 
//requete pour obtenir l'id, le nom et prenom de toutes les personnes ayant depose une fiche
// dans le but de construire l'element de formulaire select avec les noms des emetteurs de fiche
if (BAZ_RECHERCHE_PAR_EMETTEUR) {
$requete = 'SELECT DISTINCT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' '.
'FROM bazar_fiche,'.BAZ_ANNUAIRE.' WHERE ' ;
$requete .= ' bf_date_debut_validite_fiche<=NOW() AND bf_date_fin_validite_fiche>=NOW() and';
$requete .= ' bf_ce_utilisateur='.BAZ_CHAMPS_ID.' ';
if (!isset($_REQUEST['nature'])) {
if (isset($GLOBALS['_BAZAR_']['id_typeannonce'])) {
$requete .= 'AND bf_ce_nature="'.$GLOBALS['_BAZAR_']['id_typeannonce'].'" ';
}
}
else {
if ($_REQUEST['nature']!='toutes') {
$requete .= 'AND bf_ce_nature='.$_REQUEST['nature'].' ';
}
}
$requete .= 'ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$personnes_select['tous']=BAZ_TOUS_LES_EMETTEURS;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$personnes_select[$ligne[BAZ_CHAMPS_ID]] = $ligne[BAZ_CHAMPS_NOM]." ".$ligne[BAZ_CHAMPS_PRENOM] ;
}
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
$formtemplate->addElement ('select', 'personnes', BAZ_EMETTEUR, $personnes_select, $option) ;
} else {
$formtemplate->addElement ('hidden', 'personnes', 'tous') ;
}
//pour les super-administrateurs, on peut voir les annonces non validees
//on verifie si l'utilisateur est administrateur
$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']) ;
 
if ($utilisateur->isSuperAdmin()) {
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
$valide_select[0] = BAZ_FICHES_PAS_VALIDEES;
$valide_select[1] = BAZ_FICHES_VALIDEES;
$valide_select[2] = BAZ_LES_DEUX;
$formtemplate->addElement ('select', 'valides', BAZ_VALIDE, $valide_select, $option) ;
$defauts=array('valides'=>1);
$formtemplate->setDefaults($defauts);
}
//champs texte pour entrer les mots cles
$option=array('maxlength'=>60,'style'=>'border:1px solid #000;width:200px;font:12px Myriad, Arial, sans-serif;');
$formtemplate->addElement('text', 'recherche_mots_cles', BAZ_MOT_CLE, $option) ;
//option cachee pour savoir si le formulaire a ete appele deja
$formtemplate->addElement('hidden', 'recherche_effectuee', 1) ;
// Ajout des options si un type de fiche a ete choisie
if ( (isset($_REQUEST['nature']) && $_REQUEST['nature'] != 'toutes') || (isset($GLOBALS['_BAZAR_']['categorie_nature']) && $nb_type_de_fiches==1)) {
if ( BAZ_MOTEUR_RECHERCHE_AVANCEE || ( isset($_REQUEST['recherche_avancee'])&&$_REQUEST['recherche_avancee']==1) ) {
if ($GLOBALS['_BAZAR_']['categorie_nature'] != '') {
$champs_requete = '' ;
if (!isset($_REQUEST['nature']) || $_REQUEST['nature'] == '') {
$_REQUEST['nature'] = $tableau_typeannonces[0];
}
}
// Recuperation du template
$requete = 'SELECT bn_template FROM bazar_nature WHERE bn_id_nature = '.$_REQUEST['nature'];
$resultat = $GLOBALS['_BAZAR_']['db']->getOne($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if (isset($_REQUEST['recherche_avancee']) && $_REQUEST['recherche_avancee']==1) {
foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur);
$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '0');
$lien_recherche_de_base = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_DE_BASE.'</a><br />';
//lien recherche de base
labelhtml($formtemplate,'',$lien_recherche_de_base,'','','','','');
}
$tableau = baz_valeurs_template($resultat) ;
for ($i=0; $i<count($tableau); $i++) {
if (($tableau[$i]['type'] == 'liste' || $tableau[$i]['type'] == 'checkbox') && $tableau[$i]['recherche'] == 1) {
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire'], 1) ;
}
}
}
else {
foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur);
$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '1');
$lien_recherche_avancee = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_AVANCEE.'</a><br />';
foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->removeQueryString($cle);
}
}
//lien recherche avancee
if (isset($lien_recherche_avancee)) {
labelhtml($formtemplate,'',$lien_recherche_avancee,'','','','','');
}
//Bouton de validation du formulaire
$option=array('style'=>'border:1px solid #000;width:100px;font:12px Myriad, Arial, sans-serif;');
$formtemplate->addElement('submit', 'rechercher', BAZ_RECHERCHER, $option);
//affichage du formulaire
//$res.=$formtemplate->toHTML()."\n";
 
// Ajout de la table bazar_fiche_liste_valeur dans le from de la requete
$case_coche = false ;
$nb_jointures=0;
$requeteFrom = '' ;
$requeteWhere = ' bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') AND bn_id_nature='.$GLOBALS['_BAZAR_']['id_typeannonce'].' AND bn_id_nature=bf_ce_nature AND ' ;
$requeteWhereListe = '' ;
if ( isset($tableau) ) {
for ($i = 0; $i < count ($tableau); $i++) {
if ($tableau[$i]['type'] == 'checkbox' || $tableau[$i]['type'] == 'liste') {
$nb_jointures++;
$nom_liste = $tableau[$i]['type'].$tableau[$i]['nom_bdd'] ;
if (isset($_REQUEST[$nom_liste]) && is_array($_REQUEST[$nom_liste])) {
$case_coche = true;
$requeteFrom .= ', bazar_fiche_valeur_liste as bfvl'.($nb_jointures) ;
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
$requeteWhere .= ' bfvl'.($nb_jointures).'.bfvl_ce_fiche=bf_id_fiche AND ';
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur IN (' ;
$chaine = '';
//var_dump($_REQUEST[$nom_liste]);
foreach ($_REQUEST[$nom_liste] as $cle =>$valeur) {
if ($valeur == 1) {
$chaine .= '"'.$cle.'",' ;
}
}
$requeteWhereListe .= substr ($chaine, 0, strlen ($chaine)-1) ;
$requeteWhereListe .= ') AND ';
} else {
if (isset ($_REQUEST[$nom_liste]) && $_REQUEST[$nom_liste]!=0) {
$requeteFrom .= ', bazar_fiche_valeur_liste as bfvl'.($nb_jointures) ;
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur='.$_REQUEST[$nom_liste].' AND ';
$requeteWhere .= ' bfvl'.($nb_jointures).'.bfvl_ce_fiche=bf_id_fiche AND ';
$case_coche = true;
}
}
}
}
}
if ($case_coche) {
$requeteWhere .= $requeteWhereListe;
}
if (isset($_REQUEST['nature']) && $_REQUEST['nature']!='' && $_REQUEST['nature']!='toutes') {
$requeteWhere = 'bf_ce_nature="'.$_REQUEST['nature'].'" AND '.$requeteWhere;
}
if (BAZ_UTILISE_TEMPLATE) {
// Appel du template n 1
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php' ;
$template = new bazarTemplate ($GLOBALS['_BAZAR_']['db']) ;
$chaine = $template->getTemplate(1, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
if (bazarTemplate::isError ($chaine)) return $chaine->getMessage() ;
ob_start();
eval ($chaine) ;
$res .= ob_get_contents();
ob_end_clean() ;
} else {
$res .= $formtemplate->toHTML();
if (!isset($_REQUEST['recherche_effectuee'])) {
$res .= '<p class="zone_info">'.BAZ_ENTRER_VOS_CRITERES_DE_RECHERCHE.'</p>'."\n";
$GLOBALS['_BAZAR_']['url']->addQueryString('action',BAZ_VOIR_FLUX_RSS);
$GLOBALS['_BAZAR_']['url']->addQueryString('annonce',$GLOBALS['_BAZAR_']['id_typeannonce']);
if ($GLOBALS['_BAZAR_']['categorie_nature']!=0) $GLOBALS['_BAZAR_']['url']->addQueryString('categorie_nature',$GLOBALS['_BAZAR_']['categorie_nature']);
$res .= '{{Syndication titre="Derni&egrave;res actualit&eacute;s" url="'.$GLOBALS['_BAZAR_']['url']->getURL().'" nb=10 nouvellefenetre=0 formatdate="'.BAZ_FORMAT_DATE_DEFAUT.'"}}';
}
}
 
//affichage des resultats de la recherche si le formulaire a ete envoye
$requeteSQL='';
if (isset($_REQUEST['recherche_effectuee'])) {
//preparation de la requete pour trouver les mots cles
if (($_REQUEST['recherche_mots_cles']!='')and($_REQUEST['recherche_mots_cles']!=BAZ_MOT_CLE)) {
//decoupage des mots cles
$recherche = split(' ', $_REQUEST['recherche_mots_cles']) ;
$nbmots=count($recherche);
$requeteSQL='';
for ($i=0; $i<$nbmots; $i++) {
if ($i>0) $requeteSQL.=' OR ';
$requeteSQL.='bf_titre LIKE "%'.$recherche[$i].'%" OR bf_description LIKE "%'.$recherche[$i].'%" ';
}
}
if (!isset($_REQUEST['nature'])) {
if (!isset ($GLOBALS['_BAZAR_']['id_nature'])) $typedefiches = $tableau_typeannonces;
else $typedefiches = $GLOBALS['_BAZAR_']['id_nature'] ;
} else {
$typedefiches = $_REQUEST['nature'] ;
if ($typedefiches == 'toutes') $typedefiches = $tableau_typeannonces ;
}
if ($typeannonce!='toutes') $typedefiches=$typeannonce;
if (isset($_REQUEST['valides'])) {$valides=$_REQUEST['valides'];}
else {$valides=1;}
//generation de la liste de flux a afficher
if (!isset($_REQUEST['personnes'])) $_REQUEST['personnes']='tous';
$res .= baz_liste_pagine_HTML($typedefiches, '', $_REQUEST['personnes'], $valides, $requeteSQL, $requeteFrom, $requeteWhere);
}
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('annonce');
$GLOBALS['_BAZAR_']['url']->removeQueryString('categorie_nature');
$GLOBALS['_BAZAR_']['url']->removeQueryString('recherche_avancee');
return $res;
}
 
/**
* Cette fonction renvoie du HTML
*/
function baz_liste_pagine_HTML($typeannonce, $nbitem, $emetteur, $valide, $requeteSQL = '', $requeteFrom = '', $requeteWhere = '') {
// generation de la requete MySQL personnalisee
$req_where=0;
$requete = 'SELECT * '.
'FROM bazar_fiche, bazar_nature '.$requeteFrom.' WHERE '.$requeteWhere;
if ($valide!=2) {
if ($req_where==1) {$requete .= ' AND ';}
$req_where=1;
$requete .= 'bf_statut_fiche='.$valide;
} else {
$requete .= '1 ' ;
}
$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
if ($valide!=0) {
if ($utilisateur->isSuperAdmin()) {
$req_where=1;
} else {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
$req_where=1;
}
}
if ($emetteur!='' && $emetteur!='tous') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bf_ce_utilisateur='.$emetteur;
$req_where=1;
}
if ($requeteSQL!='') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= '('.$requeteSQL.')';
$req_where=1;
}
$requete .= ' ORDER BY bf_date_debut_validite_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
return $resultat->getMessage().'<br /><br />'.$resultat->getDebugInfo() ;
}
$res = '<br /><h4>'.BAZ_IL_Y_A.($resultat->numRows()).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n";
//$res .= 'requete: '. $requete. '<br />';
$res .= '<ul>' ;
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE);
$donnees = array();
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne['bf_id_fiche']) ;
array_push ($donnees, $ligne);
}
// Mise en place du Pager
include_once PAP_CHEMIN_API_PEAR.'Pager/Pager.php';
$params = array(
'mode' => BAZ_MODE_DIVISION,
'perPage' => BAZ_NOMBRE_RES_PAR_PAGE,
'delta' => BAZ_DELTA,
'httpMethod' => 'GET',
'extraVars' => array_merge($_POST, $_GET),
'altNext' => BAZ_SUIVANT,
'altPrev' => BAZ_PRECEDENT,
'nextImg' => BAZ_SUIVANT,
'prevImg' => BAZ_PRECEDENT,
'itemData' => $donnees
);
$pager = & Pager::factory($params);
$data = $pager->getPageData();
$links = $pager->getLinks();
if (BAZ_UTILISE_TEMPLATE) {
//Appel du template n 2
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php' ;
$template = new bazarTemplate ($GLOBALS['_BAZAR_']['db']) ;
$chaine = $template->getTemplate(2, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
if (bazarTemplate::isError ($chaine)) return $chaine->getMessage() ;
ob_start();
eval ($chaine) ;
$res .= ob_get_contents();
ob_end_clean() ;
} else {
$res .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
foreach ($data as $valeur) {
$res .='<li class="BAZ_'.$valeur['bn_label_class'].'">'."\n";
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $valeur['bf_id_fiche']) ;
if ($utilisateur->isSuperAdmin() || $GLOBALS['id_user']==$valeur['bf_ce_utilisateur']) {
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_MODIFIER);
$GLOBALS['_BAZAR_']['url']->addQueryString('typeannonce', $GLOBALS['_BAZAR_']['id_typeannonce']);
$GLOBALS['_BAZAR_']['url']->removeQueryString('personnes');
$GLOBALS['_BAZAR_']['url']->removeQueryString('recherche_effectuee');
$res .= '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">('.BAZ_MODIFIER.')</a>&nbsp;'."\n";
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_SUPPRESSION);
$res .='<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.'\');">('.BAZ_SUPPRIMER.')</a>&nbsp;'."\n";
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
}
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE) ;
$res .= '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.$valeur['bf_titre'].'</a>'."\n";
$res .='</li>'."\n";
}
$res .= '</ul>'."\n".'<div class="bazar_numero">'.$pager->links.'</div>'."\n";
}
 
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
$GLOBALS['_BAZAR_']['url']->removeQueryString('recherche_avancee');
 
return $res ;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.fonct.rss.php,v 1.78 2007-04-11 08:30:12 neiluj Exp $
/**
*
*@package bazar
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.78 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.class.php';
require_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.fonct.php';
 
 
/** baz_valeur_template() - Renvoi des valeurs inscrite dans le fichier de template
*
* @param string valeur du template de bazar_nature
*
* @return mixed tableau contenant les champs du fichier template
*/
function baz_valeurs_template($valeur_template) {
//Parcours du fichier de templates, pour mettre les champs specifiques
$tableau= array();
$nblignes=0;
$chaine = explode ("\n", $valeur_template);
array_pop($chaine);
foreach ($chaine as $ligne) {
$souschaine = explode ("***", $ligne) ;
$tableau[$nblignes]['type'] = trim($souschaine[0]) ;
if (isset($souschaine[1])) {$tableau[$nblignes]['nom_bdd'] = trim($souschaine[1]);}
else {$tableau[$nblignes]['nom_bdd'] ='';}
if (isset($souschaine[2])) $tableau[$nblignes]['label'] = trim($souschaine[2]);
else {$tableau[$nblignes]['label'] ='';}
if (isset($souschaine[3])) $tableau[$nblignes]['limite1'] = trim($souschaine[3]);
else {$tableau[$nblignes]['limite1'] ='';}
if (isset($souschaine[4])) $tableau[$nblignes]['limite2'] = trim($souschaine[4]);
else {$tableau[$nblignes]['limite2'] ='';}
if (isset($souschaine[5])) $tableau[$nblignes]['defaut'] = trim($souschaine[5]);
else {$tableau[$nblignes]['defaut'] ='';}
if (isset($souschaine[6])) $tableau[$nblignes]['table_source'] = trim($souschaine[6]);
else {$tableau[$nblignes]['table_source'] ='';}
if (isset($souschaine[7])) $tableau[$nblignes]['id_source'] = trim($souschaine[7]);
else {$tableau[$nblignes]['id_source'] ='';}
if (isset($souschaine[8])) $tableau[$nblignes]['obligatoire'] = trim($souschaine[8]);
else {$tableau[$nblignes]['obligatoire'] ='';}
if (isset($souschaine[9])) $tableau[$nblignes]['recherche'] = trim($souschaine[9]);
else {$tableau[$nblignes]['recherche'] ='';}
// traitement des cases à cocher, dans ce cas la, on a une table de jointure entre la table
// de liste et la table bazar_fiche (elle porte un nom du genre bazar_ont_***)
// dans le template, à la place d'un nom de champs dans 'nom_bdd', on a un nom de table
// et 2 noms de champs séparés par un virgule ex : bazar_ont_theme,bot_id_theme,bot_id_fiche
if (isset($tableau[$nblignes]['nom_bdd']) && preg_match('/,/', $tableau[$nblignes]['nom_bdd'])) {
$tableau_info_jointe = explode (',', $tableau[$nblignes]['nom_bdd']) ;
$tableau[$nblignes]['table_jointe'] = $tableau_info_jointe[0] ;
$tableau[$nblignes]['champs_id_fiche'] = $tableau_info_jointe[1] ;
$tableau[$nblignes]['champs_id_table_jointe'] = $tableau_info_jointe[2] ;
}
$nblignes++;
}
return $tableau;
}
 
/** baz_voir_fiches() - Permet de visualiser en detail une liste de fiche au format XHTML
*
* @global boolean Rajoute des informations internes à l'application (date de modification, lien vers la page de départ de l'appli)
* @global integer Tableau d(Identifiant des fiches à afficher
*
* @return string HTML
*/
function baz_voir_fiches($danslappli, $idfiches=array()) {
$res='';
foreach($idfiches as $idfiche) {
$res.=baz_voir_fiche($danslappli, $idfiche);
}
return $res;
}
 
 
/** baz_voir_fiche() - Permet de visualiser en detail une fiche au format XHTML
*
* @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
* @global integer Identifiant de la fiche a afficher
*
* @return string HTML
*/
function baz_voir_fiche($danslappli, $idfiche='') {
$res='';
if (isset($_GET['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_GET['id_fiche'];
if ($idfiche!='') $GLOBALS['_BAZAR_']['id_fiche']=$idfiche;
$url= $GLOBALS['_BAZAR_']['url'];
$url->addQueryString('action', BAZ_VOIR_FICHE);
$url->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
$url = preg_replace ('/&amp;/', '&', $url->getURL()) ;
//cas ou la fiche a été validee
if (isset($_GET['publiee'])) {
publier_fiche($_GET['publiee']);
}
//cas on une structure s'approprie une ressource
if (isset($_GET['appropriation'])) {
if ($_GET['appropriation']==1) {
$requete = 'INSERT INTO bazar_appropriation VALUES ('.$GLOBALS['_BAZAR_']['id_fiche'].', '.$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID).')';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
elseif ($_GET['appropriation']==0) {
$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);
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
}
//cas ou un commentaire a été entre
if (isset($_POST['Nom'])) {
$requete = 'INSERT INTO bazar_commentaires VALUES ('.
baz_nextid('bazar_commentaires', 'bc_id_commentaire', $GLOBALS['_BAZAR_']['db']).
', '.$GLOBALS['_BAZAR_']['id_fiche'].', "'.$_POST['Nom'].'", "'.$_POST['Commentaire'].
'", NOW() )';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
//cas ou un commentaire va etre supprime
elseif (isset($_GET['id_commentaire'])) {
$requete = 'DELETE FROM bazar_commentaires WHERE bc_id_commentaire='.$_GET['id_commentaire'].' LIMIT 1';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
else {
if (isset($_GET['action'])) {
if ($_GET['action']==BAZ_VOIR_FICHE) {
//sinon on met a jour le nb de visites pour la fiche, puisque c'est une simple consultation
$requete = 'UPDATE bazar_fiche SET bf_nb_consultations=bf_nb_consultations+1 WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
}
}
}
$requete = 'SELECT * FROM bazar_fiche WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete))
: '';
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
if (!isset($GLOBALS['_BAZAR_']['typeannonce'])) $GLOBALS['_BAZAR_']['typeannonce'] = $ligne['bf_ce_nature'];
//on verifie si l'utilisateur est administrateur
$est_admin=0;
$requete='SELECT bn_id_nature, bn_template, bn_commentaire FROM bazar_nature WHERE bn_id_nature="'.$GLOBALS['_BAZAR_']['typeannonce'].'"';
 
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$result = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
$id_nature = $result['bn_id_nature'];
if (!isset($GLOBALS['_BAZAR_']['template'])) $GLOBALS['_BAZAR_']['template'] = $result['bn_template'];
if (!isset($GLOBALS['_BAZAR_']['commentaire'])) $GLOBALS['_BAZAR_']['commentaire'] = $result['bn_commentaire'];
if ($GLOBALS['AUTH']->getAuth()) {
if ((niveau_droit($result['bn_id_nature'],$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='administrateur')
or(niveau_droit('0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur'))
{
$est_admin=1;
}
}
//affiche le titre sous forme d'image
if (isset ($GLOBALS['_BAZAR_']['image_titre']) && $GLOBALS['_BAZAR_']['image_titre']!='') {
$res .= '<img id="BAZ_img_titre" src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_titre'].'" alt="'.$result['bn_label_nature'].'" />'.'<br />'."\n";
}
//affiche le texte sinon
else {
//$res .= '<h2 class="BAZ_titre">'.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
}
$res .= '<div class="BAZ_cadre_fiche">'."\n";
$GLOBALS['_BAZAR_']['annonceur'] = $ligne['bf_ce_utilisateur'] ;
//si le template existe, on genere le template
if ((file_exists(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php'))) {
include_once(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php');
$res .=genere_fiche($ligne);
}
//on affiche ligne par ligne sinon
else {
//cas d'une image personalisée
if (isset($ligne['bf_url_image'])) {
$res .= '<div id="fiche_image">'."\n";
$res .= '<img src="client/bazar/upload/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" />'."\n";
$res .= '</div>'."\n";
}
//cas d'une image par défaut
elseif (isset ($GLOBALS['_BAZAR_']['image_logo']) && $GLOBALS['_BAZAR_']['image_logo']!='') {
$res .= '<div id="fiche_image">'."\n";
$res .= '<img src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_logo'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" width="130" height="130" />'."\n";
$res .= '</div>'."\n";
}
$res .= '<h1 id="fiche_titre">'.$ligne['bf_titre'].'</h1>'."\n";
$res .= '<div id="BAZ_description">'.nl2br($ligne['bf_description']).'</div>'."\n";
$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
for ($i=0; $i<count($tableau); $i++) {
if (isset($ligne[$tableau[$i]['nom_bdd']]) && ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' ) ) {
$val=$tableau[$i]['nom_bdd'];
if (!in_array($val, array ('bf_titre', 'bf_description'))) {
if ($ligne[$val] != '' and $ligne[$val] != BAZ_CHOISIR and $ligne[$val] != BAZ_NON_PRECISE) {
$res .= '<span class="rubrique" id="'.$tableau[$i]['nom_bdd'].'_rubrique">'.$tableau[$i]['label'].':</span>'."\n";
$res .= '<span class="description" id="'.$tableau[$i]['nom_bdd'].'_description"> '.nl2br($ligne[$val]).'</span>'."\n".'<br />'."\n";
}
}
}
elseif ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id
$requete = 'SELECT blv_label FROM bazar_fiche_valeur_liste, bazar_liste_valeurs WHERE bfvl_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].
' 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'].'"';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
$val='';$nb=0;
while ($tab = $resultat->fetchRow()) {
if ($nb>0) $val .= ', ';
$val .= $tab[0];
$nb++;
}
if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
$res .= '<span class="rubrique" id="rubrique_'.$tableau[$i]['nom_bdd'].'">'.$tableau[$i]['label'].':</span>'."\n";
$res .= '<span class="description" id="description_'.$tableau[$i]['nom_bdd'].'"> '.$val.'</span>'."\n".'<br />'."\n";
}
}
elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
$val=$tableau[$i]['nom_bdd'];
if (!in_array($val, array ('bf_date_debut_validite_fiche', 'bf_date_fin_validite_fiche'))) {
if ($ligne[$val] != '' && $ligne[$val] != '0000-00-00') {
$res .= '<span class="rubrique" id="'.$tableau[$i]['nom_bdd'].'_rubrique">'.$tableau[$i]['label'].':</span>'."\n";
$res .= '<span class="description" id="'.$tableau[$i]['nom_bdd'].'_description"> '.strftime('%d.%m.%Y',strtotime($ligne[$val])).'</span>'."\n".'<br />'."\n";
}
}
}
elseif ( $tableau[$i]['type']=='wikini' ) {
$res .= '<div class="lien_wikini"><a href="wikini/'.baz_titre_wiki($ligne["bf_titre"]).'">'.BAZ_ENTRER_PROJET.'</a></div>'."\n";
}
}
//afficher les liens pour l'annonce
$requete = 'SELECT bu_url, bu_descriptif_url FROM bazar_url WHERE bu_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$res .= '<span class="rubrique">'.BAZ_LIEN_INTERNET.':</span>'."\n";
$res .= '<span class="description">'."\n";
$res .= '<ul>'."\n";
while ($ligne1 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li><a href="'.$ligne1['bu_url'].'" target="_blank">'.$ligne1['bu_descriptif_url'].'</a></li>'."\n";
}
$res .= '</ul></span>'."\n";
}
//afficher les fichiers pour l'annonce
$requete = 'SELECT bfj_description, bfj_fichier FROM bazar_fichier_joint WHERE bfj_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$res .= '<span class="rubrique">'.BAZ_LISTE_FICHIERS_JOINTS.':</span>'."\n";
$res .= '<span class="description">'."\n";
$res .= '<ul>'."\n";
while ($ligne2 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li><a href="client/bazar/upload/'.$ligne2['bfj_fichier'].'">'.$ligne2['bfj_description'].'</a></li>'."\n";
}
$res .= '</ul></span>'."\n";
}
$res .= '<div class="bulle_haut">&nbsp;</div>'."\n";
$res .= '<div class="bulle_corps">'."\n";
//affichage du redacteur de la fiche
$requete = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.', '.BAZ_CHAMPS_EMAIL.
' FROM '.BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$ligne['bf_ce_utilisateur'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
while ($redacteur = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= BAZ_FICHE_ECRITE.'<a href="mailto:'.$redacteur[BAZ_CHAMPS_EMAIL].'">'.$redacteur[BAZ_CHAMPS_PRENOM].' '.$redacteur[BAZ_CHAMPS_NOM].'</a><br />'."\n";
}
$res .= BAZ_NB_VUS.'<strong>'.$ligne['bf_nb_consultations'].'</strong>'.BAZ_FOIS.'<br />'."\n";
$res .= '</div>'."\n";
$res .= '<div class="bulle_bas">&nbsp;</div>'."\n";
$res .= '<div id="BAZ_bas_page">';
}
//informations complementaires (id fiche, etat publication,... )
if ($danslappli==1) {
if ($ligne['bf_statut_fiche']==1 && $GLOBALS['_BAZAR_']['appropriation']!=1) {
if ($ligne['bf_date_debut_validite_fiche'] != '0000-00-00' && $ligne['bf_date_fin_validite_fiche'] != '0000-00-00') {
$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";
}
}
elseif ($GLOBALS['_BAZAR_']['appropriation']!=1 || $ligne['bf_statut_fiche']!=1) {
$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_NON;
if ( $est_admin ) {
$res .= '&nbsp;&nbsp;&nbsp;<strong>'.BAZ_VALIDER_PUBLICATION.'&nbsp;:&nbsp;</strong>'."\n";
$lien_publie = &$GLOBALS['_BAZAR_']['url'];
$lien_publie->addQueryString('action', BAZ_VOIR_FICHE);
$lien_publie->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
$lien_publie->addQueryString('typeannonce', $ligne['bf_ce_nature']);
$lien_publie->addQueryString('publiee', 1);
$res .= '<a href="'.$lien_publie->getURL().'">'.BAZ_OUI.'</a>&nbsp;/&nbsp;';
$lien_publie->removeQueryString('publiee');
$lien_publie->addQueryString('publiee', 0);
$res .='<a href="'.$lien_publie->getURL().'">'.BAZ_NON.'</a>'."\n";
$lien_publie->removeQueryString('publiee');
}
$res .= '<br />'."\n";
}
//affichage des infos pouvant interesser les admins
if ( $est_admin ) {
$res .= '<span class="rubrique" id="numero_fiche">'.BAZ_NUM_FICHE.':</span> '.$GLOBALS['_BAZAR_']['id_fiche'].'<br />'."\n";
$res .= '<span class="rubrique" id="date_creation">'.BAZ_DATE_CREATION.' :</span> '.strftime('%d.%m.%Y &agrave; %H:%M',strtotime($ligne['bf_date_creation_fiche'])).'<br />'."\n";
}
//affichage des infos et du lien pour la mise a jour de la fiche
if ( $est_admin || $GLOBALS['_BAZAR_']['annonceur']==$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID) ) {
$res .= '<span class="rubrique" id="date_mise_a_jour">'.BAZ_DATE_MAJ.' :</span> '.strftime('%d.%m.%Y &agrave; %H:%M',strtotime($ligne['bf_date_maj_fiche']))."\n";
$lien_modifier=$GLOBALS['_BAZAR_']['url'];
$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER);
$lien_modifier->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
$lien_modifier->addQueryString('typeannonce', $ligne['bf_ce_nature']);
$res .= '&nbsp;&nbsp;&nbsp;<a href="'.$lien_modifier->getURL().'" id="modifier_fiche">'.BAZ_MODIFIER_LA_FICHE.'</a>'."\n";
}
}
$res .= '</div>'."\n";
$res .= '</div>'."\n";
//on ajoute les appropriations, s'il le faut
if (($danslappli==1)and($GLOBALS['_BAZAR_']['appropriation']==1)) {
$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche">'."\n";
$res .= '<h3>'.BAZ_LES_STRUCTURES_POSSEDANT_UNE_RESSOURCE.'</h3>'."\n";
$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';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
$possede_ressource=0;
if ($resultat->numRows()>0) {
$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
if ($resultat->numRows()==1) $res .= BAZ_STRUCTURE_POSSEDANT.'<br />'."\n";
else $res .= BAZ_STRUCTURES_POSSEDANT.'<br />'."\n";
$res .= '<ul>'."\n";
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li><a href="'.BAZ_URL_ANNUAIRE.'&amp;voir_fiche='.$ligne[BAZ_CHAMPS_ID].'" onclick="javascript:window.open(this.href);return false;">'.$ligne[BAZ_CHAMPS_NOM].'</a></li>'."\n";
if ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)==$ligne[BAZ_CHAMPS_ID]) $possede_ressource=1;
}
$res .= '</ul><br />'."\n";
}
else $res .= BAZ_PAS_D_APPROPRIATION.'<br /><br />'."\n";
$res .='<p class="bulle_corps">'."\n";
$lien_appropriation = $GLOBALS['_BAZAR_']['url'];
$lien_appropriation->addQueryString('action', BAZ_VOIR_FICHE);
$lien_appropriation->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
if ($possede_ressource) {
$lien_appropriation->addQueryString('appropriation', 0);
$res .= BAZ_POSSEDE_DEJA_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_VOUS_ENLEVER.'</a>'."\n";
$lien_appropriation->removeQueryString('appropriation');
}
elseif ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
$lien_appropriation->addQueryString('appropriation', 1);
$res .= BAZ_SI_POSSEDE_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_APPARAITRE.'</a>'."\n";
$lien_appropriation->removeQueryString('appropriation');
}
elseif ($GLOBALS['AUTH']->getAuth() && !$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
$res .= BAZ_IL_FAUT_ETRE_STRUCTURE."\n";
}
elseif (!$GLOBALS['AUTH']->getAuth()) {
$res .= BAZ_IL_FAUT_ETRE_IDENTIFIE_STRUCTURE."\n";
}
$res .='</p>'."\n";
$res .= '</div>'."\n";
}
//on ajoute les commentaires, s'il le faut
if (($danslappli==1)and($GLOBALS['_BAZAR_']['commentaire']==1)) {
$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche">'."\n";
$res .= '<h3>'.BAZ_LES_COMMENTAIRES.'</h3>'."\n";
$requete = 'SELECT * FROM bazar_commentaires WHERE bc_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' ORDER BY bc_date ASC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
if ($resultat->numRows()==1) $res .= BAZ_COMMENTAIRE.'<br />'."\n";
else $res .= BAZ_COMMENTAIRES.'<br />'."\n";
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<div class="bulle_haut">&nbsp;</div>'."\n";
$res .= '<div class="bulle_corps">'."\n";
//affichage du commentaire
$res .= $ligne['bc_commentaire'].'<br />'."\n";
$res .= '</div>'."\n";
$res .= '<div class="bulle_bas">'."\n";
$res .= '<div style="font-size:9px;margin-left:10px;">'.BAZ_PAR.' : <strong>'.$ligne['bc_nom'].'</strong>'.BAZ_ECRIT_LE.$ligne['bc_date'].'</div>'."\n";
//pour les identifies seulement, administrateurs de la rubrique ou superadmins
if ($est_admin==1) {
$url_comment= $GLOBALS['_BAZAR_']['url'];
$url_comment->addQueryString('action', BAZ_VOIR_FICHE);
$url_comment->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
$url_comment->addQueryString('id_commentaire', $ligne['bc_id_commentaire']);
$res .= '<a href="'.$url_comment->getURL().'" style="font-size:9px;float:right;">'.BAZ_SUPPRIMER.'</a>'."\n";
}
$res .= '</div>'."\n";
}
}
else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br /><br />'."\n";
//formulaire des commentaires
$form_commentaire = new HTML_QuickForm('bazar_commentaire', 'post', $url);
$squelette =& $form_commentaire->defaultRenderer();
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<label style="width:200px;">{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
'</label><br />'."\n".'{element}<br />'."\n");
$squelette->setRequiredNoteTemplate("\n".'<span class="symbole_obligatoire"> *{requiredNote}</span>'."\n");
$option=array('style'=>'width:300px;border:1px solid #000;', 'maxlength'=>100);
$form_commentaire->addElement('text', 'Nom', BAZ_ENTREZ_VOTRE_NOM, $option);
$option=array('style'=>'width:95%;height:100px;white-space: pre;padding:3px;border:1px solid #000;');
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php';
$formtexte= new HTML_QuickForm_textarea('Commentaire', BAZ_ENTREZ_VOTRE_COMMENTAIRE, $option);
$form_commentaire->addElement($formtexte) ;
$option=array('style'=>'border:1px solid #000;');
$form_commentaire->addElement('submit', 'Envoyer', BAZ_ENVOYER, $option);
$form_commentaire->addRule('Nom', BAZ_NOM_REQUIS, 'required', '', 'client') ;
$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ;
$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
$res .= $form_commentaire->toHTML();
$res .= '</div>'."\n";
}
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_commentaire');
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
return $res ;
}
 
 
/** RSSversHTML () transforme un flux RSS (en XML) en page HTML
*
* On passe en paramètre le contenu du flux RSS, on affiche ou non la description,
* et on choisit de format de la date à l'affichage. On a en sortie du code HTML à afficher
*
* @param string le contenu du flux RSS
* @param boolean afficher ou non la description
* @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
*
* @return string le code HTML
*/
function RSSversHTML($rss, $voirdesc, $formatdate, $affichenb) {
if ($rss!='') {
$rawitems='';$title='';$url='';$cat='';$date='';
$res='';
if( eregi('<item>(.*)</item>', $rss, $rawitems ) ) {
$items = explode('<item>', $rawitems[0]);
$res.='<ul id="BAZ_liste_fiche">'."\n";
for( $i = 0; $i < count($items)-1; $i++ ) {
eregi('<title>(.*)</title>',$items[$i+1], $title );
eregi('<link>(.*)</link>',$items[$i+1], $url );
eregi('<description>(.*)</description>',$items[$i+1], $cat);
eregi('<pubDate>(.*)</pubDate>',$items[$i+1], $date);
$res.='<li>';
if ($formatdate=='jm') {$res.=strftime('%d.%m',strtotime($date[1])).': ';}
if ($formatdate=='jma') {$res.=strftime('%d.%m.%Y',strtotime($date[1])).': ';}
if ($formatdate=='jmh') {$res.=strftime('%d.%m %H:%M',strtotime($date[1])).': ';}
if ($formatdate=='jmah') {$res.=strftime('%d.%m.%Y %H:%M',strtotime($date[1])).': ';}
$res.='<a href="'.preg_replace ('/&amp;/', '&', $url[1]).'">'.$title[1].'</a>';
if ($voirdesc) {$res.=$cat[1];}
// Ajout du bouton supprimer pour les superadministrateur
if (($GLOBALS['AUTH']->getAuth() && niveau_droit(0,$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur')and($url[1]!='#')) {
$mon_url = preg_replace ('/&amp;/', '&', $url[1]) ;
$url_suppr = new Net_URL(preg_replace ('/&amp;/', '&', $mon_url)) ;
$url_suppr->addQueryString('action', BAZ_ACTION_SUPPRESSION) ;
$res .= ' ( <a href="'.$url_suppr->getURL().
'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.' ?\');">'.
BAZ_SUPPRIMER.'</a> )'."\n" ;
}
$res.='</li>'."\n";
}
$res.='</ul>'."\n";
if ($affichenb==1) {
//une annonce trouvee, on accorde au singulier
if (((count($items)-1)==1)and($title!=BAZ_PAS_D_ANNONCES)) {
$res = '<br /><h4>'.BAZ_IL_Y_A.' 1 '.BAZ_FICHE_CORRESPONDANTE.'</h4><br />'."\n".$res;
}
//plusieures annonces trouvees, on accorde au pluriel
else {
$res = '<br /><h4>'.BAZ_IL_Y_A.(count($items)-1).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n".$res;
}
}
//cas des fiches pas trouvées
if (((count($items)-1)==1)and($title[1]==BAZ_PAS_D_ANNONCES)) {
$res = '<br /><h4>'.BAZ_PAS_D_ANNONCES.'</h4><br />'."\n";
}
}
}
else $res = BAZ_PAS_D_ANNONCES;
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
return $res;
}
 
/** gen_RSS() - generer un fichier de flux RSS par type d'annonce
*
* @param string Le type de l'annonce (laisser vide pour tout type d'annonce)
* @param integer Le nombre d'annonces a regrouper dans le fichier XML (laisser vide pour toutes)
* @param integer L'identifiant de l'emetteur (laisser vide pour tous)
* @param integer L'etat de validation de l'annonce (laisser 1 pour les annonces validees, 0 pour les non-validees)
* @param string La requete SQL personnalisee
* @param integer La categorie des fiches bazar
*
* @return string Le code du flux RSS
*/
function gen_RSS($typeannonce='', $nbitem='', $emetteur='', $valide=1, $requeteSQL='', $requeteSQLFrom = '', $requeteWhereListe = '', $categorie_nature='') {
// generation de la requete MySQL personnalisee
$req_where=0;
$requete = 'SELECT DISTINCT bf_id_fiche, bf_titre, bf_date_debut_validite_fiche, bf_description, bn_label_nature, bf_date_creation_fiche '.
'FROM bazar_fiche, bazar_nature '.$requeteSQLFrom.' WHERE '.$requeteWhereListe;
if ($valide!=2) {
$requete .= 'bf_statut_fiche='.$valide;
$req_where=1;
}
$nomflux=BAZ_DERNIERE_ACTU;
if (!is_array ($typeannonce) && $typeannonce!='' and $typeannonce!='toutes') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bf_ce_nature='.$typeannonce.' and bf_ce_nature=bn_id_nature ';;
$req_where=1;
//le nom du flux devient le type d'annonce
$requete_nom_flux = 'select bn_label_nature from bazar_nature where bn_id_nature = '.$typeannonce;
$nomflux = $GLOBALS['_BAZAR_']['db']->getOne($requete_nom_flux) ;
}
// Cas où il y plusieurs type d annonce demande
if (is_array ($typeannonce)) {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bf_ce_nature IN (' ;
$chaine = '';
foreach ($typeannonce as $valeur) $chaine .= '"'.$valeur.'",' ;
$requete .= substr ($chaine, 0, strlen ($chaine)-1) ;
$requete .= ') and bf_ce_nature=bn_id_nature ';
}
$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
if ($valide!=0) {
if ($utilisateur->isSuperAdmin()) {
$req_where=1;
} else {
if ($req_where==1) {
$requete .= ' AND ';
}
$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
}
}
else $nomflux .= BAZ_A_MODERER;
if ($emetteur!='' && $emetteur!='tous') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bf_ce_utilisateur='.$emetteur;
$req_where=1;
//requete pour afficher le nom de la structure
$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
}
if ($requeteSQL!='') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= '('.$requeteSQL.')';
$req_where=1;
}
if ($categorie_nature!='') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bn_ce_id_menu IN ('.$categorie_nature.') and bf_ce_nature=bn_id_nature ';
$req_where=1;
}
$requete .= ' ORDER BY bf_date_creation_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
function xmlEntities($s){
//build first an assoc. array with the entities we want to match
$table1 = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
//now build another assoc. array with the entities we want to replace (numeric entities)
foreach ($table1 as $k=>$v){
$table1[$k] = "/$v/";
$c = htmlentities($k,ENT_QUOTES,"UTF-8");
$table2[$c] = "&#".ord($k).";";
}
//now perform a replacement using preg_replace
//each matched value in array 1 will be replaced with the corresponding value in array 2
$s = preg_replace($table1,$table2,$s);
return $s;
}
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-1', 'no') ;
$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ;
$xml .= XML_Util::createStartElement ('channel');
$xml .= XML_Util::createTag ('title', null, $nomflux, null, false);
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
$xml .= XML_Util::createTag ('description', null, BAZ_RSS_DESCRIPTIONSITE);
$xml .= XML_Util::createTag ('language', null, 'fr-FR');
$xml .= XML_Util::createTag ('copyright', null, 'Copyright 2005 '.BAZ_RSS_NOMSITE);
$xml .= XML_Util::createTag ('lastBuildDate', null, strftime('%d %b %Y %H:%M:%S GMT'));
$xml .= XML_Util::createTag ('docs', null, 'http://www.stervinou.com/projets/rss/');
$xml .= XML_Util::createTag ('category', null, BAZ_RSS_CATEGORIE);
$xml .= XML_Util::createTag ('managingEditor', null, BAZ_RSS_MANAGINGEDITOR);
$xml .= XML_Util::createTag ('webMaster', null, BAZ_RSS_WEBMASTER);
$xml .= XML_Util::createTag ('ttl', null, '60');
$xml .= XML_Util::createStartElement ('image');
$xml .= XML_Util::createTag ('title', null, BAZ_RSS_NOMSITE);
$xml .= XML_Util::createTag ('url', null, BAZ_RSS_LOGOSITE);
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
$xml .= XML_Util::createEndElement ('image');
if ($resultat->numRows()>0) {
// Creation des items : titre + lien + description + date de publication
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$xml .= XML_Util::createStartElement ('item');
$caractere = array('/\x92/', '/\x85/', '/\x80/', '/\x97/', '/\x96/');
$caractere_remplacement = array ('&#8217;', '&#8230;', '&#8364;', '&#8212;', '&#8211;');
$xml .= XML_Util::createTag ('title', null, preg_replace ($caractere, $caractere_remplacement,
XML_Util::replaceEntities($ligne['bf_titre'])));
$lien=$GLOBALS['_BAZAR_']['url'];
$lien->addQueryString('action', BAZ_VOIR_FICHE);
$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
$xml .= XML_Util::createTag ('link', null, $lien->getURL());
$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
$xml .= XML_Util::createStartElement ('description');
if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
$xml .= XML_Util::createCDataSection (preg_replace ($caractere, $caractere_remplacement, $ligne['bf_description']));
}
$xml .= XML_Util::createEndElement ('description');
if ($ligne['bf_date_debut_validite_fiche'] == '0000-00-00') $date_pub = $ligne[' bf_date_creation_fiche'] ; else
$date_pub = $ligne['bf_date_debut_validite_fiche'];
$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
$xml .= XML_Util::createEndElement ('item');
}
}
else {//pas d'annonces
$xml .= XML_Util::createStartElement ('item');
$xml .= XML_Util::createTag ('title', null, BAZ_PAS_D_ANNONCES);
$xml .= XML_Util::createTag ('link', null, '#');
$xml .= XML_Util::createTag ('description', null, BAZ_PAS_D_ANNONCES);
$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')));
$xml .= XML_Util::createEndElement ('item');
 
}
$xml .= XML_Util::createEndElement ('channel');
$xml .= XML_Util::createEndElement('rss') ;
 
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
return $xml;
}
 
 
/** baz_liste() Formate la liste de toutes les annonces actuelles
*
* @return string le code HTML a afficher
*/
function baz_liste($typeannonce='toutes') {
//creation du lien pour le formulaire de recherche
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
if (isset($_REQUEST['recherche_avancee'])) $GLOBALS['_BAZAR_']['url']->addQueryString ('recherche_avancee', $_REQUEST['recherche_avancee']);
$lien_formulaire = preg_replace ('/&amp;/', '&', $GLOBALS['_BAZAR_']['url']->getURL()) ;
$formtemplate = new HTML_QuickForm('formulaire', 'post', $lien_formulaire) ;
$squelette =& $formtemplate->defaultRenderer();
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'<table style="border:0;width:100%;">'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".'<td style="font-size:12px;width:120px;text-align:right;">'."\n".'{label}'.
'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
' :</td>'."\n".'<td style="text-align:left;padding:5px;"> '."\n".'{element}'."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
'</td>'."\n".'</tr>'."\n");
$squelette->setElementTemplate( '<tr>'."\n".'<td colspan="2" class="liste_a_cocher"><strong>{label}&nbsp;{element}</strong>'."\n".
'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".'</td>'."\n".'</tr>'."\n", 'accept_condition');
$squelette->setElementTemplate( '<tr><td colspan="2">{label}{element}</td></tr>'."\n", 'rechercher');
$squelette->setRequiredNoteTemplate("\n".'<tr>'."\n".'<td colspan="2" class="symbole_obligatoire">* {requiredNote}</td></tr>'."\n");
//Traduction de champs requis
$formtemplate->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
$formtemplate->setJsWarnings(BAZ_ERREUR_SAISIE,BAZ_VEUILLEZ_CORRIGER);
//cas du formulaire de recherche proposant de chercher parmis tous les types d'annonces
//requete pour obtenir l'id et le label des types d'annonces
$requete = 'SELECT bn_id_nature, bn_label_nature '.
'FROM bazar_nature WHERE bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') '.
'ORDER BY bn_label_nature ASC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
//on récupère le nb de types de fiches, pour plus tard
$nb_type_de_fiches=$resultat->numRows();
$type_annonce_select['toutes']=BAZ_TOUS_TYPES_FICHES;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$type_annonce_select[$ligne['bn_id_nature']] = $ligne['bn_label_nature'];
$tableau_typeannonces[] = $ligne['bn_id_nature'] ;
}
if ($nb_type_de_fiches>1 && $GLOBALS['_BAZAR_']['typeannonce']=='toutes') {
$res= '<h2>'.BAZ_TOUTES_LES_ANNONCES.'</h2><br />'."\n";
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;',
'onchange' => 'javascript:this.form.submit();');
$formtemplate->addElement ('select', 'nature', BAZ_TYPEANNONCE, $type_annonce_select, $option) ;
if (isset($_REQUEST['nature'])) {
$defauts=array('nature'=>$_REQUEST['nature']);
$formtemplate->setDefaults($defauts);
}
}
//cas du type d'annonces prédéfini
else {
if ($nb_type_de_fiches==1) {
$GLOBALS['_BAZAR_']['typeannonce']=end($type_annonce_select);
$GLOBALS['_BAZAR_']['id_typeannonce']=key($type_annonce_select);
}
$res = '<h2>'.BAZ_TOUTES_LES_ANNONCES_DE_TYPE.' '.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
}
 
//requete pour obtenir l'id, le nom et prenom de toutes les personnes ayant depose une fiche
// dans le but de construire l'élément de formulaire select avec les noms des émetteurs de fiche
if (BAZ_RECHERCHE_PAR_EMETTEUR) {
$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' '.
'FROM bazar_fiche,'.BAZ_ANNUAIRE.' WHERE ' ;
$requete .= ' bf_date_debut_validite_fiche<=NOW() AND bf_date_fin_validite_fiche>=NOW() and';
$requete .= ' bf_ce_utilisateur='.BAZ_CHAMPS_ID.' ';
if (!isset($_REQUEST['nature'])) {
if (isset($GLOBALS['_BAZAR_']['id_typeannonce'])) {
$requete .= 'AND bf_ce_nature="'.$GLOBALS['_BAZAR_']['id_typeannonce'].'" ';
}
}
else {
if ($_REQUEST['nature']!='toutes') {
$requete .= 'AND bf_ce_nature='.$_REQUEST['nature'].' ';
}
}
$requete .= 'ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$personnes_select['tous']=BAZ_TOUS_LES_EMETTEURS;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$personnes_select[$ligne[BAZ_CHAMPS_ID]] = $ligne[BAZ_CHAMPS_NOM]." ".$ligne[BAZ_CHAMPS_PRENOM] ;
}
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
$formtemplate->addElement ('select', 'personnes', BAZ_EMETTEUR, $personnes_select, $option) ;
} else {
$formtemplate->addElement ('hidden', 'personnes', 'tous') ;
}
//pour les super-administrateurs, on peut voir les annonces non validées
//on verifie si l'utilisateur est administrateur
$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']) ;
 
if ($utilisateur->isSuperAdmin()) {
$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
$valide_select[0] = BAZ_FICHES_PAS_VALIDEES;
$valide_select[1] = BAZ_FICHES_VALIDEES;
$valide_select[2] = BAZ_LES_DEUX;
$formtemplate->addElement ('select', 'valides', BAZ_VALIDE, $valide_select, $option) ;
$defauts=array('valides'=>1);
$formtemplate->setDefaults($defauts);
}
//champs texte pour entrer les mots cles
$option=array('maxlength'=>60,'style'=>'border:1px solid #000;width:200px;font:12px Myriad, Arial, sans-serif;');
$formtemplate->addElement('text', 'recherche_mots_cles', BAZ_MOT_CLE, $option) ;
//option cachee pour savoir si le formulaire a ete appele deja
$formtemplate->addElement('hidden', 'recherche_effectuee', 1) ;
// Ajout des options si un type de fiche a ete choisie
if ( (isset($_REQUEST['nature']) && $_REQUEST['nature'] != 'toutes') || (isset($GLOBALS['_BAZAR_']['categorie_nature']) && $nb_type_de_fiches==1)) {
if ( BAZ_MOTEUR_RECHERCHE_AVANCEE || ( isset($_REQUEST['recherche_avancee'])&&$_REQUEST['recherche_avancee']==1) ) {
if ($GLOBALS['_BAZAR_']['categorie_nature'] != '') {
$champs_requete = '' ;
if (!isset($_REQUEST['nature']) || $_REQUEST['nature'] == '') {
$_REQUEST['nature'] = $tableau_typeannonces[0];
}
}
// Récupération du template
$requete = 'SELECT bn_template FROM bazar_nature WHERE bn_id_nature = '.$_REQUEST['nature'];
$resultat = $GLOBALS['_BAZAR_']['db']->getOne($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if (isset($_REQUEST['recherche_avancee']) && $_REQUEST['recherche_avancee']==1) {
foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur);
$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '0');
$lien_recherche_de_base = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_DE_BASE.'</a><br />';
foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->removeQueryString($cle);
//lien recherche de base
labelhtml($formtemplate,'',$lien_recherche_de_base,'','','','','');
}
$tableau = baz_valeurs_template($resultat) ;
for ($i=0; $i<count($tableau); $i++) {
if (($tableau[$i]['type'] == 'liste' || $tableau[$i]['type'] == 'checkbox') && $tableau[$i]['recherche'] == 1) {
$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
$tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire'], 1) ;
}
}
}
else {
foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur);
$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '1');
$lien_recherche_avancee = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_AVANCEE.'</a><br />';
foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->removeQueryString($cle);
}
}
//lien recherche avancee
if (isset($lien_recherche_avancee)) {
labelhtml($formtemplate,'',$lien_recherche_avancee,'','','','','');
}
//Bouton de validation du formulaire
$option=array('style'=>'border:1px solid #000;width:100px;font:12px Myriad, Arial, sans-serif;');
$formtemplate->addElement('submit', 'rechercher', BAZ_RECHERCHER, $option);
//affichage du formulaire
$res.=$formtemplate->toHTML()."\n";
 
// Ajout de la table bazar_fiche_liste_valeur dans le from de la requete
$case_coche = false ;
$nb_jointures=0;
$requeteFrom = '' ;
$requeteWhere = ' bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') AND bn_id_nature=bf_ce_nature AND ' ;
$requeteWhereListe = '' ;
if ( isset($tableau) ) {
for ($i = 0; $i < count ($tableau); $i++) {
if ($tableau[$i]['type'] == 'checkbox' || $tableau[$i]['type'] == 'liste') {
$nb_jointures++;
$nom_liste = $tableau[$i]['type'].$tableau[$i]['nom_bdd'] ;
if (isset($_REQUEST[$nom_liste]) && is_array($_REQUEST[$nom_liste])) {
$case_coche = true;
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur IN (' ;
$chaine = '';
//var_dump($_REQUEST[$nom_liste]);
foreach ($_REQUEST[$nom_liste] as $cle =>$valeur) {
if ($valeur == 1) {
$chaine .= '"'.$cle.'",' ;
}
}
$requeteWhereListe .= substr ($chaine, 0, strlen ($chaine)-1) ;
$requeteWhereListe .= ') AND ';
} else {
if (isset ($_REQUEST[$nom_liste]) && $_REQUEST[$nom_liste]!=0) {
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur='.$_REQUEST[$nom_liste].' AND ';
$case_coche = true;
}
}
}
}
}
if ($case_coche) {
for ($i = 0; $i < $nb_jointures ; $i++) {
$requeteFrom .= ', bazar_fiche_valeur_liste as bfvl'.($i+1) ;
$requeteWhere .= ' bfvl'.($i+1).'.bfvl_ce_fiche=bf_id_fiche AND ';
}
$requeteWhere .= $requeteWhereListe;
}
if (isset($_REQUEST['nature']) && $_REQUEST['nature']!='' && $_REQUEST['nature']!='toutes') {
$requeteWhere = 'bf_ce_nature="'.$_REQUEST['nature'].'" AND '.$requeteWhere;
}
//affichage des resultats de la recherche si le formulaire a ete envoye
$requeteSQL='';
if (isset($_REQUEST['recherche_effectuee'])) {
//preparation de la requete pour trouver les mots cles
if (($_REQUEST['recherche_mots_cles']!='')and($_REQUEST['recherche_mots_cles']!=BAZ_MOT_CLE)) {
//decoupage des mots cles
$recherche = split(' ', $_REQUEST['recherche_mots_cles']) ;
$nbmots=count($recherche);
$requeteSQL='';
for ($i=0; $i<$nbmots; $i++) {
if ($i>0) $requeteSQL.=' OR ';
$requeteSQL.='bf_titre LIKE "%'.$recherche[$i].'%" OR bf_description LIKE "%'.$recherche[$i].'%" ';
}
}
if (!isset($_REQUEST['nature'])) {
if (!isset ($GLOBALS['_BAZAR_']['id_nature'])) $typedefiches = $tableau_typeannonces;
else $typedefiches = $GLOBALS['_BAZAR_']['id_nature'] ;
} else {
$typedefiches = $_REQUEST['nature'] ;
if ($typedefiches == 'toutes') $typedefiches = $tableau_typeannonces ;
}
if ($typeannonce!='toutes') $typedefiches=$typeannonce;
if (isset($_REQUEST['valides'])) {$valides=$_REQUEST['valides'];}
else {$valides=1;}
//generation de la liste de flux a afficher
if (!isset($_REQUEST['personne'])) $_REQUEST['personne']='tous';
$res .= baz_liste_pagine_HTML($typedefiches, '', $_REQUEST['personne'], $valides, $requeteSQL, $requeteFrom, $requeteWhere);
}
else {
//on affiche toutes les annonces
$res .= '<br /><p class="zone_info">'."\n".BAZ_ENTRER_VOS_CRITERES_DE_RECHERCHE.'</p>'."\n";
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FLUX_RSS);
$GLOBALS['_BAZAR_']['url']->addQueryString('annonce', $typeannonce);
$GLOBALS['_BAZAR_']['url']->addQueryString('categorie_nature', $GLOBALS['_BAZAR_']['categorie_nature']);
$res .= '{{Syndication titre="'.BAZ_DERNIERES_FICHES.'" url="'.preg_replace ('/&amp;/', '&', $GLOBALS['_BAZAR_']['url']->getURL()).
'" nb=10 nouvellefenetre=0 formatdate="'.BAZ_TYPE_AFFICHAGE_LISTE.'"}}';
}
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('annonce');
$GLOBALS['_BAZAR_']['url']->removeQueryString('categorie_nature');
$GLOBALS['_BAZAR_']['url']->removeQueryString('recherche_avancee');
return $res;
}
 
/**
* Cette fonction renvoie du HTML
*/
function baz_liste_pagine_HTML($typeannonce, $nbitem, $emetteur, $valide, $requeteSQL = '', $requeteFrom = '', $requeteWhere = '') {
// generation de la requete MySQL personnalisee
$req_where=0;
$requete = 'SELECT DISTINCT bf_id_fiche, bf_titre, bf_ce_utilisateur, bf_date_debut_validite_fiche '.
'FROM bazar_fiche, bazar_nature '.$requeteFrom.' WHERE '.$requeteWhere;
if ($valide!=2) {
if ($req_where==1) {$requete .= ' AND ';}
$req_where=1;
$requete .= 'bf_statut_fiche='.$valide;
} else {
$requete .= '1 ' ;
}
$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
if ($valide!=0) {
if ($utilisateur->isSuperAdmin()) {
$req_where=1;
} else {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
$req_where=1;
}
}
if ($emetteur!='' && $emetteur!='tous') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bf_ce_utilisateur='.$emetteur;
$req_where=1;
//requete pour afficher le nom de la structure
$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
}
if ($requeteSQL!='') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= '('.$requeteSQL.')';
$req_where=1;
}
$requete .= ' ORDER BY bf_date_debut_validite_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
$res = '<br /><h4>'.BAZ_IL_Y_A.($resultat->numRows()).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n";
$res .= '<ul>' ;
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE);
$donnees = array();
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne->bf_id_fiche) ;
array_push ($donnees, array ($ligne->bf_id_fiche,$ligne->bf_titre,$ligne->bf_ce_utilisateur));
}
// Mise en place du Pager
include_once PAP_CHEMIN_API_PEAR.'Pager/Pager.php';
$params = array(
'mode' => BAZ_MODE_DIVISION,
'perPage' => BAZ_NOMBRE_RES_PAR_PAGE,
'delta' => BAZ_DELTA,
'httpMethod' => 'GET',
'extraVars' => array_merge($_POST, $_GET),
'altNext' => BAZ_SUIVANT,
'altPrev' => BAZ_PRECEDENT,
'nextImg' => BAZ_SUIVANT,
'prevImg' => BAZ_PRECEDENT,
'itemData' => $donnees
);
$pager = & Pager::factory($params);
$data = $pager->getPageData();
$links = $pager->getLinks();
$res .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
foreach ($data as $valeur) {
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $valeur[0]) ;
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE) ;
$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.$valeur[1].'</a>'."\n" ;
if ($utilisateur->isSuperAdmin() || $GLOBALS['id_user']==$valeur[2]) {
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_MODIFIER);
$GLOBALS['_BAZAR_']['url']->addQueryString('typeannonce', $GLOBALS['_BAZAR_']['id_typeannonce']);
$GLOBALS['_BAZAR_']['url']->removeQueryString('personnes');
$GLOBALS['_BAZAR_']['url']->removeQueryString('recherche_effectuee');
$res .= '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">('.BAZ_MODIFIER.')</a>&nbsp;' ;
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_SUPPRESSION);
$res .= '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.'\');">('.BAZ_SUPPRIMER.')</a>' ;
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
}
$res .= '</li>';
}
$res .= '</ul>';
$res .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
 
// Nettoyage de l'url
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
$GLOBALS['_BAZAR_']['url']->removeQueryString('recherche_avancee');
 
return $res ;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.76 2007/04/04 15:09:59 florian
* modif class fichiers
*
* Revision 1.75 2007/04/04 08:51:01 florian
* gestion des classes spécifiques pour habiller par CSS les fiches bazar
*
* Revision 1.74 2007/03/28 15:54:32 florian
* correction de bugs
*
* Revision 1.73 2007/03/28 10:01:47 florian
* ajout de la constante BAZ_UTILISE_TEMPLATE, pour utiliser ou non les templates pour l'affichage du moteur de recherche
*
* Revision 1.72 2007/03/28 08:51:22 neiluj
* passage des flux RSS en UTF-8
* ajout de l'indentation du code
* Vérification validation w3c = OK
*
* Revision 1.71 2007/03/19 15:17:37 alexandre_tb
* correction de la requete de recherche
*
* Revision 1.70 2007/03/08 15:12:13 jp_milcent
* Fusion avec la livraison Menes : 08 mars 2007
*
* Revision 1.60.2.11 2007/03/07 17:20:19 jp_milcent
* Ajout du nettoyage systématique des URLs.
*
1207,17 → 1088,6
* Revision 1.60.2.10 2007/03/06 09:41:15 alexandre_tb
* backport de corrections de bugs de la branche principale
*
* Revision 1.69 2007/03/06 09:39:00 alexandre_tb
* correction de bug sur les jointures et sur les flux rss
*
* Revision 1.68 2007/03/05 10:27:06 alexandre_tb
* ajout d identifiant dans les span qui affiche le detail d une fiche.
* ajout d un modele pour les fiches -> du code a ete deplace dans
* bazar_template
*
* Revision 1.67 2007/02/28 10:18:56 alexandre_tb
* backport de bug depuis la 1.60 de menes
*
* Revision 1.60.2.9 2007/02/27 15:32:40 alexandre_tb
* utilisation de la fonction xmlEntities pour transformer les &amp; en &#...;
* fixe les plantages des flux rss lorsque des guillemets ou des esperluettes étaient présents
1234,9 → 1104,6
* Utilisation de IN à la place du = dans les requêtes traitant les catégories de fiches.
* Permet d'utiliser la syntaxe 1,2,3 dans la configuration de categorie_nature.
*
* Revision 1.64 2007/02/02 14:00:41 alexandre_tb
* mise en place d'un template pour l'affichage du moteur de recherche
*
* Revision 1.60.2.5 2007/02/02 13:46:54 alexandre_tb
* correction bug sur une date
*
1246,11 → 1113,6
* Revision 1.60.2.3 2007/01/29 10:53:46 alexandre_tb
* Mise en place de la constante BAZ_DERNIERES_FICHES pour remplacer le label en francais dans baz_liste
*
* Revision 1.63 2007/01/18 14:37:34 alexandre_tb
* backport
* les dates ne s'affichent pas si elles sont vides.
* les champs dates propose 4 années avant l'année actuelle
*
* Revision 1.60.2.2 2007/01/17 16:01:27 alexandre_tb
* les dates ne s'affichent pas si elles sont vides.
* les champs dates propose 4 années avant l'année actuelle
1296,7 → 1158,7
*
* Revision 1.48 2006/05/17 09:50:13 alexandre_tb
* Ajout du moteur de recherche évolué et du découpage par page
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>