Как определить текущую группу в ис.

#
Как определить текущую группу в ис.
эта тема не раз поднималась, но так до конца готового результата не доходила.

Имеем:

<?php
      
      /* Базовые настройки показа меню */
      $iIS = 15; // идентификатор информационной системы
      $sXsl = 'ЛевоеМеню'; // название XSL-шаблона
      $iLevel = 0; // максимальный уровень вложенности меню (0 — если уровень вложенности не ограничен)

      /* Код на базе контроллера показа информационной системы */
      $Informationsystem_Controller_Show = new Informationsystem_Controller_Show(Core_Entity::factory('Informationsystem', $iIS));
      $Informationsystem_Controller_Show
        ->xsl(Core_Entity::factory('Xsl' ->getByName($sXsl))
      ->addEntity(Core::factory('Core_Xml_Entity' ->name('max_level' ->value($iLevel))
      ->groupsMode('all' ->itemsForbiddenTags(array('text', 'description')
      ->group(FALSE)
      ->limit(9999);
      if (is_object(Core_Page::instance()->object)&& get_class(Core_Page::instance()->object) == 'Informationsystem_Controller_Show'
      {
         $Informationsystem_Controller_Show
         ->addEntity(Core::factory('Core_Xml_Entity' ->name('informationsystem_group_id' ->value(intval(Core_Page::instance()->object->group)))
         ->addEntity(Core::factory('Core_Xml_Entity' ->name('informationsystem_item_id'  ->value(intval(Core_Page::instance()->object->item)));
      }
      
      $Informationsystem_Controller_Show ->show();
?>

В результате в xml не выводится значение "informationsystem_group_id", а выводится "0"
Что не так?
#
Re: Как определить текущую группу в ис.
Может где есть готовый пример вывода в xml  informationsystem_group_id текущей группы ИС?
Модератор
#
Re: Как определить текущую группу в ис.
Как получить см. второе сообщение сверху http://www.hostcms.ru/forums/2/7122/page-5/
#
Re: Как определить текущую группу в ис.
Через $Structure_Controller_Show я видел, а вот используя $Informationsystem_Controller_Show есть ли возможность передать id текущей группы ИС? Вообще хотелось бы привести свои мозги в одну плоскость с принципом работы этой cms. Если есть какие-то доки, дайте ссылку.
#
Re: Как определить текущую группу в ис.
Ау! Кто-нибудь подскажите...

Есть Верхнее меню, в которое входит несколько инф. систем.
И есть левое меню, которое является подменю информационной системы, которое раскрывается для подгрупп.
Для того чтобы левое меню раскрывалось, нужно передать id текущей группы в xml.

Как это сделать?
Модератор
#
Re: Как определить текущую группу в ис.
em12000,
конечно есть возможность, смотрите пример, Вы получаете ID группы или элемента через Core_Page::instance(), далее если они есть, то своему контроллеру через ->group() передаете ID группы, которая отображается. если не получается, покажите Ваш код, будем разбираться вместе.
#
Re: Как определить текущую группу в ис.
Код в первом топике, но informationsystem_group_id в xml всегда = 0.
Модератор
#
Re: Как определить текущую группу в ис.
Итак, зачем Вы передаете в качестве группы FALSE, логичнее передавать 0 если нет показа ИС.
Далее, Вы просто как во внешнем примере передаете в XML номер группы, а нужно по нему ограничивать, на самом деле все очень просто:
<?php
      
      /* Базовые настройки показа меню */
      $iIS = 15; // идентификатор информационной системы
      $sXsl = 'ЛевоеМеню'; // название XSL-шаблона
      $iLevel = 0; // максимальный уровень вложенности меню (0 — если уровень вложенности не ограничен)

      /* Код на базе контроллера показа информационной системы */
      $Informationsystem_Controller_Show = new Informationsystem_Controller_Show(Core_Entity::factory('Informationsystem', $iIS));
      $Informationsystem_Controller_Show
        ->xsl(Core_Entity::factory('Xsl') ->getByName($sXsl))
      ->addEntity(Core::factory('Core_Xml_Entity') ->name('max_level') ->value($iLevel))
      ->groupsMode('all') ->itemsForbiddenTags(array('text', 'description'))
      ->group(0) // Корень
      ->limit(0); // зачем в меню 9999 товаров?!
      if (is_object(Core_Page::instance()->object)&& get_class(Core_Page::instance()->object) == 'Informationsystem_Controller_Show')
      {
         $Informationsystem_Controller_Show
         ->group(Core_Page::instance()->object->group); // Устанавливаем текущую группу контроллеру
      }
      
      $Informationsystem_Controller_Show ->show();
?>
#
Re: Как определить текущую группу в ис.
Текущая группа не устанавливается. Вот что получается в xml:

<informationsystem id="15">
   <informationsystem_dir_id>0</informationsystem_dir_id>
   <structure_id>89</structure_id>
   <site_id>2</site_id>
   <name>Спас</name>
   <description></description>
   <items_sorting_direction>0</items_sorting_direction>
   <items_sorting_field>0</items_sorting_field>
   <groups_sorting_direction>0</groups_sorting_direction>
   <groups_sorting_field>0</groups_sorting_field>
   <image_large_max_width>300</image_large_max_width>
   <image_large_max_height>300</image_large_max_height>
   <image_small_max_width>70</image_small_max_width>
   <image_small_max_height>70</image_small_max_height>
   <siteuser_group_id>0</siteuser_group_id>
   <use_captcha>1</use_captcha>
   <watermark_file></watermark_file>
   <watermark_default_use_large_image>0</watermark_default_use_large_image>
   <watermark_default_use_small_image>0</watermark_default_use_small_image>
   <watermark_default_position_x>50%</watermark_default_position_x>
   <watermark_default_position_y>100%</watermark_default_position_y>
   <user_id>19</user_id>
   <items_on_page>10</items_on_page>
   <format_date>%d.%m.%Y</format_date>
   <format_datetime>%d.%m.%Y %H:%M:%S</format_datetime>
   <url_type>0</url_type>
   <typograph_default_items>0</typograph_default_items>
   <typograph_default_groups>0</typograph_default_groups>
   <apply_tags_automatically>1</apply_tags_automatically>
   <change_filename>1</change_filename>
   <apply_keywords_automatically>1</apply_keywords_automatically>
   <group_image_large_max_width>300</group_image_large_max_width>
   <group_image_large_max_height>300</group_image_large_max_height>
   <group_image_small_max_width>70</group_image_small_max_width>
   <group_image_small_max_height>70</group_image_small_max_height>
   <preserve_aspect_ratio>1</preserve_aspect_ratio>
   <preserve_aspect_ratio_small>1</preserve_aspect_ratio_small>
   <url>/spas/</url>
   <captcha_id>53904</captcha_id>
   <items_count>0</items_count>
   <items_total_count>4</items_total_count>
   <subgroups_count>4</subgroups_count>
   <subgroups_total_count>10</subgroups_total_count>
   <siteuser_id>0</siteuser_id>
   <max_level>0</max_level>
   <group>0</group>
   <page>0</page>
   <part>0</part>
   <limit>0</limit>

        Вот сюда нужно вставить id выбранной группы

   <informationsystem_group id="9">
      <informationsystem_id>15</informationsystem_id>
      <siteuser_id>0</siteuser_id>
      <parent_id>0</parent_id>
      <top_parent_id>0</top_parent_id>
      <name>Курс 1</name>
      <description></description>
      <sorting>0</sorting>
      <path>9</path>
      <image_large></image_large>
      <image_small></image_small>
      <indexing>1</indexing>
      <subgroups_count>2</subgroups_count>
      <subgroups_total_count>2</subgroups_total_count>
      <items_count>2</items_count>
      <items_total_count>2</items_total_count>
      <seo_title></seo_title>
      <seo_description></seo_description>
      <seo_keywords></seo_keywords>
      <siteuser_group_id>0</siteuser_group_id>
      <active>1</active>
      <user_id>19</user_id>
      <sns_type_id>0</sns_type_id>
      <url>/spas/9/</url>
      <dir>/upload/information_system_15/0/0/9/group_9/</dir>
      <informationsystem_group id="17">
         <informationsystem_id>15</informationsystem_id>
         <siteuser_id>0</siteuser_id>
         <parent_id>9</parent_id>
         <top_parent_id>0</top_parent_id>
         <name>Ясновидение</name>
         <description></description>
         <sorting>0</sorting>
         <path>17</path>
         <image_large></image_large>
         <image_small></image_small>
         <indexing>1</indexing>
         <subgroups_count>1</subgroups_count>
         <subgroups_total_count>1</subgroups_total_count>
         <items_count>1</items_count>
         <items_total_count>1</items_total_count>
         <seo_title></seo_title>
         <seo_description></seo_description>
         <seo_keywords></seo_keywords>
         <siteuser_group_id>0</siteuser_group_id>
         <active>1</active>
         <user_id>19</user_id>
         <sns_type_id>0</sns_type_id>
         <url>/spas/9/17/</url>
         <dir>/upload/information_system_15/0/1/7/group_17/</dir>
         <informationsystem_group id="18">
            <informationsystem_id>15</informationsystem_id>
            <siteuser_id>0</siteuser_id>
            <parent_id>17</parent_id>
            <top_parent_id>0</top_parent_id>
            <name>Яснослышание</name>
            <description></description>
            <sorting>0</sorting>
            <path>18</path>
            <image_large></image_large>
            <image_small></image_small>
            <indexing>1</indexing>
            <subgroups_count>0</subgroups_count>
            <subgroups_total_count>0</subgroups_total_count>
            <items_count>0</items_count>
            <items_total_count>0</items_total_count>
            <seo_title></seo_title>
            <seo_description></seo_description>
            <seo_keywords></seo_keywords>
            <siteuser_group_id>0</siteuser_group_id>
            <active>1</active>
            <user_id>19</user_id>
            <sns_type_id>0</sns_type_id>
            <url>/spas/9/17/18/</url>
            <dir>/upload/information_system_15/0/1/8/group_18/</dir>
         </informationsystem_group>
      </informationsystem_group>
   </informationsystem_group>
   <informationsystem_group id="10">
      <informationsystem_id>15</informationsystem_id>
      <siteuser_id>0</siteuser_id>
      <parent_id>0</parent_id>
      <top_parent_id>0</top_parent_id>
      <name>Курс 2</name>
      <description></description>
      <sorting>0</sorting>
      <path>10</path>
      <image_large></image_large>
      <image_small></image_small>
      <indexing>1</indexing>
      <subgroups_count>0</subgroups_count>
      <subgroups_total_count>0</subgroups_total_count>
      <items_count>0</items_count>
      <items_total_count>0</items_total_count>
      <seo_title></seo_title>
      <seo_description></seo_description>
      <seo_keywords></seo_keywords>
      <siteuser_group_id>0</siteuser_group_id>
      <active>1</active>
      <user_id>19</user_id>
      <sns_type_id>0</sns_type_id>
      <url>/spas/10/</url>
      <dir>/upload/information_system_15/0/1/0/group_10/</dir>
   </informationsystem_group>
   <informationsystem_group id="11">
      <informationsystem_id>15</informationsystem_id>
      <siteuser_id>0</siteuser_id>
      <parent_id>0</parent_id>
      <top_parent_id>0</top_parent_id>
      <name>Курс 3</name>
      <description></description>
      <sorting>0</sorting>
      <path>11</path>
      <image_large></image_large>
      <image_small></image_small>
      <indexing>1</indexing>
      <subgroups_count>0</subgroups_count>
      <subgroups_total_count>0</subgroups_total_count>
      <items_count>0</items_count>
      <items_total_count>0</items_total_count>
      <seo_title></seo_title>
      <seo_description></seo_description>
      <seo_keywords></seo_keywords>
      <siteuser_group_id>0</siteuser_group_id>
      <active>1</active>
      <user_id>19</user_id>
      <sns_type_id>0</sns_type_id>
      <url>/spas/11/</url>
      <dir>/upload/information_system_15/0/1/1/group_11/</dir>
   </informationsystem_group>
   <informationsystem_group id="12">
      <informationsystem_id>15</informationsystem_id>
      <siteuser_id>0</siteuser_id>
      <parent_id>0</parent_id>
      <top_parent_id>0</top_parent_id>
      <name>Курс 4</name>
      <description></description>
      <sorting>0</sorting>
      <path>12</path>
      <image_large></image_large>
      <image_small></image_small>
      <indexing>1</indexing>
      <subgroups_count>4</subgroups_count>
      <subgroups_total_count>4</subgroups_total_count>
      <items_count>2</items_count>
      <items_total_count>2</items_total_count>
      <seo_title></seo_title>
      <seo_description></seo_description>
      <seo_keywords></seo_keywords>
      <siteuser_group_id>0</siteuser_group_id>
      <active>1</active>
      <user_id>19</user_id>
      <sns_type_id>0</sns_type_id>
      <url>/spas/12/</url>
      <dir>/upload/information_system_15/0/1/2/group_12/</dir>
      <informationsystem_group id="13">
         <informationsystem_id>15</informationsystem_id>
         <siteuser_id>0</siteuser_id>
         <parent_id>12</parent_id>
         <top_parent_id>0</top_parent_id>
         <name>Выливание на воск</name>
         <description></description>
         <sorting>0</sorting>
         <path>13</path>
         <image_large></image_large>
         <image_small></image_small>
         <indexing>1</indexing>
         <subgroups_count>0</subgroups_count>
         <subgroups_total_count>0</subgroups_total_count>
         <items_count>0</items_count>
         <items_total_count>0</items_total_count>
         <seo_title></seo_title>
         <seo_description></seo_description>
         <seo_keywords></seo_keywords>
         <siteuser_group_id>0</siteuser_group_id>
         <active>1</active>
         <user_id>19</user_id>
         <sns_type_id>0</sns_type_id>
         <url>/spas/12/13/</url>
         <dir>/upload/information_system_15/0/1/3/group_13/</dir>
      </informationsystem_group>
      <informationsystem_group id="14">
         <informationsystem_id>15</informationsystem_id>
         <siteuser_id>0</siteuser_id>
         <parent_id>12</parent_id>
         <top_parent_id>0</top_parent_id>
         <name>Заговоры от болезней</name>
         <description></description>
         <sorting>0</sorting>
         <path>14</path>
         <image_large></image_large>
         <image_small></image_small>
         <indexing>1</indexing>
         <subgroups_count>0</subgroups_count>
         <subgroups_total_count>0</subgroups_total_count>
         <items_count>0</items_count>
         <items_total_count>0</items_total_count>
         <seo_title></seo_title>
         <seo_description></seo_description>
         <seo_keywords></seo_keywords>
         <siteuser_group_id>0</siteuser_group_id>
         <active>1</active>
         <user_id>19</user_id>
         <sns_type_id>0</sns_type_id>
         <url>/spas/12/14/</url>
         <dir>/upload/information_system_15/0/1/4/group_14/</dir>
      </informationsystem_group>
      <informationsystem_group id="15">
         <informationsystem_id>15</informationsystem_id>
         <siteuser_id>0</siteuser_id>
         <parent_id>12</parent_id>
         <top_parent_id>0</top_parent_id>
         <name>Изготовление оберегов</name>
         <description></description>
         <sorting>0</sorting>
         <path>15</path>
         <image_large></image_large>
         <image_small></image_small>
         <indexing>1</indexing>
         <subgroups_count>0</subgroups_count>
         <subgroups_total_count>0</subgroups_total_count>
         <items_count>0</items_count>
         <items_total_count>0</items_total_count>
         <seo_title></seo_title>
         <seo_description></seo_description>
         <seo_keywords></seo_keywords>
         <siteuser_group_id>0</siteuser_group_id>
         <active>1</active>
         <user_id>19</user_id>
         <sns_type_id>0</sns_type_id>
         <url>/spas/12/15/</url>
         <dir>/upload/information_system_15/0/1/5/group_15/</dir>
      </informationsystem_group>
      <informationsystem_group id="16">
         <informationsystem_id>15</informationsystem_id>
         <siteuser_id>0</siteuser_id>
         <parent_id>12</parent_id>
         <top_parent_id>0</top_parent_id>
         <name>Чистка квартиры</name>
         <description></description>
         <sorting>0</sorting>
         <path>16</path>
         <image_large></image_large>
         <image_small></image_small>
         <indexing>1</indexing>
         <subgroups_count>0</subgroups_count>
         <subgroups_total_count>0</subgroups_total_count>
         <items_count>0</items_count>
         <items_total_count>0</items_total_count>
         <seo_title></seo_title>
         <seo_description></seo_description>
         <seo_keywords></seo_keywords>
         <siteuser_group_id>0</siteuser_group_id>
         <active>1</active>
         <user_id>19</user_id>
         <sns_type_id>0</sns_type_id>
         <url>/spas/12/16/</url>
         <dir>/upload/information_system_15/0/1/6/group_16/</dir>
      </informationsystem_group>
   </informationsystem_group>
</informationsystem>
Модератор
#
Re: Как определить текущую группу в ис.
Вносите в условие отладку и проверяйте, заходите ли вообще в условие. Если заходите, то что в ID группы var_dump(Core_Page::instance()->object->group);
Авторизация