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



function _skd_admin_vars() 
{
    $_SESSION['menu_admin_site']['Модули'][]=array('name'=>'Модель зон доступа','href'=>'editor_skd.php') ;

    $_SESSION['descr_clss'][600]['name']='Зона доступа' ;
    $_SESSION['descr_clss'][600]['parent']=1 ;
    $_SESSION['descr_clss'][600]['parent_to']=array(601,606) ;
    $_SESSION['descr_clss'][600]['child_to']=array(600) ;
    $_SESSION['descr_clss'][600]['fields']['obj_name']='varchar(255)' ;
    $_SESSION['descr_clss'][600]['fields']['small_name']='varchar(12)' ;
    //$_SESSION['descr_clss'][600]['fields']['iNet_ID']='int(11)' ;
    $_SESSION['descr_clss'][600]['fields']['cnt']='int(11)' ;
    $_SESSION['descr_clss'][600]['fields']['group_id']=array('type'=>'indx_select','array'=>'ARR_groups') ;
    //$_SESSION['descr_clss'][600]['fields']['status']=array('type'=>'indx_select','array'=>'ARR_wg_status') ;
    $_SESSION['descr_clss'][600]['fields']['use_to_one']=array('type'=>'int(1)') ;
    $_SESSION['descr_clss'][600]['fields']['use_to_time']=array('type'=>'int(1)') ;
    $_SESSION['descr_clss'][600]['fields']['use_to_perm']=array('type'=>'int(1)') ;
    $_SESSION['descr_clss'][600]['fields']['use_to_zone']=array('type'=>'int(1)') ;
    $_SESSION['descr_clss'][600]['fields']['no_select_def']=array('type'=>'int(1)') ;
    $_SESSION['descr_clss'][600]['fields']['pass_moderation']=array('type'=>'int(1)') ;
    $_SESSION['descr_clss'][600]['fields']['lastEventID']='int(11)';
    $_SESSION['descr_clss'][600]['fields']['last_kt_event']='int(11)';
    $_SESSION['descr_clss'][600]['fields']['settings']='serialize';
    $_SESSION['descr_clss'][600]['fields']['level']=array('type'=>'int(11)','index'=>'level') ;
    $_SESSION['descr_clss'][600]['fields']['parent1']=array('type'=>'int(11)','index'=>'parent1') ;
    $_SESSION['descr_clss'][600]['fields']['parent2']=array('type'=>'int(11)','index'=>'parent2') ;
    $_SESSION['descr_clss'][600]['fields']['parent3']=array('type'=>'int(11)','index'=>'parent3') ;
    $_SESSION['descr_clss'][600]['fields']['parent4']=array('type'=>'int(11)','index'=>'parent4') ;
    $_SESSION['descr_clss'][600]['fields']['parent5']=array('type'=>'int(11)','index'=>'parent5') ;
    $_SESSION['descr_clss'][600]['fields']['parent6']=array('type'=>'int(11)','index'=>'parent6') ;
    $_SESSION['descr_clss'][600]['fields']['parent7']=array('type'=>'int(11)','index'=>'parent7') ;
    $_SESSION['descr_clss'][600]['fields']['parent8']=array('type'=>'int(11)','index'=>'parent8') ;
    $_SESSION['descr_clss'][600]['fields']['parent9']=array('type'=>'int(11)','index'=>'parent9') ;    


    $_SESSION['descr_clss'][600]['list']['field']['indx']=array('title'=>'Позиция') ;
    $_SESSION['descr_clss'][600]['list']['field']['pkey']=array('title'=>'id') ;
//    $_SESSION['descr_clss'][600]['list']['field']['iNet_ID']=array('title'=>'iNet_ID') ;
    $_SESSION['descr_clss'][600]['list']['field']['obj_name']=array('title'=>'Наименование') ;
    //$_SESSION['descr_clss'][600]['list']['field']['small_name']=array('title'=>'Краткое обозначние') ;
    //$_SESSION['descr_clss'][600]['list']['field']['cnt']=array('title'=>'Число пропусков') ;
    $_SESSION['descr_clss'][600]['list']['field']['pass_moderation']=array('title'=>'Согласование заявок на РП') ;
    $_SESSION['descr_clss'][600]['list']['field']['use_to_one']=array('title'=>'Использовать для<br>разовых пропусков') ;
    $_SESSION['descr_clss'][600]['list']['field']['use_to_time']=array('title'=>'Использовать для<br>временных пропусков') ;
    $_SESSION['descr_clss'][600]['list']['field']['use_to_perm']=array('title'=>'Использовать для<br>постоянных пропусков') ;
    $_SESSION['descr_clss'][600]['list']['field']['use_to_zone']=array('title'=>'Использовать для<br>местоположения БП') ;
    $_SESSION['descr_clss'][600]['list']['field']['no_select_def']=array('title'=>'Не выбирать по умолчанию') ;
    $_SESSION['descr_clss'][600]['list']['field']['lastEventID']=array('title'=>'ID last event') ;
    $_SESSION['descr_clss'][600]['list']['field']['last_kt_event']=array('title'=>'ID last_kt_event') ;

    $_SESSION['descr_clss'][601]['name']='Устройство' ;
    $_SESSION['descr_clss'][601]['parent']=0 ;
    $_SESSION['descr_clss'][601]['child_to']=array(600) ;
    $_SESSION['descr_clss'][601]['fields']['obj_name']='varchar(255)' ;
    $_SESSION['descr_clss'][601]['fields']['type']=array('type'=>'indx_select','array'=>'ARR_type_skd_gate') ;
    $_SESSION['descr_clss'][601]['fields']['device_ID']='int(11)' ;
    $_SESSION['descr_clss'][601]['fields']['terminal_ID']='int(11)' ;
    $_SESSION['descr_clss'][601]['fields']['controller_ID']='int(11)' ;
    $_SESSION['descr_clss'][601]['fields']['zone_name']=array('type'=>'varchar(10)') ;
//    $_SESSION['descr_clss'][601]['fields']['iNet_ID']='int(11)' ;
    $_SESSION['descr_clss'][601]['fields']['cont1_ID']='int(11)' ;
    $_SESSION['descr_clss'][601]['fields']['cont2_ID']='int(11)' ;
    $_SESSION['descr_clss'][601]['fields']['in_out_reverse']='int(1)' ;
    $_SESSION['descr_clss'][601]['fields']['check_dp']='int(1)' ; // контроль двойного прохода
    $_SESSION['descr_clss'][601]['fields']['allow_one']='int(1)' ; // разрешить выходы по разовым пропускам
    $_SESSION['descr_clss'][601]['fields']['virt']='int(1)' ;
    $_SESSION['descr_clss'][601]['fields']['status']='int(11)' ;
    $_SESSION['descr_clss'][601]['fields']['ip']=array('type'=>'varchar(21)') ;
    $_SESSION['descr_clss'][601]['fields']['version']=array('type'=>'varchar(21)') ;
    $_SESSION['descr_clss'][601]['fields']['access']=array('type'=>'indx_select','array'=>'ARR_access_type2') ;
    $_SESSION['descr_clss'][601]['fields']['med_group_id']='int(11)' ;

                                                           
    $_SESSION['descr_clss'][601]['fields']['cnt']='int(11)' ;

    //$_SESSION['descr_clss'][601]['list']['field']['pkey']=array('title'=>'id') ;
    $_SESSION['descr_clss'][601]['list']['field']['ip']=array('title'=>'IP') ;
    $_SESSION['descr_clss'][601]['list']['field']['virt']=array('title'=>'virt') ;
    $_SESSION['descr_clss'][601]['list']['field']['device_ID']=array('title'=>'device_ID') ;
    $_SESSION['descr_clss'][601]['list']['field']['terminal_ID']=array('title'=>'terminal_ID') ;
    $_SESSION['descr_clss'][601]['list']['field']['controller_ID']=array('title'=>'controller_ID') ;
    $_SESSION['descr_clss'][601]['list']['field']['cont1_ID']=array('title'=>'cont1_ID') ;
    $_SESSION['descr_clss'][601]['list']['field']['cont2_ID']=array('title'=>'cont2_ID') ;
    $_SESSION['descr_clss'][601]['list']['field']['zone_name']=array('title'=>'zone_name') ;
    $_SESSION['descr_clss'][601]['list']['field']['access']=array('title'=>'Направление прохода') ;
    $_SESSION['descr_clss'][601]['list']['field']['in_out_reverse']=array('title'=>'in_out_reverse') ;
    $_SESSION['descr_clss'][601]['list']['field']['check_dp']=array('title'=>'запрет ДП') ;
    $_SESSION['descr_clss'][601]['list']['field']['allow_one']=array('title'=>'разрешить выход по разовым пропускам') ;
//    $_SESSION['descr_clss'][601]['list']['field']['iNet_ID']=array('title'=>'iNet_ID') ;
    $_SESSION['descr_clss'][601]['list']['field']['obj_name']=array('title'=>'Наименование','td_class'=>'left') ;
    $_SESSION['descr_clss'][601]['list']['field']['type']=array('title'=>'Тип') ;
    $_SESSION['descr_clss'][601]['list']['field']['version']=array('title'=>'version') ;
    $_SESSION['descr_clss'][601]['list']['field']['med_group_id']=array('title'=>'Группа мед. терминалов') ;
    $_SESSION['descr_clss'][601]['list']['field']['reboot']=array('title'=>'reboot') ;

    //$_SESSION['descr_clss'][601]['list']['field']['cnt']=array('title'=>'Число пропусков') ;

    $_SESSION['descr_clss'][602]['name']='АРМ охранника' ;
    $_SESSION['descr_clss'][602]['parent']=0 ;
    $_SESSION['descr_clss'][602]['fields']['obj_name']='varchar(255)' ;
    $_SESSION['descr_clss'][602]['fields']['ip']=array('type'=>'varchar(21)') ;
    $_SESSION['descr_clss'][602]['fields']['type']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][602]['fields']['reboot']=array('type'=>'int(1)') ;
    $_SESSION['descr_clss'][602]['fields']['turn_id']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][602]['fields']['only_turn']=array('type'=>'int(1)') ;
    $_SESSION['descr_clss'][602]['fields']['stream_name']=array('type'=>'varchar(32)') ;
    $_SESSION['descr_clss'][602]['fields']['stream_name_in']=array('type'=>'varchar(32)') ;
    $_SESSION['descr_clss'][602]['fields']['stream_name_out']=array('type'=>'varchar(32)') ;


    $_SESSION['descr_clss'][602]['list']['field']['pkey']=array('title'=>'id') ;
    //$_SESSION['descr_clss'][602]['list']['field']['iNet_ID']=array('title'=>'iNet_ID') ;
    $_SESSION['descr_clss'][602]['list']['field']['obj_name']=array('title'=>'Наименование','td_class'=>'left') ;
    $_SESSION['descr_clss'][602]['list']['field']['type']=array('title'=>'Тип') ;
    $_SESSION['descr_clss'][602]['list']['field']['ip']=array('title'=>'ip') ;
    $_SESSION['descr_clss'][602]['list']['field']['turn_id']=array('title'=>'Используемый турникет') ;
    $_SESSION['descr_clss'][602]['list']['field']['only_turn']=array('title'=>'Мониторить только турникет') ;
    $_SESSION['descr_clss'][602]['list']['field']['stream_name']=array('title'=>'Название видеопотока') ;
    $_SESSION['descr_clss'][602]['list']['field']['stream_name_in']=array('title'=>'Название видеопотока ВХОД') ;
    $_SESSION['descr_clss'][602]['list']['field']['stream_name_out']=array('title'=>'Название видеопотока ВЫХОД') ;
    $_SESSION['descr_clss'][602]['list']['field']['reboot']=array('title'=>'reboot') ;


    $_SESSION['descr_clss'][603]['name']='Модератор зоны' ;
    $_SESSION['descr_clss'][603]['parent']=0 ;
    $_SESSION['descr_clss'][603]['fields']['email']='varchar(255)' ;
    $_SESSION['descr_clss'][603]['fields']['UID']='varchar(32)' ;
    $_SESSION['descr_clss'][603]['no_show_in_tree']=1 ;

    $_SESSION['descr_clss'][603]['list']['field']['pkey']='ID' ;
    $_SESSION['descr_clss'][603]['list']['field']['enabled']='Вкл.' ;
    $_SESSION['descr_clss'][603]['list']['field']['obj_name']='ФИО' ;
    $_SESSION['descr_clss'][603]['list']['field']['email']='Email' ;


    $_SESSION['descr_clss'][604]['name']='Бюро пропусков' ;
    $_SESSION['descr_clss'][604]['parent']=0 ;
    //$_SESSION['descr_clss'][604]['no_show_in_tree']=1 ;

    $_SESSION['descr_clss'][604]['list']['field']['pkey']='ID' ;
    $_SESSION['descr_clss'][604]['list']['field']['enabled']='Вкл.' ;
    $_SESSION['descr_clss'][604]['list']['field']['obj_name']='Наименование' ;
    //$_SESSION['descr_clss'][604]['list']['field']['email']='Email' ;

    $_SESSION['descr_clss'][605]['name']='АРМ в бюро пропусков' ;
    $_SESSION['descr_clss'][605]['parent']=0 ;
    $_SESSION['descr_clss'][605]['fields']['URL']='varchar(64)' ;
    //$_SESSION['descr_clss'][605]['no_show_in_tree']=1 ;

    $_SESSION['descr_clss'][605]['list']['field']['pkey']='ID' ;
    $_SESSION['descr_clss'][605]['list']['field']['enabled']='Вкл.' ;
    $_SESSION['descr_clss'][605]['list']['field']['obj_name']='Наименование' ;
    $_SESSION['descr_clss'][605]['list']['field']['UID']='UID' ;
    $_SESSION['descr_clss'][605]['list']['field']['URL']='URL' ;

    $_SESSION['descr_clss'][606]['name']='Терминал' ;
    $_SESSION['descr_clss'][606]['parent']=0 ;
    $_SESSION['descr_clss'][606]['child_to']=array(600) ;
    $_SESSION['descr_clss'][606]['fields']['ip']='varchar(21)' ;
    $_SESSION['descr_clss'][606]['fields']['device_ID']='int(11)' ;
    $_SESSION['descr_clss'][606]['fields']['version']='varchar(21)' ;

    $_SESSION['descr_clss'][606]['list']['field']['pkey']='pkey' ;
    $_SESSION['descr_clss'][606]['list']['field']['device_ID']='device_ID' ;
    $_SESSION['descr_clss'][606]['list']['field']['enabled']='Вкл.' ;
    $_SESSION['descr_clss'][606]['list']['field']['obj_name']='Наименование' ;
    $_SESSION['descr_clss'][606]['list']['field']['version']='Версия' ;
    $_SESSION['descr_clss'][606]['list']['field']['ip']='IP' ;


    $_SESSION['descr_clss'][610]['name']='Группа зон доступа' ;
    $_SESSION['descr_clss'][610]['parent']=1 ;
