<?php
class report_log_req extends c_report
{
 var $title='Журнал обмена' ;
 var $allow_to_rol=array() ;
 var $filter=array() ;
 var $view_by_space_filter=1 ;
 var $use_jwplayer=0 ;

 function setting($options=array())
 {   ?><div id="panel_filter" >
             <form id="sky-form" class="sky-form"><input type="hidden" name="filter_dir" value="<?echo _CUR_REPORT_DIR?>">
                  <fieldset>
                      <div class="row" id="person_info">
                          <section class="col col-2">
                               <label class="label">Команда:</label>
                               <label class="select">
                                  <? $recs=execSQL_line('select distinct(cmd) from '.ENGINE()->table_mo_req.' where cmd!="" order by cmd') ;?>
                                     <select name="filter[cmd]" id="to_zone_id"><option></option>
                                        <? if (_sizeof($recs)) foreach($recs as $value) {?><option value="<?echo $value?>" <?if ($this->filter['cmd']==$value) echo 'selected'?>><?echo $value?></option><?} ?>
                                    </select>
                               </label>
                            </section>
                          <section class="col col-2">
                              <label class="label">Текст</label>
                              <label class="input">
                                  <input type="text" name="filter[text]" value="<?if ($this->filter['text']) echo htmlspecialchars($this->filter['text'])?>">
                              </label>
                            </section>

                          <section class="col col-2">
                              <label class="label">Дата от</label>
                              <label class="input">
                                  <i class="icon-append fa fa-calendar"></i>
                                  <input type="text" name="filter[data_from]" class="datetimepicker" value="<?echo $this->filter['data_from']?>">
                              </label>
                            </section>
                            <section class="col col-2">
                              <label class="label">Дата до</label>
                              <label class="input">
                                  <i class="icon-append fa fa-calendar"></i>
                                  <input type="text" name="filter[data_to]" class="datetimepicker" value="<?echo $this->filter['data_to']?>">
                              </label>
                          </section>
                          <? $arr_term=execSQL_row('select id,obj_name,clss from obj_site_account where clss=203')?>
                          <section class="col col-2">
                             <label class="label">Терминал:</label>
                             <label class="select">
                                 <select name="filter[terminal_id]"><option value="0">Все</option><?
                                   if (_sizeof($arr_term)) foreach($arr_term as $id=>$name) {?><option value="<?echo $id?>" <?if($this->filter['terminal_id']==$id) echo 'selected'?>><?echo $name?> [<?echo $id?>]</option><?}?>
                                 </select>
                             </label>
                          </section>
                          <section class="col col-2">
                               <label class="label">Сортировка:</label>
                               <label class="select">
                                  <select name="filter[order]" id="order">
                                      <option value="0" <?if (!$this->filter['order']) echo 'selected'?>>Обратная</option>
                                      <option value="1" <?if ($this->filter['order']==1) echo 'selected'?>>Прямая</option>
                                  </select>
                               </label>
                            </section>

                        </div>
                  </fieldset>
                 <div id="panel_buttons"><input type="submit" class="button v2" cmd="set_filter" value="OK"></div>
              </form>
       </div>
     <?
  }


