[mod_quickfinder:XXX] в нужном месте вашего шаблона, где XXX - идентификаторы меню навигации указанные через запятую.';
$modul['ModuleAutor'] = 'Arcanum, UPD Repellent ';
$modul['ModuleCopyright'] = '© 2007-2016 AVE.CMS';
$modul['ModuleIsFunction'] = 1;
$modul['ModuleAdminEdit'] = 0;
$modul['ModuleFunction'] = 'mod_quickfinder';
$modul['ModuleTag'] = '[mod_quickfinder:XXX]';
$modul['ModuleTagLink'] = null;
$modul['ModuleAveTag'] = '#\\\[mod_quickfinder:([\\\d,]*)]#';
$modul['ModulePHPTag'] = "";
}
function mod_quickfinder($navi_ids = '')
{
global $AVE_DB, $AVE_Core, $navigations;
if (!empty($navi_ids))
{
$sql = array();
$navi_ids = explode(',', $navi_ids);
foreach ($navi_ids as $navi_id)
{
if (is_numeric($navi_id) && check_navi_permission($navi_id))
{
$sql[] = "(
SELECT
navigation_item_id,
parent_id,
title,
document_id,
target,
level,
alias,
0 AS active
FROM " . PREFIX . "_navigation_items
WHERE status = '1'
AND navigation_id = " . $navi_id . "
ORDER BY position ASC
)";
}
}
$sql = implode(' UNION ', $sql);
if (empty($sql)) return;
}
else
{
$navigations = get_navigations();
if (empty($navigations)) return;
$navi_in = array();
foreach ($navigations as $navigation)
{
if (in_array(UGROUP, $navigation->user_group))
{
array_push($navi_in, $navigation->navigation_id);
}
}
if (sizeof($navi_in)) {
$sql = "
SELECT
navigation_item_id,
parent_id,
title,
document_id,
target,
level,
alias,
0 AS active
FROM " . PREFIX . "_navigation_items
WHERE status = '1'
AND navigation_id IN(" . implode(',', $navi_in) . ")
ORDER BY navigation_id ASC, position ASC
";
}
else
{
return;
}
}
$nav_items = array();
$sql = $AVE_DB->Query($sql);
while ($row_nav_item = $sql->FetchAssocArray())
{
if (empty($_REQUEST['module']))
{
$curent_doc_id = (isset($_GET['id']) && is_numeric($_GET['id'])) ? $_GET['id'] : 1;
if ($row_nav_item['alias'] == $AVE_Core->curentdoc->document_alias ||
'index.php?id=' . $row_nav_item['document_id'] == 'index.php?id=' . $curent_doc_id)
{
$row_nav_item['active'] = 1;
}
}
else
{
if ('index.php?id=' . $row_nav_item['document_id'] == 'index.php?module=' . $_REQUEST['module'])
{
$row_nav_item['active'] = 1;
}
}
$nav_items[$row_nav_item['parent_id']][] = $row_nav_item;
}
if (sizeof($nav_items))
{
$quickfinder = '';
}
}
function printQuickfinder(&$nav_items, &$quickfinder = '', $parent = '0')
{
foreach ($nav_items[$parent] as $row)
{
if (strpos('index.php?id=' . $row['document_id'], 'module=') === false && start_with('index.php?', 'index.php?id=' . $row['document_id']))
{
'index.php?id=' . $row['document_id'] .= '&doc=' . (empty($row['alias']) ? prepare_url($row['title']) : $row['alias']);
}
if (start_with('www.', 'index.php?id=' . $row['document_id']))
{
'index.php?id=' . $row['document_id'] = str_replace('www.', 'http://www.', 'index.php?id=' . $row['document_id']);
}
'index.php?id=' . $row['document_id'] = rewrite_link('index.php?id=' . $row['document_id']);
if (!start_with('javascript:', 'index.php?id=' . $row['document_id']))
{
if ($row['target'] == '_blank')
{
$row['alias'] = "javascript:window.open('" . $row['alias'] . "', '', '')";
}
else
{
$row['alias'] = "window.location.href = '" . $row['alias'] . "'";
}
}
$quickfinder .= '';
if (isset($nav_items[$row['navigation_item_id']]))
{
printQuickfinder($nav_items, $quickfinder, $row['navigation_item_id']);
}
}
}
?>