<?php // этот модуль необходимо делать тольео для крупных проектов, для небольшых описание пунктов меню и файлов меню лучше делать в init.php
$__functions['init'][]      ='_engine_admin_vars' ;
//$__functions['alert'][]   ='_engine_admin_alert' ;
$__functions['install'][]	='_engine_install_modul' ;



function _engine_admin_vars() //
{   //-----------------------------------------------------------------------------------------------------------------------------
	// описание переменных модуля
	//-----------------------------------------------------------------------------------------------------------------------------
	//-----------------------------------------------------------------------------------------------------------------------------
	// описание классов модуля
	//-----------------------------------------------------------------------------------------------------------------------------

    $_SESSION['descr_clss'][5]['fields']['account_id']=array('type'=>'int(11)','default'=>0) ;
    $_SESSION['descr_clss'][5]['fields']['source_pkey']=array('type'=>'int(11)','default'=>0) ;
    $_SESSION['descr_clss'][5]['fields']['source_tkey']=array('type'=>'int(11)','default'=>0) ;
    $_SESSION['descr_clss'][5]['fields']['obj_reffer']=array('type'=>'varchar(32)','default'=>'') ;

	$_SESSION['descr_clss'][20]['fields']['uid']='varchar(128)' ; // UID для элементов списка
    $_SESSION['descr_clss'][20]['fields']['viewer_name']=array('type'=>'varchar(32)') ;

	$_SESSION['descr_clss'][23]['name']='Помощь по странице' ;
    $_SESSION['descr_clss'][23]['parent']=0 ;
    $_SESSION['descr_clss'][23]['fields']['obj_name']=array('type'=>'varchar(255)','default'=>0) ;
    $_SESSION['descr_clss'][23]['fields']['content']=array('type'=>'text') ;

    //-----------------------------------------------------------------------------------------------------
    $_SESSION['descr_clss'][216]['name']='Права доступа' ;
    $_SESSION['descr_clss'][216]['table_code']='permit' ;
    $_SESSION['descr_clss'][216]['parent']=0 ;
    $_SESSION['descr_clss'][216]['fields']['obj_name']=array('type'=>'varchar(255)') ; //  название скрипта
    $_SESSION['descr_clss'][216]['fields']['rol_id']=array('type'=>'int(11)') ; //  доступ

    $_SESSION['descr_clss'][219]['name']='event_lister' ;
    $_SESSION['descr_clss'][219]['table_code']='event_lister' ;
    $_SESSION['descr_clss'][219]['parent']=0 ;
    $_SESSION['descr_clss'][219]['fields']['obj_name']=array('type'=>'varchar(150)','index'=>'system_name') ;
    $_SESSION['descr_clss'][219]['fields']['system_name']=array('type'=>'varchar(32)','index'=>'system_name') ;
    $_SESSION['descr_clss'][219]['fields']['method_name']=array('type'=>'varchar(128)') ;

	$_SESSION['descr_clss'][213]['name']='Тип мероприятия' ;
	$_SESSION['descr_clss'][213]['parent']=0 ;
	$_SESSION['descr_clss'][213]['fields']['obj_name']=array('type'=>'varchar(255)') ; //  название мероприятия
	$_SESSION['descr_clss'][213]['fields']['system_name']=array('type'=>'varchar(255)') ; //  система мероприятия
	$_SESSION['descr_clss'][213]['fields']['ext']=array('type'=>'varchar(255)') ; //  директория с объектом мероприятия



    //-----------------------------------------------------------------------------------------------------
    $_SESSION['descr_clss'][251]['name']='Журнал событий' ;
    $_SESSION['descr_clss'][251]['parent']=0 ;
    $_SESSION['descr_clss'][251]['fields']['с_data']=array('type'=>'timedata','data_format'=>'d.m.y G:i','index'=>'c_data') ; // время начала сенса
    $_SESSION['descr_clss'][251]['fields']['с_data2']=array('type'=>'DATETIME') ; // время начала сенса
    $_SESSION['descr_clss'][251]['fields']['terminal_id']=array('type'=>'varchar(32)','index'=>'terminal_id') ; // ID терминала
    $_SESSION['descr_clss'][251]['fields']['terminal_ip']=array('type'=>'varchar(15)') ; // IP терминала
    $_SESSION['descr_clss'][251]['fields']['member_id']=array('type'=>'int(11)') ; // код сотрудника организации, старое поле, заменено на account_id
    $_SESSION['descr_clss'][251]['fields']['account_id']=array('type'=>'int(11)') ; //
    $_SESSION['descr_clss'][251]['fields']['user_id']=array('type'=>'int(11)') ; // код сотрудника AСПМО, старое поле, заменено на personal_id
    $_SESSION['descr_clss'][251]['fields']['personal_id']=array('type'=>'int(11)','index'=>'personal_id') ; // код сотрудника AСПМО
    $_SESSION['descr_clss'][251]['fields']['mo_id']=array('type'=>'int(11)') ; // код текущей сессии МО
    $_SESSION['descr_clss'][251]['fields']['obj_name']=array('type'=>'varchar(255)','index'=>'obj_name') ; // этап медосмотра
    $_SESSION['descr_clss'][251]['fields']['comment']='text' ;
    $_SESSION['descr_clss'][251]['fields']['data']='serialize' ;
    $_SESSION['descr_clss'][251]['fields']['time_exec']='float(10,5)' ;
    $_SESSION['descr_clss'][251]['fields']['reffer1']=array('type'=>'any_object')  ;
    $_SESSION['descr_clss'][251]['fields']['reffer2']=array('type'=>'any_object')  ;
    $_SESSION['descr_clss'][251]['fields']['reffer3']=array('type'=>'any_object')  ;
    $_SESSION['descr_clss'][251]['fields']['reffer4']=array('type'=>'any_object')  ;
    $_SESSION['descr_clss'][251]['fields']['reffer5']=array('type'=>'any_object')  ;
    $_SESSION['descr_clss'][251]['fields']['IP']=array('type'=>'varchar(15)')  ;
    $_SESSION['descr_clss'][251]['fields']['request_uid']=array('type'=>'varchar(32)')  ;
    $_SESSION['descr_clss'][251]['child_to']=array(1) ;
    $_SESSION['descr_clss'][251]['parent_to']=array(3) ;
    $_SESSION['descr_clss'][251]['no_show_in_tree']=0 ; // не показывать объекты класса в дереве
    $_SESSION['descr_clss'][251]['list']['field']['с_data']			=array('title'=>'Время начала сенса','td_class'=>'left') ;
    $_SESSION['descr_clss'][251]['list']['field']['terminal_id']    =array('title'=>'Интерфейс','td_class'=>'left') ;
    $_SESSION['descr_clss'][251]['list']['field']['member_id']	    =array('title'=>'Работник','td_class'=>'left') ;
    $_SESSION['descr_clss'][251]['list']['field']['obj_name']	    =array('title'=>'Операция','td_class'=>'left') ;
    $_SESSION['descr_clss'][251]['list']['field']['comment']	    =array('title'=>'Комментарий','td_class'=>'left') ;
    $_SESSION['descr_clss'][251]['details']=$_SESSION['descr_clss'][251]['list'] ;

    //-----------------------------------------------------------------------------------------------------
    $_SESSION['descr_clss'][253]['name']='Журнал обмена' ;
    $_SESSION['descr_clss'][253]['parent']=0 ;
    $_SESSION['descr_clss'][253]['fields']['с_data']=array('type'=>'timedata','data_format'=>'d.m.y G:i','index'=>'c_data') ; // время запроса
    $_SESSION['descr_clss'][253]['fields']['r_data']=array('type'=>'timedata','data_format'=>'d.m.y G:i') ; // время ответа
    $_SESSION['descr_clss'][253]['fields']['IP1']=array('type'=>'varchar(19)') ; // IP запроса
    $_SESSION['descr_clss'][253]['fields']['req_url']=array('type'=>'varchar(128)') ; // URL запроса
    $_SESSION['descr_clss'][253]['fields']['req_type']=array('type'=>'int(1)','default'=>0) ; // URL запроса
    $_SESSION['descr_clss'][253]['fields']['cmd']=array('type'=>'varchar(32)','index'=>'cmd') ; // команда
    $_SESSION['descr_clss'][253]['fields']['mess1']=array('type'=>'longtext') ; // запрос
    $_SESSION['descr_clss'][253]['fields']['status']=array('type'=>'int(11)') ; // статус ответа - 200,404,500
    $_SESSION['descr_clss'][253]['fields']['IP2']=array('type'=>'varchar(256)') ; // IP ответа
    $_SESSION['descr_clss'][253]['fields']['mess2']=array('type'=>'longtext') ; // ответ
    $_SESSION['descr_clss'][253]['fields']['terminal_id']=array('type'=>'int(11)','index'=>'terminal_id') ; // id терминала
    $_SESSION['descr_clss'][253]['fields']['mo_id']=array('type'=>'int(11)') ; // id MO
    $_SESSION['descr_clss'][253]['fields']['personal_id']=array('type'=>'int(11)') ; // id Персонала
    $_SESSION['descr_clss'][253]['fields']['evt_id']=array('type'=>'int(11)') ; // id события в журнале событий
    $_SESSION['descr_clss'][253]['fields']['message']=array('type'=>'varchar(32)') ; // message, fail
    $_SESSION['descr_clss'][253]['fields']['size1']=array('type'=>'int(11)') ; //
    $_SESSION['descr_clss'][253]['fields']['size2']=array('type'=>'int(11)') ; //
    $_SESSION['descr_clss'][253]['fields']['debug_text']=array('type'=>'text') ; //
    $_SESSION['descr_clss'][253]['fields']['time_exec']=array('type'=>'float(10,5)') ; //
    $_SESSION['descr_clss'][253]['fields']['reffer1']=array('type'=>'any_object')  ;
    $_SESSION['descr_clss'][253]['fields']['reffer2']=array('type'=>'any_object')  ;
    $_SESSION['descr_clss'][253]['fields']['reffer3']=array('type'=>'any_object')  ;
    $_SESSION['descr_clss'][253]['fields']['reffer4']=array('type'=>'any_object')  ;
    $_SESSION['descr_clss'][253]['fields']['reffer5']=array('type'=>'any_object')  ;
    $_SESSION['descr_clss'][253]['fields']['UID']=array('type'=>'varchar(32)')  ;
    $_SESSION['descr_clss'][253]['fields']['content_type1']=array('type'=>'varchar(32)')  ;
    $_SESSION['descr_clss'][253]['fields']['content_type2']=array('type'=>'varchar(32)')  ;

    $_SESSION['descr_clss'][253]['list']['field']['с_data']          =array('title'=>'Дата от') ;
    $_SESSION['descr_clss'][253]['list']['field']['status']          =array('title'=>'status') ;
    $_SESSION['descr_clss'][253]['list']['field']['IP1']            =array('title'=>'IP1') ;
    $_SESSION['descr_clss'][253]['list']['field']['cmd']            =array('title'=>'cmd') ;
    $_SESSION['descr_clss'][253]['list']['field']['mess1']            =array('title'=>'mess1','view'=>'view_mess1', 'script'=>'mod/aspmo/i_field_views.php') ;
    $_SESSION['descr_clss'][253]['list']['field']['IP2']            =array('title'=>'IP2') ;
    $_SESSION['descr_clss'][253]['list']['field']['mess2']            =array('title'=>'mess2','view'=>'view_mess2', 'script'=>'mod/aspmo/i_field_views.php') ;


    //-----------------------------------------------------------------------------------------------------
    $_SESSION['descr_clss'][255]['name']='Отчет' ;
    $_SESSION['descr_clss'][255]['parent']=0 ;
    $_SESSION['descr_clss'][255]['fields']['group_name']=array('type'=>'varchar(255)') ;
    $_SESSION['descr_clss'][255]['fields']['class_name']=array('type'=>'varchar(255)') ;
    $_SESSION['descr_clss'][255]['fields']['script']=array('type'=>'varchar(255)') ;
    $_SESSION['descr_clss'][255]['fields']['code']=array('type'=>'varchar(64)') ;
    $_SESSION['descr_clss'][255]['fields']['type']=array('type'=>'varchar(11)','default'=>1) ; // 1 - отчет, 2 - документ
    $_SESSION['descr_clss'][255]['fields']['virt']=array('type'=>'int(1)','default'=>0) ; // 1 - отчет, 2 - документ
    $_SESSION['descr_clss'][255]['fields']['scan_priority']=array('type'=>'int(1)','default'=>0) ; // 1 - приоритет при распозновании сканов

    //-----------------------------------------------------------------------------------------------------
    $_SESSION['descr_clss'][256]['name']='Шаблон отчета' ;
    $_SESSION['descr_clss'][256]['parent']=20 ;
    $_SESSION['descr_clss'][256]['fields']['template_name']=array('type'=>'varchar(255)') ;

    $_SESSION['descr_clss'][256]['list']['field']['id']		        	=array('title'=>'Код.') ;
    $_SESSION['descr_clss'][256]['list']['field']['enabled']			=array('title'=>'Сост.') ;
    $_SESSION['descr_clss'][256]['list']['field']['obj_name']			=array('title'=>'Название','td_class'=>'left') ;
    $_SESSION['descr_clss'][256]['list']['field']['template_name']      =array('title'=>'Шазвание шаблона') ;

    $_SESSION['descr_clss'][260]['name']='Сообщение в монитор' ;
    $_SESSION['descr_clss'][260]['parent']=0 ;
    $_SESSION['descr_clss'][260]['table_code']='mess' ;

    $_SESSION['descr_clss'][260]['fields']['obj_name']=array('type'=>'serialize') ;
    $_SESSION['descr_clss'][260]['fields']['grp']=array('type'=>'int(11)') ; //

    $_SESSION['descr_clss'][270]['name']='Нагрузка на систему' ;
    $_SESSION['descr_clss'][270]['parent']=0 ;
    $_SESSION['descr_clss'][270]['fields']['cnt_a_proc']=array('type'=>'int(11)') ; // число открытых процессов апача
    $_SESSION['descr_clss'][270]['fields']['uptime']=array('type'=>'varchar(100)') ; //
    $_SESSION['descr_clss'][270]['fields']['free']=array('type'=>'varchar(255)') ; //
    $_SESSION['descr_clss'][270]['fields']['c_data_m']=array('type'=>'timedata','data_format'=>'d.m.y G:i') ; // дата для группировки по 1 минутe
    $_SESSION['descr_clss'][270]['fields']['c_data_h']=array('type'=>'timedata','data_format'=>'d.m.y G:i') ; // дата для группировки по 1 часу
    $_SESSION['descr_clss'][270]['fields']['c_data_d']=array('type'=>'timedata','data_format'=>'d.m.y G:i') ; // дата для группировки по дню


    // сообщения будут показаны сотруднику всему возможными способами
    // - при МО
    // - при получении пропуска
    $_SESSION['descr_clss'][271]['name']='Сообщение сотруднику' ;
    $_SESSION['descr_clss'][271]['parent']=0 ;
    $_SESSION['descr_clss'][271]['fields']['status']=array('type'=>'int(11)') ; // стутус сообщения
    $_SESSION['descr_clss'][271]['fields']['pid_from']=array('type'=>'int(11)') ; // personal_id от кого сообщение
    $_SESSION['descr_clss'][271]['fields']['pid_to']=array('type'=>'int(11)') ; // personal_id кому сообщение
    $_SESSION['descr_clss'][271]['fields']['obj_name']=array('type'=>'varchar(255)') ; // текст сообщения
    $_SESSION['descr_clss'][271]['fields']['cnt_view_max']=array('type'=>'int(11)') ; // максимальное число просмотров
    $_SESSION['descr_clss'][271]['fields']['cnt_view_cur']=array('type'=>'int(11)') ; // текущее число просмотров
    $_SESSION['descr_clss'][271]['fields']['date_view_max']=array('type'=>'int(11)') ; // самая поздняя дата показа
    $_SESSION['descr_clss'][271]['fields']['date_view_cur']=array('type'=>'int(11)') ; // последняя дата показа

    $_SESSION['descr_clss'][272]['name']='Кеш отчетов' ;
    $_SESSION['descr_clss'][272]['parent']=0 ;
    $_SESSION['descr_clss'][272]['fields']['obj_name']=array('type'=>'varchar(32)') ; // код отчета
    $_SESSION['descr_clss'][272]['fields']['filter']=array('type'=>'serialize') ; // набор фильтров
    $_SESSION['descr_clss'][272]['fields']['result']=array('type'=>'serialize') ; // данные отчета
    //
    $_SESSION['descr_clss'][273]['name']='Входящее письмо' ;
    $_SESSION['descr_clss'][273]['parent']=0 ;
    $_SESSION['descr_clss'][273]['fields']['obj_name']=array('type'=>'varchar(64)') ; // код отчета
    $_SESSION['descr_clss'][273]['fields']['sender']=array('type'=>'varchar(127)') ; // набор фильтров
    $_SESSION['descr_clss'][273]['fields']['size']=array('type'=>'int(11)') ; // данные отчета
    $_SESSION['descr_clss'][273]['fields']['send_time']=array('type'=>'int(11)') ; // данные отчета
                                        $_SESSION['descr_clss'][273]['fields']['size']=array('type'=>'int(11)') ; // данные отчета
    $_SESSION['descr_clss'][273]['fields']['status']=array('type'=>'int(11)','default'=>0) ; // данные отчета
    $_SESSION['descr_clss'][273]['fields']['message_uid']=array('type'=>'varchar(64)','default'=>'') ; // данные отчета


    $_SESSION['descr_clss'][274]['name']='Вложение в письмо' ;
    $_SESSION['descr_clss'][274]['parent']=0 ;
    $_SESSION['descr_clss'][274]['fields']['type']=array('type'=>'varchar(128)') ; // код отчета
    $_SESSION['descr_clss'][274]['fields']['obj_name']=array('type'=>'varchar(128)') ; // набор фильтров
    $_SESSION['descr_clss'][274]['fields']['bytes']=array('type'=>'int(11)') ; // данные отчета
    $_SESSION['descr_clss'][274]['fields']['saved_fname']=array('type'=>'varchar(128)') ; // данные отчета
    $_SESSION['descr_clss'][274]['fields']['status']=array('type'=>'int(11)','default'=>0) ; // данные отчета
    $_SESSION['descr_clss'][274]['fields']['message_uid']=array('type'=>'varchar(64)','default'=>'') ; // данные отчета

    $_SESSION['descr_clss'][275]['name']='Локализация' ;
    $_SESSION['descr_clss'][275]['parent']=0 ;
    $_SESSION['descr_clss'][275]['fields']['obj_name']=array('type'=>'varchar(256)') ; // фраза на русском
    $_SESSION['descr_clss'][275]['fields']['obj_name_loc']=array('type'=>'varchar(256)') ; // фраза на английском

	$_SESSION['descr_clss'][280]['name']='Размер директории' ;
    $_SESSION['descr_clss'][280]['parent']=0 ;
    $_SESSION['descr_clss'][280]['fields']['status']=array('type'=>'int(11)') ; // тип директории (программеый код, данные, временные файлы)
    $_SESSION['descr_clss'][280]['fields']['size']=array('type'=>'BIGINT(11)') ;
    $_SESSION['descr_clss'][280]['fields']['cnt']=array('type'=>'int(11)') ;
	$_SESSION['descr_clss'][282]['fields']['newest_file']=array('type'=>'varchar(255)') ;
    $_SESSION['descr_clss'][282]['fields']['newest_time']=array('type'=>'int(11)') ;
	$_SESSION['descr_clss'][282]['fields']['oldest_file']=array('type'=>'varchar(255)') ;
    $_SESSION['descr_clss'][282]['fields']['oldest_time']=array('type'=>'int(11)') ;


    $_SESSION['descr_clss'][281]['name']='Свободное место на диске' ;
    $_SESSION['descr_clss'][281]['parent']=0 ;
    $_SESSION['descr_clss'][281]['fields']['size']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][281]['fields']['cnt']=array('type'=>'int(11)') ;

    $_SESSION['descr_clss'][282]['name']='Директория' ;
    $_SESSION['descr_clss'][282]['parent']=0 ;
    $_SESSION['descr_clss'][282]['fields']['obj_name']=array('type'=>'varchar(255)') ;
    $_SESSION['descr_clss'][282]['fields']['status']=array('type'=>'int(11)') ; // тип директории (программеый код, данные, временные файлы)
    $_SESSION['descr_clss'][282]['fields']['level']=array('type'=>'int(11)') ; // уровень от корня хоста
    $_SESSION['descr_clss'][282]['fields']['newest_file']=array('type'=>'varchar(255)') ;
    $_SESSION['descr_clss'][282]['fields']['newest_time']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][282]['fields']['oldest_file']=array('type'=>'varchar(255)') ;
    $_SESSION['descr_clss'][282]['fields']['oldest_time']=array('type'=>'int(11)') ;

    // временно тут пока не будет обновлен движок
    $_SESSION['descr_clss'][102]['fields']['o_id']=array('type'=>'int(11)','index'=>'o_id') ;
	$_SESSION['descr_clss'][102]['fields']['o_tkey']=array('type'=>'int(11)','index'=>'o_tkey') ;
	$_SESSION['descr_clss'][102]['fields']['o_clss']=array('type'=>'int(11)','index'=>'o_clss') ;
	$_SESSION['descr_clss'][102]['fields']['p_id']=array('type'=>'int(11)','index'=>'p_id') ;
	$_SESSION['descr_clss'][102]['fields']['p_tkey']=array('type'=>'int(11)','index'=>'p_tkey') ;
	$_SESSION['descr_clss'][102]['fields']['p_clss']=array('type'=>'int(11)','index'=>'p_clss') ;

	// устройство
	$_SESSION['descr_clss'][77]=array() ;
    $_SESSION['descr_clss'][77]['name']='Устройство' ;
    $_SESSION['descr_clss'][77]['parent']=0 ;

    $_SESSION['descr_clss'][77]['fields']['id']=array('type'=>'int(11)','index'=>'id') ;
    $_SESSION['descr_clss'][77]['fields']['ip']=array('type'=>'varchar(20)','index'=>'ip') ;
    //$_SESSION['descr_clss'][77]['fields']['video']=array('type'=>'int(1)','default'=>0) ;
    //$_SESSION['descr_clss'][77]['fields']['tonometer']=array('type'=>'int(1)','default'=>0) ;
    //$_SESSION['descr_clss'][77]['fields']['thermometer']=array('type'=>'int(1)','default'=>0) ;
    //$_SESSION['descr_clss'][77]['fields']['alcotester']=array('type'=>'int(1)','default'=>0) ;
    //$_SESSION['descr_clss'][77]['fields']['pupilometer']=array('type'=>'int(1)','default'=>0) ;
	$_SESSION['descr_clss'][77]['fields']['terminal_type']=array('type'=>'varchar(2)','default'=>'mt') ;
    $_SESSION['descr_clss'][77]['fields']['type']=array('type'=>'int(11)','default'=>0) ;
    $_SESSION['descr_clss'][77]['fields']['status']=array('type'=>'int(11)','default'=>0) ;
    $_SESSION['descr_clss'][77]['fields']['profil']=array('type'=>'indx_select','array'=>'IL_term_prof') ;
    //$_SESSION['descr_clss'][77]['fields']['VS_IP']=array('type'=>'varchar(20)') ;
    $_SESSION['descr_clss'][77]['fields']['stream_name_1']=array('type'=>'varchar(32)') ;
    $_SESSION['descr_clss'][77]['fields']['stream_name_2']=array('type'=>'varchar(32)') ;
    $_SESSION['descr_clss'][77]['fields']['vers']=array('type'=>'varchar(32)') ;
    $_SESSION['descr_clss'][77]['fields']['assigned_version']=array('type'=>'varchar(32)') ;
	$_SESSION['descr_clss'][77]['fields']['zone_id']=array('type'=>'int(11)') ;
	$_SESSION['descr_clss'][77]['fields']['group_id']=array('type'=>'int(11)') ;
	$_SESSION['descr_clss'][77]['fields']['ext_info']=array('type'=>'serialize') ;
	$_SESSION['descr_clss'][77]['fields']['devices']=array('type'=>'serialize') ;
	$_SESSION['descr_clss'][77]['fields']['port']=array('type'=>'int(11)') ;
    // поля, используемые только для виртуальных терминалов
    $_SESSION['descr_clss'][77]['fields']['virt']=array('type'=>'int(1)','default'=>0) ;
    $_SESSION['descr_clss'][77]['fields']['virt_status']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][77]['fields']['virt_time']=array('type'=>'timedata') ;


}

