迅睿CMS框架是一款PHP8高性能·简单易用的CMS开源开发框架,基于MIT开源许可协议发布,免费且不限制商业使用,是免费开源的产品,以万端互联为设计理念,支持的微信公众号、小程序、APP客户端、移动端网站、PC网站等多终端式管理系统。
联系官方销售客服
1835022288
028-61286886
function dr_my_admin_min_menu($menu,$string = ''){ $my_menu = []; $string = ''; $my_menu = []; if (\Phpcmf\Service::C()->admin['adminid'] > 1) { foreach ($menu as $t) { @in_array($t['mark'], \Phpcmf\Service::C()->admin['system']['mark']) && $my_menu[$t['id']] = $t; } } else { $my_menu = $menu; } if ($my_menu) { // 权限判断并筛选 $tid = 0; $first = 0; foreach ($my_menu as $left) { if (!$left['link']) { continue; // 没有分组菜单就不要 } elseif (SITE_ID > 1 && !in_array(SITE_ID, $left['site'])) { continue; // 没有划分本站点就不显示 } $_link = 0; // 是否第一个链接菜单,0表示第一个 $left_string = ''; // 链接菜单开始 $link_string = ''; foreach ($left['link'] as $i => $link) { if ($link['uri'] && !\Phpcmf\Service::C()->_is_admin_auth($link['uri'])) { // 判断权限 unset($left['link'][$i]); continue; } elseif ($link['mark'] && $left['mark'] == 'content-module') { // 内容模块权限判断 list($ac, $name) = explode('-', $link['mark']); if ($ac == 'module' && !\Phpcmf\Service::C()->get_cache('module-'.SITE_ID.'-content', $name)) { unset($left['link'][$i]); continue; } } elseif (SITE_ID > 1 && !in_array(SITE_ID, $link['site'])) { // 没有划分本站点就不显示 unset($left['link'][$i]); continue; } elseif (SITE_ID > 1 && $link['uri'] && $link['uri'] == 'cloud/local') { // 多站点不显示应用 unset($left['link'][$i]); continue; } elseif ($link['mark'] && $left['mark'] == 'content-form') { // 网站表单权限判断 list($ac, $name) = explode('-', $link['mark']); if ($ac == 'form' && !\Phpcmf\Service::C()->get_cache('form-'.SITE_ID, $name)) { unset($left['link'][$i]); continue; } } elseif ($link['mark'] && $left['mark'] == 'content-verify') { // 内容模块审核部分权限判断 list($ac, $ab, $name, $cc) = explode('-', $link['mark']); if ($ac.'-'.$ab == 'verify-module' && !\Phpcmf\Service::C()->get_cache('module-'.SITE_ID.'-content', $name)) { unset($left['link'][$i]); continue; } elseif ($ac.'-'.$ab == 'verify-comment' && !\Phpcmf\Service::C()->get_cache('module-'.SITE_ID.'-content', $name, 'comment')) { unset($left['link'][$i]); continue; } elseif ($ac.'-'.$ab == 'verify-mform' && !\Phpcmf\Service::C()->get_cache('module-'.SITE_ID.'-'.$name, 'form', $cc)) { unset($left['link'][$i]); continue; } elseif ($ac.'-'.$ab == 'verify-form' && !\Phpcmf\Service::C()->get_cache('form-'.SITE_ID, $name)) { unset($left['link'][$i]); continue; } } $url = $link['url'] ? $link['url'] :\Phpcmf\Service::L('Router')->url($link['uri']); if (!$_link) { // 第一个链接菜单时 指定class $class = 'nav-item active open'; $top['url'] = $url; $top['link_id'] = $link['id']; $top['left_id'] = $left['id']; } else { $class = 'nav-item'; } $_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>'; } if (!$link_string) { continue; // 没有链接菜单就不要 } $left_string.= ' <li id="dr_menu_left_'.$left['id'].'" class="dr_menu_'.$tid.' dr_menu_item nav-item '.($first ? '' : 'active open').' " > <a href="javascript:;" class="nav-link nav-toggle"> <i class="'.$left['icon'].'"></i> <span class="title">'.dr_strcut(dr_lang($left['name']), 5).'</span> <span class="selected" style="'.($first ? 'display:none' : '').'"></span> <span class="arrow '.($first ? '' : ' open').'"></span> </a> <ul class="sub-menu">'.$link_string.'</ul> </li>'; !$first && $first = 1; $string.= $left_string; } } return $string; }