log_user_view.php 3.66 KB
<div style="/*max-height: 465px; overflow: scroll*/">
    <table class="table table-striped table-bordered table-hover">
        <thead>
        <tr>
            <th style="text-align: center">TT</th>
            <th style="text-align: center">ID</th>
            <th style="text-align: center; min-width: 100px;">Mã Action</th>
            <th style="text-align: center">Thời điểm login</th>
            <th style="text-align: center">Với tài khoản</th>
            <th style="text-align: center">Từ IP</th>
            <th style="text-align: center">Kết quả</th>
            <th style="text-align: center">Thời điểm logout</th>
            <th style="text-align: center">Thời gian sử dụng</th>
            <th style="text-align: center">Trạng thái</th>
            <th style="text-align: center">Xử lý</th>
        </tr>
        </thead>
        <tbody>
        <?php
        if(count($listData) > 0):
        foreach($listData as $key => $data): ?>
            <tr>
                <td style="text-align: center"><?php echo ($key+1+$offset); ?></td>
                <td style="text-align: center">#<?php echo $data['id']; ?></td>
                <td style="text-align: center"><?php echo $data['action']; ?></td>
                <td style="text-align: center"><?php echo MyHelper::reFormatDate($data['time_login']); ?></td>
                <td><?php echo MyHelper::truncate($data['account_input']); ?></td>
                <td><?php echo $data['ip_address']; ?></td>
                <td style="text-align: center">
                    <?php
                    if($data['result'] == 'SUCCESS'){
                        echo '<span class="label label-success">'.$data['result'].'</span>';
                    }else{
                        echo '<span class="label label-danger">'.$data['result'].'</span>';
                    }?>
                </td>
                <td style="text-align: center">
                    <?php echo MyHelper::reFormatDate($data['time_logout']); ?>
                </td>
                <td style="text-align: right">
                    <?php
                    if($data['duration'] > 0){
                        echo gmdate("H:i:s", $data['duration']);
                    }?>
                </td>
                <td style="text-align: center">
                    <?php
                    if($data['duration'] > 0){
                        echo 'Đã logout';
                    }else{
                        if($data['result'] == 'SUCCESS'){
                            echo '<i class="fa fa-refresh fa-spin bigger-130"></i>';
                        }elseif($data['result'] == 'FAILED'){
                            echo 'Login thất bại';
                        }
                    }?>
                </td>
                <td style="text-align: center">
                    <?php if((time() - strtotime($data['time_login'])) > 15*24*3600): ?>
                        <a href="<?php echo base_url().'backend/cmsSetting/deleteLogUser/'.$data['id']; ?>"
                           onclick="return confirm('Bạn có chắc chắn muốn xóa không?')" title="Xóa">
                            <i class="ace-icon red fa fa-trash-o bigger-130"></i>
                        </a>
                    <?php else: echo 'Xóa sau '.(15-(gmdate('d', time()-strtotime($data['time_login'])))).' ngày'; endif;?>
                </td>
            </tr>
        <?php
        endforeach;
        else:
        ?>
            <tr>
                <td colspan="11" style="color: red">Không có dữ liệu nào!</td>
            </tr>
        <?php endif; ?>
        </tbody>
    </table>
</div>
<!-- /.row -->
<div style="text-align: center;"><?php echo $pagination; ?></div>