<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:84:"C:\phpStudy\PHPTutorial\WWW\aqm-web\public/../application/admin\view\db\restore.html";i:1557480234;s:75:"C:\phpStudy\PHPTutorial\WWW\aqm-web\application\admin\view\layout\home.html";i:1557480234;s:82:"C:\phpStudy\PHPTutorial\WWW\aqm-web\application\admin\view\layout\admin_items.html";i:1557480234;}*/ ?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>安全猫官网</title>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <!-- Bootstrap 3.3.7 -->
        <link rel="stylesheet" href="<?php echo PLUGINS_SITE_ROOT; ?>/layui/css/layui.css">
        <link rel="stylesheet" href="<?php echo ADMIN_SITE_ROOT; ?>/css/admin.css">
        <link rel="stylesheet" href="<?php echo ADMIN_SITE_ROOT; ?>/iconfont/iconfont.css">
        <script src="<?php echo PLUGINS_SITE_ROOT; ?>/jquery-2.1.4.min.js"></script>
        <script src="<?php echo ADMIN_SITE_ROOT; ?>/js/admin.js"></script>
        <script type="text/javascript" src="<?php echo PLUGINS_SITE_ROOT; ?>/layui/layui.js"></script>
        <script type="text/javascript">
            var BASESITEROOT = "<?php echo BASE_SITE_ROOT; ?>";
            var ADMINSITEROOT = "<?php echo ADMIN_SITE_ROOT; ?>";
            var BASESITEURL = "<?php echo BASE_SITE_URL; ?>";
            var HOMESITEURL = "<?php echo HOME_SITE_URL; ?>";
            var ADMINSITEURL = "<?php echo ADMIN_SITE_URL; ?>";
            layui.use('layer', function () {
                var layer = layui.layer;
            });
        </script>
    </head>
    <body>
        
<div class="layui-tab layui-tab-card">
    <?php if($admin_item): ?>
<ul class="layui-tab-title">
    <?php if(is_array($admin_item) || $admin_item instanceof \think\Collection || $admin_item instanceof \think\Paginator): if( count($admin_item)==0 ) : echo "" ;else: foreach($admin_item as $key=>$item): if(array_intersect(explode(" ",str_replace("/", ".",substr($item['url'],7,-5))),$allpower) || array_intersect(explode(" ",str_replace("/", ".",substr($item['url'],31,-16))),$allpower)): ?>
    <li <?php if($item['name'] == $curitem): ?>class="layui-this" <?php endif; ?>>
    <a href="<?php echo $item['url']; ?>"><?php echo $item['text']; ?></a>
    <?php endif; ?>
    </li>
    <?php endforeach; endif; else: echo "" ;endif; ?>
    <div class="tool-btns">
        <a href="javascript:location.reload();" title="刷新当前页面" class="iconfont icon-reload"></i></a>
    </div>
