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


<?php
foreach ($my_menu as $tid => $topm) {
$_left = 0; // 是否第一个分组菜单，0表示第一个
$_link = 0; // 是否第一个链接菜单，0表示第一个
$left_string = '';
$mleft_string = [];
!$first && $first = $tid;
foreach ($topm['left'] as $if => $left) {
// 链接菜单开始
$link_string = '';
$mlink_string = '';
foreach ($left['link'] as $i => $link) {
$url = $link['url'];
if (!$_link) {
// 第一个链接菜单时 指定class
$class = 'nav-item active open';
$topm['url'] = $link['url'];
$topm['link_id'] = $link['id'];
$topm['left_id'] = $left['id'];
} else {
$class = 'nav-item';
}
$_link = 1; // 标识以后的菜单就不是第一个了
$link_string.= '<li id="dr_menu_link_'.$link['id'].'" class="'.$class.'"><a href="javascript:Mlink('.$tid.', '.$left['id'].', '.$link['id'].', \''.$url.'\');" class="tooltips" data-container="body" data-placement="right" data-original-title="'.dr_lang($link['name']).'" title="'.dr_lang($link['name']).'"><i class="iconm '.$link['icon'].'"></i> <span class="title" title="'.dr_lang($topm['name']).' - '.dr_lang($left['name']).' - '.dr_lang($link['name']).'">'.dr_lang($link['name']).'</span></a></li>';
$mlink_string.= '<li id="dr_menu_m_link_'.$link['id'].'" class="'.$class.'"><a href="javascript:Mlink('.$tid.', '.$left['id'].', '.$link['id'].', \''.$url.'\');"><i class="iconm '.$link['icon'].'"></i> <span class="title" title="'.dr_lang($topm['name']).' - '.dr_lang($left['name']).' - '.dr_lang($link['name']).'">'.dr_lang($link['name']).'</span></a></li>';
}
$left_string.= '
<li id="dr_menu_left_'.$left['id'].'" class="dr_menu_'.$tid.' dr_menu_item nav-item '.($_left ? '' : 'active open').' " style="'.($first==$tid ? '' : 'display:none').'">
    <a href="javascript:;" class="nav-link nav-toggle tooltips" data-container="body" data-placement="right" data-original-title="'.dr_lang($left['name']).'">
        <i class="'.$left['icon'].'"></i>
        <span class="title">'.dr_strcut(dr_lang($left['name']), 5).'</span>
        <span class="selected" style="'.($_left ? 'display:none' : '').'"></span>
        <span class="arrow '.($_left ? '' : ' open').'"></span>
    </a>
    <ul class="sub-menu">'.$link_string.'</ul>
</li>';
$mleft_string[] = $mlink_string;
$_left = 1; // 标识以后的菜单就不是第一个了
}
$string.= $left_string;
$mstring.= '<li class="dropdown dropdown-extended dropdown-tasks fc-mb-sum-menu" id="dr_m_top_'.$tid.'" style=" '.($first == $tid ? '' : 'display:none').'">
    <a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
        <i class="fa fa-angle-down"></i>
    </a>
    <ul class="dropdown-menu" role="menu">
        '.implode('<li class="divider"> </li>', $mleft_string).'
    </ul>
</li>';
$menu_top[$tid] = $topm;
}
// 自定义后台菜单显示
if (function_exists('dr_my_admin_menu')) {
list($string, $mstring, $menu_top, $first) = dr_my_admin_menu($my_menu, $string, $mstring, $menu_top, $first);
}
$top = $menu_top;
?>
<body scroll="no" style="overflow: hidden;" class="page-sidebar-closed-hide-logo page-admin-all page-content-white 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" alt="logo" class="logo-default" /> </a>
        </div>
        <a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse" data-target=".navbar-collapse">
            <span></span>
        </a>
        {if SYS_NOT_ADMIN_CACHE}
         <div class="top-menu my-top-left pull-left">
            <ul class="nav navbar-nav pull-left fc-all-menu-top ">
                {loop $top $t}
                <li id="dr_menu_top_{$t.id}" class="dropdown {if $t.id==$first}open{/if}">
                    <a class="dropdown-toggle popovers" href="javascript:Mlink('{$t.id}', '{$t.left_id}', '{$t.link_id}', '{$t.url}');">
                        <div class="menu-top-icon"><i class="{$t.icon}"></i></div>
                        <div class="menu-top-name"><i class="top-txt-menu">{dr_lang($t.name)}</i></div>
                    </a>
                </li>
                {/loop}
            </ul>
        </div>
        {else}
        <div class="top-menu my-top-left pull-left">
            {if !$is_mobile}
            <ul class="page-toolbar qs-top-menu  pull-left" id="dr_go_url">
                <li class="qs-top-refresh" id="dr_tab_close"><a href="javascript:dr_tab_update();"><i class="fa fa-refresh"></i></a></li>
            </ul>
            {/if}
        </div> 
        {/if}
        <div class="top-menu my-top-right">
            <ul class="nav navbar-nav pull-right">
                {if $is_mobile}
                <li class="dropdown fc-mini-menu-top">
                    <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
                        <i class="fa fa-bars"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-menu-default fc_mini_menu_top">
                        {loop $top $t}
                        <li>
                            <a id="dr_mini_menu_top_{$t.id}" class="dr_mini_menu_top {if $t.id==$first}open{/if}" href="javascript:Mlink('{$t.id}', '{$t.left_id}', '{$t.link_id}', '{$t.url}');">
                                <i class="{$t.icon}"></i> {dr_lang($t.name)}
                            </a>
                        </li>
                        {/loop}
                    </ul>
                </li>
                {$mstring}
                {/if}

                {if dr_is_app('ai_helper')}
                <li class="dropdown dropdown-extended">
                    <a href="javascript:;" onclick="dr_iframe_show('{dr_lang('AI助手')}', '{dr_url('ai_helper/api/index')}')" 
                    class="dropdown-toggle tooltips" data-container="body" data-placement="left" data-original-title="{dr_lang('AI助手')}">
                        <div class="menu-top-icon"><i class="fa fa-adn"></i></div>
                    </a>
                </li>
                {/if}

                {if count($ci->site_info) > 1 && dr_is_app('sites')}
                <li class="dropdown dropdown-extended dropdown-tasks">
                    <a href="javascript:;" class="dropdown-toggle " data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
                        <div class="menu-top-icon"><i class="fa fa-share-alt"></i>
                        </div>
                    </a>
                    <ul class="dropdown-menu extended tasks">
                        <li>
                            <ul class="dropdown-menu-list scroller" style="height:400px;overflow: scroll;" data-handle-color="#637283">
                                {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}style="color:red"{/if}>
                                        <p style="margin: 0">{dr_strcut($t.SITE_NAME, 30)}</p>
                                        <p style="margin: 0;margin-top: -4px;">{trim(str_replace(['http://', 'https://'], '', $t.SITE_URL), '/')}</p>
                                    </a>
                                </li>
                                {/if}
                                {/loop}
                                {if $ci->_is_admin_auth('sites/home/index')}
                                <li class="external text-center">
                                    <a href="javascript:dr_go_url('{dr_url('sites/home/index')}', '{dr_lang('站点管理')}');">{dr_lang('站点管理')}</a>
                                </li>
                                {/if}
                            </ul>
                        </li>
                    </ul>
                </li>
                {/if}
                <?php $notice = \Phpcmf\Service::M('auth')->admin_notice(10, true);?>
                {if $notice}
                <li class="dropdown dropdown-extended dropdown-notification">
                    <a href="javascript:;" class="dropdown-toggle "  data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
                        <div class="menu-top-icon"><i class="fa fa-bell"></i>
                        </div>
                    </a>
                    <ul class="dropdown-menu extended tasks">
                        <li>
                            <ul class="dropdown-menu-list scroller" style="height:400px;overflow: scroll;" data-handle-color="#637283">
                                {loop $notice $t}
                                <li>
                                    <a  onclick="dr_hide_left_tab()" href="javascript:dr_go_url('{dr_url('api/notice', array('id' => $t.id))}');">
                                        <span class="time">{dr_fdate($t.inputtime)}</span>
                                        <span class="details"> {$t.msg} </span>
                                    </a>
                                </li>
                                {/loop}
                                {if $ci->_is_admin_auth('notice/index')}
                                <li class="external text-center">
                                    <a href="javascript:dr_go_url('{dr_url('notice/index')}', '{dr_lang('更多提醒')}');">{dr_lang('更多提醒')}</a>
                                </li>
                                {/if}
                            </ul>
                        </li>
                    </ul>
                </li>
                {/if}

                {if $is_mobile}
                <li class="dropdown">
                    <a href="javascript:;"  class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
                        <div class="menu-top-icon"> <i class="fa fa-wrench"></i> </div>
                        <div class="menu-top-icon"><i class="top-txt-menu">{dr_lang('账号')}</i></div>
                    </a>
                    {else}
                <li class="dropdown dropdown-user">
                    <a style="margin-right: -10px;" href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
                        <img alt="{$admin['username']}" class="img-circle" src="{dr_avatar($admin.uid)}" />
                    </a>
                    {/if}
                    <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')}', '{dr_lang('修改资料')}');"><i class="fa fa-edit"></i> {dr_lang('修改资料')} </a></li>
                        <li><a href="{dr_url('api/admin_min')}"><i class="fa fa-retweet"></i> {dr_lang('简化模式')}</a></li>
                        <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')}', '{dr_lang('系统更新')}');"><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')}', '{dr_lang('系统体检')}');"><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(1);"><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')}', '{dr_lang('系统日志')}');"><i class="fa fa-shield"></i> {dr_lang('系统日志')}</a></li>
                        {/if}
                        {if $is_search_help}
                        <li><a href="https://www.xunruicms.com/doc/" target="_blank"><i class="fa fa-book"></i> {dr_lang('帮助手册')}</a></li>
                        {/if}
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</div>

