<?php
include_once(_DIR_TO_CLASS."/c_page.php");
class c_page_cab_debug extends c_page
{
  public $h1='Журнал обмена' ;

  function second_menu_config()
   {
      $this->second_menu=$this->menu['/cab/debug/']['items'] ;
   }

 function block_main()
 { $this->page_title() ;
   $this->panel_log() ;
 }

 function  panel_log()
 {

     ?><div id=panel_search_member class="float_left">
             <form>
                  <span class="title">Текст в сообщении:</span>
                  <input type="text" name="text"><input type="submit" class="v2 fa fa-search" cmd="aspmo_debug/set_filter_debug" value="Искать" validate="form">&nbsp;&nbsp;&nbsp;
                  <span class="title">Команда:</span>
                  <select name="req_cmd" class="v2" cmd="aspmo_debug/set_filter_debug"><option value=""></option>
                          <? $recs=execSQL_line('select distinct(cmd) from '.ENGINE()->table_mo_req.' where cmd!="" order by cmd') ;
                            if (_sizeof($recs)) foreach($recs as $value) {?><option value="<?echo $value?>" <?if ($_SESSION['filter']['debug']['cmd']==$value) echo 'selected'?>><?echo $value?></option><?}?>
                  </select>&nbsp;&nbsp;&nbsp;
                  <span class="title">Терминал:</span>
                  <select name="terminal_id" class="v2" cmd="aspmo_debug/set_filter_debug"><option value=""></option>
                          <? $recs=execSQL_line('select distinct(terminal_id) from '.ENGINE()->table_mo_req.' where terminal_id!="" order by terminal_id') ;
                            if (_sizeof($recs)) foreach($recs as $value) {?><option value="<?echo $value?>" <?if ($_SESSION['filter']['debug']['terminal_id']==$value) echo 'selected'?>><?echo $value?></option><?}?>
                  </select>&nbsp;&nbsp;&nbsp;
                  <span class="title">Сессия МО:</span>
                  <select name="mo_id" class="v2" cmd="aspmo_debug/set_filter_debug"><option value=""></option>
                          <? $recs=execSQL_line('select distinct(mo_id) from '.ENGINE()->table_mo_req.' where mo_id!="" order by mo_id desc') ;
                            if (_sizeof($recs)) foreach($recs as $value) {?><option value="<?echo $value?>" <?if ($_SESSION['filter']['debug']['mo_id']==$value) echo 'selected'?>><?echo $value?></option><?}?>
                  </select>&nbsp;&nbsp;&nbsp;
                 <span class="title">Персонал:</span>
                   <select name="personal_id" class="v2" cmd="aspmo_debug/set_filter_debug"><option value=""></option>
                           <? $recs=execSQL_line('select distinct(personal_id) from '.ENGINE()->table_mo_req.' where personal_id!="" order by personal_id') ;
                              if (_sizeof($recs)) $recs_personal=execSQL_row('select pkey,obj_name from '.PERSONAL()->table_name.' where pkey in ('.implode(',',$recs).') order by obj_name') ;
                             if (_sizeof($recs_personal)) foreach($recs_personal as $id=>$value) {?><option value="<?echo $id?>" <?if ($_SESSION['filter']['debug']['personal_id']==$value) echo 'selected'?>><?echo $value?></option><?}?>
                   </select>&nbsp;&nbsp;&nbsp;

             </form>
          </div><br><br><?
   ?><div id="panel_log"><?
   $options=array('count'=>200,'mo_id'=>$_SESSION['filter']['debug']['mo_id'],'personal_id'=>$_SESSION['filter']['debug']['personal_id'],'terminal_id'=>$_SESSION['filter']['debug']['terminal_id'],'cmd'=>$_SESSION['filter']['debug']['cmd'],'text'=>$_SESSION['filter']['debug']['text']) ;
   $list_log=LOGS()->get_log_request($options) ;
   print_template($options,'aspmo_debug/panel_filter_status') ;
   if (_sizeof($list_log)) print_template($list_log,'aspmo_debug/list_logs_request') ;
   else echo '<div class="alert">Ничего не найдено</div>' ;
   ?></div><?
 }


}



?>
