<nav class="main-header navbar navbar-expand navbar-white navbar-light">
  <ul class="nav navbar-nav">
    <li class="nav-item">
      <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
    </li>
    <li class="nav-item d-none d-sm-inline-block">
      <a href="{ROOT}" class="nav-link">
        <i class="fa fa-home" aria-hidden="true"></i> 首页
      </a>
    </li>
    {yy:cat level=1}
    {loop}
    <li class="nav-item d-none d-sm-inline-block">
      <a href="{$v.url}" class="nav-link">
        {$v.title}
      </a>
    </li>
    {/loop}
    {/yy}
  </ul>
  <!-- Navbar Right Menu -->
  <ul class="navbar-nav ml-auto">
    <!-- User Account: style can be found in dropdown.less -->
    <li class="nav-item dropdown user user-menu tipright">

      <a href="#" class="dropdown-toggle" data-toggle="dropdown">
        <img src="/public/ui/dist/img/user.png" class="user-image" alt="User Image">
        <span class="hidden-xs">{$member.username}</span>
      </a>
      <ul class="dropdown-menu">
        <!-- User image -->
        <li class="user-header">
          <img src="/public/ui/dist/img/user.png" class="img-circle" alt="User Image">
          <p class="text-white">
            {php echo GetMemberGroupName($member["groupid"]);} <small>上次登录： <php>if($member['lastlogintime']){echo
                date('Y-m-d H:i:s',$member['lastlogintime']);}else{
                echo date('Y-m-d H:i:s',$member['addtime']);
                }</php></small>
          </p>
        </li>
        <!-- Menu Footer-->
        <li class="user-footer">
          <div class="float-left">
            <a href="<?php echo url('member/member/myinfo');?>" class="btn btn-info btn-flat" target="maincontent"><i
                class="fa fa-user"></i> 个人资料</a>
          </div>
          <div class="float-right">
            <a href="{php echo url('member/member/logout');}" class="btn btn-danger btn-flat"><i
                class="fa fa-close"></i> 退 出</a>
          </div>
        </li>
      </ul>
    </li>
    <li class="nav-item">
      <a class="nav-link" data-widget="fullscreen" href="#" role="button">
        <i class="fas fa-expand-arrows-alt"></i>
      </a>
    </li>
  </ul>
</nav>

