Initial commit
This commit is contained in:
11
README.md
11
README.md
@@ -1,3 +1,10 @@
|
||||
# quickfinder
|
||||
### quickfinder
|
||||
|
||||
Модуль Быстрый переход Только для AVE.CMS ALT
|
||||
## Модуль Быстрый переход v1.26.1
|
||||
|
||||
* Модуль является альтернативным способом организации меню навигации на сайте. Он представлен в виде выпадающего списка разделов и подразделов вашего сайта. Для использования модуля, разместите системный тег <strong>[mod_quickfinder:XXX]</strong> в нужном месте вашего шаблона, где XXX - идентификаторы меню навигации указанные через запятую.
|
||||
|
||||
|
||||
04.09.2019 - версия 1.26.1
|
||||
|
||||
15.06.2016 - версия 1.2
|
||||
20
info.php
Normal file
20
info.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
if (! defined('BASE_DIR'))
|
||||
exit;
|
||||
|
||||
$module = array(
|
||||
'ModuleSysName' => 'quickfinder',
|
||||
'ModuleVersion' => '1.26.1',
|
||||
'ModuleAutor' => 'AVE.cms Team',
|
||||
'ModuleCopyright' => '© 2007-' . date('Y') . ' AVE.cms',
|
||||
'ModuleStatus' => 1,
|
||||
'ModuleIsFunction' => 1,
|
||||
'ModuleTemplate' => 0,
|
||||
'ModuleAdminEdit' => 0,
|
||||
'ModuleFunction' => 'mod_quickfinder',
|
||||
'ModuleTag' => '[mod_quickfinder:XXX]',
|
||||
'ModuleTagLink' => null,
|
||||
'ModuleAveTag' => '#\\\[mod_quickfinder:([\\\d,]*)]#',
|
||||
'ModulePHPTag' => "<?php mod_quickfinder(''$1''); ?>"
|
||||
);
|
||||
?>
|
||||
4
lang/index.php
Normal file
4
lang/index.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
header('Location:/');
|
||||
exit;
|
||||
?>
|
||||
3
lang/ru.txt
Normal file
3
lang/ru.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
[name]
|
||||
MODULE_NAME = "Быстрый переход"
|
||||
MODULE_DESCRIPTION = "Данный модуль является альтернативным способом организации меню навигации на сайте. Он представлен в виде выпадающего списка разделов и подразделов вашего сайта. Для использования модуля, разместите системный тег <strong>[mod_quickfinder:XXX]</strong> в нужном месте вашего шаблона, где XXX - идентификаторы меню навигации указанные через запятую."
|
||||
182
module.php
Normal file
182
module.php
Normal file
@@ -0,0 +1,182 @@
|
||||
<style type="text/css">
|
||||
.level_1:before {content: "\203a\a0";}
|
||||
.level_2:before {margin-left: 10px; content: "\21b3\a0";}
|
||||
.level_3:before {margin-left: 25px; content: "\21b3\a0";}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms - Модуль Быстрый переход
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @subpackage module_QuickFinder
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
if(!defined('BASE_DIR')) exit;
|
||||
|
||||
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 = '<select class="form-control" name="quickfinder" onchange="eval(this.options[this.selectedIndex].value);">';
|
||||
$quickfinder .= '<option></option>';
|
||||
printQuickfinder($nav_items, $quickfinder);
|
||||
echo $quickfinder . '</select>';
|
||||
}
|
||||
$sql->Close();
|
||||
}
|
||||
|
||||
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($row['alias']=='/') {
|
||||
|
||||
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'] . "'";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
if (!start_with('javascript:', 'index.php?id=' . $row['document_id']))
|
||||
{
|
||||
if ($row['target'] == '_blank')
|
||||
{
|
||||
$row['alias'] = "javascript:window.open('". ABS_PATH. $row['alias'] . "', '', '')";
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['alias'] = "window.location.href = '". ABS_PATH. $row['alias'] . "'";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$quickfinder .= '<option class="level_' . $row['level'] . '" value="' . $row['alias'] . '"' . ($row['active'] == 1 ? ' selected="selected"' : '') . '>' . pretty_chars($row['title']) . '</option>';
|
||||
|
||||
|
||||
if (isset($nav_items[$row['navigation_item_id']]))
|
||||
{
|
||||
printQuickfinder($nav_items, $quickfinder, $row['navigation_item_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user