<?php /*a:3:{s:59:"/data/web/mall.valimart.net/app/admin/view/database/db.html";i:1657785096;s:61:"/data/web/mall.valimart.net/app/admin/view/public/header.html";i:1657785098;s:66:"/data/web/mall.valimart.net/app/admin/view/public/admin_items.html";i:1657785098;}*/ ?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title><?php echo htmlentities((isset($html_title) && ($html_title !== '')?$html_title:config('ds_config.site_name'))); ?><?php echo htmlentities(lang('system_backend')); ?></title>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <link rel="stylesheet" href="<?php echo htmlentities(ADMIN_SITE_ROOT); ?>/css/admin.css">
        <link rel="stylesheet" href="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/js/jquery-ui/jquery-ui.min.css">
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/jquery-2.1.4.min.js"></script>
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/jquery.validate.min.js"></script>
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/jquery.cookie.js"></script>
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/common.js"></script>
        <script src="<?php echo htmlentities(ADMIN_SITE_ROOT); ?>/js/admin.js"></script>
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/js/jquery-ui/jquery-ui.min.js"></script>
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/js/jquery-ui/jquery.ui.datepicker-zh-CN.js"></script>
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/perfect-scrollbar.min.js"></script>
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/layer/layer.js"></script>
        <script type="text/javascript">
            var BASESITEROOT = "<?php echo htmlentities(BASE_SITE_ROOT); ?>";
            var ADMINSITEROOT = "<?php echo htmlentities(ADMIN_SITE_ROOT); ?>";
            var BASESITEURL = "<?php echo htmlentities(BASE_SITE_URL); ?>";
            var HOMESITEURL = "<?php echo htmlentities(HOME_SITE_URL); ?>";
            var ADMINSITEURL = "<?php echo htmlentities(ADMIN_SITE_URL); ?>";
        </script>
    </head>
    <body>
        <div id="append_parent"></div>
        <div id="ajaxwaitid"></div>










<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3><?php echo htmlentities(lang('ds_db')); ?></h3>
                <h5></h5>
            </div>
            <?php if($admin_item): ?>
<ul class="tab-base ds-row">
    <?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): ?>
    <li><a href="<?php echo htmlentities($item['url']); ?>" <?php if($item['name'] == $curitem): ?>class="current"<?php endif; ?>><span><?php echo htmlentities($item['text']); ?></span></a></li>
    <?php endforeach; endif; else: echo "" ;endif; ?>
