Ejemplo n.º 1
0
<?php

// $Header$
// Copyright (c) 2004 bitweaver Sample
// All Rights Reserved. See below for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
// Initialization
require_once '../kernel/setup_inc.php';
require_once 'meta_lib.php';
// Is package installed and enabled
$gBitSystem->verifyPackage('meta');
// Now check permissions to access this page
$gBitSystem->verifyPermission('p_browse_meta');
$gBitSmarty->assign('metaAttributes', meta_get_possible_values(null, false));
if (isset($_REQUEST['metatt'])) {
    foreach ($_REQUEST['metatt'] as $key => $value) {
        if (!empty($value)) {
            $listHash['search'][$key] = $value;
        }
    }
    $searchResults = meta_search($listHash);
    foreach (array_keys($searchResults) as $key) {
        $groupKey = implode($searchResults[$key]['meta'], ',');
        $groupedResults[$groupKey][$key] = $searchResults[$key];
    }
    ksort($groupedResults);
    $gBitSmarty->assign_by_ref('searchData', $groupedResults);
    $gBitSmarty->assign('tab', 2);
} else {
    $gBitSmarty->assign('tab', 0);
}
Ejemplo n.º 2
0
function meta_content_preview(&$pContent, &$pParamHash)
{
    // {{{
    global $gBitDb, $gBitUser, $gBitSmarty;
    if (!$gBitUser->hasPermission('p_assign_meta')) {
        return;
    }
    $attributes = meta_get_possible_values();
    if (!empty($pParamHash['metatt'])) {
        foreach ($pParamHash['metatt'] as $att_id => $value) {
            foreach ($attributes as $group => $values) {
                if (isset($values[$att_id])) {
                    foreach ($values[$att_id]['values'] as $index => $row) {
                        if ($row['id'] == $value) {
                            $attributes[$group][$att_id]['values'][$index]['selected'] = true;
                        }
                    }
                }
            }
        }
    }
    $gBitSmarty->assign('metaAttributes', $attributes);
    $gBitSmarty->assign('metaAttributesOther', $_POST['metatt_other']);
}