Построение меню, связанного с информационной системой

Модератор
#
Построение меню, связанного с информационной системой
Код для построения меню:

<?
$Structure = new Structure();
// Получаем данные о текущей странице
$structure_parent_id = CURRENT_STRUCTURE_ID;
while ($structure_parent_id != 0)
{
$row_structure = $Structure->GetStructureItem($structure_parent_id);
$structure_parent_id = $row_structure['structure_parent_id'];
}

$InformationSystem = & singleton('InformationSystem');

$InformationSystem_id = Идентификатор информационной системы;

$result = $InformationSystem->GetInformationFromPath($InformationSystem_id);

$external_propertys = array();
if (to_int($result['group']) > 0)
{
   $external_propertys['ТекущаяГруппа'] =  $result['group'];  
}

$menu_id = Идентификатор меню;

// XSL-шаблон для обработки меню
$menu_xsl = 'Меню';

$Structure->ShowStructure($menu_id, $menu_xsl, array('parent_id' => $row_structure['structure_id'], 'show_groups' => true, 'show_items'=>'true'), $external_propertys);
?>


XSL-шаблон для отображения меню:

<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
      encoding="Windows-1251" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml" />
   <xsl:template match="/document">
      <ul>
         <!-- Выбираем узлы структуры -->
         <xsl:apply-templates select="structure[show=1]"/>
      </ul>
   </xsl:template>
   <xsl:template match="structure">
      <li>
         <!-- Запишем в константу ID структуры, данные для которой будут выводиться пользователю
         <xsl:variable name="current_structure_id" select="/document/structure/current_structure_id"/>-->
         <!-- Запишем в константу ID структуры, данные для которой будут выводиться пользователю -->
         <xsl:variable name="current_structure_id">
            <xsl:choose>
               <xsl:when test="/document/ТекущийЭлемент/node()">item_<xsl:value-of select="/document/ТекущийЭлемент"/></xsl:when>
               <xsl:when test="/document/ТекущаяГруппа/node()">group_<xsl:value-of select="/document/ТекущаяГруппа"/></xsl:when>
               <xsl:otherwise>
                  <xsl:value-of select="/document/structure/current_structure_id"/>
               </xsl:otherwise>
            </xsl:choose>
         </xsl:variable>
         <!-- Расчитываем размер отступа -->
         <xsl:variable name="padding" select="level * 10" />
         <!-- Показывать ссылку, или нет -->
         <xsl:if test="show_link = 1">
            <!-- Определяем адрес ссылки -->
            <xsl:variable name="link"><xsl:choose>
                  <!-- Если внешняя ссылка -->
                  <xsl:when test="is_external_link=1">
                     <xsl:value-of disable-output-escaping="yes" select="external_link"/>
                  </xsl:when>
                  <!-- Иначе если внутренняя ссылка -->
                  <xsl:otherwise>
                     <xsl:value-of disable-output-escaping="yes" select="link"/>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:variable>
            <!-- Определяем стиль вывода ссылки -->
            <xsl:variable name="link_style">
               <xsl:choose>
                  <!-- Выделяем текущую страницу жирным (если это текущая страница, либо у нее есть ребенок с ID, равным текущей) -->
                  <xsl:when test="current_structure_id=@id or count(.//structure[@id=$current_structure_id])=1">font-weight: bold</xsl:when>
                  <!-- Иначе обычный вывод с пустым стилем -->
                  <xsl:otherwise>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:variable>
         <a href="{$link}"><span style="{$link_style}"><xsl:value-of disable-output-escaping="yes" select="name"/></span></a>
         </xsl:if>
         <!-- Если не показывать ссылку - выводим просто имя ссылки -->
         <xsl:if test="show_link=0">
            <xsl:value-of disable-output-escaping="yes" select="name"/>
         </xsl:if>
         <!-- Выбираем подузлы структуры -->
         <!-- <xsl:value-of select="$current_structure_id" /> = <xsl:value-of select="@id" />-->
         <xsl:if test="$current_structure_id = @id or count(.//structure[@id=$current_structure_id]) = 1 and count(structure[show=1]) > 0">
            <!-- <xsl:if test="count(structure[show=1]) &gt; 0 and @id = /document/current_group_id">-->
               <ul>
                  <!-- Выбираем узлы структуры -->
                  <xsl:apply-templates select="structure[show=1]"/>
               </ul>
            </xsl:if>
         </li>
      </xsl:template>
   </xsl:stylesheet>
#
Re: Построение меню, связанного с информационной системой
Расскажите пожалуйста подробнее что имеется в виду под названием? и пример в сети если есть
ку
Модератор
#
Re: Построение меню, связанного с информационной системой
compaq,
Это значит что в меню будут учитываться элементы инфосистемы.
Авторизация