<?php
include_once('c_mo.php') ;
class c_page_cab_mo_db extends c_page_cab_mo
{
 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/mo/'.$this->rec_mo['pkey'].'/db/']=array('title'=>'Исходные данные','class'=>'fa fa-user-md') ;
     $this->second_menu['/cab/mo/'.$this->rec_mo['pkey'].'/db/req/']=array('title'=>'Лог запросов','class'=>'fa fa-user-md') ;
     $this->second_menu['/cab/mo/'.$this->rec_mo['pkey'].'/db/evt/']=array('title'=>'Лог событий','class'=>'fa fa-user-md') ;
     $this->second_menu['/cab/mo/'.$this->rec_mo['pkey'].'/db/term/']=array('title'=>'Логи терминала','class'=>'fa fa-user-md') ;
     $this->second_menu['/cab/mo/'.$this->rec_mo['pkey'].'/db/dump/']=array('title'=>'Дамп записи МО','class'=>'fa fa-user-md') ;
     if ($this->rec_personal['pkey']) $this->second_menu['/cab/mo/'.$this->rec_mo['pkey'].'/db/personal/']=array('title'=>'Дамп записи по сотруднику','class'=>'fa fa-user-md') ;
     $this->second_menu['/cab/mo/'.$this->rec_mo['pkey'].'/db/json/']=array('title'=>'Данные с терминала') ;
     $this->second_menu['/cab/mo/'.$this->rec_mo['pkey'].'/db/facecontrol/']=array('title'=>'FaceControl') ;
   }


 function block_main()
 { $this->page_title() ;
   $rec=$this->rec_mo  ;
   ?><h2>Данные по проверке</h2>
     <table class="basic">
         <tr><th></th><th>tonometer</th><th>thermometer</th><th>pulsometer</th><th>alcotester</th><th>pupilometer</th><th>vcheck</th><th>question</th><th>question_comment</th></tr>
         <tr><td>Проводить измерения</td><td><?echo $rec['tonometer']?></td><td><?echo $rec['thermometer']?></td><td><?echo $rec['pulsometer']?></td><td><?echo $rec['alcotester']?></td><td><?echo $rec['pupilometer']?></td><td><?echo $rec['vcheck']?></td><td></td><td></td></tr>
         <tr><td>Результат измерений</td><td><?echo $rec['systolic'].' '.$rec['diastolic']?></td><td><?echo $rec['temperature']?></td><td><?echo $rec['pulse']?></td><td><?echo $rec['alko']?></td><td><?echo $rec['narko']?></td><td><?echo $rec['v_time']?> / <?echo $rec['v_error']?> / <?echo $rec['v_ball']?></td><td><?echo $rec['question']?></td><td><?echo $rec['question_comment']?></td></tr>
         <tr><td>Отформатированное значение </td><td><?echo $rec['_sd']?></td><td><?echo $rec['_temperature']?></td><td><?echo $rec['_pulse']?></td><td><?echo $rec['_alko']?></td><td><?echo $rec['_narko']?></td><td><?echo $rec['_vcheck']?></td><td><?echo $rec['_question']?></td><td><?echo $rec['question_comment']?></td></tr>
         <tr><td>Флаг измерений</td><td><?echo $rec['res_s'].' '.$rec['res_d']?></td><td><?echo $rec['res_t']?></td><td><?echo $rec['res_p']?></td><td><?echo $rec['res_a']?></td><td><?echo $rec['res_n']?></td><td><?echo $rec['res_v']?></td><td></td><td></td></tr>
     </table>
     <br>
     <h2>Статус МО</h2><?
     $this->show_table($rec,array('message_terminal','status','mo_type','model','_model_name','dopusk','comment','reason','equipment','error','error_reason')) ;
     ?><br><h2>Идентификаторы МО</h2><?
     $this->show_table($rec,array('pkey','member_id','group_id','terminal_id','terminal_pkey','hand_check_user_id','doctor_id','creator_id','dopusk_user_id','report_id','napravlenie_id','mo1_id','_pp_id','_ord_id','_otdel_id')) ;
     ?><br><h2>Текстовые статусы</h2><?
     $this->show_table($rec,array('_status_name','_comment','_reason','_equipment','_dopusk_name','_dopusk_name_full','_dopusk_status','_tk_name')) ;
     ?><br><h2>Временные метки</h2><?
     $this->show_table($rec,array('c_data','r_data','e_data','dopusk_time','dopusk_time_end',),array('it_is_time'=>1)) ;
     ?><br><h2>Имена</h2><?
     $this->show_table($rec,array('member_name','terminal_name','working','age','propusk','_org_name','_otdel_name','_doctor_name','_creator_name','_hand_check_user_name','dopusk_user_name')) ;

   unset($rec['tkey'],$rec['enabled'],$rec['_enabled'],$rec['indx'],$rec['obj_name'],$rec['parent'],$rec['clss'],$rec['temp'],$rec['_reffer'],$rec['_parent_reffer']) ;
   //$arr[0]=$rec  ;
   //damp_array($rec,1,-1) ;

 }

 function show_table($rec,$data,$options=array())
 { ?><table class="basic"><?
      ?><tr><? if (_sizeof($data)) foreach($data as $id) {?><th><?echo $id?></th><?}   ?></tr><?
      ?><tr><? if (_sizeof($data)) foreach($data as $id) {?><td><?echo ($options['it_is_time'] and $rec[$id]>0)? date('d.m.Y H:i:s',$rec[$id]):$rec[$id]?></td><?}   ?></tr><?
   ?></table><?
 }

}

?>
