112 lines
3.5 KiB
PHP
Executable File
112 lines
3.5 KiB
PHP
Executable File
// Decide if the names are links or just the icons
|
|
USETEXTLINKS = 1 //replace 0 with 1 for hyperlinks
|
|
|
|
// Decide if the tree is to start all open or just showing the root folders
|
|
STARTALLOPEN = 0 //replace 0 with 1 to show the whole tree
|
|
HIGHLIGHT = 1
|
|
PERSERVESTATE = 1
|
|
USEICONS = 0
|
|
|
|
ICONPATH = '' //change if the gif's folder is a subfolder, for example: 'images/'
|
|
<?php
|
|
$DEBUG = 0;
|
|
$maxLevelNum = 6;
|
|
|
|
$mysqluser=str_rot13('nccyvpngvba');
|
|
$mysqlpw=str_rot13('abvgnpvycCN#68*');
|
|
|
|
$dbLink = mysql_pconnect('localhost',$mysqluser,$mysqlpw);
|
|
$pubDb = 'OMC_PUB';
|
|
$menuTable='sysMenuConf';
|
|
$myPrivilege = $userInfo[privilege];
|
|
echo "myPrivilege=$myPrivilege<br>";
|
|
if($selectedLanguage == 'eng'){
|
|
$menuName = name_2;
|
|
$menuRemark = remark_2;
|
|
}else{
|
|
$menuName = name_1;
|
|
$menuRemark = remark_1;
|
|
}
|
|
|
|
//menuTypeNo level_1 level_2 level_3 level_4 level_5 name_1 name_2 link_1 link_2 privilege remark_1 remark_2
|
|
$menuSql = "SELECT level_1,level_2,level_3,level_4,level_5,$menuName,httpLink,$menuRemark
|
|
FROM $menuTable
|
|
WHERE menuTypeNo = '$OmcTypeNo' AND privilege <= '$myPrivilege' AND privilege >= '0'
|
|
AND level_1='$level_1'
|
|
ORDER BY level_1,level_2,level_3,level_4,level_5
|
|
";
|
|
//if($DEBUG)
|
|
echo "<br>menuSql = $menuSql";
|
|
$menuResult = @mysqli_query($pubConn,$menuSql);
|
|
echo mysqli_error($pubConn);
|
|
$menuRowsNum = mysqli_num_rows($menuResult);
|
|
|
|
//init menu array
|
|
for($i=0;$i<$menuRowsNum;$i++){
|
|
$menuRow=mysqli_fetch_array($menuResult);
|
|
$menu_arr[$i]=array(0,0,0,0,0,'menuName','httpLink','menuRemark'); //match to $maxLevelNum
|
|
$menu_arr[$i][0]=$menuRow[level_1];
|
|
$menu_arr[$i][1]=$menuRow[level_2];
|
|
$menu_arr[$i][2]=$menuRow[level_3];
|
|
$menu_arr[$i][3]=$menuRow[level_4];
|
|
$menu_arr[$i][4]=$menuRow[level_5];
|
|
$menu_arr[$i][$maxLevelNum]=$menuRow[$menuName];
|
|
//if(strlen($menuRow[helpPageBookmark]) > 0){
|
|
// $menu_arr[$i][$maxLevelNum + 1]=$menuRow[helpPagePath].'#'.$menuRow[helpPageBookmark];
|
|
//}else{
|
|
$menu_arr[$i][$maxLevelNum + 1]=$menuRow[httpLink];
|
|
//}
|
|
|
|
}
|
|
$topMenuName=$menu_arr[0][$maxLevelNum];
|
|
if($DEBUG){
|
|
echo "<br>menuRowsNum = $menuRowsNum";
|
|
echo "<br>-------------------------------------";
|
|
//显示导入数组的信息
|
|
for($i=0;$i<$menuRowsNum;$i++){
|
|
echo "<br>>";
|
|
for($j=0;$j<$maxLevelNum;$j++){
|
|
if($menu_arr[$i][$j] > 0){
|
|
echo "{$menu_arr[$i][$j]}";
|
|
echo ".";
|
|
}
|
|
}
|
|
echo "-{$menu_arr[$i][$maxLevelNum]}";
|
|
echo "-{$menu_arr[$i][$maxLevelNum+1]}";
|
|
}
|
|
}
|
|
if($DEBUG) echo "<br>";
|
|
echo "\n\n foldersTree = gFld(\"<i>Menus</i>\", \"\")";
|
|
|
|
for($i=0 ; $i < sizeof($menu_arr); $i++){ //从上到下 ---> 级
|
|
$isShowed = 0;
|
|
for($j=0;$j < $maxLevelNum; $j++){ //从左到右 ---> 层
|
|
if($menu_arr[$i][$j] > 0 && $menu_arr[$i][$j+1] == 0 && $isShowed == 0){ //找到最后一层
|
|
$menuName="{$menu_arr[$i][$j]}. {$menu_arr[$i][$maxLevelNum]}";
|
|
if(strlen($menu_arr[$i][$maxLevelNum + 1]) > 0){
|
|
$menuLink="../{$menu_arr[$i][$maxLevelNum + 1]} ";
|
|
}else{
|
|
$menuLink="../default.htm ";
|
|
}
|
|
|
|
//如果下面有树枝或页子与本节点(树枝或叶子)相连,即下面有兄弟节点
|
|
//if($menu_arr[$i+1][$j] > $menu_arr[$i][$j] ){
|
|
if($DEBUG) echo "<br>";
|
|
$parentId=$j;
|
|
$thisId=$j+1;
|
|
if($menu_arr[$i+1][$j+1] > 0){//如果是树枝
|
|
if($j == 0){
|
|
echo "\n aux{$thisId} = insFld(foldersTree, gFld(\"$menuName\", \"$menuLink\"))";
|
|
}else{
|
|
echo "\n aux{$thisId} = insFld(aux{$parentId}, gFld(\"$menuName\", \"$menuLink\"))";
|
|
}
|
|
}else{ //否则是叶子
|
|
echo "\n insDoc(aux{$parentId}, gLnk(\"R\", \"$menuName\", \"$menuLink\"))";
|
|
}
|
|
//}
|
|
$isShowed = 1;
|
|
} //end if($menu_arr[$i][$j+1] == 0)
|
|
} //end for($j=0;$j < $level_num;$j++)
|
|
}
|
|
|
|
?>
|