 function _setting_details($options=array())
 {   list($time_from,$time_to)=$this->get_time_range_by_filter_to_cur_day() ;
     ?><div id="panel_filter">
             <form id="sky-form" class="sky-form"><input type="hidden" name="filter_dir" value="<?echo _CUR_REPORT_DIR?>">
               <fieldset>
                 <section>
                    <label class="label">Команда:</label>
                    <label class="select">
                       <? $recs=execSQL_line('select distinct(obj_name) from '.ENGINE()->table_mo_log.' where obj_name!="" order by obj_name') ;?>
                          <select name="filter[cmd]" id="to_zone_id"><option></option>
                             <? if (_sizeof($recs)) foreach($recs as $value) {?><option value="<?echo $value?>" <?if ($this->filter['cmd']==$value) echo 'selected'?>><?echo $value?></option><?} ?>
                         </select>
                    </label>
                 </section>
               <section>
                   <label class="label">Дата от</label>
                   <label class="input">
                       <i class="icon-append fa fa-calendar"></i>
                       <input type="text" name="filter[data_from]" class="datetimepicker" value="<?echo date('d.m.Y H:i',$time_from)?>">
                   </label>
                 </section>
                 <section>
                   <label class="label">Дата до</label>
                   <label class="input">
                       <i class="icon-append fa fa-calendar"></i>
                       <input type="text" name="filter[data_to]" class="datetimepicker" value="<?echo date('d.m.Y H:i',$time_to)?>">
                   </label>
                </section>
                <section>
                       <label class="label">ID события</label>
                       <label class="input">
                            <input type="text" name="filter[evt_id]" placeholder="" value="<?echo $this->filter['evt_id']?>">
                       </label>
                 </section>
                 <section>
                       <label class="label">ID турникета</label>
                       <label class="input">
                            <input type="text" name="filter[turn_id]" placeholder="" value="<?echo $this->filter['turn_id']?>">
                       </label>
                 </section>
                 <!--
                 <section>
                       <label class="label">ФИО посетителя</label>
                       <label class="input">
                            <input type="text" name="filter[name]" placeholder="" lang="RUS" value="<?echo $this->filter['name']?>">
                       </label>
                 </section>
                <section>
                       <label class="label">Текст в результате</label>
                       <label class="input">
                            <input type="text" name="filter[text]" placeholder="" lang="RUS" value="<?echo $this->filter['text']?>">
                       </label>
                 </section>
                  <section>
                     <label class="label">Зона доступа, турникет, РМО</label>
                     <label class="select">
                        <? $arr_zones=array() ; SKD()->tree['root']->tree_to_array($arr_zones) ;
                           $arr_devices=SKD()->get_arr_devices(); $arr_devices_by_zone=group_by_field('parent',$arr_devices)  ;
                        ?>
                           <select name="filter[to_zone_id]" id="to_zone_id"  data-required><option value="0">Все зоны</option>
                              <? if (_sizeof($arr_zones)) foreach($arr_zones as $rec_zone) if ($rec_zone['pkey']>1)
                                 {?><option value="<?echo $rec_zone['pkey']?>" <?if ($this->filter['to_zone_id']==$rec_zone['pkey']) echo 'selected'?>><?echo SKD()->get_full_zone_path($rec_zone['pkey']) ?></option><?
                                  if (_sizeof($arr_devices_by_zone[$rec_zone['pkey']])) foreach($arr_devices_by_zone[$rec_zone['pkey']] as $rec_device)
                                  { ?><option value="<?echo $rec_device['pkey']?>" <?if ($this->filter['to_zone_id']==$rec_device['pkey']) echo 'selected'?>><?
                                      /*if ($rec_device['clss']==602) {?><i class="fa fa-male"></i><?} ;*/
                                      echo '&nbsp;&nbsp;-&nbsp;&nbsp;'.$_SESSION['ARR_device_name_small'][$rec_device['clss']]  ;
                                      if ($rec_device['device_ID']) echo ' '.$rec_device['device_ID'] ;
                                      if ($rec_device['turn_id'])   echo ' '.$rec_device['turn_id'] ;
                                    ?></option><?
                                  }
                                 }
                              ?>
                          </select>
                     </label>
                  </section> -->
                  <section>
                     <label class="label">Тип пропуска:</label>
                     <label class="select">
                        <select name="filter[pass_type]" data-required>
                               <option value="0" <?if (!$this->filter['pass_type']) echo 'selected'?>>Не важно</option>
                               <option value="1" <?if ($this->filter['pass_type']==1) echo 'selected'?>>Разовый</option>
                               <option value="2" <?if ($this->filter['pass_type']==2) echo 'selected'?>>Временный</option>
                        </select>
                     </label>
                  </section>
                  <section>
                      <label class="label">Номер пропуска</label>
                      <label class="input">
                           <input type="text" name="filter[pass_number]" placeholder="" lang="RUS" value="<?echo $this->filter['pass_number']?>">
                      </label>
                  </section>
                   <section>
                        <label class="label">Сортировка:</label>
                        <label class="select">
                           <select name="filter[order]" id="order">
                               <option value="pkey desc" <?if ($this->filter['order']!='pkey') echo 'selected'?>>Обратная</option>
                               <option value="pkey" <?if ($this->filter['order']=='pkey') echo 'selected'?>>Прямая</option>
                           </select>
                        </label>
                     </section>
                  </fieldset>
                  <?$this->panel_button_apply();?>
                  <?$this->panel_buttons_action();?>
              </form>
       </div><br>
     <?
  }

