<?php  
//第一層選單權限內id
function level_permissions($displaytype="",$finish=""){
    $where = "  where `of_sortid` = '0'  && `enable` = '1'  &&  FIND_IN_SET(".$displaytype.",`displaytype`) order by  sortidsort  ASC";    
    $i=0;
    $legal = array(); // 新增一個陣列來儲存子層選單
    foreach ($sortArr = databasetablewhile($dbneme="neothemesmenu", $where) as $key => $val) {
	//群組觀看權限
	if(!empty(grouppermission($dbneme="neothemesmenu",$where="  where `sortid` = '".$sortArr[$key]['sortid']."' order by  sortid  ASC",$var="browsegroup",$type=true))) {
    $legal[]=$sortArr[$key]['sortid'];
	$i++;
	}	
	if($i==$finish) break;
	}
    return $legal;
}

//管理按鈕
function menu_admin_btn($setting="",$listval=""){
global $isAdmin;	
if(!empty($isAdmin) && $setting['themefolder']=='computer') $adminbtn='<span id="adminbtn"><a  title="'.sprintf(_MB_SHOWTHENUMBER23,$listval['sorttitle']).'" href="'.XOOPS_URL.'/modules/neothemesadmin/admin/menutable.php?groupid='.$listval['sortid'].'"><i class="fa fa-cog" aria-hidden="true"></i></a></span>';
return $adminbtn;
}


//輸出主選單
$blockmenu['mt_group']=neothemesadmin_menurecursion($sortid="0", $dbneme="neothemesmenu", $sublayer="0", $order="order by  sortidsort  ASC",$displaytype="1",$limit=$fieldsplit[15],$legal=level_permissions($displaytype="1",$finish=$fieldsplit[15]));
//輸出底選單
$blockmenu['mb_group']=neothemesadmin_menurecursion($sortid="0", $dbneme="neothemesmenu", $sublayer="0", $order="order by  sortidsort  ASC",$displaytype="2",$limit=$fieldsplit[16],$legal=level_permissions($displaytype="2",$finish=$fieldsplit[16]));
//資料庫
$blockmenu['db_name']="neothemesmenu";
	
$xoopsTpl->assign("setting", $setting);
$xoopsTpl->assign("btnpadding", $fieldsplit[20]);
$xoopsTpl->assign("blockmenu", $blockmenu);
$xoopsTpl->assign("bbtnstyle", neothemesadmin_btnquantitystyle($menuval=$fieldsplit[16],$key="bottom"));
?>