<?php
include_once('c_personal_person_db.php') ;
class c_page_cab_personal_person_db_check extends c_page_cab_personal_person_db
{
 public $h1='Карточка сотрудника - проверки запросов' ;

 function get_cur_page_meta_tags()
 {
   if ($this->rec_personal['pkey']) $this->h1='Проверки запросов по сотруднику '.$this->rec_personal['obj_name'] ;
 }

 function block_main()
 { $this->page_title() ;
   ?><h2>check_personal_access</h2><?
   ESMO()->check_personal_access($this->rec_personal,array('debug'=>1)) ;
   damp_array($this->rec_personal,1,-1) ;

   ?><h2>check_active_dopusk</h2><?
   $rec=ESMO()->check_active_dopusk($this->rec_personal['pkey'],array('debug'=>1)) ;
   if (_sizeof($rec))
   {   echo '<br><strong>'.$rec['_dopusk_name_full'].' до '.date('d.m.Y H:i',$rec['dopusk_time_end']).'</strong><br><br>' ;
       $arr[]=$rec ;
       print_2x_arr($arr) ;
   }
   else echo '<strong>Действующего допуска/запрета допуска не найдено</strong>' ;

   ?><h2>check_count_nedopusk</h2><?
   $cnt=ESMO()->check_count_nedopusk($this->rec_personal['pkey'],array('debug'=>1)) ;
   echo '<strong>Найдено '.$cnt.' за последние '.$GLOBALS['LS_setting_max_DD_count_hour'].' часов </strong>' ;


   ?><h2>check_time_last_mo</h2><?
   if (!is_array($this->rec_personal['__check']))$this->rec_personal['__check']=array() ;
   $rec_personal2=$this->rec_personal ;
   ESMO()->check_time_last_mo($rec_personal2,array('debug'=>1)) ;

   ?><h2>get_mo_rules_to_personal</h2><?
   $rules_info=ESMO_RULES()->get_mo_rules_to_personal($this->rec_personal,array('echo_debug'=>1,'terminal_id'=>0,'esmo_group'=>0)) ;
   echo $rules_info['_rules']['debug'].'<br>' ;
   unset($rules_info['_rules']['debug']);
   damp_array($rules_info,1,-1);

   //$res=array_intersect($rec_personal2,$this->rec_personal) ;
   //$res=array_diff($rec_personal2,$this->rec_personal) ; damp_array($res,1,-1) ;
   ?><strong>Массив __check</strong><?
   $res=array_diff_assoc($rec_personal2['__check'],$this->rec_personal['__check']) ; damp_array($res,1,-1) ;
   ?><strong>Дополнения по массиву сотрудника</strong><?
   $res=array_diff_assoc($rec_personal2,$this->rec_personal) ; damp_array($res,1,-1) ;

   ?><strong>get_active_mess_to_personal</strong><?
   $recs=PERSONAL()->get_active_mess_to_personal($this->rec_personal['pkey'],array('view_blocked'=>1)) ;
   print_2x_arr($recs) ;
   //damp_array($res,1,-1) ;
   //damp_array($this->rec_personal,1,-1) ;
   //damp_array($rec_personal2,1,-1) ;




 }



}

?>
