<!DOCTYPE html>
<html lang="{SITE_LANGUAGE}">
<head>
    <meta charset="utf-8" />
    <title>{if $meta_title}{$meta_title}{else}{SITE_NAME} - {dr_lang('后台管理平台')}{/if}</title>
    <link href="{$THEME_PATH}assets/layui/css/layui.css?v={CMF_UPDATE_TIME}" rel="stylesheet" type="text/css" />
    <link href="{$THEME_PATH}assets/global/css/min{if !IS_XRDEV}.min{/if}.css?v={CMF_UPDATE_TIME}" rel="stylesheet" type="text/css" />
    {template "head.html"}
</head>

<?php
$string = '';
foreach ($my_menu as $tid => $left) {
    $_link = 0;
    $link_string = '';
    $is_first_group = ((string) $first === (string) $tid);
    foreach ($left['link'] as $i => $link) {
        $url = $link['url'];
        // 仅「首个分组的首个链接」高亮，避免每个分组第一项都带 active
        $class = (!$_link && $is_first_group) ? 'nav-item active' : 'nav-item';
        if (!$_link && $is_first_group) {
            $top['url'] = $url;
            $top['link_id'] = $link['id'];
            $top['left_id'] = $left['id'];
        }
        $_link = 1;
        $link['icon'] = $link['icon'] ? $link['icon'] : 'fa fa-th-large';
        $link_string .= '<li id="dr_menu_link_' . $link['id'] . '" class="' . $class . '"><a href="javascript:Mlink(' . $tid . ', ' . $left['id'] . ', ' . $link['id'] . ', \'' . $url . '\');"><i class="iconm ' . $link['icon'] . '"></i> <span class="title">' . dr_lang($link['name']) . '</span></a></li>';
    }
    $group_cls = $is_first_group ? 'active open' : '';
    $string .= '
        <li id="dr_menu_left_' . $left['id'] . '" class="dr_menu_' . $tid . ' dr_menu_item nav-item ' . $group_cls . '">
            <a href="javascript:;" class="nav-link nav-toggle">
                <i class="' . $left['icon'] . '"></i>
                <span class="title">' . dr_lang($left['name']) . '</span>
                <span class="arrow"></span>
            </a>
            <ul class="sub-menu">' . $link_string . '</ul>
        </li>';
}
if (function_exists('dr_my_admin_min_menu')) {
    $string = dr_my_admin_min_menu($my_menu, $string);
}
?>

