Для реализации необходимо добавить код(выделен жирным) в типовую динамическую страницу для инфосистемы:
<?php
// Получаем информацию о текущем пользователе
if (class_exists('SiteUsers'))
{
$SiteUsers = & singleton('SiteUsers');
$site_user_id = $SiteUsers->GetCurrentSiteUser();
}
else
{
$site_user_id = 0;
}
/* Массив внешних параметров, передаваемых в XML */
$external_propertys = array();
/* Добавление комментария */
// ShowAddComment == 1 - только авторизированные
// ShowAddComment == 2 - все
if (isset($_POST['add_comment'])
&& (($GLOBALS['LA']['ShowAddComment'] == 1 && $site_user_id > 0) || $GLOBALS['LA']['ShowAddComment'] == 2))
{
$param['information_items_id'] = to_int($GLOBALS['InformationResult']['item_id']);
/* XSL шаблон для отправки уведомления администратору о добавлении комментария */
$param['admin_email_xsl'] = to_str($GLOBALS['LA']['xsl_admin_email']);
$xsl_add_comment = to_str($GLOBALS['LA']['xsl_add_comment']);
/* Режим добавления комментария:
1 - публиковать сразу,
0 - публиковать после проверки.*/
if (to_bool($GLOBALS['LA']['TypeAddComment'])/* || $site_user_id > 0*/)
{
$param['status'] = 1;
}
else
{
$param['status'] = 0;
}
// Текст комментария
$_POST['comment_text'] = nl2br(to_str($_POST['comment_text']));
// Типографируем текст, если доступен модуль типографирования
if (class_exists('typograph'))
{
$typograph = new typograph();
$_POST['comment_text'] = $typograph->ProcessTypographic($_POST['comment_text']);
}
$param['comment_mail_type'] = to_int($GLOBALS['LA']['comment_mail_type']);
// ID родительского комментария
$param['comment_parent_id'] = to_int($_POST['comment_parent_id']);
$param['comment_autor'] = to_str($_POST['comment_autor']);
$param['comment_email'] = to_str($_POST['comment_email']);
$param['comment_subject'] = to_str($_POST['comment_subject']);
$param['comment_text'] = to_str($_POST['comment_text']);
$param['comment_grade'] = to_int($_POST['comment_grade']);
$param['allowable_tags'] = '<b><strong><i><u><strike><ul><ol><li>';
ob_start();
$GLOBALS['LA_InformationSystem']->ShowAddComment('УведомлениеДобавлениеКомментария', $param);
$external_propertys['message'] = ob_get_clean();
}
$InformationSystem_id = to_int($GLOBALS['InformationSystem_id']);
// XSL шаблон для отображения списка элементов информационной системы
$xsl_list = to_str($GLOBALS['LA']['xsl_information_system_list']);
// XSL шаблон для отображения элемента информационной системы
$xsl_item = to_str($GLOBALS['LA']['xsl_information_item']);
$InformationResult = $GLOBALS['InformationResult'];
$external_propertys['ОтображатьСсылкуНаАрхив'] = 0;
$external_propertys['ОтображатьСсылкиНаСледующиеСтраницы'] = 1;
// Массив дополнительных параметров
$property = array();
// Число элементов на страницу
if (isset($InformationResult['items_on_page']))
{
if ($InformationResult['items_on_page'] !== true)
{
$InformationResult['items_on_page'] = to_int($InformationResult['items_on_page']);
}
}
else
{
$InformationResult['items_on_page'] = 10;
}
/* Номер, с которого начинается показ */
if (isset($InformationResult['items_begin']))
{
$InformationResult['items_begin'] = to_int($InformationResult['items_begin']);
}
else
{
$InformationResult['items_begin'] = 0;
}
/* Метод определения идентификатора информационной группы и идентификатора информационного элемента по значению URI */
//$result = $GLOBALS['LA_InformationSystem']->GetInformationFromPath($InformationSystem_id);
if ($GLOBALS['INFSYS_result'] != false)
{
/* Вывод списка */
if ($GLOBALS['INFSYS_result']['item'] == false)
{
// Если передано имя тэга - фильтруем
if (isset($GLOBALS['INFSYS_result']['tag_name']))
{
$oTag = & singleton('Tag');
$tag_row = $oTag->GetTagByName($GLOBALS['INFSYS_result']['tag_name']);
$property['tags'] = array($tag_row['tag_id']);
// При выводе тэгов вывод элементов ведется из всех групп
$GLOBALS['INFSYS_result']['group'] = false;
}
/* Отображаем информационную систему */
$GLOBALS['LA_InformationSystem']->ShowInformationSystem($InformationSystem_id, $GLOBALS['INFSYS_result']['group'], $xsl_list, $InformationResult['items_on_page'], $InformationResult['items_begin'], $external_propertys, $property);
}
else
{
/* Определяем идентификатор информационного элемента */
$item_id = $GLOBALS['LA_InformationSystem']->GetIdInformationItem($GLOBALS['INFSYS_result']['item'], $GLOBALS['INFSYS_result']['group'], $InformationSystem_id);
if (to_bool($GLOBALS['LA']['ShowComments']))
{
$external_propertys['show_comments'] = '1';
}
else
{
$external_propertys['show_comments'] = '0';
}
// Кому разрешено добавление комментария
$external_propertys['show_add_comments'] = to_int($GLOBALS['LA']['ShowAddComment']);
$mas = $GLOBALS['LA_InformationSystem']->GetInformationSystem($InformationSystem_id);
$order_field = $mas['information_systems_items_order_field'];
$order_type = $mas['information_systems_items_order_type'];
switch ($order_field)
{
default:
case 0:
$name_field = 'information_items_date';
break;
case 1:
$name_field = 'information_items_name';
break;
case 2:
$name_field = 'information_items_order';
break;
}
switch ($order_type)
{
default:
case 0:
$order_field = 'Asc';
break;
case 1:
$order_field = 'Desc';
break;
}
$DataBase = & singleton('DataBase');
$prev = false;
$next = false;
$current_date = date('Y-m-d H:i:s');
$current_group = intval($GLOBALS['INFSYS_result']['group']);
$query = "SELECT SQL_CALC_FOUND_ROWS DISTINCT information_items_table.information_items_id
FROM information_items_table
LEFT JOIN information_groups_table
ON information_items_table.information_groups_id = information_groups_table.information_groups_id
AND information_groups_table.information_groups_access IN (0,6,7,-1)
WHERE 1 AND information_items_table.information_systems_id = '$InformationSystem_id'
AND information_items_table.information_items_status = '1'
AND (information_items_table.information_items_putend_date >= '$current_date'
OR information_items_table.information_items_putend_date ='0000-00-00 00:00:00')
AND information_items_table.information_items_putoff_date <= '$current_date'
AND information_items_table.information_items_access IN (0,6,7,-1)
AND (information_items_table.information_groups_id = '$current_group')
ORDER BY $name_field $order_field LIMIT 0, 9999";
$result = $DataBase->select($query);
while ($row = mysql_fetch_assoc($result))
{
if ($row['information_items_id'] == $item_id)
{
$next_row = mysql_fetch_assoc($result);
$next = $next_row['information_items_id'];
break;
}
$prev = $row['information_items_id'];
}
$item_info = $GLOBALS['LA_InformationSystem']->GetInformationSystemItem($prev);
$item_path = $GLOBALS['LA_InformationSystem']->GetPathItem($prev, '');
if($item_path != '')
{
$external_propertys['PrevName'] = $item_info['information_items_name'];
$external_propertys['PrevLink'] = $item_path;
}
$item_info = $GLOBALS['LA_InformationSystem']->GetInformationSystemItem($next);
$item_path = $GLOBALS['LA_InformationSystem']->GetPathItem($next, '');
if($item_path != '')
{
$external_propertys['NextName'] = $item_info['information_items_name'];
$external_propertys['NextLink'] = $item_path;
}
// Выводим элемент информационной системы
$GLOBALS['LA_InformationSystem']->ShowInformationSystemItem($item_id, $xsl_item, $external_propertys,
array('part' => $GLOBALS['part_ii']));
}
}
?>
После чего добавить код отображения ссылок на предыдущий и следующий элементы в XSL-шаблон для вывода единицы инфосистемы:
<xsl:template match="/document/item">
...
<xsl:if test="/document/PrevName/node()">
Предыдущий элемент:<br/>
<a href="{/document/information_system/url}{/document/PrevLink}"><xsl:value-of disable-output-escaping="yes" select="/document/PrevName"/></a>
</xsl:if>
<xsl:if test="/document/NextName/node()">
<br/>
Следующий элемент:<br/>
<a href="{/document/information_system/url}{/document/NextLink}"><xsl:value-of disable-output-escaping="yes" select="/document/NextName"/></a>
</xsl:if>
</xsl:template>