MastodonHelp/web/lib/menu.php

58 lines
2.4 KiB
PHP
Raw Normal View History

2023-12-26 11:16:24 +01:00
<?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),
'noxious'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Nocive', 'selected'=>false, 'submenu'=>null),
'notifs'=>array('liadd'=>null, 'href'=>'notifs.php', 'title'=>'Notifiche', 'selected'=>false, 'submenu'=>null),
'accounts'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Accounts', 'selected'=>false, 'submenu'=>null),
'account'=>array('liadd'=>null, 'href'=>'account.php?id='.$account['ID'], 'title'=>'Il tuo account', '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'=>'account.php?id='.$account['ID'], 'title'=>'Your 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;
}
}
?>