<?php
include_once("c_docs.php");
class c_page_cab_docs_types extends c_page_cab_docs
{
  public $h1='Типы документов' ;

 function second_menu_config()
 { $this->second_menu['/cab/docs/']=array('title'=>'Документы') ;
   $this->second_menu['/cab/docs/types/']=array('title'=>'Типы документов') ;
 }

 function block_main()
 { $this->page_title() ;
   $this->panel_list_edit() ;

 }


  function panel_list_edit()
  { $recs_doc=execSQL('select * from reports where type=2') ;
    $scan_priority=SETUP()->load_ini_setting('/ini/scan_priority.yaml') ;
    //damp_array($scan_priority);
    ?><form>
      <button class="button v2 left" cmd="docs/doc_type_create">Добавить новый тип документа</button>
      <button class="button v2 left" cmd="docs/doc_type_save">Сохранить изменения</button>
      <button class="button v2 left" cmd="docs/doc_type_delete">Удалить тип документа</button>
      <div class="clear"></div>
      <table class="basic fz_small"><tr><th>Выбор</th><th>ID</th><th>Модуль</th><th>Наименование</th><th>Код документа</th><th>Расположение шаблона документа</th><th>Приоритет при загрузке сканов</th></tr>
       <?if ($recs_doc) foreach($recs_doc as $rec)
         {   $id=$rec['pkey'] ;
             $rec_report=REPORTS()->docs_list[$rec['code']] ;
             ?><tr>
                 <td><?if ($rec['virt']){?><input type="checkbox" name="_check[<?echo $rec['pkey']?>]" value="1"><?}?></td>
                 <td class="left"><?echo $id?></td>
                 <td class="left"><?echo $rec_report['section_title']?></td>
                 <td class="left">
                   <? if ($rec['virt']){?><input type="text" name="doc_types[<?echo  $rec['pkey']?>][name]"  style="width:1000px;" value="<?echo htmlspecialchars($rec['obj_name'])?>"><?}
                      else echo $rec['obj_name'] ;
                   ?>
                 </td>
                 <td class="left"><?echo ($rec['code'])?></td>
                 <td class="left"><?echo ($rec['script']) ?></td>
                 <td><input type="hidden" name="scan_priority[<?echo $rec['code']?>]" value="0"><input type="checkbox" name="scan_priority[<?echo $rec['code']?>]" value="1" <?if ($scan_priority[$rec['code']]) echo 'checked'?>></td>
            </tr><?
         }?>
     </table>
     </form>
      <?
//      print_2x_arr($recs_doc);
  }

}



?>