function _engine_admin_boot($options)
{
    create_system_modul_obj('engine',$options) ;

}

function check_exists_dir($dir)
{  include_once(_DIR_TO_MODULES.'/engine/i_setup.php') ;
   SETUP()->check_exists_dir($dir) ;
}

function check_attr_X($dir)
{  include_once(_DIR_TO_MODULES.'/engine/i_setup.php') ;
   SETUP()->check_attr_X($dir) ;
}

function check_AddOns_dir($dir)
{  include_once(_DIR_TO_MODULES.'/engine/i_setup.php') ;
   $result=SETUP()->check_AddOns_dir($dir) ;
   return($result) ;
}

function check_exists_file($dir,$options=array())
{  include_once(_DIR_TO_MODULES.'/engine/i_setup.php') ;
   SETUP()->check_exists_file($dir,$options) ;
}

function remove_old_script($dir)
{  include_once(_DIR_TO_MODULES.'/engine/i_setup.php') ;
   SETUP()->remove_old_script($dir) ;
}

function remove_old_dir($dir)
{  include_once(_DIR_TO_MODULES.'/engine/i_setup.php') ;
   SETUP()->remove_old_dir($dir) ;
}

function alert_old_dir($dir)
{  include_once(_DIR_TO_MODULES.'/engine/i_setup.php') ;
   SETUP()->alert_old_dir($dir) ;
}