</ul>
<?php endif; ?>
    <!-- 操作说明 -->
    <div class="layui-tab-content page-tab-content" id="flexigrid">
        <div class="explanation" id="explanation">
            <div class="title" id="checkZoom">
                <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
                <span id="explanationZoom" title="收起提示" class="arrow"></span>
            </div>
            <ul>
                <li> 数据还原, 点击恢复选项进行数据库导入.</li>
                <li> 导入的SQL文件语句必须按照MYSQL的语法编写</li>
            </ul>
        </div>

        <div class="mDiv">
            <div class="ftitle">
                <div style="width: 100px;float: left;line-height: 56px;"><h3>sql文件列表</h3></div>
                <div style="width: 300px;float: left;line-height: 56px;"><h5>(备份文件数量：<?php echo $filenum; ?>，占空间大小：<?php echo format_bytes($total); ?>)</h5></div>
            </div>
            <div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>
        </div>
        <table class="layui-table lay-even">
            <colgroup>
                <col width="150">
                <col width="200">
                <col width="200">
                <col>
                <col width="150">
            </colgroup>
            <thead>
            <tr>
                <th align="left" abbr="article_title" axis="col3" class="">
                    <div style="text-align: left; width: 200px;" class="">文件名称</div>
                </th>
                <th align="center" abbr="ac_id" axis="col4" class="">
                    <div style="text-align: center; width: 50px;" class="">卷号</div>
                </th>
                <th align="center" abbr="article_show" axis="col5" class="">
                    <div style="text-align: center; width: 50px;" class="">压缩</div>
                </th>
                <th align="center" abbr="article_time" axis="col6" class="">
                    <div style="text-align: center; width: 150px;" class="">数据大小</div>
                </th>
                <th align="center" abbr="article_show" axis="col7" class="">
                    <div style="text-align: center; width: 150px;" class="">备份时间</div>
                </th>
                <th align="center" abbr="article_show" axis="col8" class="">
                    <div style="text-align: center; width: 130px;" class="">状态</div>
                </th>
                <th align="center" axis="col1" class="handle">
                    <div style="text-align: center; width: 250px;">操作</div>
                </th>
            </tr>
            </thead>
            <tbody>
            <?php if(!(empty($list) || (($list instanceof \think\Collection || $list instanceof \think\Paginator ) && $list->isEmpty()))): if(is_array($list) || $list instanceof \think\Collection || $list instanceof \think\Paginator): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
            <tr>
                <td align="left" class="">
                    <div style="text-align: left; width: 200px;"><?php echo $vo['basename']; ?></div>
                </td>
                <td align="center" class="">
                    <div style="text-align: center; width: 50px;"><?php echo $vo['part']; ?></div>
                </td>
                <td align="center" class="">
                    <div style="text-align: center; width: 50px;"><?php echo $vo['compress']; ?></div>
                </td>
                <td align="center" class="">
                    <div style="text-align: center; width: 150px;"><?php echo format_bytes($vo['size']); ?></div>
                </td>
                <td align="center" class="">
                    <div style="text-align: center; width: 150px;"><?php echo date("Y-m-d H:i:s",$vo['time']); ?></div>
                </td>
                <td align="center" class="">
                    <div style="text-align: center; width: 130px;">-</div>
                </td>
                <td align="center" class="handle">
                    <div style="text-align: center; width: 170px; max-width:170px;">
                        <a value="<?php echo url('/Admin/Db/import',['time'=>$vo['time']]); ?>" href="javascript:void(0)" class="db-import"><i
                                class="fa fa-repeat"></i>恢复</a> |
                        <a href="<?php echo url('/Admin/Db/downFile',['time'=>$vo['time']]); ?>"><i class="fa fa-download"></i>下载</a> |
                        <a href="<?php echo url('/Admin/Db/del',['time'=>$vo['time']]); ?>"><i class="fa fa-trash"></i>删除</a>
                    </div>
                </td>
            </tr>
            <?php endforeach; endif; else: echo "" ;endif; else: ?>
            <tr class="no_data">
                <td colspan="11"><?php echo \think\Lang::get('ds_no_record'); ?></td>
            </tr>
            <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
<script>

    $(document).ready(function () {
        // 表格行点击选中切换
        $('#flexigrid > table>tbody >tr').click(function () {
            $(this).toggleClass('trSelected');
        });

        // 点击刷新数据
        $('.fa-refresh').click(function () {
            location.href = location.href;
        });
    });

    $(".db-import").click(function () {

        var self = this, status = ".";
        $.get($('.db-import').attr('value'), success, "json");
        window.onbeforeunload = function () {
            return "正在还原数据库，请不要关闭！"
        }
        function success(data) {
            if (data.code) {
                if (data.gz) {
                    data.info += status;
                    if (status.length === 5) {
                        status = ".";
                    } else {
                        status += ".";
                    }
                }
                $(self).parent().parent().prev().find('div').text(data.msg);
                if (data.data) {
                    $.get($('.db-import').attr('value'), {"part": data.data.part, "start": data.data.start}, success, "json");
                } else {
                    window.onbeforeunload = function () {
                        return null;
                    }
                }
            } else {
                layer.alert(data.msg, {icon: 2});
            }
        }
    });
</script>

    </body>
</html>



