<?php
include_once("c_debug_info.php");
include_once(_DIR_TO_MODULES.'/engine/i_disk.php') ;
class c_page_cab_debug_personal_filters extends c_page_cab_debug_info
{
  public $h1='Отбор сотрудников' ;


  function block_main()
  { $this->page_title() ;
    $reffers=execSQL_line('select reffer from personals_filter') ;
    $arr=array() ;
    if (_sizeof($reffers)) foreach($reffers as $reffer) if ($reffer)
    {
      list($pkey,$tkey)=explode('.',$reffer) ;
      $table_name=_DOT($tkey)->table_name ;
      if ($table_name)
      { $arr_select[$tkey]="t$tkey.pkey as reffer_id,t$tkey.obj_name as reffer_name,t$tkey.enabled as reffer_enabled" ;
        $arr_join[$tkey]="left join $table_name t$tkey on t$tkey.pkey=REPLACE(t1.reffer,'.$tkey','')"  ;
      }
    }
    damp_array($arr);
    $recs=execSQL('select t1.*,
                  '.
                   implode(",\n",$arr_select).' 
                   from personals_filter t1 
                   '.
                   implode("\n",$arr_join)
                   ) ;
    print_2x_arr($recs);

    //PERSONALS_FILTER()->convert_personals_filter_from_old_format() ;

  }

}



?>