//    $_SESSION['descr_clss'][610]['fields']['iNetID']='int(11)' ;
    $_SESSION['descr_clss'][610]['fields']['level']=array('type'=>'int(11)','index'=>'level') ;
    $_SESSION['descr_clss'][610]['fields']['parent1']=array('type'=>'int(11)','index'=>'parent1') ;
    $_SESSION['descr_clss'][610]['fields']['parent2']=array('type'=>'int(11)','index'=>'parent2') ;
    $_SESSION['descr_clss'][610]['fields']['parent3']=array('type'=>'int(11)','index'=>'parent3') ;
    $_SESSION['descr_clss'][610]['fields']['parent4']=array('type'=>'int(11)','index'=>'parent4') ;
    $_SESSION['descr_clss'][610]['fields']['parent5']=array('type'=>'int(11)','index'=>'parent5') ;
    $_SESSION['descr_clss'][610]['fields']['parent6']=array('type'=>'int(11)','index'=>'parent6') ;
    $_SESSION['descr_clss'][610]['fields']['parent7']=array('type'=>'int(11)','index'=>'parent7') ;
    $_SESSION['descr_clss'][610]['fields']['parent8']=array('type'=>'int(11)','index'=>'parent8') ;
    $_SESSION['descr_clss'][610]['fields']['parent9']=array('type'=>'int(11)','index'=>'parent9') ;

