Доп. св-во типа "Информационная система"

#
Доп. св-во типа "Информационная система"
Добрый день!

Мы пытались воспользоваться доп. свойством типа "Информационная система", но никак не получается настроить XSL-шаблон. Не понимаем, как вызывать нужные значения, а именно:

1. на странице должно отображаться название группы Инфосистемы, выбранной в доп. свойстве, а также ссылка на эту группу;
2. на странице должно отображаться название элемента Инфосистемы, выбранной в доп. свойстве, а также ссылка на этот элемент.
Модератор
#
Re: Доп. св-во типа "Информационная система"
2wind писал(а):
1. на странице должно отображаться название группы Инфосистемы, выбранной в доп. свойстве, а также ссылка на эту группу;

В XML идет информация только об элементе, размещение групп не осуществляется, т.к. XML получится очень большой. Если очень нужно - напишите в поддержку, рассмотрим добавление такой опции.

2wind писал(а):
2. на странице должно отображаться название элемента Инфосистемы, выбранной в доп. свойстве, а также ссылка на этот элемент.

Никак проблем быть не должно, информация в XML идет о самом элементе.
#
Re: Доп. св-во типа "Информационная система"
2. Но все же проблемы есть, так как в XML нет информации о доп. свойствах.

<?xml version="1.0" encoding="windows-1251"?>
<document>
   <site_user_id>0</site_user_id>
   <ОтображатьСсылкуНаАрхив>0</ОтображатьСсылкуНаАрхив>
   <ОтображатьСсылкиНаСледующиеСтраницы>1</ОтображатьСсылкиНаСледующиеСтраницы>
   <blocks id="24">
      <name>Плитка для кухни</name>
      <description>&lt;div class=&quot;col2-set&quot;&gt;
         &lt;div class=&quot;col-left&quot;&gt;&lt;img src=&quot;/images/holder.gif&quot; alt=&quot;&quot; width=&quot;210&quot; height=&quot;310&quot; /&gt;&lt;/div&gt;
         &lt;div class=&quot;col-main content&quot;&gt;
         &lt;h1 class=&quot;page-title&quot;&gt;Стеклянная мозайка&lt;/h1&gt;
         &lt;/div&gt;
      &lt;/div&gt;</description>
      <url>/tile-for-kitchen/</url>
      <access>0</access>
      <parent_group_id>0</parent_group_id>
      <count_items>4</count_items>
      <count_items_on_page>100</count_items_on_page>
      <count_all_items>4</count_all_items>
      <count_groups>0</count_groups>
      <count_all_groups>0</count_all_groups>
      <tags>
      </tags>
      <items>
         <count_items>4</count_items>
         <current_page>0</current_page>
         <items_on_page>100</items_on_page>
         <item id="545" group_id="0">
            <item_date>10.08.2009</item_date>
            <item_datetime>10.08.2009 19:26:13</item_datetime>
            <item_time>19:26:13</item_time>
            <item_putoff_date>10.08.2009 19:26:13</item_putoff_date>
            <item_putend_date>00.00.0000 00:00:00</item_putend_date>
            <item_name>Фото 1</item_name>
            <item_description></item_description>
            <part count="1">0</part>
            <item_text></item_text>
            <item_image width="344" height="258">/upload/information_system_24/5/4/5/item_545/information_items_545.jpg</item_image>
            <item_small_image width="344" height="258">/upload/information_system_24/5/4/5/item_545/small_information_items_545.jpg</item_small_image>
            <item_status>1</item_status>
            <item_seo_title></item_seo_title>
            <item_seo_description></item_seo_description>
            <item_seo_keywords></item_seo_keywords>
            <item_access>-1</item_access>
            <item_path>/tile-for-kitchen/foto-1/</item_path>
            <item_path_field>foto-1</item_path_field>
            <item_show_count>1</item_show_count>
            <site_user_id>0</site_user_id>
            <item_comments>
               <count_comments>0</count_comments>
               <grade_sum>0</grade_sum>
               <grade_count>0</grade_count>
               <average_grade>0</average_grade>
            </item_comments>
         </item>
         <item id="546" group_id="0">
            <item_date>10.08.2009</item_date>
            <item_datetime>10.08.2009 19:27:05</item_datetime>
            <item_time>19:27:05</item_time>
            <item_putoff_date>10.08.2009 19:27:05</item_putoff_date>
            <item_putend_date>00.00.0000 00:00:00</item_putend_date>
            <item_name>Фото 2</item_name>
            <item_description></item_description>
            <part count="1">0</part>
            <item_text></item_text>
            <item_image width="344" height="258">/upload/information_system_24/5/4/6/item_546/information_items_546.jpg</item_image>
            <item_small_image width="344" height="258">/upload/information_system_24/5/4/6/item_546/small_information_items_546.jpg</item_small_image>
            <item_status>1</item_status>
            <item_seo_title></item_seo_title>
            <item_seo_description></item_seo_description>
            <item_seo_keywords></item_seo_keywords>
            <item_access>-1</item_access>
            <item_path>/tile-for-kitchen/foto-2/</item_path>
            <item_path_field>foto-2</item_path_field>
            <item_show_count>0</item_show_count>
            <site_user_id>0</site_user_id>
            <item_comments>
               <count_comments>0</count_comments>
               <grade_sum>0</grade_sum>
               <grade_count>0</grade_count>
               <average_grade>0</average_grade>
            </item_comments>
         </item>
         <item id="547" group_id="0">
            <item_date>10.08.2009</item_date>
            <item_datetime>10.08.2009 19:27:30</item_datetime>
            <item_time>19:27:30</item_time>
            <item_putoff_date>10.08.2009 19:27:30</item_putoff_date>
            <item_putend_date>00.00.0000 00:00:00</item_putend_date>
            <item_name>Фото 3</item_name>
            <item_description></item_description>
            <part count="1">0</part>
            <item_text></item_text>
            <item_image width="344" height="258">/upload/information_system_24/5/4/7/item_547/information_items_547.jpg</item_image>
            <item_small_image width="344" height="258">/upload/information_system_24/5/4/7/item_547/small_information_items_547.jpg</item_small_image>
            <item_status>1</item_status>
            <item_seo_title></item_seo_title>
            <item_seo_description></item_seo_description>
            <item_seo_keywords></item_seo_keywords>
            <item_access>-1</item_access>
            <item_path>/tile-for-kitchen/foto-3/</item_path>
            <item_path_field>foto-3</item_path_field>
            <item_show_count>0</item_show_count>
            <site_user_id>0</site_user_id>
            <item_comments>
               <count_comments>0</count_comments>
               <grade_sum>0</grade_sum>
               <grade_count>0</grade_count>
               <average_grade>0</average_grade>
            </item_comments>
         </item>
         <item id="548" group_id="0">
            <item_date>10.08.2009</item_date>
            <item_datetime>10.08.2009 19:27:57</item_datetime>
            <item_time>19:27:57</item_time>
            <item_putoff_date>10.08.2009 19:27:57</item_putoff_date>
            <item_putend_date>00.00.0000 00:00:00</item_putend_date>
            <item_name>Фото 4</item_name>
            <item_description></item_description>
            <part count="1">0</part>
            <item_text></item_text>
            <item_image width="344" height="258">/upload/information_system_24/5/4/8/item_548/information_items_548.jpg</item_image>
            <item_small_image width="344" height="258">/upload/information_system_24/5/4/8/item_548/small_information_items_548.jpg</item_small_image>
            <item_status>1</item_status>
            <item_seo_title></item_seo_title>
            <item_seo_description></item_seo_description>
            <item_seo_keywords></item_seo_keywords>
            <item_access>-1</item_access>
            <item_path>/tile-for-kitchen/foto-4/</item_path>
            <item_path_field>foto-4</item_path_field>
            <item_show_count>0</item_show_count>
            <site_user_id>0</site_user_id>
            <item_comments>
               <count_comments>0</count_comments>
               <grade_sum>0</grade_sum>
               <grade_count>0</grade_count>
               <average_grade>0</average_grade>
            </item_comments>
         </item>
      </items>
   </blocks>
