Модуль Навигация по документам рубрики v1.26.2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

126 lines
3.3 KiB

<?php
/**
* AVE.cms - Модуль Навигация по документам рубрики
*
* @package AVE.cms
* @subpackage module_Rubnav
* @filesource
*/
if(!defined('BASE_DIR')) exit;
/**
* Обработка тэга модуля
*
*/
function mod_rubnav($data)
{
global $AVE_DB, $AVE_Core;
$row_templ = $AVE_DB->Query("
SELECT *
FROM " . PREFIX . "_module_rubnav
WHERE Id = 1
")->FetchRow();
if ($data == "next")
{
$next_link = '';
$row = $AVE_DB->Query("
SELECT
Id,
document_alias,
document_title
FROM " . PREFIX . "_documents
WHERE
Id != '1'
AND Id != '" . PAGE_NOT_FOUND_ID . "'
AND Id != '" . $AVE_Core->curentdoc->Id . "'
AND rubric_id = '" . $AVE_Core->curentdoc->rubric_id . "'
AND document_published >= '" . $AVE_Core->curentdoc->document_published . "'
AND (document_expire = 0 || document_expire > UNIX_TIMESTAMP())
AND (document_published = 0 || document_published < UNIX_TIMESTAMP())
AND document_deleted = '0'
AND document_status = '1'
ORDER BY document_published ASC
LIMIT 0,1
")
->fetchRow();
if ($row)
{
$search = array('[tag:link]','[tag:linkname]');
$replace = array(
rewrite_link('index.php?id=' . $row->Id . '&amp;doc=' . (empty($row->document_alias) ? prepare_url($row->document_title) : $row->document_alias)),
stripslashes(htmlspecialchars_decode($row->document_title))
);
$next_link = str_replace($search, $replace, $row_templ->rubnav_tmpl_next);
}
echo $next_link;
}
else if ($data == "prev")
{
//Функция перехода на предыдущую страницу в данной рубрике
$prev_link = '';
$row = $AVE_DB->Query("
SELECT
Id,
document_alias,
document_title
FROM " . PREFIX . "_documents
WHERE
Id != '1'
AND Id != '" . PAGE_NOT_FOUND_ID . "'
AND Id != '" . $AVE_Core->curentdoc->Id . "'
AND rubric_id = '" . $AVE_Core->curentdoc->rubric_id . "'
AND document_published <= '" . $AVE_Core->curentdoc->document_published . "'
AND (document_expire = 0 || document_expire > UNIX_TIMESTAMP())
AND (document_published = 0 || document_published < UNIX_TIMESTAMP())
AND document_deleted = '0'
AND document_status = '1'
ORDER BY document_published DESC
LIMIT 0,1
")
->fetchRow();
if ($row)
{
$search = array('[tag:link]','[tag:linkname]');
$replace = array(
rewrite_link('index.php?id=' . $row->Id . '&amp;doc=' . (empty($row->document_alias) ? prepare_url($row->document_title) : $row->document_alias)),
stripslashes(htmlspecialchars_decode($row->document_title))
);
$prev_link = str_replace($search, $replace, $row_templ->rubnav_tmpl_prev);
}
echo $prev_link;
}
}
/**
* Администрирование
*/
if (defined('ACP') && !empty($_REQUEST['moduleaction']))
{
global $rubric_list;
$tpl_dir = BASE_DIR . '/modules/rubnav/templates/';
$lang_file = BASE_DIR . '/modules/rubnav/lang/' . $_SESSION['admin_language'] . '.txt';
if (! @require(BASE_DIR . '/modules/rubnav/class/rubnav.php')) module_error();
$rubric_list = new RubNav($tpl_dir, $lang_file);
$AVE_Template->config_load($lang_file, 'module');
$config_vars = $AVE_Template->get_config_vars();
$AVE_Template->assign('config_vars', $config_vars);
switch($_REQUEST['moduleaction'])
{
case '1':
$rubric_list->rubnavSettingsEdit();
break;
}
}
?>