function _engine_install_modul($DOT_root)
{   SETUP()->reg_rol(1,'Администратор') ;

    check_exists_file('/favicon.ico') ;
    check_exists_file('/.htaccess') ;
    check_exists_file('/ajax.php') ;
    check_exists_file('/ajax_json.php') ;
    check_exists_file('/index.php',array('remove_old_file'=>1)) ;
    check_exists_file('/ip.php') ;
    check_exists_file('/win_second.php') ;
    check_exists_file('/equipment-api.php') ;
    check_exists_file('/equipment-api-kz.php') ;
    check_exists_file('/equipment-api-kt.php') ;
    check_exists_file('/equipment_api_kt.php') ;
    check_exists_dir('/storage') ;
    check_exists_dir('/cab') ;
    check_exists_file('/cab/.htaccess') ;
    check_exists_file('/cab/ajax.php') ;
    check_exists_file('/cab/ajax_json.php') ;
    check_exists_file('/cab/index.php',array('remove_old_file'=>1)) ;
    check_exists_dir('/window') ;
    check_exists_file('/window/.htaccess') ;
    check_exists_file('/window/index.php',array('remove_old_file'=>1)) ;
    check_exists_dir('/frame') ;
    check_exists_file('/frame/.htaccess') ;
    check_exists_file('/frame/ajax.php') ;
    check_exists_file('/frame/index.php',array('remove_old_file'=>1)) ;
    check_exists_dir('/services') ;
    check_exists_file('/services/.htaccess') ;
    check_exists_file('/services/index.php') ;
    check_exists_dir('/docs') ;
    check_exists_dir('/docs/scan') ;
    check_exists_dir('/docs/pdf') ;
    check_exists_dir('/files') ;
    check_exists_dir('/logs') ;
    check_exists_dir('/temp') ;
    check_exists_dir('/temp/doc') ;
    check_exists_dir('/temp/uploads') ;
    check_exists_dir('/temp/monitor') ;
    check_exists_dir('/temp/du') ;
    check_exists_dir('/capture') ;
    check_exists_dir('/public/') ;
    check_exists_dir('/public/instruktions_sign') ;
    check_exists_dir('/public/instruktions_docs') ;
    check_exists_dir('/public/account') ;
    check_exists_dir('/public/account/small') ;
    check_exists_dir('/public/account/source') ;
    check_attr_X('/'._CLASS_.'/engine_moduls/engine/filestat') ;
    check_attr_X('/AddOns/html2pdf/wkhtmltopdf-amd64') ;

	SETUP()->check_dir_protection('/storage') ;
	SETUP()->check_dir_protection('/docs') ;
	SETUP()->check_dir_protection('/files') ;
	SETUP()->check_dir_protection('/logs') ;
	SETUP()->check_dir_protection('/temp') ;
	SETUP()->check_dir_protection('/temp') ;
	SETUP()->check_dir_protection('/capture') ;
	SETUP()->check_dir_protection('/capture') ;
	SETUP()->check_dir_protection('/public') ;

    // удаляем мусор
    remove_old_script('/pdf.php') ;
    remove_old_script('/ajax2.php') ;
    remove_old_script('/async.php') ;
    remove_old_script('/authorizationTerminal.php') ;
    remove_old_script('/check_files.php') ;
    remove_old_script('/demo.php') ;
    remove_old_script('/request.php') ;
    remove_old_script('/s1.php') ;
    remove_old_script('/s2.php') ;
    remove_old_script('/setting.pdf') ;
    remove_old_script('/signal.php') ;
    remove_old_script('/sse.php') ;
    remove_old_script('/style_pdf.css') ;
    remove_old_script('/talon.php') ;
    remove_old_script('/terminal.php') ;
    remove_old_script('/vers.txt') ;
    remove_old_script('/xls_pdf.php') ;
    remove_old_script('/get_video.php') ;
    remove_old_script('/test2.php') ;
    remove_old_script('/test_push.php') ;
    remove_old_script('/qrcode.php') ;
	//remove_old_dir('/test/') ;
	//remove_old_dir('/qrcode/') ;
	//remove_old_dir('/sert/') ;
	//remove_old_dir('/ioncube/') ;
	//remove_old_dir('/cp/') ;
	//remove_old_dir('/camera/') ;
	//remove_old_dir('/demo/') ;
	//remove_old_dir('/pchar/') ;
	//remove_old_dir('/get/') ;
	//remove_old_dir('/XLS/') ;
	//remove_old_dir('/XML/') ;

	SETUP()->append_ini_value('security','session_life_time',3660) ; // срок жизни сессии, в сек
    if ($GLOBALS['_SETTING']['security']['session_life_time'] and $GLOBALS['_SETTING']['security']['session_life_time']<300) {
        // в старых версиях сервера значение ['security']['session_life_time'] в ini было установлено в 10 секунд
        // после обновления нужно было успеть за 10 секунд изменить это значение
        SETUP()->update_ini_value('security','session_life_time',300) ; // срок жизни сессии, в сек
    }

	// пока еще рано, не готова страница редактироания настройка по аналогии с настройками в БД
	//SETUP()->append_ini_value('system','lifetime_logs',24) ; //     // срок хранения логов в часах
	//SETUP()->append_ini_value('system','lifetime_temp',24) ; //    // срок хранения временного видео в часах
	//SETUP()->append_ini_value('system','lifetime_temp_video',3) ; // срок хранения временного видео в часах

	// удаляем значения ключей шифрования из ini.yaml
	if (SETUP_LEVEL('append_ini_value'))
    {  // если в файле ini.yaml присутвует ключ шифрования для настроек
       if ($GLOBALS['_SETTING']['main_db']['crypt_key']) SETUP()->append_key_value('sdfjhaskjfdhabfak',$GLOBALS['_SETTING']['main_db']['crypt_key']) ;
       if ($GLOBALS['_SETTING']['ActiveDirectory']['app_key']) SETUP()->append_key_value('wfhksjhdfsufauisy',$GLOBALS['_SETTING']['ActiveDirectory']['app_key']) ;
    }

	if ($GLOBALS['_SETTING']['dist']['esmo_version'] and !$GLOBALS['_SETTING']['dist']['class_version'])
	{ SETUP()->append_ini_value('dist','class_version',$GLOBALS['_SETTING']['dist']['esmo_version']) ;
	  SETUP()->update_ini_value('dist','engine_version',$GLOBALS['_SETTING']['dist']['esmo_version'].'/system') ;
	}

	SETUP()->remove_old_ini_section('admin_account') ;
	SETUP()->remove_old_ini_section('doctor_account') ;
	SETUP()->remove_old_ini_section('mail') ;
	SETUP()->remove_old_ini_section('main_db','crypt_key') ;
	SETUP()->remove_old_ini_section('ActiveDirectory','app_key') ;

    //if (file_exists(_DIR_TO_ROOT.'/AddOns/html2pdf/wkhtmltopdf-amd64')) chmod(_DIR_TO_ROOT.'/AddOns/html2pdf/wkhtmltopdf-amd64',0755) ;

	// !!! вызов этиъ функций происходит в SETUP()->check_setting
	//SETUP()->clear_event_lister() ; // сбрасываем список обработчиков событий в базе
	//SETUP()->mark_crontab_for_remove() ; // сбрасываем список обработчиков событий в базе
	//SETUP()->reg_event_lister('test','ENGINE','test_event_lister') ;


	//$this->reg_report('Служебные отчеты','log/report_log_events_req.php') ;  // !!! не доделан       //
	   SETUP()->reg_report('Служебные отчеты','log/report_log_req.php') ;         //
        SETUP()->reg_report('Служебные отчеты','log/report_log_events.php') ;         //
        SETUP()->reg_report('Служебные отчеты','log/report_log_pages.php') ;         //
	SETUP()->reg_report('Служебные отчеты','log/report_log_sql_errors.php') ;         //
	SETUP()->reg_report('Служебные отчеты','log/report_log_sql_long.php') ;         //
	// SETUP()->reg_report('Служебные отчеты','log/report_disk.php') ;         //
	// SETUP()->reg_report('Служебные отчеты','log/report_proc.php') ;         //


	$id_sect=SETUP_add_section_to_site_setting('Мета-теги') ;
    SETUP_add_rec_to_site_setting($id_sect,'Заголовок страницы по умолчанию','ЭСМО','LS_def_page_title') ;
    SETUP_add_rec_to_site_setting($id_sect,'Ключевые слова по умолчанию','','LS_def_page_keywords') ;
    SETUP_add_rec_to_site_setting($id_sect,'Описание страницы по умолчанию','','LS_def_page_descr') ;
    SETUP_add_rec_to_site_setting($id_sect,'Приставка к заголовку','','LS_pre_title') ;
    SETUP_add_rec_to_site_setting($id_sect,'Суффикс к заголовку','','LS_after_title') ;


    $id_sect=SETUP_add_section_to_site_setting('Отладка') ;
	SETUP_add_rec_to_site_setting($id_sect,"Включить режим отладки",0,'LS_debug_mode',array('el'=>'checkbox','descr'=>'Будет включено логгирование выполенных SQL запросов и временной трассировки выдачи страниц')) ;
	SETUP_add_rec_to_site_setting($id_sect,"Включить логгирование JS-событий подписи документа",0,'LS_trace_sign_JS',array('el'=>'checkbox')) ;
    //SETUP_add_rec_to_site_setting($id_sect,"Вести журнал страниц",0,'LS_log_pages',array('el'=>'checkbox')) ; // включено в режим отладки
    SETUP_add_rec_to_site_setting($id_sect,"Время выполнения SQL-запроса, более которого запрос будет считаться долгим, сек",0.5,'LS_sql_max_time_execute',array('human'=>'sec','descr'=>'Все SQL-запросы более заданного времени будут попадать в журанал долгих SQL-запросов')) ;
    SETUP_add_rec_to_site_setting($id_sect,"Вести журнал долгих SQL-запросов",1,'LS_log_long_SQL',array('el'=>'checkbox')) ;
	SETUP_add_rec_to_site_setting($id_sect,"Включить логгирование ошибок SQL",1,'LS_logging_SQL_error',array('el'=>'checkbox')) ; // работает независимо от режима отладки
    //SETUP_add_rec_to_site_setting($id_sect,"Глобальная трассировка SQL запросов",0,'LS_trace_SQL',array('el'=>'checkbox')) ;

    $id_sect=SETUP_add_section_to_site_setting('Служебные настройки') ;
    SETUP_add_rec_to_site_setting($id_sect,"Число записей за запрос при экспорте в Excel CSV:",1000,'LS_CSV_export_row_count',array('update_current_value'=>1)) ;
    SETUP_add_rec_to_site_setting($id_sect,"Включить планировщик:",1,'LS_cron_active',array('el'=>'checkbox')) ;
    SETUP_add_rec_to_site_setting($id_sect,"Дата последней отработки крона:",0,'LS_last_cron_time',array('hidden'=>1)) ;
    SETUP_add_rec_to_site_setting($id_sect,"Дата последнего запуска крона:",0,'LS_last_cron_status',array('hidden'=>1)) ;
    SETUP_add_rec_to_site_setting($id_sect,"Использовать 127.0.0.1 в PDF:",0,'LS_use_localhost_in_pdf',array('el'=>'checkbox')) ;
    SETUP_add_rec_to_site_setting($id_sect,"Минимальное число непрырывных линий",1,'LS_handsign_line_min') ;
    SETUP_add_rec_to_site_setting($id_sect,"Минимальное число точек в линии",10,'LS_handsign_pix_min') ;
    SETUP_add_rec_to_site_setting($id_sect,"Таймаут CURL установления соединения, сек",2,'LS_curl_connect_timeout',array('human'=>'sec')) ;
    SETUP_add_rec_to_site_setting($id_sect,"Таймаут CURL ожидания ответа, сек",3,'LS_curl_timeout',array('human'=>'sec')) ;
	SETUP_add_rec_to_site_setting($id_sect,"Число строк/insert",500,'LS_insert_rows_count') ;
	SETUP_add_rec_to_site_setting($id_sect,"Захват фото с камеры - использовать старую версию",0,'LS_web_camera_capture_use_old_version',array('el'=>'checkbox')) ;
	SETUP_add_rec_to_site_setting($id_sect,"Срок хранения логов, часов",24,'LS_lifetime_logs',array('human'=>'hour')) ;
	SETUP_add_rec_to_site_setting($id_sect,"Срок хранения временных файлов, часов",24,'LS_lifetime_temp',array('human'=>'hour')) ;
	SETUP_add_rec_to_site_setting($id_sect,"Срок хранения временных файлов видео, часов",3,'LS_lifetime_temp_video',array('human'=>'hour')) ;
	SETUP_add_rec_to_site_setting($id_sect,"Перенаправлять на протокол по умолчанию (HTTP,HTTPS)",1,'LS_redirect_to_main_sheme',array('el'=>'checkbox')) ;
    SETUP_add_rec_to_site_setting($id_sect,"Разрешить update-запросы в SQL-редакторе:",0,'LS_allow_sql_update',array('el'=>'checkbox')) ;
  SETUP_add_rec_to_site_setting($id_sect,"Использовать оперативную таблицу лога",0,'LS_log_now_enabled',array('el'=>'checkbox','hidden'=>1)) ;
  SETUP_add_rec_to_site_setting($id_sect,"Глубина оперативной таблицы лога, час",24,'LS_setting_log_now_len',array('human'=>'hour')) ;



	$id_sect=SETUP_add_section_to_site_setting('Обновление') ;
	SETUP_add_rec_to_site_setting($id_sect,"Адрес репозитария:",'https://dist.kvzrm.ru/esmo/server/','LS_update_git_server_url') ;
    SETUP_add_rec_to_site_setting($id_sect,"Название ветки:",'work','LS_update_git_branch') ;
    SETUP_add_rec_to_site_setting($id_sect,"Логин:",'kvzrm','LS_update_git_login') ;
    SETUP_add_rec_to_site_setting($id_sect,"Пароль:",'','LS_update_git_password',array('crypt'=>1)) ;


    $id_sect=SETUP_add_section_to_site_setting('Безопасность') ;
    SETUP_add_rec_to_site_setting($id_sect,"Использовать сертификат при обращении к терминалу",0,'LS_use_sertificat_to_req_term',array('el'=>'checkbox')) ;
    //SETUP_add_rec_to_site_setting($id_sect,"Срок жизни сессии, сек",0,'LS_gc_maxlifetime',array('human'=>'sec')) ; // перенесено в ini.yaml

    $id_sect=SETUP_add_section_to_site_setting('Интерфейс') ;
    SETUP_add_rec_to_site_setting($id_sect,"Ширина всплывающего окна, px:",1920,'LS_popup_window_width') ;
    SETUP_add_rec_to_site_setting($id_sect,"Высота всплывающего окна, px:",1000,'LS_popup_window_height') ;
    SETUP_add_rec_to_site_setting($id_sect,"Цветовая схема:",'bg-cyan','LS_cab_color_set',array('el'=>'select','array'=>'arr_color_sets','place'=>'ini')) ;
    SETUP_add_rec_to_site_setting($id_sect,"Включить HELP:",0,'LS_help_enabled',array('el'=>'checkbox')) ;

	$id_sect=SETUP_add_section_to_site_setting('Прием почты (IMAP)') ;
    SETUP_add_rec_to_site_setting($id_sect,"Адрес почтового сервера",'imap.yandex.ru','LS_mailbox_server') ;
    SETUP_add_rec_to_site_setting($id_sect,"Порт почтового сервера",993,'LS_mailbox_port') ;
    SETUP_add_rec_to_site_setting($id_sect,"Логин",'','LS_mailbox_login') ;
    SETUP_add_rec_to_site_setting($id_sect,"Пароль",'','LS_mailbox_pass',array('crypt'=>1)) ;
    SETUP_add_rec_to_site_setting($id_sect,"Протокол",'pop3','LS_mailbox_protokol') ;
    SETUP_add_rec_to_site_setting($id_sect,"Параметры",'/ssl/notls','LS_mailbox_params') ;
    SETUP_add_rec_to_site_setting($id_sect,"Папка (IMAP)",'','LS_mailbox_in_folder') ;


    $id_sect=SETUP_add_section_to_site_setting('Отправка почты (smtp)') ;
    SETUP_add_rec_to_site_setting($id_sect,"Требуется применить, только SMTP идентификацию при отправке",1,'LS_smtp_auth_use',array('el'=>'checkbox')) ;
    SETUP_add_rec_to_site_setting($id_sect,"server adress",'','LS_smtp_server') ;
    SETUP_add_rec_to_site_setting($id_sect,"server port",'','LS_smtp_port') ;
    SETUP_add_rec_to_site_setting($id_sect,"server login",'','LS_smtp_login') ;
    SETUP_add_rec_to_site_setting($id_sect,"server pass",'','LS_smtp_pass',array('crypt'=>1)) ;
    SETUP_add_rec_to_site_setting($id_sect,"smtp from",'','LS_smtp_from') ;
    SETUP_add_rec_to_site_setting($id_sect,"smtp from name",'','LS_smtp_from_name') ;
    SETUP_add_rec_to_site_setting($id_sect,"smtp secure",'ssl','LS_smtp_secure') ;

	$id_sect=SETUP_add_section_to_site_setting('Хранилище') ;
	SETUP_add_rec_to_site_setting($id_sect,"Имя директории для хранения файлов",'storage','LS_storage') ;

$id_sect=SETUP_add_section_to_site_setting('Сокеты');
  	 SETUP_add_rec_to_site_setting($id_sect,'Использовать сокеты',1,'LS_monitoring_use_WS',array('el'=>'checkbox')); // старое название , не совсем корректно, но что сделать
  	 SETUP_add_rec_to_site_setting($id_sect,'Использовать сокеты только на РВМ и мониторинге',1,'LS_monitoring_use_WS_only_rmv',array('el'=>'checkbox')); //
     SETUP_add_rec_to_site_setting($id_sect,'Проверка домена получателя при получении пакета через сокет',0,'LS_WS_check_domain',array('el'=>'checkbox')); //
  	 SETUP_add_rec_to_site_setting($id_sect,'Адрес и порт сервера WS для бекэнда (PHP)','localhost','LS_WS_address_port');
  	 SETUP_add_rec_to_site_setting($id_sect,'Адрес и порт сервера WS для фронтенда (JS)',_MAIN_DOMAIN,'LS_WS_address_port_JS');
  	 SETUP_add_rec_to_site_setting($id_sect,'URL подключения к WS','ws_connect','LS_WS_connect_URL');
  	 SETUP_add_rec_to_site_setting($id_sect,'URL отправки сообщения WS','ws_sendMessage','LS_WS_send_message_URL');

    // Журнал событий
    $pattern=array() ;
    $pattern['table_title']		        = 	'Журнал событий' ;
    $pattern['use_clss']		        = 	'1,251' ;
    $pattern['table_name']				= 	'obj_site_mo_log' ;
    $pattern['table_clss']				= 	101 ;
    $pattern['table_parent']			= 	$DOT_root;
//	$pattern['table_engine']		    = 	'MyISAM';
    create_table_by_pattern($pattern) ;

    // Журнал событий
    $pattern=array() ;
    $pattern['table_title']		        = 	'Журнал событий (оперативный)' ;
    $pattern['use_clss']		        = 	'1,251' ;
    $pattern['table_name']				= 	'obj_site_mo_log_now' ;
    $pattern['table_clss']				= 	101 ;
    $pattern['table_parent']			= 	$DOT_root;
//	$pattern['table_engine']		    = 	'MyISAM';
    create_table_by_pattern($pattern) ;


    // Журнал событий
    $pattern=array() ;
    $pattern['table_title']		        = 	'Журнал обмена' ;
    $pattern['use_clss']		        = 	'1,253' ;
    $pattern['table_name']				= 	'obj_site_req_log' ;
    $pattern['table_clss']				= 	101 ;
    $pattern['table_parent']			= 	$DOT_root;
//	$pattern['table_engine']		    = 	'MyISAM';
    create_table_by_pattern($pattern) ;

    // сообщения SSE
    /*$pattern=array() ;
    $pattern['table_title']		        = 	'Стек сообщений' ;
    $pattern['use_clss']		        = 	'260' ;
    //$pattern['def_recs'][]		        =	array ('parent'=>0,	'clss'=>1,	'enabled'=>1,	'indx'=>0,	'obj_name'=>'Аккаунты') ;
    $pattern['table_name']				= 	'obj_site_mess' ;
    $pattern['table_clss']				= 	101 ;
    $pattern['table_parent']			= 	$DOT_root;
    create_table_by_pattern($pattern) ;   */

    // разграничение доступа пользователей к скриптам
    $pattern=array() ;
    $pattern['table_title']		        = 	'Разграничение доступа' ;
    $pattern['use_clss']		        = 	'216' ;
    $pattern['def_recs'][]		        =	array ('parent'=>0,	'clss'=>1,	'enabled'=>1,	'indx'=>0,	'obj_name'=>'Права доступа') ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_log_mo','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_monitor','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_monitor_XMPP','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_smena','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_smenaout','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_terminal','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_index','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_cards','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_personal_person_card','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_mo','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_mo_db','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_mo_doc','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_mo_template','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_mo_log','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_mo_n','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_personal','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_personal_download','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_personal_extlist','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_personal_org','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_personal_person','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_personal_person_ext','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_personal_person_mo','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_personal_person_pp','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_personal_upload','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_print','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_reports','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_reports_list','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_term_whois','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_term_SSE','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting_working','rol_id'=>2) ;
    //$pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting_update','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting_terminal','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting_smena','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting_org','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting_member_sert','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting_member_pass','rol_id'=>2) ;
    //$pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting_member_new','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting_member','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting_groups','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting_arm','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_rmv','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_rmv_hand_mo','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_docs','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_rmv_terminals','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_rmv_mo','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_mo_db_dump','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_mo_db_evt','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_mo_db_personal','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_mo_db_req','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_mo_pp','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_mo_personal','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'report_itog1','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'report_itog2','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'report_itog3','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'report_itog4','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'report_itog5','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'report_itog6','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'report_mo','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'report_mo3','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'report_mo_small','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'report_mo_smena','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_stats','rol_id'=>2) ;
    //$pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting_members','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting','rol_id'=>2) ;
    //$pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_pp','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_rmv_report_mo','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_personal_person_passcard','rol_id'=>2) ;
    //$pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_pp_journal','rol_id'=>2) ;
    //$pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting_right','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_docs_pdf','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'report_docs','rol_id'=>2) ;
//    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_setting_members_new_group','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_kt_hand','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_kt_report_kt','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_kt_rmv','rol_id'=>2) ;
    $pattern['def_recs'][]	=	array ('parent'=>1,	'clss'=>216,	'enabled'=>1,	'indx'=>1,	'obj_name'=>'c_page_cab_kt_terminals','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_docs_protokol','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_docs_napravlenie','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_magnit_pdd_upload_file','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_magnit_pdd_scan_report','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_magnit_pdd_scan','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_magnit_scan_actions','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personal_riski','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_magnit_pdd','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog7_local','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_magnit_2','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_magnit_scan','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_after_race','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_before_race','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_otstrannye','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_smena_ecp','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_graf','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_cryptopro_sign','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_cryptopro_set_sert','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_cryptopro_check_sert','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_cryptopro','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_setting_member_sign','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_health','rol_id'=>2) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_mo_sign_doc','rol_id'=>2) ;

    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_rmv_report_mo','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_rmv','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_members','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_rmv_speed','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_master','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_setting','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personal_riski','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_rmv','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_setting_group_of_disease','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog4','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog5','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog6','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog7','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo3','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_sess','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_sess2','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_small','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_smena','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_setting_groups_of_disease','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_setting_group_of_personal_report','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_setting_group_of_personal','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_local_words','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personal_messages_as_napravlenie','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_after_race','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_magnit_2','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog7_local','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_magnit_pdd_scan_report','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_smena_ecp','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_docs_protokol','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_docs_napravlenie','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_magnit_pdd','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_magnit_pdd_scan','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_otstrannye','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_before_race','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_magnit_pdd_upload_file','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_esmo_ct_terapia','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_esmo_ct','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_terapia','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_log','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_map','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_person_anamnes','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_person_graf','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_person_graf2','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_person_recommendations','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_person_terapia','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_events_instruktions','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_pp','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_esmo_ct_map','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_message','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personal_messages','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_graf','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_otdels','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_card','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_card_rules','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_docs','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_docs_new','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_events','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_events_docs','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_pp_journal','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog3','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_pp_itog3','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_pp_itog4','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_pp_journal','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_pp_result','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_pp_result2','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_reports','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog1','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_count_mo','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_health','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_pp_itog2','rol_id'=>3) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog2','rol_id'=>3) ;

    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personals_to_medic_group','rol_id'=>11) ;

    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_log_req','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog5','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_reports','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_log_pages','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_log_events_req','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_log_events','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog4','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog6','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo3','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_small','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_smena','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_count_mo','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_health','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog2','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog7','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog1','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_reason','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_to_smena','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_work_groups','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=> 'report_log_sql_errors','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog3','rol_id'=>20) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_master','rol_id'=>20) ;

    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_magnit_2','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_setting_group_of_disease','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_master_personals','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_otstrannye','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_master_stats_health','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_master_stats','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_session_time','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_master_stats2','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_master_personal','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_smena_ecp','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personal_riski','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_setting_group_of_disease_rules','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_magnit_3','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_magnit_scan','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_magnit_scan_actions','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_setting_groups_of_disease','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_setting_group_of_personal_report','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_setting_group_of_personal_db','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_setting_group_of_personal','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_after_race','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_before_race','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personal_messages_as_napravlenie','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_setting_groups','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=> 'report_log_sql_errors','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_disk','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_log_events','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_log_events_req','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_log_pages','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personals','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_log_req','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_proc','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_create','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_graf','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personals_group','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personals_of_group','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_setting_mo','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_setting_rules','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personals_to_medic_group','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_master_messages','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_master_mess','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personals_to_group2','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_master','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personals_to_group','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personal_cards','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_magnit_1','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_pp_itog4','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_pp_result','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_pp_result2','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_smena','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_small','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_sess2','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_sess','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo3','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog7','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_reports','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_count_mo','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_health','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog1','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog2','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog3','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_pp_itog3','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_pp_itog2','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_pp','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_message','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_card','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_card_rules','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_events_instruktions','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_events_docs','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_events','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_docs_new','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_docs','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_orgs','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_personal_person_pp','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_otdels','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personal_messages','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_personal_passcard','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_pp','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_pp_journal','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog4','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog5','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog6','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_esmo_ct','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_esmo_ct_map','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_esmo_ct_terapia','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_terapevt_reception','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_get_mo','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_get_mo_based','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_get_mo_full','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_get_persons','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_magnit_pdd','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_magnit_pdd_scan','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_magnit_pdd_scan_report','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_magnit_pdd_upload_file','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_docs_napravlenie','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_docs_protokol','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_groups_edit','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_terapia','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_req','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_person_terapia','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_rmv_speed','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_mo_rmv','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_rmv_report_mo','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_rmv','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_setting','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_local_words','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_members','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_members_cryptopro','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_docs','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_pp_journal','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_log','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_map','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_person_graf','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'c_page_cab_esmo_ct_person_graf2','rol_id'=>21) ;
    $pattern['def_recs'][] = array ('parent'=>1, 'clss'=>216, 'enabled'=>1, 'indx'=>1, 'obj_name'=>'report_itog7_local','rol_id'=>21) ;


    $pattern['table_name']				= 	'obj_site_permit' ;
    $pattern['table_clss']				= 	101 ;
    $pattern['table_parent']			= 	$DOT_root;
    create_table_by_pattern($pattern) ;

    // сообщения сотрудников
    /* $pattern=array() ;
     $pattern['table_title']		        = 	'Сообщения персонала' ;
     $pattern['use_clss']		        = 	'271' ;
     $pattern['table_name']				= 	'obj_site_messages' ;
     $pattern['table_clss']				= 	101 ;
     $pattern['table_parent']			= 	$DOT_root;
     create_table_by_pattern($pattern) ;*/

	 // помощь по страницам
	$pattern=array() ;
	$pattern['table_title']		        = 	'help content' ;
	$pattern['use_clss']		        = 	'23' ;
	$pattern['table_name']				= 	'help_content' ;
	$pattern['table_clss']				= 	101 ;
	$pattern['table_parent']			= 	$DOT_root;
     create_table_by_pattern($pattern) ;

    // Контроль свободного места
    $pattern=array() ;
    $pattern['table_title']		    = 	'Контроль диска' ;
    $pattern['use_clss']		        = 	'280,281' ;
    $pattern['table_name']				= 	'obj_site_disk' ;
    $pattern['table_clss']				= 	101 ;
    $pattern['table_parent']			= 	$DOT_root;
    create_table_by_pattern($pattern) ;

	// Контроль свободного места
	$pattern=array() ;
	$pattern['table_title']		    = 	'Контроль диска (du)' ;
	$pattern['use_clss']		        = 	'282,280' ;
	$pattern['table_name']				= 	'obj_site_disk_du' ;
	$pattern['table_clss']				= 	101 ;
	$pattern['table_parent']			= 	$DOT_root;
	create_table_by_pattern($pattern) ;


     $pattern=array() ;
     $pattern['table_title']		    = 'Входяшие письма' ;
     $pattern['use_clss']		        = 	'273' ;
     $pattern['table_name']				= 	'obj_site_inmail' ;
     $pattern['table_clss']				= 	101 ;
     $pattern['table_parent']			= 	$DOT_root;
     $id=create_table_by_pattern($pattern) ;

     $pattern=array() ;
     $pattern['table_title']		    = 'Вложения' ;
     $pattern['use_clss']		        = 	'274' ;
     $pattern['table_name']				= 	'obj_site_inmail_attach' ;
     $pattern['table_clss']				= 	101 ;
     $pattern['table_parent']			= 	$id;
     create_table_by_pattern($pattern) ;

     $pattern=array() ;
     $pattern['table_title']		    = 'Event lister' ;
     $pattern['use_clss']		        = 	'219' ;
     $pattern['table_name']				= 	'event_lister' ;
     $pattern['table_clss']				= 	101 ;
     $pattern['table_parent']			= 	$DOT_root;
     create_table_by_pattern($pattern) ;

	 // типы доступны мероприятий
     $pattern=array() ;
     $pattern['table_title']		    = 	'Типы мероприятий' ;
     $pattern['use_clss']		        = 	'213' ;
     $pattern['table_name']				= 	'events_types' ;
     $pattern['table_clss']				= 	101 ;
     $pattern['table_parent']			= 	$DOT_root;
     create_table_by_pattern($pattern) ;

	 // Отчеты
     $pattern=array() ;
     $pattern['table_title']		    = 	'Отчеты' ;
     $pattern['use_clss']		        = 	'255' ;
     $pattern['table_name']				= 	'reports' ;
     $pattern['table_clss']				= 	101 ;
     $pattern['table_parent']			= 	$DOT_root;
     create_table_by_pattern($pattern) ;

       // Отчеты
     $pattern=array() ;
     $pattern['table_title']		    = 	'Файлы' ;
     $pattern['use_clss']		        = 	'5' ;
     $pattern['table_name']				= 	'files' ;
     $pattern['table_clss']				= 	101 ;
     $pattern['table_parent']			= 	$DOT_root;
     create_table_by_pattern($pattern) ;

     // терминалы
	 $pattern=array() ;
	 $pattern['table_title']		    = 	'Устройства' ;
	 $pattern['use_clss']		        = 	'77' ;
	 $pattern['table_name']				= 	'device' ;
	 $pattern['table_clss']				= 	101 ;
	 $pattern['table_parent']			= 	$DOT_root;
	 $id_DOT_mo=create_table_by_pattern($pattern) ;

	 if (SETUP_LEVEL('db_updates') and ESMO_STATUS!='SETUP_FIRST')
	 {
		$fields=execSQL('describe obj_site_personal_mess') ;
		if (isset($fields['max_data']))
		{ $count=execSQL_update('update obj_site_personal_mess set block_from=max_data where block_from=0 and max_data>0') ;
		  echo 'Коррекция поля block_from по полю max_data: '.$count.' строк<br>' ;
		}
	 }

	if (SETUP_LEVEL('create_default_objects') and ESMO_STATUS!='SETUP_FIRST')  SETUP()->import_local_roles() ;


     $pattern=array() ;
     $pattern['table_title']		    = 'Локализация' ;
     $pattern['use_clss']		        = 	'1,275' ;
     $pattern['table_name']				= 	'obj_site_locals' ;
     $pattern['table_clss']				= 	101 ;
     $pattern['table_parent']			= 	$DOT_root;
     $pattern['def_recs'][]		        =	array ('parent'=>0,	'clss'=>1,	'enabled'=>1,	'indx'=>0,	'obj_name'=>'Локализации') ;
     create_table_by_pattern($pattern) ;

     /*$file_items=array() ;
     $file_items['aspmo_setup.php']['include'][]				='_DIR_EXT."/aspmo_setup/m_aspmo_setup_frames.php"' ;
     $file_items['aspmo_setup.php']['options']['title']		='"Служебные операции"' ;
     $file_items['aspmo_setup.php']['options']['use_class']	='"c_aspmo_setup"' ;
     $file_items['aspmo_setup_tree.php']['include'][]			='_DIR_EXT."/aspmo_setup/m_aspmo_setup_frames.php"' ;
     $file_items['aspmo_setup_viewer.php']['include'][]		='_DIR_EXT."/aspmo_setup/m_aspmo_setup_frames.php"' ;
     create_menu_item($file_items) ;*/

    SETUP()->create_list_viewers() ;

	ENGINE()->reg_cron('Очистка журналов','LOGS/clear_jurnals','0 2 * * *',array('enabled'=>1)) ;
 ENGINE()->reg_cron('Удаление временных таблиц','ENGINE/delete_temp_tables','0 2 * * *',array('enabled'=>1)) ;
 ENGINE()->reg_cron('Удаление видео файлов из TEMP директории','ENGINE/clear_mp4_from_temp_dir','0 */1 * * *',array('enabled'=>1)) ;
 ENGINE()->reg_cron('Очистка TEMP+LOG директорий','ENGINE/clear_temp_dirs','0 2 * * *',array('enabled'=>1)) ;
    ENGINE()->reg_cron('Сбор статистики по загрузке диска','DISK/scan_dirs','0 3 * * *',array('enabled'=>1)) ;
    ENGINE()->reg_cron('Перенос фото МО в подкаталоги','DISK/move_old_mo_photo','*/2 * * * *',array('enabled'=>1)) ;
	ENGINE()->reg_cron('Проверка почты','ENGINE/check_mail_box','*/2 * * * *') ;
