<?php
include_once('c_daily_briefing.php') ;

class c_page_cab_daily_briefing_card extends c_page_cab_daily_briefing
{
    public $h1='Карточка инструктажа' ;
    public $rec_briefing=array() ;

    function select_obj_info()
    {
        if (_CUR_ID) {
            $this->rec_briefing=DAILY_BRIEFING()->get_briefing_by_id(_CUR_ID);
            if ($this->rec_briefing['pkey']) {
                $this->h1='Инструктаж "'.$this->rec_briefing['obj_name'].'"' ;
            } else $this->result=404;
        } else {
            $this->result=404;
        }
    }

    function second_menu_config()
    {
        $this->second_menu['/cab/daily_briefing/']='Рабочее место техника';
        if ($this->rec_briefing['pkey']) {
            $this->second_menu[$this->rec_briefing['__href']]='Статистика';
            $this->second_menu[$this->rec_briefing['__href'].'conduct/']='Проведение';
            $this->second_menu[$this->rec_briefing['__href'].'report/']='Отчет';
            if (MEMBER()->rol==1) {
                $this->second_menu[$this->rec_briefing['__href'].'edit/']='Редактировать';
            }
        }
    }

    function block_main()
    {
        $this->page_title() ;
        ?><div id="daily_briefing_stats"><?php daily_briefing_render_stats_summary($this->rec_briefing['pkey'])?></div><?php
        ?><div id="daily_briefing_instructor_stats"><?php daily_briefing_render_instructor_stats_table($this->rec_briefing['pkey'])?></div><?php
        ?><h2>Последние прохождения</h2><div id="daily_briefing_journal"><?php daily_briefing_render_recent_journal($this->rec_briefing['pkey'])?></div><?php
    }


}
?>
