<?php
include_once("c_autonomous_terminals_upload_mo.php");
class c_page_cab_autonomous_terminals_upload_mo_log extends c_page_cab_autonomous_terminals_upload_mo

{
    public $h1='Загрузка данных через шлюз - лог загрузки' ;

    function block_main()
    {
        $this->page_title() ;
        $recs=execSQL('select * from obj_site_post_log where clss=362 and obj_name="upload_mo" order by pkey desc limit 100') ;
        if (_sizeof($recs)) $this->log_upload_persons($recs) ;
    }

    // шаблон - вывод ссылками без разделитея
    function log_upload_persons($list_recs,$options=array())
    {
        $id=($options['id'])? 'id='.$options['id']:'' ;?>
        <table class="log_upload_persons basic fz_small full auto" <?echo $id?>>
            <tr>
                <th>Дата, время</th>
                <th>IP</th>
                <th>Источник</th>
                <th>Обработано записей</th>
                <th>Добавлено<br>записей</th>
                <th>Информация</th>
                <th>Лог</th>
            </tr><?
        if (_sizeof($list_recs)) foreach($list_recs as $rec) {
            $result=unserialize($rec['result'])  ;?>
            <tr>
                <td class=data><? echo date('d.m.Y H:i:s',$rec['c_data']) ;?></td>
                <td class=name><? echo $rec['IP'] ?></td>
                <td class=name><? echo $rec['obj_name'] ?></td>
                <td>
                    <?echo ($result['relation_count'])? $result['relation_count']:0?>
                </td>
                <td>
                    <?echo ($result['relation_adding'])? $result['relation_adding']:0?>
                </td>
                <td class="left">
                    <? if(is_array($result['comment'])) { foreach ($result['comment'] as $comment) echo $comment.'<br>';} else echo $result['comment']; ?>
                </td>
                <td><?
                if ($rec['session_uid'] and file_exists(_DIR_TO_ROOT.'/logs/import_trace_'.$rec['session_uid'].'.html')) echo '<a target="blank" href="/logs/import_trace_'.$rec['session_uid'].'.html">'.$rec['session_uid'].'</a>' ?></td>
            </tr><?
        }
        ?></table><?
    }



}



?>
