1
0
Fork 0
MastodonStartpage/web/mustard/include/menu.php
pezcurrel 85876775c4 ...
2020-05-07 07:24:56 +02:00

56 Zeilen
2,2 KiB
PHP

<?php
if ($account['Level']!='guest') {
$menu=array(
'menu'=>array('liadd'=>null, 'href'=>null, 'title'=>'Menu', 'selected'=>false, 'submenu'=>
array(
'instances'=>array('liadd'=>null, 'href'=>'instances.php', 'title'=>'Istanze', 'selected'=>false, 'submenu'=>null),
'blacklist'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Blacklist', 'selected'=>false, 'submenu'=>null),
'accounts'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Accounts', 'selected'=>false, 'submenu'=>null),
'notifs'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Notifiche', 'selected'=>false, 'submenu'=>null),
'logout'=>array('liadd'=>null, 'href'=>'logout.php', 'title'=>'Logout', 'selected'=>false, 'submenu'=>null)
)
)
);
} else {
$menu=array(
'menu'=>array('liadd'=>null, 'href'=>null, 'title'=>'Menu', 'selected'=>false, 'submenu'=>
array(
'instances'=>array('liadd'=>null, 'href'=>'guestinsts.php', 'title'=>'Instances', 'selected'=>false, 'submenu'=>null),
'account'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Account', 'selected'=>false, 'submenu'=>null),
'logout'=>array('liadd'=>null, 'href'=>'logout.php', 'title'=>'Logout', 'selected'=>false, 'submenu'=>null),
)
)
);
}
// $menuout va sempre wrappato in <ul></ul> che abbia una classe css come quella che si vede in theme.css ("#hmenu ul" ecc.)
$menuout='';
function buildmenu($menu,$submenu=false) {
global $menuout;
foreach ($menu as $key=>$arr) {
$menuout.='<li';
if (!is_null($arr['liadd'])) $menuout.=' '.$arr['liadd'];
if (!is_null($arr['submenu'])) $menuout.=' onmouseover="chulsh(this,true)" onmouseout="chulsh(this,false)"';
if ($arr['selected']) $menuout.=' class="hil"';
$menuout.='>';
if (!is_null($arr['href'])) {
if (!$arr['selected'])
$menuout.='<a href="'.$arr['href'].'">'.$arr['title'].'</a>';
else
$menuout.='<a href="'.$arr['href'].'" class="shref">'.$arr['title'].'</a>';
} else {
$menuout.=$arr['title'];
}
if (!is_null($arr['submenu'])) {
($submenu) ? $class='ulb' : $class='ula';
$menuout.=N.'<ul class="'.$class.'" onmouseover="ulsh(this,true)" onmouseout="ulsh(this,false)">'.N;
buildmenu($arr['submenu'],true);
$menuout.='</ul>'.N;
}
$menuout.='</li>'.N;
}
}
?>