<?php
include_once(_DIR_EXT."/esmo_setting/c_esmo_setting_terminal.php");
include_once(_DIR_EXT.'/log/i_term_log.php') ;

class c_page_cab_esmo_setting_terminal_log_handler extends c_page_cab_esmo_setting_terminal
{
    public $h1 = 'Загрузка логов терминала для обработки';
    public $use_fusioncharts=1;
    public $use_datepicker=1;

    function set_head_tags() {
        parent::set_head_tags() ;
        $this->HEAD['css'][]=_PATH_TO_EXT.'/log/term_log.css' ;
        $this->HEAD['js'][]=_PATH_TO_EXT.'/log/term_log.js' ;
    }

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

        TERM_LOG()->load_log_panel();
        if($_POST['cmd'] == 'load_log') {
            $path_to_log = TERM_LOG()->load_log($_FILES['source_log']['tmp_name'], $_FILES['source_log']['name']);
        }

        if($path_to_log != false) {
            TERM_LOG()->process_log($path_to_log, ['save_as_json' => 1]);
            TERM_LOG()->print_log_header(basename($path_to_log));
            ?>
            <div id="show_log"></div>
            <div class="log-loading" id="loading_layer">
                <img id="load_gif" src="/images/loading15.gif" hidden>
            </div>
            <?
        }
    }

}
?>

