<?php
include_once("c_personal_person.php");
class c_page_cab_personal_person_db extends c_page_cab_personal_person
{
  public $h1='Карточка сотрудника - дамп записи БД' ;

 function get_cur_page_meta_tags()
 {
   if ($this->rec_personal['pkey']) $this->h1='Исходные данные '.$this->rec_personal['obj_name'] ;
 }

 function second_menu_config()
  { $this->second_menu['/cab/personal/person/'.$this->rec_personal['pkey'].'/db/']=array('title'=>'дамп записи БД','class'=>'fa fa-user-md') ;
    $this->second_menu['/cab/personal/person/'.$this->rec_personal['pkey'].'/db/req/']=array('title'=>'Лог запросов','class'=>'fa fa-user-md') ;
    $this->second_menu['/cab/personal/person/'.$this->rec_personal['pkey'].'/db/evt/']=array('title'=>'Лог событий','class'=>'fa fa-user-md') ;
    $this->second_menu['/cab/personal/person/'.$this->rec_personal['pkey'].'/db/check/']=array('title'=>'Проверки','class'=>'fa fa-user-md') ;
    $this->second_menu['/cab/personal/person/'.$this->rec_personal['pkey'].'/db/stats/']=array('title'=>'Статистика','class'=>'fa fa-user-md') ;
    $this->second_menu['/cab/personal/person/'.$this->rec_personal['pkey'].'/db/messages/']=array('title'=>'Сообщения','class'=>'fa fa-user-md') ;
    // WORK_ORDER $this->second_menu['/cab/personal/person/'.$this->rec_personal['pkey'].'/work_order/']=array('title'=>'Наряд на работы') ;
  }

 function block_main()
 { $this->page_title() ;
   ?><h2>Дамп записи по сотруднику (обработанный)</h2><?
   $recs['db_rec']=execSQL_van('select * from obj_site_personals where pkey='.$this->rec_personal['pkey']) ;
   $recs['viewer']=execSQL_van('select * from view_personals where pkey='.$this->rec_personal['pkey']) ;
   $recs['public_info']=PERSONAL()->get_personal_by_id($this->rec_personal['pkey'],array('debug'=>1)) ;
   print_2x_arr($recs) ;
   ?><h2>Линки</h2><?
   $recs=execSQL('select * from obj_site_link where (o_id='.$this->rec_personal['pkey'].' and o_tkey='.$this->rec_personal['tkey'].') or (p_id='.$this->rec_personal['pkey'].' and p_tkey='.$this->rec_personal['tkey'].')') ;
   print_2x_arr($recs) ;
   ?><h2>Сотрудники организаций</h2><?
   $recs=execSQL('select * from obj_site_workers where personal_id='.$this->rec_personal['pkey']) ;
   //execSQL_update('delete from obj_site_workers where personal_id='.$this->rec_personal['pkey']) ;
   print_2x_arr($recs) ;

   $recs=execSQL('select * from obj_site_personals_image where parent='.$this->rec_personal['pkey'],2) ;
   if (_sizeof($recs)) foreach($recs as $rec)
   {
       ?><img src="<? echo img_clone($rec,'small')?>"><? echo $rec['file_name'].'<br>' ;
   }
   $recs=execSQL('select file_name from obj_site_personals_image where parent='.$this->rec_personal['pkey'].' and enabled=1 order by indx desc limit 1',2) ;

   ?><h2>Группы сотрудника</h2><?
   PERSONAL()->get_groups_to_personal($this->rec_personal,['debug'=>1]) ;

   if (function_exists('EVENT_PMO')) {
   ?><h2>ПМО</h2><?
   $rec_event=EVENTS()->get_event_by_id($GLOBALS['LS_esmo_PMO_event']) ;
   $pmo_ot_info=EVENT_PMO()->get_pmo_len_info_to_person($rec_event,$this->rec_personal['pkey']) ;
   damp_array($pmo_ot_info,1,-1);
   }

 }

}



?>