  function create_usl_select_obj($_params,&$options)
  {  //damp_array($this->filter) ;
      /*
      $_usl=array('clss=251') ;
                if ($options['mo_id']) $_usl[]='mo_id='.$options['mo_id'] ;
                if ($options['personal_id']) $_usl[]='(user_id='.$options['personal_id'].' or member_id='.$options['personal_id'].')' ;
                if ($options['terminal_id']) $_usl[]='terminal_id='.$options['terminal_id'] ;
                if ($options['reffer']) $_usl[]='(reffer1='.$options['reffer'].' or reffer2='.$options['reffer'].' or reffer3='.$options['reffer'].' or reffer4='.$options['reffer'].' or reffer5='.$options['reffer'].')';
                if ($options['cmd']) $_usl[]='obj_name="'.$options['cmd'].'"' ;
                if ($options['text']) $_usl[]='(comment like "%'.$options['text'].'%" or data like "%'.$options['text'].'%")' ;

                $usl=implode(' and ',$_usl) ;
                $recs=execSQL('select * from '.ENGINE()->table_mo_log.' where '.$usl.' order by pkey desc limit 500') ;
                return($recs) ;
      */
     $usl=array() ;
     //$usl[]='clss=253' ;
     if ($this->filter['from_id'])             $usl[]='pkey>'.$this->filter['from_id'] ;
     if ($this->filter['cmd'])                 $usl[]='cmd like "'.$this->filter['cmd'].'"' ;
     if ($this->filter['evt_id'])              $usl[]='evt_id="'.$this->filter['evt_id'].'"' ;
     if ($this->filter['mo_id'])              $usl[]='mo_id="'.$this->filter['mo_id'].'"' ;
     //if ($this->filter['name'])              $usl[]='_person_fio like "'.$this->filter['name'].'%"' ;
     //if ($this->filter['doc_number'])        $usl[]='_person_doc_number like "'.$this->filter['doc_number'].'%"' ;
     if ($this->filter['to_zone_id'])
     { // получаем все турникеты, которые находятся в данной зоне
       if (isset(SKD()->tree[$this->filter['to_zone_id']]))
       { $child_zone_ids=SKD()->tree[$this->filter['to_zone_id']]->get_list_child() ;
         //echo '$child_zone_ids='.$child_zone_ids.'<br>' ;
         $arr_child_zone_ids=explode(',',$child_zone_ids) ;
         //print_r($arr_child_zone_ids) ;
         $arr_devices=SKD()->get_arr_devices(); $arr_devices_by_zone=group_by_field('parent',$arr_devices)  ;
         if (_sizeof($arr_child_zone_ids)) foreach($arr_child_zone_ids as $zone_child_id) if (_sizeof($arr_devices_by_zone[$zone_child_id])) foreach($arr_devices_by_zone[$zone_child_id] as $rec_device)
         { //print_r($rec_device) ; echo '<br>' ; echo '<br>' ;

         }
       }

       //else $usl[]='zone_id in ('.SKD()->tree[$this->filter['to_zone_id']]->get_list_child().')' ;
     }

     if ($this->filter['pass_type']==1)        $usl[]='(ref1t=277 or'.
                                                      ' ref2t=277 or'.
                                                      ' ref3t=277 or'.
                                                      ' ref4t=277 or'.
                                                      ' ref5t=277)' ;
     if ($this->filter['pass_type']==2)        $usl[]='(ref1t=280 or'.
                                                      ' ref2t=280 or'.
                                                      ' ref3t=280 or'.
                                                      ' ref4t=280 or'.
                                                      ' ref5t=280' ;
     if ($this->filter['pass_number'])         $usl[]='(ref1p = "'.$this->filter['pass_number'].'" or'.
                                                      ' ref2p = "'.$this->filter['pass_number'].'" or'.
                                                      ' ref3p = "'.$this->filter['pass_number'].'" or'.
                                                      ' ref4p = "'.$this->filter['pass_number'].'" or'.
                                                      ' ref5p = "'.$this->filter['pass_number'].'")' ;
     if ($this->filter['reffer'])
     {   list($p,$t)=explode('.',$this->filter['reffer']) ;
         if ($p and $t)  $usl[]='((ref1p='.$p.' and ref1t='.$t.') or 
                                  (ref2p='.$p.' and ref2t='.$t.') or 
                                  (ref3p='.$p.' and ref3t='.$t.') or 
                                  (ref4p='.$p.' and ref4t='.$t.') or 
                                  (ref5p='.$p.' and ref5t='.$t.')
                                 )';
     }