SETUP()->reg_cron('Перенос данных лога из оперативной таблицы','ENGINE/copy_log_from_now','*/5 * * * *',array('enabled'=>0)) ;
 //ENGINE()->reg_cron('Обновление данных по дисковой нагрузке','disk/update_DB_dir_size_info','0 3 * * *') ;

 //ENGINE()->reg_cron('Тест крон каждые 2 мин','ENGINE/test_cron','*/2 * * * *') ;
 //ENGINE()->reg_cron('Тест крон каждые 10 мин','ENGINE/test_cron','*/10 * * * *') ;
 //ENGINE()->reg_cron('Тест крон каждые 15 мин','ENGINE/test_cron','*/15 * * * *') ;
 //ENGINE()->reg_cron('Тест крон каждые 30 мин','ENGINE/test_cron','*/30 * * * *') ;
 //ENGINE()->reg_cron('Тест крон каждый час','ENGINE/test_cron','* */1 * * *') ;
 //ENGINE()->reg_cron('Тест крон каждые два часа','ENGINE/test_cron','* */2 * * *') ;
 //ENGINE()->reg_cron('Тест крон каждые три часа','ENGINE/test_cron','* */3 * * *') ;
 //ENGINE()->reg_cron('Тест крон полночь','ENGINE/test_cron','0 0 * * *') ;
 //ENGINE()->reg_cron('Тест крон три ночи','ENGINE/test_cron','0 3 * * *') ;
 //ENGINE()->reg_cron('Тест крон 2:50','ENGINE/test_cron','50 2 * * *') ;
 //ENGINE()->reg_cron('Тест крон 8:20','ENGINE/test_cron','20 8 * * *') ;
 //ENGINE()->reg_cron('Тест крон 9:00','ENGINE/test_cron','00 9 * * *') ;
 //ENGINE()->reg_cron('Тест крон каждые две минуты девятого часа','ENGINE/test_cron','*/2 9 * * *') ;
}


?>