<body scroll="no" style="overflow:hidden;" class="page-sidebar-closed-hide-logo page-admin-min page-header-fixed page-sidebar-fixed">
<div class="page-header navbar navbar-fixed-top">
    <div class="page-header-inner">
        <div class="page-logo">
            <a href="{SITE_URL}" target="_blank">
                <img src="{THEME_PATH}assets/logo.png" class="logo-default" alt="logo" />
            </a>
        </div>
        <a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse" data-target=".navbar-collapse">
            <span></span>
        </a>
        <div class="page-top">
            {if !$is_mobile}
            <div class="top-menu my-top-left pull-left">
                <ul class="fc-all-menu-top fc-mb-left-menu" id="dr_go_url"></ul>
            </div>
            {/if}
            <div class="top-menu">
                <ul class="nav navbar-nav pull-right">
                    {if count($ci->site_info) > 1}
                    <li class="dropdown dropdown-extended dropdown-tasks">
                        <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
                            <i class="fa fa-share-alt"></i>
                            <span class="badge badge-default">{count($ci->site_info)}</span>
                        </a>
                        <ul class="dropdown-menu extended tasks">
                            <li>
                                <ul class="dropdown-menu-list">
                                    {loop $ci->site_info $i $t}
                                    {if \Phpcmf\Service::M('auth')->_check_site($i)}
                                    <li>
                                        <a href="javascript:;" onclick="dr_select_site('{$i}')" title="{$t.SITE_NAME}"{if SITE_ID == $i} class="active" style="color:#dc3545"{/if}>
                                            <span class="task"><span class="desc">{dr_strcut($t.SITE_NAME, 30)}</span></span>
                                        </a>
                                    </li>
                                    {/if}
                                    {/loop}
                                </ul>
                            </li>
                        </ul>
                    </li>
                    {/if}
                    <li class="dropdown dropdown-user">
                        <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
                            <span class="username username-hide-on-mobile">{dr_strcut($admin['username'], 8)}</span>
                            <i class="fa fa-angle-down"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-default">
                            {if IS_USE_MEMBER}<li><a href="{dr_url('api/alogin', ['id'=>$admin.uid])}" target="_blank"><i class="fa fa-user"></i> {dr_lang('用户中心')}</a></li>{/if}
                            <li><a href="javascript:dr_go_url('{dr_url('api/my')}');"><i class="fa fa-edit"></i> {dr_lang('修改资料')}</a></li>
                            {if !$is_mode}
                            <li><a href="{dr_url('api/admin_all')}"><i class="fa fa-retweet"></i> {dr_lang('完整模式')}</a></li>
                            {/if}
                            <li><a href="javascript:;" onClick="dr_logout('{dr_url('login/out')}');"><i class="fa fa-user-times"></i> {dr_lang('退出系统')}</a></li>
                            <li class="divider"></li>
                            {if $ci->_is_admin_auth('cache/index')}
                            <li><a href="javascript:dr_go_url('{dr_url('cache/index')}');"><i class="fa fa-cogs"></i> {dr_lang('系统更新')}</a></li>
                            {/if}
                            {if $ci->_is_admin_auth('check/index')}
                            <li><a href="javascript:dr_go_url('{dr_url('check/index')}');"><i class="fa fa-wrench"></i> {dr_lang('系统体检')}</a></li>
                            {/if}
                            <li><a href="javascript:dr_update_cache_all();"><i class="fa fa-refresh"></i> {dr_lang('更新缓存')}</a></li>
                            <li><a href="javascript:dr_update_cache_data();"><i class="fa fa-trash"></i> {dr_lang('更新数据')}</a></li>
                            {if $admin.adminid==1}
                            <li class="divider"></li>
                            <li><a href="javascript:dr_go_url('{dr_url('error/index')}');"><i class="fa fa-shield"></i> {dr_lang('系统日志')}</a></li>
                            {/if}
                            {if $is_search_help}
                            <li><a href="http://help.xunruicms.com" target="_blank"><i class="fa fa-book"></i> {dr_lang('帮助手册')}</a></li>
                            {/if}
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>
<div class="clearfix"></div>
<div class="sidebar-overlay" id="min_sidebar_overlay"></div>
<div class="page-container">
    <div class="page-sidebar-wrapper">
        <div class="page-sidebar navbar-collapse collapse">
            <ul class="page-sidebar-menu page-header-fixed" data-slide-speed="200" data-auto-scroll="false" data-keep-expanded="false">
                {$string}
                {if $is_mobile}
                {if $ci->_is_admin_auth('cache/index')}
                <li class="nav-item nav-extra"><a href="javascript:dr_go_url('{dr_url('cache/index')}', 'null');"><i class="fa fa-cogs"></i> <span class="title">{dr_lang('系统更新')}</span></a></li>
                {/if}
                <li class="nav-item nav-extra"><a href="javascript:dr_update_cache_all();"><i class="fa fa-refresh"></i> <span class="title">{dr_lang('更新缓存')}</span></a></li>
                <li class="nav-item nav-extra"><a href="javascript:dr_update_cache_data();"><i class="fa fa-trash"></i> <span class="title">{dr_lang('更新数据')}</span></a></li>
                <li class="nav-item nav-extra"><a href="{dr_url('api/alogin', ['id'=>$admin.uid])}" target="_blank"><i class="fa fa-user"></i> <span class="title">{dr_lang('用户中心')}</span></a></li>
                {if !$is_mode}
                <li class="nav-item nav-extra"><a href="{dr_url('api/admin_all')}"><i class="fa fa-retweet"></i> <span class="title">{dr_lang('完整模式')}</span></a></li>
                {/if}
                <li class="nav-item nav-extra"><a href="javascript:;" onClick="dr_logout('{dr_url('login/out')}');"><i class="fa fa-user-times"></i> <span class="title">{dr_lang('退出系统')}</span></a></li>
                {/if}
            </ul>
        </div>
    </div>
    <div class="page-content-wrapper">
        <div class="page-content page-content-min">
            <div id="myiframe">
                <iframe class="myiframe" name="right" id="right_page" src="{$main_url}" url="{$main_url}" width="100%" height="auto" allowtransparency="true"></iframe>
            </div>
        </div>
    </div>
</div>
<script src="{$THEME_PATH}assets/global/scripts/min.js?v={CMF_UPDATE_TIME}" type="text/javascript"></script>
</body>
</html>