     if ($this->filter['event'])               $usl[]='evt_type='.$this->filter['event'] ;
     if ($this->filter['terminal_id'])         $usl[]='terminal_id='.$this->filter['terminal_id'] ;
     if ($this->filter['turn_id'])
     {   $rec_terminal=SKD()->get_device_by_id($this->filter['turn_id'],array('check_reboot'=>1)) ;
         $usl[]='ref2p="'.$rec_terminal['pkey'].'"' ;
     }
     if ($this->filter['access_type'])         $usl[]=($this->filter['access_type']==1)? 'access_type=0':'access_type=1' ;
     if ($this->filter['result'])              $usl[]='result='.($this->filter['result']-1) ;
     // время передаваемое в unix формате
     if ($this->filter['time_from'])           $usl[]='c_data>='.$this->filter['time_from'] ;
     if ($this->filter['time_to'])             $usl[]='c_data<='.$this->filter['time_to'] ;
     // время передаваемое в текстовом формате
     if ($this->filter['data_from'])           $usl[]='c_data>='.strtotime($this->filter['data_from']) ;
     if ($this->filter['data_to'])             $usl[]='c_data<='.strtotime($this->filter['data_to']) ;
      // текст внутри результата
      if ($this->filter['text'])              $usl[]='(mess1 like "%'.$this->filter['text'].'%" or mess2 like "%'.$this->filter['text'].'%")' ;


