<?php
class report_training3 extends c_report
{
 var $title='Сведения о темах и количестве часов ежегодных занятий по программе повышения квалификации с водителями АТП' ;
 var $view_by_space_filter=0;
 var $event_id=0 ;
 var $personal_id=1 ;
 var $rec_personal=array() ;
 var $rec_event=array() ;
 var $sign_before_print=1 ;
 //var $allow_export_to_csv=1 ;

 function init($options=array())
 { if ($this->event_id) $this->rec_event=EVENTS()->get_event_by_id($this->event_id)  ;
   if ($this->filter['event_id'])
   { $this->rec_event=EVENTS()->get_event_by_id($this->filter['event_id'])  ;
     $this->event_id=$this->rec_event['pkey'] ;
   }
 }

 function setting($options=array())
 {   $arr_instruktions=execSQL('select pkey,obj_name from obj_site_events_schedule where clss=222 and obj_name!="" and ext like "%instruction/i_event_training%" order by c_data desc') ;
     ?><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">
                          <? if (!$options['no_view_event_select']) $this->filter_section_select('event_id','Мероприятия:',2,$arr_instruktions) ; ?></div>
                  </fieldset>
                      <?$this->panel_buttons($options);?>
                  </form>
           </div><br>
         <?
      }

  function panel_info_filter()
  { $_str=array() ; $title='' ;  $info=array() ;
    if ($this->event_id)
    { $arr_names=execSQL_line('select obj_name from obj_site_events_schedule where pkey='.$this->event_id) ;
      $info['Мероприятие']=implode(', ',$arr_names) ;
    }
    $info2=$this->get_arr_info_filters() ;
    $info=array_merge($info,$info2) ;
    if (_sizeof($info)) foreach($info as $title=>$value) $_str[]=$title.': <strong>'.$value.'</strong>' ;
    if (_sizeof($_str)) $title='<div class=center>'.implode(' ',$_str).'</div>' ;
    return $title ;
  }


 function HTML_report_body($options=array())
  {   if (!$this->rec_event['pkey']) return ;
      $recs_themes=execSQL('select * from obj_site_events_themes where parent='.$this->rec_event['pkey'].' and clss=225 order by indx') ;
       ?><table class="basic fz_small full auto"><tr class="head"><th>№</th><th>Тема занятий</th><th>Количество часов</th></tr><?
           if (_sizeof($recs_themes)) foreach($recs_themes as $rec)
           { ?><tr>
                 <td style="width:10%;" class="indx center"><?echo $rec['indx']?></td>
                 <td style="width:35%;" class="left"><?echo $rec['obj_name']?></td>
                 <td style="width:5%;" class="center"><?echo $rec['length']?> мин.</td>
               </tr>
             <?
           }
           ?>
            </table>
            <style type="text/css">
               table.basic td.indx{text-align:center;}
               table.basic td.indx:hover i{display:inline;cursor:pointer;}
               table.basic ul{margin:0 0 0 20px;;padding:0;}
               table.basic ul li{padding:0;margin:0;}
            </style>
           <?
  }
}

?>
