Skip to content

Instantly share code, notes, and snippets.

@maximzasorin
Created January 15, 2016 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maximzasorin/8ed42e98cdb42c91bfa6 to your computer and use it in GitHub Desktop.
Save maximzasorin/8ed42e98cdb42c91bfa6 to your computer and use it in GitHub Desktop.
Произвольная структура хлебных крошек с помощью базового контроллера (HostCMS)
<?php
// ...
$Core_Controller = new Core_Controller(
Core_Entity::factory('Site', CURRENT_SITE)
);
// Информационная система «Сервисное обслуживание»
$serviceInformationsystemId = 23;
$oServiceInformationsystem = Core_Entity::factory('Informationsystem', $serviceInformationsystemId);
// Без тега active ссылка не выводится
$oServiceInformationsystem
->addEntity(
Core::factory('Core_Xml_Entity')
->name('active')
->value(1)
);
$oObjectGroup = Core_Entity::factory('Informationsystem_Group', $Informationsystem_Controller_Show->group);
// Получаем элемент информационной системы «Сервисное обслуживание»,
// с которым связана группа объекта
$oServiceItems = Core_Entity::factory('Informationsystem_Item');
$oServiceItems->queryBuilder()
->join('property_value_ints', 'property_value_ints.entity_id', '=', 'informationsystem_items.id')
->join('properties', 'properties.id', '=', 'property_value_ints.property_id')
->where('informationsystem_items.informationsystem_id', '=', $serviceInformationsystemId)
->where('properties.tag_name', '=', 'objects_group_id')
->where('property_value_ints.value', '=', $oObjectGroup->parent_id)
;
$aoServiceItems = $oServiceItems->findAll();
if (count($aoServiceItems) > 0)
{
$oServiceItem = $aoServiceItems[0];
$oServiceItem->addEntity($oObjectGroup);
$oServiceInformationsystem->addEntity($oServiceItem);
}
$Core_Controller->addEntity($oServiceInformationsystem);
$Core_Controller
->xsl(
Core_Entity::factory('Xsl')->getByName('ХлебныеКрошки')
)
->show();
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment