This is an old revision of the document!
Пример наблюдателя и перехватчика.
<?php defined('HOSTCMS') || exit('HostCMS: access denied.'); /** * Наблюдатель объявляет константу с городом, на основе текущего поддомена * * @author Kozub Boris, KAD Systems (©) 2014 * @author Shcherbakov Aleksandr, KAD Systems (©) 2015 * @date 14-06-2015 * Начало >> Core_Event::attach('Core_Command_Controller_Default.onBeforeShowAction', array('Kad_Core_Command_Controller_Default_Observer', 'onBeforeShowAction')); */ class Kad_Core_Command_Controller_Default_Observer { static public function onBeforeShowAction($object, $operation) { $sHost = $_SERVER['HTTP_HOST']; if(strpos($sHost, 'jaluzinof.ru')) { // вывод городов из ИС $informationsystemId = 21; $oGroups = Core_Entity::factory("informationsystem_item"); $oGroups->queryBuilder() ->where('informationsystem_id', '=', $informationsystemId) ->where('path', '=', substr($sHost, 0, strpos($sHost, 'jaluzinof.ru')-1)) ->where('active', '=', 1); $aoGroups = $oGroups->findAll(); if(count($aoGroups)) { define('TOWN', $aoGroups[0]->name); } else { define('TOWN', FALSE); } } else { define('TOWN', FALSE); } } }