<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar sidebar-dark-primary">
  <!-- Logo -->
  <a href="{ROOT}" class="brand-link" target="_blank">
    <img src="<?php echo YUNYECMS_UI; ?>dist/img/logo-member.png" alt="{$lang.sitename}"
      class="brand-image img-circle elevation-3" style="opacity: .8">
    <span class="brand-text font-weight-light">{$lang.sitename}</span>
  </a>
  <!-- sidebar: style can be found in sidebar.less -->
  <div class="sidebar">
    <!-- Sidebar user panel -->
    <div class="user-panel mt-3 pb-3 mb-3 d-flex">
      <div class="info">
        <a href="{php echo url('member/member/myinfo');}" class="d-block"><i class="fa fa-circle text-yellow"></i>
          {$member.username} &nbsp;&nbsp;{php echo GetMemberGroupName($this->member["groupid"]);}</a>
      </div>
    </div>
    <!-- sidebar menu: : style can be found in sidebar.less -->
    <php>
      $cssmember="";
      $cssorder="";
      if((ROUTE_C=='membergroup_orders'||ROUTE_C=='grant_orders'||ROUTE_C=='ucontent'||ROUTE_A=='mygrant'||ROUTE_A=='addons'||ROUTE_C=='orders')||(ROUTE_C=='member'&&
      ROUTE_A=='index')){
      $cssorder="menu-open active";
      }else{
      $cssmember="menu-open active";
      }
    </php>
    <nav class="mt-2">
      <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
        <li class="nav-item  {$cssorder}">
          <a href="#" class="nav-link">
            <i class="fa fa-files-o"></i>
            <p>
              基础信息管理
              <i class="right fas fa-angle-left"></i>
            </p>
          </a>
          <ul class="nav nav-treeview  menu-open ">
            <li {if ROUTE_C=='orders' &&ROUTE_A=='index' } class="nav-item  active" {/if}> <a class="nav-link"
                href="<?php echo url('shop/orders/index');?>"> <i class="fa fa-list"></i>
                <p>订单管理</p>
              </a></li>
            <li {if ROUTE_C=='ucontent' } class="nav-item  menu-open active" {else} class="nav-item" {/if}>
              <a href="#" class="nav-link"><i class="fa fa-circle"></i>
                <p>
                  内容管理
                  <i class="right fas fa-angle-left"></i>
                </p>
              </a>
              <ul class="nav nav-treeview">
                {yy:cat level="3" tougao="1" pid="0" }
                {loop item="vo"}
                <?php if($vo['child']){
                                              $onearrowcss=' <i class="right fas fa-angle-left"></i>';
                                              $onetitleurl="javascript:;";  
                                                  if($catid==$vo['id']||$parentid==$vo['id']||$scatid==$vo['id']||$rootcatid==$vo['id']){ 
                                                   $onecurcss=' class="nav-item active"';
                                                   $onesubcss='class="nav nav-treeview menu-open" style="display: block;"';
                                                   }else{ $onecurcss='class="nav-item"';  $onesubcss='class="nav nav-treeview" '; }
                                              }else{ $onearrowcss='';
                                               $modeltype=getmodeltype($vo["modelid"]);
                                               $onetitleurl=url('member/ucontent/'.$modeltype.'',array('catid'=>$vo['id']));
                                               if($catid==$vo['id']||$parentid==$vo['id']||$scatid==$vo['id']||$rootcatid==$vo['id']){ 
                                               $onecurcss=' class="nav-item active"';
                                               }else{ $onecurcss='class="nav-item"';}
                                           }
                                           ?>
                <li {$onecurcss}><a href="{$onetitleurl}" class="nav-link"><i class="far fa-circle nav-icon"></i>
                    <p> {$vo.title} {$onearrowcss} </p>
                  </a>
                  <?php if($vo['child']): ?>
                  <ul {$onesubcss}>
                    {loop name="vo['child']" index="k2" item="vo_cat2" }
                    <?php if($vo_cat2['child']){
                                           $twotitleurl="javascript:;"; 
                                           if($catid==$vo_cat2['id']||$parentid==$vo_cat2['id']){ 
                                           $twocurcss=' class="nav-item active"';
                                           $twosubcss='class="nav nav-treeview menu-open" style="display: block;"';
                                           }else{ $twocurcss=' class="nav-item';  $twosubcss='class="nav nav-treeview" '; }
								      } else{
                                      $modeltype2=getmodeltype($vo_cat2["modelid"]);
									  $twotitleurl=url('member/ucontent/'. $modeltype2.'',array('catid'=>$vo_cat2['id']));
									  }
									  if($catid==$vo_cat2['id']){ 
									  $onecurcss=' class="nav-item active"';
									  $twocurcss=' class="nav-item active"';
									  }else{  $onecurcss='class="nav-item"';$twocurcss='class="nav-item"'; }
							?>
                    <li {$twocurcss}><a href="{$twotitleurl}" class="nav-link"><i class="far fa-circle nav-icon"></i>
                        <p> {$vo_cat2.title}
                          <?php if($vo_cat2['child']): ?><i class="right fas fa-angle-left"></i>
                          <?php endif; ?>
                        </p>
                      </a>
                      <?php if($vo_cat2['child']): ?>
                      <ul {$twosubcss}>
                        {loop name="vo_cat2['child']" index="k3" item="vo_cat3" }
                        <?php 
                    $modeltype3=getmodeltype($vo_cat3["modelid"]);
									  $threetitleurl=url('member/ucontent/'. $modeltype3.'',array('catid'=>$vo_cat3['id']));
									  if($catid==$vo_cat3['id']){ 
									  $onecurcss=' class="nav-item active"';
									  $twocurcss=' class="nav-item active"';
									  $threecurcss=' class="nav-item active"';
									  }else{  $onecurcss='class="nav-item"';$twocurcss='class="nav-item "';$threecurcss='class="nav-item"'; }
							    ?>
                        <li {$threecurcss}><a href="{$threetitleurl}" class="nav-link"><i
                              class="far fa-dot-circle nav-icon"></i>
                            <p>{$vo_cat3.title}</p>
                          </a></li>
                        {/loop}
                      </ul>
                      <?php endif; ?>
                    </li>
                    {/loop}
                  </ul>
                  <?php endif; ?>
                </li>
                {/loop}
                {/yy}
              </ul>
            </li>
          </ul>
        </li>

        <li class="nav-item {$cssorder}">
          <a href="#" class="nav-link">
            <i class="fa fa-files-o"></i>
            <p>
              我的订单
              <i class="right fas fa-angle-left"></i>
            </p>
          </a>
          <ul class="nav nav-treeview">
            <li {if ROUTE_C=='membergroup_orders' } class=" nav-item active" {/if}> <a class="nav-link"
                href="<?php echo url('member/membergroup_orders/index');?>"> <i class="fa fa-circle"></i>
                <p>会员升级订单</p>
              </a>
            </li>
            <li {if ROUTE_C=='orders' &&ROUTE_A=='index' } class="nav-item active" {/if}> <a class="nav-link"
                href="<?php echo url('shop/orders/index');?>"> <i class="fa fa-list"></i>
                <p>产品订单</p>
              </a></li>
          </ul>
        </li>
        <li class="{$cssmember} nav-item">
          <a href="#" class="nav-link">
            <i class="fa fa-user-o"></i>
            <p>
              会员中心
              <i class="right fas fa-angle-left"></i>
            </p>
          </a>
          <ul class="nav nav-treeview">
            <li {if ROUTE_A=='index' &&ROUTE_C=='member' } class="nav-item active" {/if}><a class="nav-link"
                href="{php echo url('member/member/index');}"><i class="fa fa-home"></i>
                <p>会员首页</p>
              </a></li>
            <li {if ROUTE_C=='membergroup_goods' } class="nav-item active" {/if}><a class="nav-link"
                href="<?php echo url('member/membergroup_goods/index');?>"> <i class="fa fa-user"></i>
                <p>会员升级</p>
              </a></li>
            <li {if ROUTE_A=='myinfo' } class="active" {/if}><a href="{php echo url('member/member/myinfo');}"
                class="nav-link"> <i class="fa fa-user"></i>
                <p>我的资料</p>
              </a></li>

            <li {if ROUTE_C=='cart' } class="nav-item active" {/if}> <a href="<?php echo url('shop/cart/index');?>"
                class="nav-link"> <i class="fa fa-shopping-cart"></i>
                <p>购物车</p>
              </a></li>



            <li {if ROUTE_C=='notice' } class="nav-item active" {/if}> <a class="nav-link"
                href="<?php echo url('member/notice/index');?>"> <i class="fa fa-bullhorn"></i>
                <p>通知消息</p>
              </a></li>
            {yy:cat pid="9"}
            {loop}
            <li {if ROUTE_A=='customform' } class="nav-item active" {/if}><a class="nav-link"
                href="<?php echo url('member/member/customform',array('catid'=>$v['id']));?>"> <i
                  class="fa fa-commenting-o"></i>
                <p>我的{$v.title}</p>
              </a>
            </li>
            {/loop}
            {/yy}
            <li {if ROUTE_A=='pwd' } class="nav-item active" {/if}> <a class="nav-link"
                href="<?php echo url('member/member/pwd');?>">
                <i class=" fa fa-lock"></i>
                <p>修改密码</p>
              </a></li>
            <li {if ROUTE_A=='logout' } class="nav-item active" {/if}> <a class="nav-link"
                href="<?php echo url('member/member/logout');?>">

                <i class="fas fa-sign-out-alt"></i>
                <p>退出</p>
              </a></li>
          </ul>
        </li>
      </ul>
    </nav>
  </div>
  <!-- /.sidebar -->
</aside>