</document>
Модератор
#
Re: Доп. св-во типа "Информационная система"
2wind,
у Вас для какого-то инфоэлемента указаны св-ва и они не отображаются? Укажите код вызова, с помощью которого Вы показываете список элементов.
#
Re: Доп. св-во типа "Информационная система"
<?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="/">
      <xsl:apply-templates select="/document"/>
   </xsl:template>
   
   <xsl:template match="/document">
      
      <!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
      <xsl:variable name="parent_group_id" select="blocks/parent_group_id"/>
      
      
      <!-- Если в находимся в группе - выводим название группы -->
      <xsl:if test="blocks/parent_group_id!=0 or blocks/parent_group_id=0">
         <div class="collection">
            <h1 class="title title-logo"><xsl:value-of disable-output-escaping="yes" select=".//group[@id=$parent_group_id]/name"/></h1>
            <div class="content">
               <xsl:if test="blocks/parent_group_id=0">
                  <xsl:value-of disable-output-escaping="yes" select="blocks/description"/>
               </xsl:if>
            </div>
            
            <!-- Отображение подгрупп данной группы -->
            <xsl:apply-templates select=".//group[@parent_id=$parent_group_id]" mode="goups"/>
            
            <div class="thumbs">
               <ul class="row2">
                  <!-- Отображение записи информационной системы -->
                  <xsl:apply-templates select="blocks/items/item"/>
               </ul>
            </div>
         </div>
      </xsl:if>
   </xsl:template>
   
   <!-- ======================================================== -->
   <!-- Шаблон выводит ссылки подгруппы информационного элемента -->
   <!-- ======================================================== -->
   <xsl:template match="group" mode="goups">
   <li><a href="{/document/blocks/url}{fullpath}"><xsl:value-of disable-output-escaping="yes" select="name"/></a></li>
      <!--
   <xsl:if test="small_image!=''"><a href="{/document/blocks/url}{fullpath}" target="_blank"><img src="{small_image}"/></a>&#xA0;</xsl:if>
      -->
   </xsl:template>
   
   <!-- ======================== -->
   <!-- Данные об инф. элементах -->
   <!-- ======================== -->
   <xsl:template match="blocks/items/item">
      
      <!-- Название -->
      <li>
      <xsl:if test="item_image!=''"><a href="/{item_propertys/item_property[@xml_name='fabric']/item/item_path}"><img src="{item_image}" alt="" title="" /></a><br /></xsl:if>
      <xsl:if test="item_propertys/item_property[@xml_name='fabric']/value!=''"><a href="/{item_propertys/item_property[@xml_name='fabric']/item/item_path}"><xsl:value-of disable-output-escaping="yes" select="item_propertys/item_property[@xml_name='fabric']/item/item_name"/></a>
      </li>
      
      <!-- Перевод строки после каждого 2-го элемента -->
      <xsl:if test="position() mod 2 = 0">
         <xsl:text disable-output-escaping="yes">
            &lt;/ul&gt;
            &lt;ul class="row2"&gt;
         </xsl:text>
      </xsl:if>
      
   </xsl:template>
