1
0
Fork 0
MastodonStartpage/web/admin/include/menu.php
pezcurrel 93692a43ed ...
2020-01-08 14:52:20 +01:00

51 lines
1.7 KiB
PHP

<?php
$menu=array(
'istanze'=>array('liadd'=>null, 'href'=>'istanze.php', 'title'=>'Istanze', 'selected'=>false, 'submenu'=>
array(
'aggiungi'=>array('liadd'=>null, 'href'=>'editinst?m=new', 'title'=>'Aggiungi', 'selected'=>false, 'submenu'=>null),
)
),
'blacklist'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Blacklist', 'selected'=>false, 'submenu'=>null),
'magari'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Chissà', 'selected'=>false, 'submenu'=>null),
'forse'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Forse', 'selected'=>false, 'submenu'=>null)
);
/*
<li><a href=".">Guide</a></li>
<li><a href="instances">Instances</a></li>
<li><a href="about">About us</a></li>
<li onmouseover="chulsh(this,true)" onmouseout="chulsh(this,false)">Language
<ul class="ula" onmouseover="ulsh(this,true)" onmouseout="ulsh(this,false)">
<li><a href="#">English</a></li>
<li><a href="#">Italiano</a></li>
</ul>
</li>
*/
$menuout='';
function buildmenu($menu) {
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']))
$menuout.='<a href="'.$arr['href'].'">'.$arr['title'].'</a>';
else
$menuout.=$arr['title'];
if (!is_null($arr['submenu'])) {
// qui bisognerebbe aggiungere che a seconda del "livello" imposta class giusta: ula, oppure ulb per livello > 1
$menuout.=N.'<ul class="ula" onmouseover="ulsh(this,true)" onmouseout="ulsh(this,false)">'.N;
buildmenu($arr['submenu']);
$menuout.='</ul>'.N;
}
$menuout.='</li>'.N;
}
}
?>