Esempio n. 1
0
}
include_once 'tools/tags/libs/tags.functions.php';
$nbcartrunc = 200;
$elementwidth = $this->GetParameter('elementwidth');
if (empty($elementwidth)) {
    $elementwidth = 300;
}
$elementoffset = $this->GetParameter('elementoffset');
if (empty($elementoffset)) {
    $elementoffset = 10;
}
$template = $this->GetParameter('template');
if (empty($template) || !file_exists('tools/tags/presentation/templates/' . $template)) {
    $template = 'pages_grid_filter.tpl.html';
}
$params = get_filtertags_parameters_recursive();
if (!is_array($params) && strstr($params, 'alert-danger')) {
    echo $params;
    return;
}
$taglist = _convert($params['tags'], TEMPLATES_DEFAULT_CHARSET, TRUE);
unset($params['tags']);
// requete avec toutes les pages contenants les mots cles
$req = "SELECT DISTINCT tag, time, user, owner, body \nFROM " . $this->config['table_prefix'] . "pages, " . $this->config['table_prefix'] . "triples tags\nWHERE latest = 'Y' AND comment_on = '' AND tags.value IN (" . $taglist . ") AND tags.property = \"http://outils-reseaux.org/_vocabulary/tag\" AND tags.resource = tag AND tag NOT IN (\"" . implode('","', $this->GetAllInclusions()) . "\") ORDER BY tag ASC";
$pages = $this->LoadAll($req);
echo '<div class="well well-sm no-dblclick controls">' . "\n" . '<div class="pull-right muted"><span class="nbfilteredelements">' . count($pages) . '</span> ' . _t('TAGS_RESULTS') . '</div>';
foreach ($params as $param) {
    echo '<div class="filter-group ' . $param['class'] . '" data-type="' . $param['toggle'] . '">' . "\n" . $param['title'] . "\n" . '<div class="btn-group filter-tags">' . "\n";
    foreach ($param['arraytags'] as $tagname) {
        if ($tagname == "alaligne") {
            echo '<br />' . "\n";
function get_filtertags_parameters_recursive($nb = 1, $tab = array())
{
    $filter = $GLOBALS['wiki']->GetParameter('filter' . $nb);
    if (empty($filter) && $nb == 1) {
        return '<div class="alert alert-danger"><strong>' . _t('TAGS_ACTION_FILTERTAGS') . '</strong> : ' . _t('TAGS_NO_FILTERS') . '</div>' . "\n";
    } elseif (empty($filter)) {
        return $tab;
    } else {
        if (!isset($tab['tags'])) {
            $tab['tags'] = '';
        } else {
            $tab['tags'] .= ',';
        }
        $explodelabel = explode(":", $filter);
        // on decoupe le choix pour recuperer le titre
        if (count($explodelabel) > 2) {
            return '<div class="alert alert-danger"><strong>' . _t('TAGS_ACTION_FILTERTAGS') . '</strong> : ' . _t('TAGS_ONLY_ONE_DOUBLEPOINT') . '</div>' . "\n";
        } elseif (count($explodelabel) == 2) {
            $tab[$nb]['title'] = '<strong>' . $explodelabel[0] . ' : </strong>' . "\n";
            $tab[$nb]['arraytags'] = explode(',', $explodelabel[1]);
        } else {
            $tab[$nb]['title'] = '';
            $tab[$nb]['arraytags'] = explode(',', $explodelabel[0]);
        }
        $toggle = $GLOBALS['wiki']->GetParameter('select' . $nb);
        if (!empty($toggle) && $toggle == 'checkbox') {
            $tab[$nb]['toggle'] = $toggle;
        } else {
            $tab[$nb]['toggle'] = 'radio';
        }
        $class = $GLOBALS['wiki']->GetParameter('class' . $nb);
        if (!empty($class)) {
            $tab[$nb]['class'] = $class;
        } else {
            $tab[$nb]['class'] = 'filter-inline';
        }
        $tab['tags'] .= '"' . implode('","', $tab[$nb]['arraytags']) . '"';
        $nb++;
        $tab = get_filtertags_parameters_recursive($nb, $tab);
        return $tab;
    }
}