<div class="clearfix"> </div>

<div class="page-container">
    <div class="page-sidebar-wrapper">

        {if !SYS_NOT_ADMIN_CACHE}
        <div class="page-sidebar-one ">
            <ul class="fc-all-menu-top ">
                {loop $top $t}
                <li id="dr_menu_top_{$t.id}" class="dropdown {if $t.id==$first}open{/if}">
                    <a class="dropdown-toggle popovers" href="javascript:Mlink('{$t.id}', '{$t.left_id}', '{$t.link_id}', '{$t.url}');">
                        <div class="menu-top-icon"><i class="{$t.icon}"></i></div>
                        <div class="menu-top-name"><i class="top-txt-menu">{dr_lang($t.name)}</i></div>
                        <span class="selected"></span>
                    </a>
                </li>
                {/loop}
            </ul>
        </div>
        {/if}
        <div class="page-sidebar navbar-collapse collapse">

            <ul class="page-sidebar-menu  page-header-fixed  page-sidebar-menu-light" data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200">
              
                {$string}
            </ul>
        </div>
    </div>
    <div class="page-content-wrapper">
        <div class="page-content index-content">
            <div id="myiframe" cid="right_page">
                <iframe class="myiframe active" name="right" id="right_page" data-top="{$main_menu.tid}" data-left="{$main_menu.pid}" data-link="{$main_menu.id}" src="{$main_url}" url="{$main_url}" style="border:none; margin-bottom:0px;" width="100%" height="auto" allowtransparency="true"></iframe>
            </div>
        </div>
    </div>


</div>
<script>
    $(function() {
        dr_go_url("{$main_url}", "{$main_name}", true, {$main_menu.tid}, {$main_menu.pid}, {$main_menu.id});
    });
    // 关闭栏
    function dr_hide_left_tab() {
        $(".page-quick-sidebar-toggler").click();
    }
    if (self != top) {
        top.location.href = admin_file;
    }
    var url = '{dr_url_prefix('/')}';
    var p = url.split('/');
    var ptl = document.location.protocol;
    if ((p[0] == 'http:' || p[0] == 'https:') && ptl != p[0]) {
        alert('当前访问是'+ptl.replace(':', '')+'模式，本项目设置的是'+p[0].replace(':', '')+'模式，请使用'+p[0].replace(':', '')+'模式访问，会导致部分功能无法正常使用');
    }
</script>
</body>
</html>