<?php
// специальный отчет для добавления сотрудников в группы
include_once('report_personals_in_event_instruction.php') ;
class report_personals_in_event_instruction_free extends report_personals_in_event_instruction
{
 var $title='Участники мероприятия - подлежат инструктажу' ;
 var $status=[1] ;
 var $filter_set=['name','org_ids','otdel_ids','working_ids','group_pers',/*'group_medic',*/'age_from','age_to','age_to','temp_fired'/*,'pass_status'*/];
 var $report_script=__FILE__ ;


 function panel_buttons($options=array())
 {   if (!is_array($options['disabled_filter'])) $options['disabled_filter']=array() ;
     ?><div id="panel_buttons">
             <input type="submit" class="button v2" cmd="set_filter" value="Поиск">
             <button class="button v2" cmd="esmo_magnit_instruction/set_check_personal_to_status_2" use_form="form_personals" event_id="<?echo $this->rec_event['pkey']?>">Направить на инструктаж выбранных</button>
             <button class="button v2" cmd="esmo_magnit_instruction/set_all_personal_to_status_2" event_id="<?echo $this->rec_event['pkey']?>">Направить на инструктаж всех</button>
                 </div>
     <?
  }

// шаблон - вывод ссылками без разделитея
  function print_template_HTML($list_recs,$options=array())
  { $id=($options['id'])? 'id='.$options['id']:'' ;
    $arr_personal_ids=array() ;
    ?><form id="form_personals"><table class="list_personal_table_img basic fz_small full auto"<?echo $id?>>
        <tr><th>Выбор</th>
            <th>ID</th>
            <th>ФИО, дата рождения, Возраст</th>
            <th>Организация, подразделение</th>
            <th>Должность</th>
            <th>Статус</th>
        </tr>
        <?
        if (_sizeof($list_recs)) foreach($list_recs as $rec)
        {   ?><tr class=item>
                <td><?if (!in_array($rec['pkey'],$arr_personal_ids) and $rec['event_status']==1){?><input type="<?echo ($options['check_type'])? $options['check_type']:'checkbox'?>" name="_check[]" value="<?echo $rec['pkey']?>"><?} else echo '<span class="red"></span>'?></td>
                <td><a href="/cab/events/pass/<?echo $rec['event_pass_id']?>/" class="new_window" target="_blank" title="win_pass_info"><?echo $rec['event_pass_id']?></a></td>
                <td class="left"><a href="<?echo $rec['__href_window']?>" class="new_window" target="_blank" title="win_second"><?echo $rec['obj_name']?></a>
                    <?  if ($rec['uid']) echo '<br><span class="nowrap small">'.$rec['uid'].'</span>' ;
                        if (!$rec['enabled'])echo '<br><br><span class="red bold">УВОЛЕН</span> ('.date('d.m.Y H:i',$rec['fired_data']).')' ;
                        if ($rec['dr'])echo '<br>'.$rec['dr'] ;
                        if ($rec['age'])echo ', '.$rec['age'].' '.get_case_by_count_1_2_5($rec['age'],'год,года,лет');
                        if ($rec['fired_data'])echo '<div style="color:burlywood;">Отложенное увольнение до <strong>'.date('d.m.Y',$rec['fired_data']).'</strong></div>' ;
                    ?>
                </td>
                <td class="left"><?echo '<strong>'.$rec['_org_name'].'</strong><br><div class="small">'.$rec['_otdel_name'].'</div>'?></td>
                <td class="left"><?echo _IL('IL_works')->recs[$rec['working']]['obj_name']  ;
                    if ($rec['working2']) echo '<br><strong>Совмещение: </strong>'._IL('IL_works')->recs[$rec['working2']]['obj_name'] ;
                    ?></td>
                <td><?echo EVENT_INSTR()->arr_status[$rec['event_status']]?></td>
            </tr><?
        }
      ?></table></form><?
      //damp_array($rec) ;
  }


}

?>
