GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Vérification de sécurité if (!defined("WIKINI_VERSION")) { die("accès direct interdit"); } if (isset($_REQUEST['demand'])) { header('Content-type: application/json; charset=UTF-8'); switch ($_REQUEST['demand']) { case "listes_et_fiches": if (baz_a_le_droit($_REQUEST['demand'])) { $tab['listes'] = baz_valeurs_toutes_les_listes('json'); $tab['fiches'] = baz_valeurs_tous_les_formulaires('toutes', 'json'); echo json_encode($tab); } break; //sur mesure pour moustic //sur mesure pour moustic case "fiches": $tab = baz_requete_recherche_fiches('', 'alphabetique', 21, 'inscription'); echo json_encode($tab); break; } } ?>
/** checkboxfiche() - permet d'aller saisir et modifier un autre type de fiche * * @param mixed L'objet QuickForm du formulaire * @param mixed Le tableau des valeurs des différentes option pour le texte HTML * @param string Type d'action pour le formulaire : saisie, modification, vue,... saisie par défaut * @param mixed Tableau des valeurs par défauts (pour modification) * * @return void */ function checkboxfiche(&$formtemplate, $tableau_template, $mode, $valeurs_fiche) { $id = $tableau_template[0] . $tableau_template[1] . $tableau_template[6]; //on teste la presence de filtres pour les valeurs $tabquery = array(); if (isset($_GET["query"]) && !empty($_GET["query"])) { $tableau = array(); $tab = explode('|', $_GET["query"]); //découpe la requete autour des | foreach ($tab as $req) { $tabdecoup = explode('=', $req, 2); $tableau[$tabdecoup[0]] = trim($tabdecoup[1]); } $tabquery = array_merge($tabquery, $tableau); } if ($mode == 'saisie' || $mode == 'formulaire_recherche' && $tableau_template[9] == 1) { $bulledaide = ''; if ($mode == 'saisie' && isset($tableau_template[10]) && $tableau_template[10] != '') { $bulledaide = ' <img class="tooltip_aide" title="' . htmlentities($tableau_template[10], ENT_QUOTES, TEMPLATES_DEFAULT_CHARSET) . '" src="tools/bazar/presentation/images/aide.png" width="16" height="16" alt="image aide" />'; } $checkbox_html = '<div class="control-group form-group">' . "\n" . '<label class="control-label col-sm-3">' . "\n"; if ($mode == 'saisie' && isset($tableau_template[8]) && $tableau_template[8] == 1) { $checkbox_html .= '<span class="symbole_obligatoire">* </span>' . "\n"; } $checkbox_html .= $tableau_template[2] . $bulledaide . ' : </label>' . "\n" . '<div class="controls col-sm-9"'; if ($mode == 'saisie' && isset($tableau_template[8]) && $tableau_template[8] == 1) { $checkbox_html .= ' required="required"'; } $checkbox_html .= '>' . "\n"; if (isset($valeurs_fiche[$id]) && $valeurs_fiche[$id] != '') { $def = explode(',', $valeurs_fiche[$id]); } elseif (isset($_REQUEST[$id]) && $_REQUEST[$id] != '') { $def = explode(',', $_REQUEST[$id]); } else { $def = explode(',', $tableau_template[5]); } $val_type = baz_valeurs_formulaire($tableau_template[1]); //on recupere les parameres pour une requete specifique if ($GLOBALS['wiki']->config['global_query'] && isset($_GET['query'])) { $query = $tableau_template[12]; if (!empty($query)) { $query .= '|' . $_GET['query']; } else { $query = $_GET['query']; } } else { $query = $tableau_template[12]; } if (!empty($query)) { $tabquery = array(); $tableau = array(); $tab = explode('|', $query); //découpe la requete autour des | foreach ($tab as $req) { $tabdecoup = explode('=', $req, 2); $tableau[$tabdecoup[0]] = trim($tabdecoup[1]); } $tabquery = array_merge($tabquery, $tableau); } else { $tabquery = ''; } $tab_result = baz_requete_recherche_fiches($tabquery, 'alphabetique', $tableau_template[1], $val_type["bn_type_fiche"], 1, '', '', true, !empty($tableau_template[13]) ? $tableau_template[13] : ''); $checkboxtab = ''; foreach ($tab_result as $fiche) { $valeurs_fiche_liste = json_decode($fiche["body"], true); if (TEMPLATES_DEFAULT_CHARSET != 'UTF-8') { $valeurs_fiche_liste = array_map('utf8_decode', $valeurs_fiche_liste); } $checkboxtab[$valeurs_fiche_liste['id_fiche']] = $valeurs_fiche_liste['bf_titre']; } if (is_array($checkboxtab)) { if ($tableau_template[7] == 'tags') { foreach ($checkboxtab as $key => $title) { $tabfiches[$key] = '{"id":"' . $key . '", "title":"' . str_replace('"', '\\"', $title) . '"}'; } $script = '$(function(){ var tagsexistants = [' . implode(',', $tabfiches) . ']; var bazartag = []; bazartag["' . $id . '"] = $(\'#formulaire .yeswiki-input-entries' . $id . '\'); bazartag["' . $id . '"].tagsinput({ itemValue: \'id\', itemText: \'title\', typeahead: { afterSelect: function(val) { this.$element.val(""); }, source: tagsexistants }, freeInput: false, confirmKeys: [13, 188] });' . "\n"; if (is_array($def) && count($def) > 0 && !empty($def[0])) { foreach ($def as $key) { if (isset($tabfiches[$key])) { $script .= 'bazartag["' . $id . '"].tagsinput(\'add\', ' . $tabfiches[$key] . ');' . "\n"; } } } $script .= '});' . "\n"; $GLOBALS['wiki']->AddJavascriptFile('tools/tags/libs/vendor/bootstrap-tagsinput.min.js'); $GLOBALS['wiki']->AddJavascript($script); $checkbox_html .= '<input type="text" name="' . $id . '" class="yeswiki-input-entries yeswiki-input-entries' . $id . '">'; } else { $checkbox_html .= '<input type="text" class="pull-left filter-entries" value="" placeholder="' . _t('BAZAR_FILTER') . '"><label class="pull-right"><input type="checkbox" class="selectall" /> ' . _t('BAZAR_CHECKALL') . '</label>' . "\n" . '<div class="clearfix"></div>' . "\n" . '<ul class="list-bazar-entries list-unstyled">'; foreach ($checkboxtab as $key => $label) { $checkbox_html .= '<div class="yeswiki-checkbox checkbox"> <input type="checkbox" id="ckbx_' . $key . '" value="1" name="' . $id . '[' . $key . ']"'; if ($def != '' && in_array($key, $def)) { $checkbox_html .= ' checked="checked"'; } $checkbox_html .= ' class="element_checkbox"><label for="ckbx_' . $key . '">' . $label . '</label></div>'; } $checkbox_html .= "\n" . '</ul>' . "\n"; // javascript additions $GLOBALS['wiki']->AddJavascriptFile('tools/bazar/libs/vendor/jquery.fastLiveFilter.js'); $script = "\$(function() { \$('.filter-entries').each(function() {\n \$(this).fastLiveFilter(\$(this).siblings('.list-bazar-entries')); });\n });"; $GLOBALS['wiki']->AddJavascript($script); } } $checkbox_html .= "</div>\n</div>\n"; $formtemplate->addElement('html', $checkbox_html); } elseif ($mode == 'requete') { if (isset($valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]]) && $valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]] != 0) { return array($tableau_template[0] . $tableau_template[1] . $tableau_template[6] => $valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]]); } } elseif ($mode == 'html') { $html = ''; if (isset($valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]]) && $valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]] != '') { $html .= '<div class="BAZ_rubrique" data-id="' . $tableau_template[0] . $tableau_template[1] . $tableau_template[6] . '">' . "\n" . '<span class="BAZ_label">' . $tableau_template[2] . ' :</span>' . "\n"; $html .= '<span class="BAZ_texte">' . "\n"; $tab_fiche = explode(',', $valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]]); foreach ($tab_fiche as $fiche) { $html .= '<ul>'; if ($tableau_template[3] == 'fiche') { $html .= baz_voir_fiche(0, $fiche); } else { $val_fiche = baz_valeurs_fiche($fiche); // il y a des filtres à faire sur les fiches if (count($tabquery) > 0) { $match = false; foreach ($tabquery as $key => $value) { if (strstr($val_fiche[$key], $value)) { $match = true; } else { $match = false; break; } } } if (is_array($val_fiche) && (!isset($match) || $match == true)) { $html .= '<li><a href="' . str_replace('&', '&', $GLOBALS['wiki']->href('', $fiche)) . '" class="modalbox" title="Voir la fiche ' . htmlspecialchars($val_fiche['bf_titre'], ENT_COMPAT | ENT_HTML401, TEMPLATES_DEFAULT_CHARSET) . '">' . $val_fiche['bf_titre'] . '</a></li>' . "\n"; } } $html .= '</ul>'; } $html .= '</span>' . "\n" . '</div> <!-- /.BAZ_rubrique -->' . "\n"; } return $html; } }
// on recupere les parametres pour une requete specifique $query = $this->GetParameter("query"); if (!empty($query)) { $tabquery = array(); $tableau = array(); $tab = explode('|', $query); foreach ($tab as $req) { $tabdecoup = explode('=', $req, 2); $tableau[$tabdecoup[0]] = trim($tabdecoup[1]); } $tabquery = array_merge($tabquery, $tableau); } else { $tabquery = ''; } $minical = $this->GetParameter('minical'); $tableau_resultat = baz_requete_recherche_fiches($tabquery, '', $GLOBALS['_BAZAR_']['id_typeannonce'], $GLOBALS['_BAZAR_']['categorie_nature']); $js = ''; foreach ($tableau_resultat as $fiche) { $valeurs_fiche = json_decode($fiche["body"], true); if (TEMPLATES_DEFAULT_CHARSET != 'UTF-8') { $valeurs_fiche = array_map('utf8_decode', $valeurs_fiche); } if (isset($valeurs_fiche['bf_date_debut_evenement']) && isset($valeurs_fiche['bf_date_fin_evenement'])) { $js .= ' { title: "' . addslashes($valeurs_fiche['bf_titre']) . '", /*start: new Date(' . date('Y', strtotime($valeurs_fiche['bf_date_debut_evenement'])) . ',' . (date('n', strtotime($valeurs_fiche['bf_date_debut_evenement'])) - 1) . ',' . date('d', strtotime($valeurs_fiche['bf_date_debut_evenement'])) . '), end: new Date(' . date('Y', strtotime($valeurs_fiche['bf_date_fin_evenement'])) . ',' . (date('n', strtotime($valeurs_fiche['bf_date_fin_evenement'])) - 1) . ',' . date('d', strtotime($valeurs_fiche['bf_date_fin_evenement'])) . '),*/ start:"' . $valeurs_fiche['bf_date_debut_evenement'] . '", end:"' . $valeurs_fiche['bf_date_fin_evenement'] . '", url:"' . $GLOBALS['wiki']->config['base_url'] . $valeurs_fiche['id_fiche'] . '", allDay: ' . (strlen($valeurs_fiche['bf_date_debut_evenement']) > 10 ? 'false' : 'true') . '
/** baz_affiche_flux_RSS() - affiche le flux rss a partir de parametres * @return string Le flux RSS, avec les headers et tout et tout */ function baz_afficher_flux_RSS() { $urlrss = $GLOBALS['wiki']->href('rss'); if (isset($_GET['id_typeannonce'])) { $id_typeannonce = $_GET['id_typeannonce']; $urlrss .= '&id_typeannonce=' . $id_typeannonce; } else { $id_typeannonce = ''; } if (isset($_GET['categorie_fiche'])) { $categorie_fiche = $_GET['categorie_fiche']; $urlrss .= '&categorie_fiche=' . $categorie_fiche; } else { $categorie_fiche = ''; } if (isset($_GET['nbitem'])) { $nbitem = $_GET['nbitem']; $urlrss .= '&nbitem=' . $nbitem; } else { $nbitem = BAZ_NB_ENTREES_FLUX_RSS; } if (isset($_GET['utilisateur'])) { $utilisateur = $_GET['utilisateur']; $urlrss .= '&utilisateur=' . $utilisateur; } else { $utilisateur = ''; } if (isset($_GET['statut'])) { $statut = $_GET['statut']; $urlrss .= '&statut=' . $statut; } else { $statut = 1; } if (isset($_GET['query'])) { $query = $_GET['query']; $urlrss .= '&query=' . $query; } else { $query = ''; } $tableau_flux_rss = baz_requete_recherche_fiches($query, '', $id_typeannonce, $categorie_fiche, $statut, $utilisateur, 20); require_once BAZ_CHEMIN . 'libs' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'XML/Util.php'; // 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', 'xmlns:atom' => 'http://www.w3.org/2005/Atom', 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/')); $xml .= "\r\n "; $xml .= XML_Util::createStartElement('channel'); $xml .= "\r\n "; $xml .= XML_Util::createTag('title', null, html_entity_decode(_t('BAZ_DERNIERE_ACTU'), ENT_QUOTES, 'UTF-8')); $xml .= "\r\n "; $xml .= XML_Util::createTag('link', null, html_entity_decode(BAZ_RSS_ADRESSESITE, ENT_QUOTES, 'UTF-8')); $xml .= "\r\n "; $xml .= XML_Util::createTag('description', null, html_entity_decode(BAZ_RSS_DESCRIPTIONSITE, ENT_QUOTES, 'UTF-8')); $xml .= "\r\n "; $xml .= XML_Util::createTag('language', null, 'fr-FR'); $xml .= "\r\n "; $xml .= XML_Util::createTag('copyright', null, 'Copyright (c) ' . date('Y') . ' ' . html_entity_decode(BAZ_RSS_NOMSITE, ENT_QUOTES, 'UTF-8')); $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, html_entity_decode(_t('BAZ_DERNIERE_ACTU'), ENT_QUOTES, 'UTF-8')); $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 (count($tableau_flux_rss) > 0) { // Creation des items : titre + lien + description + date de publication foreach ($tableau_flux_rss as $ligne) { $ligne = json_decode($ligne['body'], true); $ligne = _convert($ligne, 'UTF-8'); $xml .= "\r\n "; $xml .= XML_Util::createStartElement('item'); $xml .= "\r\n "; $xml .= XML_Util::createTag('title', null, html_entity_decode(stripslashes($ligne['bf_titre']), ENT_QUOTES, 'UTF-8')); $xml .= "\r\n "; $lien = $GLOBALS['_BAZAR_']['url']; $lien->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FICHE); $lien->addQueryString(BAZ_VARIABLE_VOIR, BAZ_VOIR_CONSULTER); $lien->addQueryString('id_fiche', $ligne['id_fiche']); $xml .= XML_Util::createTag('link', null, '<![CDATA[' . $lien->getURL() . ']]>'); $xml .= "\r\n "; $xml .= XML_Util::createTag('guid', null, '<![CDATA[' . $lien->getURL() . ']]>'); $xml .= "\r\n "; $xml .= XML_Util::createTag('dc:creator', null, $ligne['createur']); $xml .= "\r\n "; $tab = explode('wakka.php?wiki=', $lien->getURL()); $xml .= XML_Util::createTag('description', null, '<![CDATA[' . preg_replace('/data-id=".*"/Ui', '', html_entity_decode(baz_voir_fiche(0, $ligne), ENT_QUOTES, 'UTF-8')) . ']]>'); $xml .= "\r\n "; $xml .= XML_Util::createTag('pubDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT', strtotime($ligne['date_creation_fiche']))); $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, html_entity_decode(_t('BAZ_PAS_DE_FICHES'), ENT_QUOTES, 'UTF-8')); $xml .= "\r\n "; $xml .= XML_Util::createTag('link', null, '<![CDATA[' . $GLOBALS['_BAZAR_']['url']->getUrl() . ']]>'); $xml .= "\r\n "; $xml .= XML_Util::createTag('guid', null, '<![CDATA[' . $GLOBALS['_BAZAR_']['url']->getUrl() . ']]>'); $xml .= "\r\n "; $xml .= XML_Util::createTag('description', null, html_entity_decode(_t('BAZ_PAS_DE_FICHES'), ENT_QUOTES, 'UTF-8')); $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(BAZ_VARIABLE_ACTION); $GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche'); echo str_replace('</image>', '</image>' . "\n" . '<atom:link href="' . $urlrss . '" rel="self" type="application/rss+xml" />', html_entity_decode($xml, ENT_QUOTES, 'UTF-8')); }
<?php /** * Programme gerant les fiches bazar depuis une interface de type geographique. **/ // +------------------------------------------------------------------------------------------------------+ // | ENTETE du PROGRAMME | // +------------------------------------------------------------------------------------------------------+ // test de sécurité pour vérifier si on passe par wiki if (!defined('WIKINI_VERSION')) { die('accès direct interdit'); } // on compte le nombre de fois que l'action bazarliste est appelée afin de différencier les instances if (!isset($GLOBALS['nbbazarliste'])) { $GLOBALS['nbbazarliste'] = 0; } ++$GLOBALS['nbbazarliste']; // Recuperation de tous les parametres $params = getAllParameters($this); $params['template'] = 'map.tpl.html'; // tableau des fiches correspondantes aux critères if (is_array($params['idtypeannonce'])) { $results = array(); foreach ($params['idtypeannonce'] as $formid) { $results = array_merge($results, baz_requete_recherche_fiches($params['query'], 'alphabetique', $formid, '', 1, '', '', true, '')); } } else { $results = baz_requete_recherche_fiches($params['query'], 'alphabetique', '', '', 1, '', '', true, ''); } // affichage à l'écran echo displayResultList($results, $params, false);
} unset($_GET['query']); if (!empty($query)) { $tabquery = array(); $tableau = array(); $tab = explode('|', $query); //découpe la requete autour des | foreach ($tab as $req) { $tabdecoup = explode('=', $req, 2); $tableau[$tabdecoup[0]] = trim($tabdecoup[1]); } $tabquery = array_merge($tabquery, $tableau); } else { $tabquery = ''; } $tableau_resultat = baz_requete_recherche_fiches($tabquery, 'alphabetique', $id_typeannonce, $categorie_nature, 1, '', ''); $fiches['info_res'] = ''; $fiches['pager_links'] = ''; $fiches['fiches'] = array(); foreach ($tableau_resultat as $fiche) { //json = norme d'ecriture utilisée pour les fiches bazar (en utf8) $valeurs_fiche = json_decode($fiche['body'], true); if (TEMPLATES_DEFAULT_CHARSET != 'UTF-8') { $valeurs_fiche = array_map('utf8_decode', $valeurs_fiche); } // pour les checkbox, on crée une fiche par case cochée pour apparaitre à différents endroits $tabcheckbox = explode(',', $valeurs_fiche[$id]); foreach ($tabcheckbox as $value) { // on sauve les multiples valeurs pour les retablir à l'affichage $multiplecheckbox[$valeurs_fiche['id_fiche']] = $valeurs_fiche[$id]; $valeurs_fiche[$id] = $value;
} //on récupère les paramètres pour une requête spécifique $query = $this->GetParameter("query"); if (!empty($query)) { $tabquery = array(); $tableau = array(); $tab = explode('|', $query); foreach ($tab as $req) { $tabdecoup = explode('=', $req, 2); $tableau[$tabdecoup[0]] = trim($tabdecoup[1]); } $tabquery = array_merge($tabquery, $tableau); } else { $tabquery = ''; } $tableau_resultat = baz_requete_recherche_fiches($tabquery, $ordre, $id_typeannonce, $categorie_nature); $tab_points_carto = array(); foreach ($tableau_resultat as $fiche) { $valeurs_fiche = json_decode($fiche[0], true); $valeurs_fiche = array_map('utf8_decode', $valeurs_fiche); $tab = explode('|', $valeurs_fiche['carte_google']); if (count($tab) > 1 && $tab[0] != '' && $tab[1] != '') { $tab_points_carto[] = '{ "title": "' . addslashes($valeurs_fiche['bf_titre']) . '", "description": \'<div class="BAZ_cadre_map">' . preg_replace("(\r\n|\n|\r|)", '', addslashes('<ul class="css-tabs"></ul>' . baz_voir_fiche(1, $valeurs_fiche))) . '\', "lat": ' . $tab[0] . ', "lng": ' . $tab[1] . ' }'; } } $points_carto = implode(',', $tab_points_carto);
foreach ($tableau as $ligne) { if ($ligne[0] == "listefiche") { // jointure if ($ligne[1] == $annonce) { $jointure[$numformulaire] = $ligne[1]; // numero de fiche liee } } } } } } // Recherche de l'ensemble des fiches liee supplementaires $tableau_resultat_lie = array(); foreach ($jointure as $cible => $origine) { $tableau_resultat_lie[$origine][$cible] = baz_requete_recherche_fiches($tabquery, $ordre, $cible, ''); } $fiche_resultat = array(); $comptage_groupe = array(); foreach ($tableau_resultat as $fiche) { $valeurs_fiche = json_decode($fiche["body"], true); $valeurs_fiche = _convert($valeurs_fiche, 'UTF-8'); $valeurs_fiche['html'] = baz_voir_fiche(0, $valeurs_fiche); // Recherche des fiches liees supplementaires : if (isset($tableau_resultat_lie[$valeurs_fiche['id_typeannonce']])) { //print $valeurs_fiche['listefiche'.$jointure[$valeurs_fiche['id_typeannonce']]]; // clef listefiche+idtypannonce cible foreach ($tableau_resultat_lie[$valeurs_fiche['id_typeannonce']] as $formulaire_lies) { foreach ($formulaire_lies as $fiche_lies) { $valeurs_fiche_liee = json_decode($fiche_lies["body"], true); $valeurs_fiche_liee = array_map('utf8_decode', $valeurs_fiche_liee); $valeurs_fiche_liee['html'] = baz_voir_fiche(0, $valeurs_fiche_liee);
/** baz_affiche_flux_RSS() - affiche le flux rss ÃÂ partir de parametres * * * @return string Le flux RSS, avec les headers et tout et tout */ function baz_afficher_flux_RSS() { if (isset($_GET['id_typeannonce'])) { $id_typeannonce = $_GET['id_typeannonce']; } else { $id_typeannonce = $GLOBALS['_BAZAR_']['id_typeannonce']; } if (isset($_GET['categorie_fiche'])) { $categorie_fiche = $_GET['categorie_fiche']; } else { $categorie_fiche = $GLOBALS['_BAZAR_']['categorie_nature']; } if (isset($_GET['nbitem'])) { $nbitem = $_GET['nbitem']; } else { $nbitem = BAZ_NB_ENTREES_FLUX_RSS; } if (isset($_GET['utilisateur'])) { $utilisateur = $_GET['utilisateur']; } else { $utilisateur = ''; } if (isset($_GET['statut'])) { $statut = $_GET['statut']; } else { $statut = 1; } if (isset($_GET['query'])) { $query = $_GET['query']; } else { $query = ''; } $tableau_flux_rss = baz_requete_recherche_fiches($query, '', $id_typeannonce, $categorie_fiche, $statut, $utilisateur, 20); require_once 'XML/Util.php'; // 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', 'xmlns:atom' => "http://www.w3.org/2005/Atom")); $xml .= "\r\n "; $xml .= XML_Util::createStartElement('channel'); $xml .= "\r\n "; $xml .= XML_Util::createTag('title', null, utf8_encode(html_entity_decode(BAZ_DERNIERE_ACTU))); $xml .= "\r\n "; $xml .= XML_Util::createTag('link', null, utf8_encode(html_entity_decode(BAZ_RSS_ADRESSESITE))); $xml .= "\r\n "; $xml .= XML_Util::createTag('description', null, utf8_encode(html_entity_decode(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') . ' ' . utf8_encode(html_entity_decode(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_DERNIERE_ACTU))); $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 (count($tableau_flux_rss) > 0) { // Creation des items : titre + lien + description + date de publication foreach ($tableau_flux_rss as $ligne) { $ligne = json_decode($ligne[0], true); $ligne = array_map('utf8_decode', $ligne); $xml .= "\r\n "; $xml .= XML_Util::createStartElement('item'); $xml .= "\r\n "; $xml .= XML_Util::createTag('title', null, encoder_en_utf8(html_entity_decode(stripslashes($ligne['bf_titre'])))); $xml .= "\r\n "; $lien = $GLOBALS['_BAZAR_']['url']; $lien->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FICHE); $lien->addQueryString(BAZ_VARIABLE_VOIR, BAZ_VOIR_CONSULTER); $lien->addQueryString('id_fiche', $ligne['id_fiche']); $xml .= XML_Util::createTag('link', null, '<![CDATA[' . $lien->getURL() . ']]>'); $xml .= "\r\n "; $xml .= XML_Util::createTag('guid', null, '<![CDATA[' . $lien->getURL() . ']]>'); $xml .= "\r\n "; $tab = explode("wakka.php?wiki=", $lien->getURL()); $xml .= XML_Util::createTag('description', null, '<![CDATA[' . encoder_en_utf8(html_entity_decode(baz_voir_fiche(0, $ligne))) . ']]>'); $xml .= "\r\n "; if ($ligne['date_debut_validite_fiche'] != '0000-00-00' && $ligne['date_debut_validite_fiche'] > $ligne['date_creation_fiche']) { $date_pub = $ligne['date_debut_validite_fiche']; } else { $date_pub = $ligne['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_DE_FICHES))); $xml .= "\r\n "; $xml .= XML_Util::createTag('link', null, '<![CDATA[' . $GLOBALS['_BAZAR_']['url']->getUrl() . ']]>'); $xml .= "\r\n "; $xml .= XML_Util::createTag('guid', null, '<![CDATA[' . $GLOBALS['_BAZAR_']['url']->getUrl() . ']]>'); $xml .= "\r\n "; $xml .= XML_Util::createTag('description', null, utf8_encode(html_entity_decode(BAZ_PAS_DE_FICHES))); $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 "; $GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FLUX_RSS); // $xml .= utf8_encode(html_entity_decode('<atom:link href="'.$GLOBALS['_BAZAR_']['url']->getUrl().'" rel="self" type="application/rss+xml" />'."\r\n ")); $xml .= XML_Util::createEndElement('channel'); $xml .= "\r\n "; $xml .= XML_Util::createEndElement('rss'); // Nettoyage de l'url $GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_ACTION); $GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche'); echo html_entity_decode($xml); }
/** listefiche() - Ajoute un element de type liste deroulante correspondant a un autre type de fiche au formulaire * * @param mixed L'objet QuickForm du formulaire * @param mixed Le tableau des valeurs des differentes option pour l'element liste * @param string Type d'action pour le formulaire : saisie, modification, vue,... saisie par defaut * @return void */ function listefiche(&$formtemplate, $tableau_template, $mode, $valeurs_fiche) { if ($mode == 'saisie') { $bulledaide = ''; if (isset($tableau_template[10]) && $tableau_template[10] != '') { $bulledaide = ' <img class="tooltip_aide" title="' . htmlentities($tableau_template[10]) . '" src="tools/bazar/presentation/images/aide.png" width="16" height="16" alt="image aide" />'; } $val_type = baz_valeurs_formulaire($tableau_template[1]); $tab_result = baz_requete_recherche_fiches('', 'alphabetique', $tableau_template[1], $val_type["bn_type_fiche"]); $select[0] = BAZ_CHOISIR; foreach ($tab_result as $fiche) { $valeurs_fiche = json_decode($fiche[0], true); $valeurs_fiche = array_map('utf8_decode', $valeurs_fiche); $select[$valeurs_fiche['id_fiche']] = $valeurs_fiche['bf_titre']; } $option = array('id' => $tableau_template[0] . $tableau_template[1] . $tableau_template[6]); if (isset($valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]]) && $valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]] != '') { $def = $valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]]; } else { $def = $tableau_template[5]; } require_once 'HTML/QuickForm/select.php'; $select = new HTML_QuickForm_select($tableau_template[0] . $tableau_template[1] . $tableau_template[6], $tableau_template[2] . $bulledaide, $select, $option); if ($tableau_template[4] != '') { $select->setSize($tableau_template[4]); } $select->setMultiple(0); $select->setValue($def); $formtemplate->addElement($select); if (isset($tableau_template[8]) && $tableau_template[8] == 1 && $resultat->numRows() > 0) { $formtemplate->addRule($tableau_template[0] . $tableau_template[1] . $tableau_template[6], $tableau_template[2] . ' obligatoire', 'required', '', 'client'); } } elseif ($mode == 'requete') { if (isset($valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]]) && $valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]] != 0) { return array($tableau_template[0] . $tableau_template[1] . $tableau_template[6] => $valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]]); } } elseif ($mode == 'formulaire_recherche') { if ($tableau_template[9] == 1) { $tab_result = baz_requete_recherche_fiches('', $tri = 'alphabetique', $tableau_template[1], ''); $select[0] = BAZ_INDIFFERENT; foreach ($tab_result as $fiche) { $valeurs_fiche = json_decode($fiche[0], true); $valeurs_fiche = array_map('utf8_decode', $valeurs_fiche); $select[$valeurs_fiche['id_fiche']] = $valeurs_fiche['bf_titre']; } $option = array('id' => $tableau_template[0] . $tableau_template[1] . $tableau_template[6]); require_once 'HTML/QuickForm/select.php'; $select = new HTML_QuickForm_select($tableau_template[0] . $tableau_template[1] . $tableau_template[6], $tableau_template[2], $select, $option); if ($tableau_template[4] != '') { $select->setSize($tableau_template[4]); } $select->setMultiple(0); $formtemplate->addElement($select); } } elseif ($mode == 'html') { $html = ''; if (isset($valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]]) && $valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]] != '') { if ($tableau_template[3] == 'fiche') { $html = baz_voir_fiche(0, $valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]]); } else { $html = '<div class="BAZ_rubrique BAZ_rubrique_' . $GLOBALS['_BAZAR_']['class'] . '">' . "\n" . '<span class="BAZ_label ' . $tableau_template[2] . '_rubrique">' . $tableau_template[2] . ' :</span>' . "\n"; $html .= '<span class="BAZ_texte BAZ_texte_' . $GLOBALS['_BAZAR_']['class'] . ' ' . $tableau_template[2] . '_description">'; $url_voirfiche = clone $GLOBALS['_BAZAR_']['url']; $url_voirfiche->addQueryString(BAZ_VARIABLE_VOIR, BAZ_VOIR_CONSULTER); $url_voirfiche->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FICHE); $url_voirfiche->addQueryString('wiki', $_GET['wiki'] . '/iframe'); $url_voirfiche->addQueryString('id_fiche', $valeurs_fiche[$tableau_template[0] . $tableau_template[1] . $tableau_template[6]]); $html .= '<a href="' . str_replace('&', '&', $url_voirfiche->getUrl()) . '" class="voir_fiche ouvrir_overlay" title="Voir la fiche ' . $res[0] . '" rel="#overlay">' . $res[0] . '</a></span>' . "\n" . '</div>' . "\n"; } } return $html; } }
* *@version $Revision: 1.10 $ $Date: 2010-12-15 14:23:19 $ */ // +------------------------------------------------------------------------------------------------------+ // | ENTETE du PROGRAMME | // +------------------------------------------------------------------------------------------------------+ if (!defined("WIKINI_VERSION")) { die("accès direct interdit"); } $nomwiki = $GLOBALS['wiki']->getUser(); if ($nomwiki) { $requetesql = 'SELECT DISTINCT tag FROM ' . BAZ_PREFIXE . 'pages WHERE latest="Y" AND comment_on = \'\' AND body LIKE \'%"nomwiki":"' . $nomwiki['name'] . '"%\' AND body LIKE \'%"statut_fiche":"1"%\' AND tag IN (SELECT DISTINCT resource FROM ' . BAZ_PREFIXE . 'triples WHERE value = "fiche_bazar" AND property = "http://outils-reseaux.org/_vocabulary/type" ORDER BY resource ASC) ORDER BY time DESC'; $results = $GLOBALS['wiki']->LoadAll($requetesql); if (count($results) > 0) { echo baz_voir_fiche(1, $results[0]["tag"]) . '<br /><br />'; } else { //echo '<div class="alert alert-info">'._t('BAZ_PAS_DE_FICHES_UTILISATEUR_TROUVEE').'</div>'; } // On cherche un template personnalise dans le repertoire themes/tools/bazar/templates $GLOBALS['_BAZAR_']['templates'] = $this->GetParameter("template"); if (empty($GLOBALS['_BAZAR_']['templates'])) { $GLOBALS['_BAZAR_']['templates'] = BAZ_TEMPLATE_LISTE_DEFAUT; } $tableau_dernieres_fiches = baz_requete_recherche_fiches('', '', '', '', 1, $nomwiki["name"]); if (count($tableau_dernieres_fiches) > 0) { echo '<h2 class="titre_mes_fiches">' . _t('BAZ_VOS_FICHES') . '</h2>' . "\n"; echo baz_afficher_liste_resultat($tableau_dernieres_fiches, false); } }
function GestionAffichageCalendrier($type = 'calendrier') { $retour = '<div class="' . $type . '">'; $url = $GLOBALS['_BAZAR_']['url']; $db =& $GLOBALS['_BAZAR_']['db']; // Nettoyage de l'url de la query string $chaine_url = $url->getQueryString(); $tab_params = explode('&', $chaine_url); if (count($tab_params) == 0) { $tab_params = explode('&', $chaine_url); } foreach ($tab_params as $param) { $tab_parametre = explode('=', $param); if ($tab_parametre[0] != 'wiki') { $url->removeQueryString($tab_parametre[0]); } } if (!isset($_GET['y'])) { $_GET['y'] = date('Y'); } if (!isset($_GET['m'])) { $_GET['m'] = date('m'); } // Construction Mois en Cours $month = new Calendar_Month_Weekdays($_GET['y'], $_GET['m']); $curStamp = $month->getTimeStamp(); $url->addQueryString('y', date('Y', $curStamp)); $url->addQueryString('m', date('n', $curStamp)); $url->addQueryString('d', date('j', $curStamp)); $cur = str_replace('&', '&', $url->getUrl()); // Gestion de l'affichage des titres des evenements if (isset($_GET['ctt']) && $_GET['ctt'] == '1') { $url->addQueryString('tt', '0'); if (isset($_GET['tt']) && $_GET['tt'] == '0') { $url->addQueryString('tt', '1'); } $tc_lien = str_replace('&', '&', $url->getUrl()); } else { $url->addQueryString('tt', '0'); if (isset($_GET['tt']) && $_GET['tt'] == '0') { $url->addQueryString('tt', '1'); } $url->addQueryString('ctt', '1'); $tc_lien = str_replace('&', '&', $url->getUrl()); } $url->removeQueryString('ctt'); $url->removeQueryString('tt'); $tc_txt = BAZ_AFFICHE_TITRES_COMPLETS; if (isset($_GET['tt']) && $_GET['tt'] == '0') { $tc_txt = BAZ_TRONQUER_TITRES; $url->addQueryString('tt', $_GET['tt']); } // Navigation $prevStamp = $month->prevMonth(true); $url->addQueryString('y', date('Y', $prevStamp)); $url->addQueryString('m', date('n', $prevStamp)); $url->addQueryString('d', date('j', $prevStamp)); $prev = str_replace('&', '&', $url->getUrl()); $nextStamp = $month->nextMonth(true); $url->addQueryString('y', date('Y', $nextStamp)); $url->addQueryString('m', date('n', $nextStamp)); $url->addQueryString('d', date('j', $nextStamp)); $next = str_replace('&', '&', $url->getUrl()); // Suppression du parametre 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); if ($type == 'calendrier' || $type == 'calendrierjquery' || $type == 'calendrierjquerymini') { $retour .= '<div class="cal_entete">' . "\n"; $retour .= '<span class="cal_navigation">' . "\n"; $retour .= '<a class="cal_precedent_lien" href="' . $prev . '" title="Allez au mois precedent"><img class="cal_precedent_img" src="' . BAZ_CHEMIN . 'presentation/images/cal_precedent.png" alt="<<"/></a>' . "\n"; $retour .= '<a class="cal_mois_courrant" href="' . $cur . '">'; $retour .= $fr_month[date('n', $curStamp)]; $retour .= ' '; $retour .= date('Y', $curStamp); $retour .= '</a>' . "\n"; $retour .= '<a class="cal_suivant_lien" href="' . $next . '" title="Allez au mois suivant"><img class="cal_suivant_img" src="' . BAZ_CHEMIN . 'presentation/images/cal_suivant.png" alt=">>"/></a>' . "\n"; $retour .= '</span>' . "\n"; if ($type == 'calendrier') { $retour .= '<span class="tc_lien">' . '<a href="' . $tc_lien . '">' . $tc_txt . '</a>' . '</span>' . "\n"; } $retour .= '</div>' . "\n"; } // Vue Mois calendrier ou vue applette if (!isset($_GET['id_fiche']) && ($type == 'calendrier' || $type == 'calendrierjquery' || $type == 'calendrierjquerymini')) { // Recherche evenement de la periode selectionnée $ts_jour_fin_mois = $month->nextMonth('timestamp'); $ts_jour_debut_mois = $month->thisMonth('timestamp'); //on recherche toutes les fiches puis on trie sur ceux qui possede une date $tableau_resultat = baz_requete_recherche_fiches('', 'chronologique', $GLOBALS['_BAZAR_']['id_typeannonce'], $GLOBALS['_BAZAR_']['categorie_nature']); $tab_fiches = array(); foreach ($tableau_resultat as $fiche) { $valeurs_fiche = json_decode($fiche[0], true); $valeurs_fiche = array_map('utf8_decode', $valeurs_fiche); //echo $valeurs_fiche['bf_titre'].' du '.$valeurs_fiche['bf_date_debut_evenement'].' au '.$valeurs_fiche['bf_date_fin_evenement'].'<br />'; //echo 'date fin mois : '.date('Y-n-j', $ts_jour_fin_mois).'<br />'; //echo 'date debut mois : '.date('Y-n-j', $ts_jour_debut_mois).'<br />'; if (isset($valeurs_fiche['bf_date_debut_evenement'])) { $dateArr = explode("-", $valeurs_fiche['bf_date_debut_evenement']); $date1Int = mktime(0, 0, 0, $dateArr[1], $dateArr[2], $dateArr[0]); } else { $date1Int = NULL; } if (isset($valeurs_fiche['bf_date_fin_evenement'])) { $dateArr = explode("-", $valeurs_fiche['bf_date_fin_evenement']); $date2Int = mktime(0, 0, 0, $dateArr[1], $dateArr[2], $dateArr[0]); } else { $date2Int = NULL; } //echo ($date1Int < $ts_jour_fin_mois).' = ($date1Int < $ts_jour_fin_mois)'; //echo ($date2Int >= $ts_jour_debut_mois).' = ($date2Int >= $ts_jour_debut_mois)'; if ($date1Int && $date2Int) { $tab_fiches[] = $valeurs_fiche; } } $selection = array(); $evenements = array(); $annee = date('Y', $curStamp); $mois = date('m', $curStamp); $tablo_jours = array(); foreach ($tab_fiches as $val_fiche) { list($annee_debut, $mois_debut, $jour_debut) = explode('-', $val_fiche['bf_date_debut_evenement']); list($annee_fin, $mois_fin, $jour_fin) = explode('-', $val_fiche['bf_date_fin_evenement']); $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); $naviguer = true; while ($naviguer && $ts_jour_suivant <= $ts_jour_fin) { // Si le jours suivant est inferieur a 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($val_fiche['bf_titre']); $ts_jour_suivant = $Calendrier->nextDay('timestamp'); //echo "ici$ts_jour_suivant-"; $Calendrier->setTimestamp($ts_jour_suivant); //echo "la".$Calendrier->thisDay('timestamp')."-"; } else { $naviguer = false; } } } // Add the decorator to the selection foreach ($tablo_jours as $jour) { $selection[] = $jour['Diary_Event']; } // Affichage Calendrier $month->build($selection); $retour .= '<table>' . "\n" . '<colgroup>' . "\n" . '<col class="cal_lundi"/>' . "\n" . '<col class="cal_mardi"/>' . "\n" . '<col class="cal_mercredi"/>' . "\n" . '<col class="cal_jeudi"/>' . "\n" . '<col class="cal_vendredi"/>' . "\n" . '<col class="cal_samedi"/>' . "\n" . '<col class="cal_dimanche"/>' . "\n" . '</colgroup>' . "\n" . '<thead>' . "\n" . "<tr>" . "\n"; if ($type == 'calendrier' || $type == 'calendrierjquery') { $retour .= "<th> " . BAZ_LUNDI . "</th>\n\t\t\t <th> " . BAZ_MARDI . "</th>\n\t\t\t <th> " . BAZ_MERCREDI . "</th>\n\t\t\t <th> " . BAZ_JEUDI . "</th>\n\t\t\t <th> " . BAZ_VENDREDI . "</th>\n\t\t\t <th> " . BAZ_SAMEDI . "</th>\n\t\t\t <th> " . BAZ_DIMANCHE . "</th>\n\t\t\t </tr>\n\t\t\t " . '</thead>' . "\n" . '<tbody>' . "\n"; } elseif ($type == 'calendrierjquerymini') { $retour .= "<th> " . BAZ_LUNDI_COURT . "</th>\n\t\t\t <th> " . BAZ_MARDI_COURT . "</th>\n\t\t\t <th> " . BAZ_MERCREDI_COURT . "</th>\n\t\t\t <th> " . BAZ_JEUDI_COURT . "</th>\n\t\t\t <th> " . BAZ_VENDREDI_COURT . "</th>\n\t\t\t <th> " . BAZ_SAMEDI_COURT . "</th>\n\t\t\t <th> " . BAZ_DIMANCHE_COURT . "</th>\n\t\t\t </tr>\n\t\t\t " . '</thead>' . "\n" . '<tbody>' . "\n"; } $todayStamp = time(); $today_ymd = date('Ymd', $todayStamp); // Other month : mois while ($day = $month->fetch()) { $dayStamp = $day->thisDay(true); $day_ymd = date('Ymd', $dayStamp); if ($day->isEmpty()) { $class = "cal_autre_mois"; } else { if ($day_ymd < $today_ymd) { $class = "cal_mois_precedent"; } else { if ($day_ymd == $today_ymd) { $class = "cal_jour_courant"; } else { $class = "cal_mois_courant"; } } } $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()) { $retour .= "<tr>\n"; } if ($type == 'calendrier') { $retour .= "<td class=\"" . $class . "\">" . '<span class="cal_j">' . $day->thisDay() . '</span>' . "\n"; if ($day->isSelected()) { $evenements = $day->getEntry(); $evenements_nbre = count($evenements); $evenemt_xhtml = ''; while ($ligne_evenement = array_pop($evenements)) { $id_fiches = $ligne_evenement->bf_id_fiche; $url->addQueryString('id_fiche', $id_fiches); $link = str_replace('&', '&', $url->getUrl()); if (!isset($_GET['tt']) || isset($_GET['tt']) && $_GET['tt'] == '1') { $titre_taille = strlen($ligne_evenement->bf_titre); $titre = htmlentities($titre_taille > 40 ? substr($ligne_evenement->bf_titre, 0, 40) . '...' : $ligne_evenement->bf_titre, ENT_QUOTES); } else { $titre = htmlentities($ligne_evenement->bf_titre, ENT_QUOTES); } $evenemt_xhtml .= '<li class="tooltip" title="' . htmlentities($ligne_evenement->bf_titre, ENT_QUOTES) . '"><a class="cal_evenemt" href="' . $link . '">' . $titre . '</a></li>' . "\n"; $url->removeQueryString('id_fiches'); } if ($evenements_nbre > 0) { $retour .= '<ul class="cal_evenemt_liste">'; $retour .= $evenemt_xhtml; $retour .= '</ul>'; } } } elseif ($type == 'calendrierjquery' || $type == 'calendrierjquerymini') { if ($day->isSelected()) { $evenements = $day->getEntry(); $evenements_nbre = count($evenements); $evenemt_xhtml = ''; while ($ligne_evenement = array_pop($evenements)) { $id_fiches = $ligne_evenement->bf_id_fiche; $url->addQueryString('id_fiche', $id_fiches); $link = str_replace('&', '&', $url->getUrl()); $titre = htmlentities($ligne_evenement->bf_titre, ENT_QUOTES); $evenemt_xhtml .= '<li> <span class="titre_evenement"><a class="cal_evenemt" href="' . $link . '">' . $titre . '</a></span> </li>'; $url->removeQueryString('id_fiches'); } if ($evenements_nbre > 0) { $retour .= '<td class="' . $class . ' date_avec_evenements">' . $day->thisDay() . ' <div class="evenements"> <ul>'; $retour .= $evenemt_xhtml; $retour .= '</ul> </div>'; } else { $retour .= '<td class="' . $class . '">' . $day->thisDay() . "\n"; } } else { $retour .= '<td class="' . $class . '">' . $day->thisDay() . "\n"; } } elseif ($type == 'calendriermini') { $lien_date = "<td class=\"" . $class . "\">" . $day->thisDay(); if ($day->isSelected()) { $evenements = $day->getEntry(); $id_fiches = array(); while ($ligne_evenement = array_pop($evenements)) { $id_fiches[] = $ligne_evenement->bf_id_fiche; } $url->addQueryString('id_fiches', $id_fiches); $link = str_replace('&', '&', $url->getUrl()); $lien_date = "<td class=\"" . $class . "\"><a href=\"" . $link . "\">" . $day->thisDay() . "</a>\n"; $url->removeQueryString('id_fiches'); } $retour .= $lien_date; } $retour .= "</td>\n"; // isLast() to find end of week if ($day->isLast()) { $retour .= "</tr>\n"; } } $retour .= "</tbody></table>"; } // Vue detail if (isset($_GET['id_fiche'])) { // 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']); $retour .= '<h1>' . $jours[date('w', $timestamp) - 1] . ' ' . $_GET['d'] . ' ' . $mois[$_GET['m'] - 1] . ' ' . $_GET['y'] . '</h1>'; $retour .= baz_voir_fiche(0, $_GET['id_fiche']); // Un lien pour retourner au calendrier $url->removeQueryString('id_fiche'); $url->removeQueryString('y'); $url->removeQueryString('m'); $url->removeQueryString('d'); $url->addQueryString('y', $_GET['y']); $url->addQueryString('m', $_GET['m']); $url->addQueryString('d', $_GET['d']); $retour .= '<div class="retour"><a href="' . str_replace('&', '&', $url->getUrl()) . '">Retour au calendrier</a></div>'; } // Nettoyage de l'url $url->removeQueryString('id_fiche'); $url->removeQueryString('y'); $url->removeQueryString('m'); $url->removeQueryString('d'); return $retour . "\n" . '</div>' . "\n"; }
* *@package Bazar //Auteur original : *@author Florian SCHMITT <*****@*****.**> *@version $Revision: 1.1 $ $Date: 2011/07/13 10:33:22 $ // +------------------------------------------------------------------------------------------------------+ */ // +------------------------------------------------------------------------------------------------------+ // | ENTETE du PROGRAMME | // +------------------------------------------------------------------------------------------------------+ if (!defined("WIKINI_VERSION")) { die("accès direct interdit"); } $nomwiki = $GLOBALS['wiki']->getUser(); if ($nomwiki) { $requetesql = 'SELECT DISTINCT tag FROM ' . BAZ_PREFIXE . 'pages WHERE latest="Y" AND comment_on = \'\' AND body LIKE \'%"nomwiki":"' . $nomwiki['name'] . '"%\' AND body LIKE \'%"statut_fiche":"1"%\' AND tag IN (SELECT DISTINCT resource FROM ' . BAZ_PREFIXE . 'triples WHERE value = "fiche_bazar" AND property = "http://outils-reseaux.org/_vocabulary/type" ORDER BY resource ASC) ORDER BY time DESC'; $results = $GLOBALS['wiki']->LoadAll($requetesql); if (count($results) > 0) { echo baz_voir_fiche(1, $results[0]["tag"]) . '<br /><br />'; } else { echo '<div class="info_box">' . BAZ_PAS_DE_FICHES_UTILISATEUR_TROUVEE . '</div>'; } echo '<h2 class="titre_mes_fiches">' . BAZ_VOS_FICHES . '</h2>' . "\n"; $tableau_fiches = baz_requete_recherche_fiches('', '', $GLOBALS['_BAZAR_']['id_typeannonce'], $GLOBALS['_BAZAR_']['categorie_nature'], 1, $nomwiki["name"]); if (count($tableau_fiches) > 0) { echo baz_afficher_liste_resultat($tableau_fiches, false); } else { echo '<div class="info_box">' . BAZ_PAS_DE_FICHES_SAUVEES_EN_VOTRE_NOM . '</div>' . "\n"; } }
$prepared[$i]['required'] = ''; // valeurs associées $prepared[$i]['values'] = ''; // texte d'aide $prepared[$i]['helper'] = $formelem[1]; } $i++; } $form['prepared'] = $prepared; $formval[$idform] = $form; } echo json_encode($formval); break; case "entries": // liste de fiches bazar $results = baz_requete_recherche_fiches($tabquery, $order, $form, '', 1, '', ''); foreach ($results as $wikipage) { $decoded_entry = json_decode($wikipage['body'], true); //json = norme d'ecriture utilisée pour les fiches bazar (en utf8) if ($html == '1') { $fichehtml = baz_voir_fiche(0, $decoded_entry); $regexp = '/<div.*data-id="(.*)".*>\\s*<span class="BAZ_label.*">.*<\\/span>\\s*' . '<span class="BAZ_texte">\\s*(.*)\\s*<\\/span>\\s*<\\/div> <!-- \\/.BAZ_rubrique -->/Uis'; preg_match_all($regexp, $fichehtml, $matches); if (isset($matches[1]) && count($matches[1]) > 0) { foreach ($matches[1] as $key => $value) { $decoded_entry[$value] = $matches[2][$key]; } } } $tab_entries[$decoded_entry['id_fiche']] = $decoded_entry; }