</xsl:stylesheet>
#
Re: Доп. св-во типа "Информационная система"
там еще пропущен закрывающий тег
</xsl:if>


но это всеравно не помогает.
Модератор
#
Re: Доп. св-во типа "Информационная система"
HostCMS,
я имел ввиду PHP-код
#
Re: Доп. св-во типа "Информационная система"
стандартная Типовая динамическая страница Информационной системы.

<?php
/* ID Информационной системы */
$InformationSystem_id = to_int($GLOBALS['LA']['InformationSystemID']);

// Получаем информацию о текущем пользователе
if (class_exists('SiteUsers'))
{
   $SiteUsers = & singleton('SiteUsers');
   $site_user_id = $SiteUsers->GetCurrentSiteUser();
}
else
{
   $site_user_id = 0;
}

$form_user_name = to_str($_POST['comment_autor']);
$form_user_email = to_str($_POST['comment_email']);
$form_text = to_str($_POST['comment_text']);
$form_subject = to_str($_POST['comment_subject']);
$form_parent_id = to_int($_POST['comment_parent_id']);

/* Массив внешних параметров, передаваемых в 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'] = htmlspecialchars(to_str($_POST['comment_autor']));
   $param['comment_email'] = htmlspecialchars(to_str($_POST['comment_email']));
   $param['comment_subject'] = htmlspecialchars(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><em><br><p><u><strike><ul><ol><li>';

   ob_start();

   $GLOBALS['LA_InformationSystem']->ShowAddComment('УведомлениеДобавлениеКомментария', $param);
   $external_propertys['message'] = ob_get_clean();

   if (strpos($external_propertys['message'], '<div id="error">') === false)
   {
      $form_user_name = '';
      $form_user_email = '';
      $form_text = '';
      $form_subject = '';
      $form_parent_id = to_int($_POST['comment_parent_id']);
   }
}

if ($GLOBALS['INFSYS_result'] != false)
{
   /* XSL шаблон для отображения списка элементов информационной системы */
   $xsl_list = to_str($GLOBALS['LA']['xsl_information_system_list']);

   /* XSL шаблон для отображения элемента информационной системы */
   $xsl_item = to_str($GLOBALS['LA']['xsl_information_item']);

   $InformationResult = $GLOBALS['InformationResult'];

   /* Массив внешних параметров, передаваемых в XML */
   $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;
   }

   /* Вывод списка */
   if ($GLOBALS['INFSYS_result']['item'] == false)
   {
      // Если передано имя тэга - фильтруем
      if (isset($GLOBALS['INFSYS_result']['tag_name']))
      {
         if (class_exists('Tag'))
         {
            $oTag = & singleton('Tag');

            $tag_row = $oTag->GetTagByName($GLOBALS['INFSYS_result']['tag_name']);

            $property['tags'] = array($tag_row['tag_id']);

            // При выводе тэгов вывод элементов ведется из всех групп
            $GLOBALS['INFSYS_result']['group'] = false;
         }
      }

      // $property['xml_show_group_type'] = 'all';

      // Разрешаем передачу в XML свойств групп
      $property['xml_show_group_property'] = true;

      // При отображении списка элементов запрещаем передавать в XML список свойств товаров с целью экономии памяти
      $property['xml_show_item_property'] = 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;
      }

      $property['part'] = $GLOBALS['part_ii'];

      // Запрещаем передачу в XML свойств групп
      $property['xml_show_group_property'] = false;

      $external_propertys['form_user_name'] = $form_user_name;
      $external_propertys['form_user_email'] = $form_user_email;
      $external_propertys['form_text'] = $form_text;
      $external_propertys['form_subject'] = $form_subject;
      $external_propertys['form_parent_id'] = $form_parent_id;

      // Выводим элемент информационной системы
      $GLOBALS['LA_InformationSystem']->ShowInformationSystemItem($item_id, $xsl_item, $external_propertys, $property);
   }
}

?>
Модератор
#
Re: Доп. св-во типа "Информационная система"
Обратите внимание на этот фрагмент:
// При отображении списка элементов запрещаем передавать в XML список свойств товаров с целью экономии памяти
      $property['xml_show_item_property'] = false;

вам нужно его закомментировать
#
Re: Доп. св-во типа "Информационная система"
Действительно. Не заметил. Спасибо Вам за Ваши зоркие глаза и незаменимую помощь

А чтобы с группами также сделать - это проблематично?
Авторизация