コード例 #1
0
/** 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 = ' &nbsp;&nbsp;<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">*&nbsp;</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] . '&nbsp;:</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('&', '&amp;', $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;
    }
}
コード例 #2
0
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Vérification de sécurité
if (!defined("WIKINI_VERSION")) {
    die("acc&egrave;s direct interdit");
}
// si la page est de type fiche_bazar, alors on affiche la fiche plutot que de formater en wiki
$type = $this->GetTripleValue($incPageName, 'http://outils-reseaux.org/_vocabulary/type', '', '');
if ($type == 'fiche_bazar') {
    $valjson = $this->LoadPage($incPageName);
    $tab_valeurs = json_decode($valjson['body'], true);
    if (TEMPLATES_DEFAULT_CHARSET != 'UTF-8') {
        $tab_valeurs = array_map('utf8_decode', $tab_valeurs);
    }
    $plugin_output_new = '<div class="' . $class . '">' . "\n" . baz_voir_fiche(0, $tab_valeurs) . "\n" . '</div>' . "\n";
    //exit;
} else {
    $type = '';
}
コード例 #3
0
/** 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 .= '&amp;id_typeannonce=' . $id_typeannonce;
    } else {
        $id_typeannonce = '';
    }
    if (isset($_GET['categorie_fiche'])) {
        $categorie_fiche = $_GET['categorie_fiche'];
        $urlrss .= '&amp;categorie_fiche=' . $categorie_fiche;
    } else {
        $categorie_fiche = '';
    }
    if (isset($_GET['nbitem'])) {
        $nbitem = $_GET['nbitem'];
        $urlrss .= '&amp;nbitem=' . $nbitem;
    } else {
        $nbitem = BAZ_NB_ENTREES_FLUX_RSS;
    }
    if (isset($_GET['utilisateur'])) {
        $utilisateur = $_GET['utilisateur'];
        $urlrss .= '&amp;utilisateur=' . $utilisateur;
    } else {
        $utilisateur = '';
    }
    if (isset($_GET['statut'])) {
        $statut = $_GET['statut'];
        $urlrss .= '&amp;statut=' . $statut;
    } else {
        $statut = 1;
    }
    if (isset($_GET['query'])) {
        $query = $_GET['query'];
        $urlrss .= '&amp;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'));
}
コード例 #4
0
 $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;
         // permet de voir la fiche
         $valeurs_fiche['html'] = baz_voir_fiche(0, $valeurs_fiche);
         // lien de suppression visible pour le super admin
         if (baz_a_le_droit('supp_fiche', $valeurs_fiche['createur'])) {
             $valeurs_fiche['lien_suppression'] = '<a class="BAZ_lien_supprimer" href="' . $this->href('deletepage', $valeurs_fiche['id_fiche']) . '"></a>' . "\n";
         }
         if (baz_a_le_droit('modif_fiche', $valeurs_fiche['createur'])) {
             $valeurs_fiche['lien_edition'] = '<a class="BAZ_lien_modifier" href="' . $this->href('edit', $valeurs_fiche['id_fiche']) . '"></a>' . "\n";
         }
         $valeurs_fiche['lien_voir_titre'] = '<a class="BAZ_lien_modifier" href="' . $this->href('', $valeurs_fiche['id_fiche']) . '">' . $valeurs_fiche['bf_titre'] . '</a>' . "\n";
         $valeurs_fiche['lien_voir'] = '<a class="BAZ_lien_modifier" href="' . $this->href('', $valeurs_fiche['id_fiche']) . '"></a>' . "\n";
         $fiches['fiches'][] = $valeurs_fiche;
     }
 }
 // trie par liste choisie
 usort($fiches['fiches'], 'champCompare');
 // preparation du template
コード例 #5
0
        $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);
echo '<div id="map" style="width: ' . BAZ_GOOGLE_IMAGE_LARGEUR . '; height: ' . BAZ_GOOGLE_IMAGE_HAUTEUR . '"></div>' . "\n" . '<ul id="markers"></ul>' . "\n";
echo '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
	<script type="text/javascript" src="http://www.google.com/jsapi"></script>

	<script type="text/javascript">
	//variable pour la carte google
	var map;
	
	//tableau des marqueurs google
コード例 #6
0
                    foreach ($valeurs_fiche['ficheliees'] as $valeurs_fiche_liee) {
                        $index_liste = explode(",", $valeurs_fiche_liee['checkbox' . $group]);
                        if (empty($index_liste[0])) {
                            $index_liste = explode(",", $valeurs_fiche_liee['liste' . $group]);
                        }
                        foreach ($index_liste as $element_liste) {
                            // string compatible css
                            $valeurs_fiche['categorie'] = $valeurs_fiche['categorie'] . " " . trim(preg_replace('/\\W+/', '', strtolower(strip_tags($grouplist[$group][$element_liste]))));
                        }
                    }
                }
            }
        }
        $valeurs_fiche['categorie'] = trim(preg_replace('/[ ][ ]*/', ' ', $valeurs_fiche['categorie']));
        $facettes['fiches'][$valeurs_fiche['id_fiche']] = $valeurs_fiche;
        $facettes['html'] = baz_voir_fiche(0, $valeurs_fiche);
    }
}
//print_r($facettes);
if (!empty($pagination)) {
    $facettes['info_res'] = '<div class="info_box">' . 'Resultat : ';
    $nb_result = count($facettes['fiches']);
    if ($nb_result <= 1) {
        $facettes['info_res'] .= $nb_result . ' fiche ' . "</div>\n";
    } else {
        $facettes['info_res'] .= $nb_result . ' fiches ' . "</div>\n";
    }
    // Mise en place du Pager
    require_once 'Pager/Pager.php';
    $params = array('mode' => 'Jumping', 'perPage' => $pagination, 'delta' => 12, 'httpMethod' => 'GET', 'extraVars' => array_merge($_POST, $_GET), 'altNext' => '>', 'altPrev' => '<', 'nextImg' => '>', 'prevImg' => '<', 'itemData' => $facettes['fiches']);
    $pager =& Pager::factory($params);
コード例 #7
0
/** 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);
}
コード例 #8
0
ファイル: bazar.php プロジェクト: BackupTheBerlios/wikiplug
         }
     } else {
         $output .= baz_liste_rss();
     }
     break;
 case BAZ_VOIR_SAISIR:
     if (isset($_GET[BAZ_VARIABLE_ACTION])) {
         switch ($_GET[BAZ_VARIABLE_ACTION]) {
             case BAZ_ACTION_SUPPRESSION:
                 $output .= baz_suppression($_GET['id_fiche']);
                 break;
             case BAZ_ACTION_PUBLIER:
                 $output .= publier_fiche(1) . baz_voir_fiche(1, $GLOBALS['_BAZAR_']['id_fiche']);
                 break;
             case BAZ_ACTION_PAS_PUBLIER:
                 $output .= publier_fiche(0) . baz_voir_fiche(1, $GLOBALS['_BAZAR_']['id_fiche']);
                 break;
             default:
                 $output .= baz_formulaire($_GET[BAZ_VARIABLE_ACTION]);
                 break;
         }
     } else {
         $_GET[BAZ_VARIABLE_ACTION] = BAZ_CHOISIR_TYPE_FICHE;
         $output .= baz_formulaire($_GET[BAZ_VARIABLE_ACTION]);
     }
     break;
 case BAZ_VOIR_FORMULAIRE:
     $output .= baz_gestion_formulaire();
     break;
 case BAZ_VOIR_LISTES:
     $output .= baz_gestion_listes();
コード例 #9
0
ファイル: __show.php プロジェクト: BackupTheBerlios/wikiplug
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Vérification de sécurité
if (!defined("WIKINI_VERSION")) {
    die("acc&egrave;s direct interdit");
}
//si la page est de type fiche_bazar, alors on affiche la fiche plutot que de formater en wiki
$type = $this->GetTripleValue($this->GetPageTag(), 'http://outils-reseaux.org/_vocabulary/type', '', '');
if ($type == 'fiche_bazar') {
    $valjson = $this->page["body"];
    $tab_valeurs = json_decode($valjson, true);
    $tab_valeurs = array_map('utf8_decode', $tab_valeurs);
    $this->page["body"] = '""' . baz_voir_fiche(0, $tab_valeurs) . '""';
}
コード例 #10
0
/** 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] . '&nbsp;:</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('&', '&amp;', $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;
    }
}
コード例 #11
0
*
*@version       $Revision: 1.10 $ $Date: 2010-12-15 14:23:19 $
*/
// +------------------------------------------------------------------------------------------------------+
// |                                            ENTETE du PROGRAMME                                       |
// +------------------------------------------------------------------------------------------------------+
if (!defined("WIKINI_VERSION")) {
    die("acc&egrave;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);
    }
}
コード例 #12
0
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('&amp;', $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('&', '&amp;', $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('&', '&amp;', $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('&', '&amp;', $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('&', '&amp;', $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('&', '&amp;', $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="&lt;&lt;"/></a>' . "\n";
        $retour .= '<a class="cal_mois_courrant" href="' . $cur . '">';
        $retour .= $fr_month[date('n', $curStamp)];
        $retour .= '&nbsp;';
        $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="&gt;&gt;"/></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('&', '&amp;', $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('&', '&amp;', $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('&', '&amp;', $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&eacute;vrier', 'mars', 'avril', 'mai', 'juin', 'juillet', 'ao&ucirc;t', 'septembre', 'octobre', 'novembre', 'd&eacute;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('&', '&amp;', $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";
}
コード例 #13
0
ファイル: json.php プロジェクト: YesWiki/yeswiki-sandstorm
             }
             $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;
     }
     echo json_encode($tab_entries);
     break;
 case "pages":
     // les pages wiki
     echo json_encode(baz_utf8_encode_recursive($this->LoadAllPages()));
コード例 #14
0
ファイル: bazar.php プロジェクト: YesWiki/yeswiki-sandstorm
             break;
         default:
             $output .= baz_liste_rss();
             break;
     }
     break;
 case BAZ_VOIR_SAISIR:
     switch ($GLOBALS['params']['action']) {
         case BAZ_ACTION_SUPPRESSION:
             $output .= baz_suppression($_REQUEST['id_fiche']);
             break;
         case BAZ_ACTION_PUBLIER:
             $output .= publier_fiche(1) . baz_voir_fiche(1, $_REQUEST['id_fiche']);
             break;
         case BAZ_ACTION_PAS_PUBLIER:
             $output .= publier_fiche(0) . baz_voir_fiche(1, $_REQUEST['id_fiche']);
             break;
         case BAZ_ACTION_NOUVEAU:
             // Affichage du formulaire du saisie d'une' fiche
             $output .= baz_formulaire(BAZ_ACTION_NOUVEAU);
             break;
         case BAZ_ACTION_MODIFIER:
             // Affichage du formulaire de modification d'une fiche
             $output .= baz_formulaire(BAZ_ACTION_MODIFIER);
             break;
         case BAZ_ACTION_NOUVEAU_V:
             // Affichage du formulaire du saisie d'une' fiche
             $output .= baz_formulaire(BAZ_ACTION_NOUVEAU_V);
             break;
         case BAZ_ACTION_MODIFIER_V:
             // Affichage du formulaire de modification d'une fiche