//    $_SESSION['descr_clss'][610]['list']['field']['iNetID']='iNetID' ;
    $_SESSION['descr_clss'][610]['list']['field']['enabled']='Вкл.' ;
    $_SESSION['descr_clss'][610]['list']['field']['obj_name']='Наименование' ;

    $_SESSION['descr_clss'][611]['name']='Зона доступа/Точка прохода' ;
    $_SESSION['descr_clss'][611]['parent']=0 ;
    $_SESSION['descr_clss'][611]['fields']['device_ID']='int(11)' ;

//    $_SESSION['descr_clss'][611]['list']['field']['iNetID']='iNetID' ;
    $_SESSION['descr_clss'][611]['list']['field']['enabled']='Вкл.' ;
    $_SESSION['descr_clss'][611]['list']['field']['obj_name']='Наименование' ;
    $_SESSION['descr_clss'][611]['list']['field']['device_ID']='СКД point ID' ;

    $_SESSION['descr_clss'][612]['name']='Событие прохода' ;
    $_SESSION['descr_clss'][612]['parent']=0 ;
    $_SESSION['descr_clss'][612]['fields']['obj_name']=array('type'=>'varchar(255)') ;
    $_SESSION['descr_clss'][612]['fields']['evt_type']=array('type'=>'indx_select','array'=>'ARR_evt_type','default'=>0) ;
    $_SESSION['descr_clss'][612]['fields']['pass_type']=array('type'=>'indx_select','array'=>'ARR_pass_type') ;
    $_SESSION['descr_clss'][612]['fields']['zone_id']='int(11)' ; // ID зоны
    $_SESSION['descr_clss'][612]['fields']['pass_id']='int(11)' ; // ID пропуска = номер пропуска
    $_SESSION['descr_clss'][612]['fields']['device_id']='int(11)' ; // ID устройсва, которое пропустило
    $_SESSION['descr_clss'][612]['fields']['person_id']=array('type'=>'int(11)','default'=>0) ;  // ID посетителя
    $_SESSION['descr_clss'][612]['fields']['personal_id']=array('type'=>'int(11)','default'=>0) ;  // ID сотрудника
    $_SESSION['descr_clss'][612]['fields']['car_id']='int(11)' ;  // ID авто
    $_SESSION['descr_clss'][612]['fields']['access_type']=array('type'=>'int(1)') ;
    $_SESSION['descr_clss'][612]['fields']['result']=array('type'=>'int(1)') ;
    $_SESSION['descr_clss'][612]['fields']['evt_out_time']=array('type'=>'timedata') ;
    $_SESSION['descr_clss'][612]['fields']['evt_out_id']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][612]['fields']['evt_out_zone']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][612]['fields']['evt_out_dev']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][612]['fields']['evt_check_id']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][612]['fields']['pass_image']=array('type'=>'varchar(32)') ;
    //$_SESSION['descr_clss'][612]['fields']['session_uid']=array('type'=>'varchar(32)') ;
    $_SESSION['descr_clss'][612]['fields']['session_id']=array('type'=>'int(11)','index'=>'session_id','default'=>0) ;

    //$_SESSION['descr_clss'][612]['list']['field']['pkey']=array('title'=>'id') ;
    $_SESSION['descr_clss'][612]['list']['field']['c_data']=array('title'=>'Время пропуска') ;
    $_SESSION['descr_clss'][612]['list']['field']['pass_type']=array('title'=>'Тип пропуска') ;
    $_SESSION['descr_clss'][612]['list']['field']['pass_id']=array('title'=>'ID пропуска') ;
    $_SESSION['descr_clss'][612]['list']['field']['device_id']=array('title'=>'ID устройсва') ;
    $_SESSION['descr_clss'][612]['list']['field']['access_type']=array('title'=>'Направление прохода') ;
    $_SESSION['descr_clss'][612]['list']['field']['personal_id']=array('title'=>'ID сотрудника') ;
    $_SESSION['descr_clss'][612]['list']['field']['result']=array('title'=>'Результат') ;

    $_SESSION['descr_clss'][613]['name']='Событие прохода (ПП)' ;
    $_SESSION['descr_clss'][613]['parent']=0 ;
    //$_SESSION['descr_clss'][613]['fields']['pkey']=array('type'=>'BIGINT') ;
    $_SESSION['descr_clss'][613]['fields']['obj_name']=array('type'=>'varchar(20)') ;
    $_SESSION['descr_clss'][613]['fields']['evt_type']=array('type'=>'indx_select','array'=>'ARR_evt_type','default'=>0) ;
    $_SESSION['descr_clss'][613]['fields']['zone_id']='int(11)' ; // ID зоны
    $_SESSION['descr_clss'][613]['fields']['pass_id']='int(11)' ; // ID пропуска
    $_SESSION['descr_clss'][613]['fields']['device_id']='int(11)' ; // ID устройсва, которое пропустило
    $_SESSION['descr_clss'][613]['fields']['person_id']=array('type'=>'int(11)','default'=>0) ;  // ID посетителя
    $_SESSION['descr_clss'][613]['fields']['access_type']=array('type'=>'int(1)') ;
    $_SESSION['descr_clss'][613]['fields']['result']=array('type'=>'int(1)') ;
    $_SESSION['descr_clss'][613]['fields']['evt_out_time']=array('type'=>'timedata') ;
    $_SESSION['descr_clss'][613]['fields']['evt_out_id']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][613]['fields']['evt_out_zone']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][613]['fields']['evt_out_dev']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][613]['fields']['evt_check_id']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][613]['fields']['EventId']=array('type'=>'BIGINT(11)') ;
    $_SESSION['descr_clss'][613]['fields']['TenantNdx']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][613]['fields']['IndivNdx']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][613]['fields']['AccessVerNdx']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][613]['fields']['PointAddr']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][613]['fields']['RowNum']=array('type'=>'int(11)') ;

    $_SESSION['descr_clss'][614]['name']='Изменение персонала (iNet)' ;
    $_SESSION['descr_clss'][614]['parent']=0 ;
    $_SESSION['descr_clss'][614]['fields']['obj_name']=array('type'=>'varchar(12)') ;
    $_SESSION['descr_clss'][614]['fields']['TenantNdx']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][614]['fields']['IndivNdx']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][614]['fields']['LastName']='varchar(50)'    ;
    $_SESSION['descr_clss'][614]['fields']['FirstName']='varchar(50)' ;
    $_SESSION['descr_clss'][614]['fields']['GroupName']='varchar(65)' ;
    $_SESSION['descr_clss'][614]['fields']['UniqueField']='varchar(50)' ;
    $_SESSION['descr_clss'][614]['fields']['AccessVerId']='int(11)' ;
    $_SESSION['descr_clss'][614]['fields']['Status']='int(11)' ;

    $_SESSION['descr_clss'][615]['name']='Отслеживание проходов' ;
    $_SESSION['descr_clss'][615]['parent']=0 ;
    $_SESSION['descr_clss'][615]['fields']['account_id']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][615]['fields']['person_id']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][615]['fields']['personal_id']=array('type'=>'int(11)') ;

    $_SESSION['descr_clss'][616]['name']='Зоны модерации пропусков' ;
    $_SESSION['descr_clss'][616]['parent']=0 ;
    $_SESSION['descr_clss'][616]['fields']['zone_id']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][616]['fields']['org_id']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][616]['fields']['otdel_id']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][616]['fields']['org_name']=array('type'=>'varchar(255)') ;
    $_SESSION['descr_clss'][616]['fields']['personal_id']=array('type'=>'int(11)') ;


    $_SESSION['descr_clss'][617]['name']='Сессия прохода' ;
    $_SESSION['descr_clss'][617]['parent']=0 ;
    $_SESSION['descr_clss'][617]['fields']['obj_name']=array('type'=>'varchar(32)','index'=>'obj_name') ;


    $_SESSION['descr_clss'][800]['name']='Таблицы MSSQL' ;
    $_SESSION['descr_clss'][800]['parent']=0 ;
    $_SESSION['descr_clss'][800]['fields']['object_id']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][800]['fields']['row_count']=array('type'=>'int(11)') ;

    $_SESSION['descr_clss'][801]['name']='Альяс зоны доступа iNet' ;
    $_SESSION['descr_clss'][801]['parent']=0 ;
    $_SESSION['descr_clss'][801]['fields']['iNetID']=array('type'=>'int(11)') ;
    $_SESSION['descr_clss'][801]['no_show_in_tree']=1 ;
    $_SESSION['descr_clss'][801]['list']['field']['pkey']=array('title'=>'ID') ;