     $usl_res=(_sizeof($usl))? implode(' and ',$usl):1 ;
     //damp_array($usl,1,-1) ;
     return($usl_res) ;
  }

 function panel_info_filter()
 { $_str=array() ; $info=array() ; $title='' ;
   //if ($this->filter['pass_creator'])                    $info['сотрудник']=ACCOUNTS()->get_member_name_by_id($this->filter['pass_creator'] )  ;
   //if ($this->filter['pass_status'])                     $info['статус']= $_SESSION['ARR_pass_status'][$this->filter['pass_status']] ;
   //if ($this->filter['personal_name'])                   $info['следует к']='"'.$this->filter['personal_name'].'"' ;
   if ($this->filter['cmd'])                               $info['Команда']='"'.$this->filter['cmd'].'"' ;
   if ($this->filter['action'])                            $info['Операция']='"'.$this->filter['action'].'"' ;
   if ($this->filter['name'])                              $info['ФИО']='"'.$this->filter['name'].'"' ;
   if ($this->filter['evt_id'])                            $info['ID события']='"'.$this->filter['evt_id'].'"' ;
   if ($this->filter['terminal_id'])                       $info['Терминал']='"'.$this->filter['terminal_id'].'"' ;
   if ($this->filter['turn_id'])
   {   $info['ID турникета']='"'.$this->filter['turn_id'].'"' ;
   }
   //if ($this->filter['doc_number'])                        $info['Номер документа']='"'.$this->filter['doc_number'].'"' ;
   if ($this->filter['data_from'])                         $info['c']=$this->filter['data_from'] ;
   if ($this->filter['data_to'])                           $info['по']=$this->filter['data_to'] ;
   if ($this->filter['to_zone_id'])                        $info['зона доступа']=SKD()->get_full_zone_path($this->filter['to_zone_id'])  ;
   if ($this->filter['pass_type'])                         $info['тип пропуска']=$_SESSION['ARR_pass_type'][$this->filter['pass_type']] ;
   if ($this->filter['pass_number'])                       $info['номер пропуска']='"'.$this->filter['pass_number'].'"';
   if ($this->filter['evt_type'])                          $info['событие']=$_SESSION['ARR_evt_type'][$this->filter['evt_type']] ;
   if ($this->filter['access_type'])                       $info['направление прохода']=$_SESSION['ARR_access_type'][$this->filter['access_type']-1] ;
   if ($this->filter['result'])                            $info['результат']=$_SESSION['ARR_result'][$this->filter['result']-1] ;
   if (_sizeof($info)) foreach($info as $title=>$value) $_str[]=$title.': <strong>'.$value.'</strong>' ;
   if (_sizeof($_str)) $title='<p class=center>'.implode(' ',$_str).'</p>' ;
   return $title ;
 }


  function get_cnt_items($usl,$options=array())
  { $cnt=execSQL_value('select count(pkey) from  '.ENGINE()->table_mo_req.' where '.$usl,$options) ;
    return($cnt) ;
  }

  function get_items($usl,$options=array())
  { $limit=($options['limit'])? ' '.$options['limit']:'' ;
    $order=($this->filter['order'])? ' order by '.$this->filter['order']:' order by pkey desc' ;
    $list_rec=execSQL('select * from  '.ENGINE()->table_mo_req.' where '.$usl.$order.$limit,$options,1) ;
    return($list_rec) ;
  }

  function print_template_HTML($list_recs,$options=array())
  { $id=($options['id'])? 'id='.$options['id']:'' ;
    ?><table class="basic fz_small <?if (!$this->filter['no_full_width']) echo 'full'?> auto list_logs_request" <?echo $id?>>
        <colgroup><col id=c0><col id=c1><col id=c3><col id=c6><col id=c7><col id=c8></colgroup>
        <tr><th>ID</th><th>Время запроса</th><th>Детали запроса</th><th>Терминал</th><th>Команда</th><th>Запрос</th><th>Ответ</th></tr><? ;
        if (_sizeof($list_recs)) foreach($list_recs as $rec)
    	{  $mess1=array() ; $mess2=array() ; $size1=0 ; $size2=0 ;
           if ($rec['mess1']) $mess1=json_decode($rec['mess1'],true) ;
           else if (file_exists(_DIR_TO_ROOT.'/logs/'.$rec['UID'].'_in.html'))
           { $cont1=file_get_contents(_DIR_TO_ROOT.'/logs/'.$rec['UID'].'_in.html') ;
             if ($cont1) $mess1=json_decode($cont1,true) ;
             $size1=filesize(_DIR_TO_ROOT.'/logs/'.$rec['UID'].'_in.html') ;
           }
           if ($rec['mess2']) $mess2=json_decode($rec['mess2'],true) ;
           else if (file_exists(_DIR_TO_ROOT.'/logs/'.$rec['UID'].'_out.html'))
           { $cont2=file_get_contents(_DIR_TO_ROOT.'/logs/'.$rec['UID'].'_out.html') ;
             if ($cont2) $mess2=json_decode($cont2,true) ;
             $size2=filesize(_DIR_TO_ROOT.'/logs/'.$rec['UID'].'_out.html') ;
           }

           ?><tr>
    	      <td class=data><? echo $rec['pkey'] ;?></td>
    	      <td class=data><? echo date('d.m.Y H:i:s',$rec['c_data']) ;?></td>
    	      <td class=cmd><? echo '<strong>'.(($rec['req_type'])? 'Исходящий':'Входяший').'</strong>' ;
    	                       echo  '<br><br>'.$rec['req_url'] ;
                               if ($rec['time_exec']) echo '<br><br>Время запроса: <strong>'.round($rec['time_exec'],5).'</strong> сек' ;
                               if ($rec['debug_text']) echo '<br><br>'.$rec['debug_text'] ;
                                $fname='/logs/'.$rec['UID'].'_request_debug.html' ;
                                if (file_exists(_DIR_TO_ROOT.$fname)) {?><br><br><a class="small" href="<?echo $fname?>" target="_BLANK">View debug info</a><?}
    	                    ?>
              </td>
    	      <td class=cmd><? echo $rec['terminal_id'] ?></td>
    	      <td class=cmd><? echo $rec['cmd'] ;
                  $fname='/logs/'.$rec['cmd'].'_'.$rec['mo_id'].'.html' ;
                  if (file_exists(_DIR_TO_ROOT.$fname)) {?><br><a class="small" href="<?echo $fname?>" target="_BLANK">source</a><?}
                  $fname='/logs/'.$rec['cmd'].'_'.$rec['mo_id'].'_db.html' ;
                  if (file_exists(_DIR_TO_ROOT.$fname)) {?><br><a class="small" href="<?echo $fname?>" target="_BLANK">trace db</a><?}
                  ?></td>
    	      <td class="mess left">
                  <? echo 'Запрос с <strong>'.$rec['IP1'].'</strong>' ;
                     if ($size1) echo ', '.show_size($size1) ;
                     echo '<br>' ;
                     if ($rec['content_type1']=='xml') echo '<textarea style="width:100%;height:100px;font-size:12px;">'.$cont1.'</textarea>' ;
                     if (is_array($mess1) or is_object($mess1)) damp_array($mess1,1,-1); else echo $mess1.'<br>' ;
                             ?>
              </td>
    	      <td class="mess left">
                  <? echo 'Ответ с <strong>'.$rec['IP2'].'</strong>' ;
                     if ($size2) echo ', '.show_size($size2) ;
                     echo '<br>' ;
                     if (is_array($mess2) or is_object($mess2))
                     {  if (_sizeof($mess2))
                        {
                            if ($rec['cmd']!='get_pass')   damp_array($mess2,1,-1);
                            else  echo '<a target="_blank" href="/logs/'.$rec['UID'].'_out.html">Дамп</a>' ;
                        }
                        else echo 'Возвращен пустой ответ<br>'  ;
                     }
                     else echo $rec['mess2'].'<br>' ;
                             ?>
              </td>
    	   </tr><?
    	}
    ?></table><?
  }

  function print_template_HTML2($list_recs,$options=array())
  { $id=($options['id'])? 'id='.$options['id']:'' ;
     $recs_account=execSQL('select pkey,obj_name,rol from obj_site_account') ;
    ?><!--<link rel="stylesheet" type="text/css" href="<?echo _PATH_TO_EXT?>/jquery.tableScroll/jquery.tablescroll.css"/>
      <script type="text/javascript" src="<?echo _PATH_TO_EXT?>/jquery.tableScroll/jquery.tablescroll.js"></script>
      <script type="text/javascript" src="<?echo _PATH_TO_EXT?>/jquery.tableScroll/jquery.tablescroll.js"></script>-->
      <table class="basic fz_small <?if (!$this->filter['no_full_width']) echo 'full'?> auto list_logs_events" <?echo $id?>>
        <colgroup><col id=c1><col id=c2><col id=c3><col id=c3><col id=c4><col id=c5><col id=c6><col id=c7></colgroup>
        <thead>
            <tr><th>ID</th><th>IP</th><th>Дата, время</th><th>Оператор</th><th>Действие</th><th>Объекты события</th><th>Результат</th><th>Данные операции</th><th>Время<br>выполения</th></tr>
        </thead>
        <tbody>

        <?
        if (_sizeof($list_recs)) foreach($list_recs as $rec)
        {   if (isset($rec['user_id']) and isset($recs_account[$rec['user_id']]) and !$rec['member_id'])
                { $rec['member_id']=$rec['user_id'] ; $rec['user_id']='' ;

                }
            $recs_reffers=array() ; $str=array() ;
            if (isset($rec['ref1p'])) $recs_reffers[]=get_obj_info($rec['ref1p'].'.'.$rec['ref1t']) ;
         	if (isset($rec['ref2p'])) $recs_reffers[]=get_obj_info($rec['ref2p'].'.'.$rec['ref2t']) ;
         	if (isset($rec['ref3p'])) $recs_reffers[]=get_obj_info($rec['ref3p'].'.'.$rec['ref3t']) ;
         	if (isset($rec['ref4p'])) $recs_reffers[]=get_obj_info($rec['ref4p'].'.'.$rec['ref4t']) ;
         	if (isset($rec['ref5p'])) $recs_reffers[]=get_obj_info($rec['ref5p'].'.'.$rec['ref5t']) ;
            if (_sizeof($recs_reffers)) foreach($recs_reffers as $rec_reffer)
              {  $class_name=$_SESSION['descr_clss'][$rec_reffer['clss']]['name'] ;
                 $obj_name=$rec_reffer['obj_name'] ;
                 $obj_ID=$rec_reffer['pkey'] ;
                 $str[]=$class_name.' '.$obj_name.', ID'.$obj_ID.', ['.$rec_reffer['_reffer'].']' ;
              }
            ?><tr>
              <td class=id><? echo $rec['pkey'] ;?></td>
              <td class=id><? echo $rec['IP'] ;?></td>
              <td class=data><? echo date('d.m.Y H:i:s',$rec['c_data']) ;?></td>
              <td class=name><? echo $recs_account[$rec['member_id']]['obj_name'].'<br>'.$_SESSION['ARR_roll'][$rec['rol']]['obj_name'] ?></td>
              <td class=name><? echo $rec['obj_name'] ?></td>
              <td class="left"><? if (_sizeof($str)) echo implode('<br>',$str) ;?></td>
              <td class="comment left"><? echo $rec['comment'] ?></td>
              <td class=data><? if ($rec['data'] and $rec['cmd']!='get_pass') damp_array(unserialize($rec['data']),1,-1) ?></td>
              <td class=time><? if ($rec['time_exec']) echo round($rec['time_exec'],5) ?></td>
           </tr><?
        }
    ?></tbody></table>

    <? $this->panel_info_select($options) ;
    //$arr_devices=SKD()->get_arr_devices();  $arr_devices_by_zone=group_by_field('parent',$arr_devices)  ;damp_array($arr_devices_by_zone) ;

    ?>
      <script>
      /*<![CDATA[*/

      jQuery(document).ready(function($)
      {
        //$j('#thetable2').tableScroll({height:500});

        //$j('#thetable2').tableScroll();
      });

      /*]]>*/
      </script>
      <?
  }





}

?>