</ul>
<?php endif; ?>
        </div>
    </div>
    <!-- 操作说明 -->
    <div class="explanation" id="explanation">
        <div class="title" id="checkZoom">
            <h4 title="<?php echo htmlentities(lang('ds_explanation_tip')); ?>"><?php echo htmlentities(lang('ds_explanation')); ?></h4>
            <span id="explanationZoom" title="<?php echo htmlentities(lang('ds_explanation_close')); ?>" class="arrow"></span>
        </div>
        <ul>
            <li><?php echo htmlentities(lang('db_data_backup_help1')); ?></li>
            <li><?php echo htmlentities(lang('db_data_backup_help2')); ?></li>
        </ul>
    </div>

    
    <div class="ds-search-form">
        <dl>
            <dt style="font-size:14px;color: #09C;"><?php echo htmlentities(lang('db_database_table_list')); ?>(<?php echo htmlentities(lang('db_total_num')); ?><?php echo htmlentities($tableNum); ?><?php echo htmlentities(lang('db_tablenum_record')); ?>，<?php echo htmlentities(lang('db_total_size')); ?><?php echo htmlentities($total); ?>)</dt>
        </dl>
        <div class="btn_group">
            <a id="export" class="btn"><?php echo htmlentities(lang('ds_db')); ?></a>
        </div>
    </div>

    <table class="ds-default-table">
        <thead>
            <tr>
                <th><input type="checkbox" onclick="javascript:$('input[name*=tables]').prop('checked', this.checked);"></th>
                <th><?php echo htmlentities(lang('db_database_table')); ?></th>
                <th><?php echo htmlentities(lang('db_data_length')); ?></th>
                <th><?php echo htmlentities(lang('db_occupy_space')); ?></th>
                <th><?php echo htmlentities(lang('db_code')); ?></th>
                <th><?php echo htmlentities(lang('db_createtime')); ?></th>
                <th><?php echo htmlentities(lang('db_backup_state')); ?></th>
                <th><?php echo htmlentities(lang('db_handle')); ?></th>
            </tr>
        </thead>
        
        <form  method="post" id="export-form" action="<?php echo url('Database/export'); ?>">
            <tbody>
                <?php if(is_array($dbtable_list) || $dbtable_list instanceof \think\Collection || $dbtable_list instanceof \think\Paginator): if( count($dbtable_list)==0 ) : echo "" ;else: foreach($dbtable_list as $k=>$db): ?>
                <tr data-id="<?php echo htmlentities($db['Name']); ?>">
                    <td class="sign">
                        <div style="width: 24px;"><input type="checkbox" name="tables[]" value="<?php echo htmlentities($db['Name']); ?>"></div>
                    </td>
                    <td><?php echo htmlentities($db['Name']); ?></td>
                    <td><?php echo htmlentities($db['Rows']); ?></td>
                    <td><?php echo htmlentities(format_bytes($db['Data_length'])); ?></td>
                    <td><?php echo htmlentities($db['Collation']); ?></td>
                    <td><?php echo htmlentities($db['Create_time']); ?></td>
                    <td class="info"><?php echo htmlentities(lang('db_unbackup')); ?></td>
                    <td class="handle">
                        <div style="text-align: center; width: 170px; max-width:170px;">
                            <a href="<?php echo url('Database/optimize',array('tablename'=>$db['Name'])); ?>"><i class="iconfont">&#xe6e0;</i><?php echo htmlentities(lang('db_magic')); ?></a> | 
                            <a href="<?php echo url('Database/repair',array('tablename'=>$db['Name'])); ?>"><i class="iconfont">&#xe6e0;</i><?php echo htmlentities(lang('db_repair')); ?></a>
                        </div>
                    </td>
                </tr>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </tbody>
        </form>
    </table>
</div>
<script>
                    (function($) {
                        var $form = $("#export-form"), $export = $("#export"), tables;
                        $export.click(function() {
                            if ($("input[name^='tables']:checked").length == 0) {
                                layer.alert('<?php echo htmlentities(lang('db_backup_error')); ?>');
                                return false;
                            }
                            $export.addClass("disabled");
                            $export.html("<?php echo htmlentities(lang('db_backup_requer')); ?>");
                            $.post(
                                    $form.attr("action"),
                                    $form.serialize(),
                                    function(data) {
                                        if (data.status) {
                                            tables = data.tables;
                                            $export.html(data.info + "<?php echo htmlentities(lang('db_backup_strat')); ?>");
                                            backup(data.tab);
                                            window.onbeforeunload = function() {
                                                return "<?php echo htmlentities(lang('db_backup_conduct')); ?>"
                                            }
                                        } else {
                                            layer.alert(data.info);
                                            $export.removeClass("disabled");
                                            $export.html("<?php echo htmlentities(lang('db_backup')); ?>");
                                        }
                                    },
                                    "json"
                                    );
                            return false;
                        });

                        function backup(tab, status) {
                            status && showmsg(tab.id, "<?php echo htmlentities(lang('db_backup_state_strat')); ?>");
                            $.get($form.attr("action"), tab, function(data) {
                                if (data.status) {
                                    showmsg(tab.id, data.info);
                                    if (!$.isPlainObject(data.tab)) {
                                        $export.removeClass("disabled");
                                        $export.html("<?php echo htmlentities(lang('db_backup_restart')); ?>");
                                        window.onbeforeunload = function() {
                                            return null
                                        }
                                        return;
                                    }
                                    backup(data.tab, tab.id != data.tab.id);
                                } else {
                                    $export.removeClass("disabled");
                                    $export.html("<?php echo htmlentities(lang('db_backup')); ?>");
                                }
                            }, "json");

                        }

                        function showmsg(id, msg) {
                            $("input[value=" + tables[id] + "]").closest("tr").find(".info").html(msg);
//                            $("input[value=" + tables[id] + "]").closest("tr").hide(3000);
                        }
                    })(jQuery);
</script>
</body>
</html>