//    $_SESSION['descr_clss'][801]['list']['field']['iNetID']=array('title'=>'ID зоны Inet') ;



}

function _skd_admin_boot($options)
{
  create_system_modul_obj('skd') ;
}


function _skd_install_modul($DOT_root)
{
    //REPORTS()->reg_reports($this,'report_gate_events','aspmo_bp/report_gate_events.php','report_gate_events') ;         //
    //REPORTS()->reg_reports($this,'report_gate_events_door','aspmo_bp/report_gate_events_door.php','report_gate_events_door') ;         //
    //REPORTS()->reg_reports($this,'report_gate_events2','aspmo_bp/report_gate_events2.php','report_gate_events2') ;         //
    //REPORTS()->reg_reports($this,'report_gate_events_sys','aspmo_bp/report_gate_events_sys.php','report_gate_events_sys') ;         //
    //REPORTS()->reg_reports($this,'report_pass_events','aspmo_bp/report_pass_events.php','report_pass_events') ;         //
    //REPORTS()->reg_reports($this,'report_tracking_persons','aspmo_bp/report_tracking_persons.php','report_tracking_persons') ;         //
    //REPORTS()->reg_reports($this,'report_gate_barrier','aspmo_bp/report_gate_barrier.php','report_gate_barrier') ;         //
    //REPORTS()->reg_reports('Контроль доступа','pass_static/report_iNet_gate_events.php') ;         //

    //REPORTS()->reg_reports('Проходы','skd/report_gate_events.php') ;

    $pattern=array() ;
    $pattern['table_title']		        = 	'Модель зон доступа' ;
    $pattern['use_clss']		        = 	'600,601,602,603,606' ; //,601,602,603' ; - остальные классы должны быть добавлены в отдельные таблицы
    $pattern['table_name']				= 	'obj_site_skd' ;
    $pattern['table_clss']				= 	101 ;
    $pattern['table_parent']			= 	$DOT_root;
    $pattern['def_recs'][]				=   array('parent'=>0,'clss'=>600,'indx'=>1,'enabled'=>1,'obj_name'=>'Зоны доступа','level'=>1,'parent1'=>0) ;
    create_table_by_pattern($pattern) ;

    $pattern=array() ;
    $pattern['table_title']		        = 	'Журнал событий прохода' ;
    $pattern['use_clss']		        = 	'612' ;
    $pattern['table_name']				= 	'obj_site_gate_events' ;
    $pattern['table_clss']				= 	101 ;
    $pattern['table_parent']			= 	$DOT_root;
    $pattern['def_recs'][]				=   array('parent'=>0,'clss'=>600,'indx'=>1,'enabled'=>1,'obj_name'=>'Журнал проходов') ;
    create_table_by_pattern($pattern) ;

    $id_sect=SETUP_add_section_to_site_setting('СКД') ;
    SETUP_add_rec_to_site_setting($id_sect,"СКД смещение часового пояса на терминалах",0,'LS_acs_shift_timezone', array('descr'=>'Смещение относительно GMT')) ;
    SETUP_add_rec_to_site_setting($id_sect,"Использовать redis для хранения данных на турникетах:",'localhost','LS_use_redis_skd',array('el'=>'checkbox')) ;
    SETUP_add_rec_to_site_setting($id_sect,"Хост redis для турникетов:",'localhost','LS_redis_skd_host') ;
    SETUP_add_rec_to_site_setting($id_sect,"Порт redis для турникетов:",6379,'LS_redis_skd_port') ;
    SETUP_add_rec_to_site_setting($id_sect,"Пароль redis для турникетов:",'rdfpfh','LS_redis_skd_password',array('crypt'=>1)) ;

    SETUP()->reg_event_lister('examination_result','SKD','on_event_examination_result') ;         //
    SETUP()->reg_event_lister('fixed_hand_check_allow','SKD','on_event_examination_result') ;         //
    SETUP()->reg_event_lister('fixed_hand_check_denited','SKD','on_event_examination_result') ;         //
    SETUP()->reg_event_lister('mo_dopusk_allow','SKD','on_event_examination_result') ;         //
    SETUP()->reg_event_lister('hand_check_clear','SKD','on_event_examination_result') ;         //

    // создавем вьюверы
    $sql='create view view_gate_events as
                select  events.*,
                        pers.pkey as _personal_id,
                        pers.obj_name as _personal_fio,
                        pers._org_name as _personal_org,
                        pers._org_id as _personal_org_id,
                        pers._otdel_name as _personal_otdel_name,
                        pers._otdel_id as _personal_otdel_id,
                        turn_in.pkey as _device_pkey,
                        turn_in.clss as _device_clss,
                        turn_in.device_id as _device_id,
                        turn_in.terminal_ID as _terminal_ID,
                        turn_in.controller_ID as _controller_ID,
                        turn_in.type as _device_type,
                        turn_in.turn_id as _device_turn_id,
                        turn_in.obj_name as _device_name
                        
                from obj_site_gate_events events
                left join view_personals pers on pers.pkey=events.personal_id and events.personal_id>0
                left join obj_site_skd turn_in on turn_in.pkey=events.device_id
                where events.enabled=1' ;
    create_viewer('view_gate_events',$sql) ;

}




?>