// ----------------------------------------------------
function wow_menu($atts) {
//
// Analyze tag
extract(lAtts(array(
'start' => 'root',
'hide' => '',
'showparent' => '1',
),$atts));
$menuRendered = displayMenu($start, $hide, $showparent);
return($menuRendered);
}
// ----------------------------------------------------
// Add a new tab to the Content area.
if (@txpinterface == 'admin') {
$myevent = 'menu_control';
$mytab = 'Menu control';
// Set the privilege levels for our new event
add_privs($myevent, '1,2');
// Add a new tab under 'extensions' associated with our event
register_tab("extensions", $myevent, $mytab);
// Register wow_menu_control as callback function
register_callback("wow_menu_control", $myevent);
}
function wow_menu_control($event, $step) {
pagetop("Menu Control");
echo <<
h1 { text-align:center; }
#menubox {
width:500px;
text-align:center;
margin-left:auto;
margin-right:auto;
}
#menutree {
text-align:left;
margin-left:-30px;
}
#menubox a {
font-weight:bold;
font-size:14px;
}
#menutree li,
#menutree li li,
#menutree li li li,
#menutree li li li li {
margin:1px;
list-style-type:none;
}
#menutree li { background:#eee; }
#menutree li li { background:#ddd; }
#menutree li li li { background:#ccc; }
#menutree li li li li { background:#bbb; }
CSS_BLOCK;
print("");
}
function displayMenu($root_item, $deny, $showparentitem) {
// Now, retrieve the ordered menu item list from the db
$menuitems_ordered = safe_rows("id,name,type,parent,title,idx","txp_category","idx is not NULL order by idx");
$ids_denied = explode(",",$deny);
if ($deny) {
$menuitems_denied = array();
foreach ($ids_denied as $j) {
$temp = safe_row("name","txp_category","id = $j");
$menuitems_denied[] = $temp['name'];
}
}
// Initialize output variable and initialize menu tree structure
$output = "";
return($output);
}
function getChildren($parent_item) {
$parent = $parent_item['name'];
$menu_items = safe_rows("id,name,type,parent,title","txp_category","name != 'root' and type = 'article' and parent = '$parent' order by idx");
print("$parent_item[title] [$parent_item[id]] ⇑ ⇓");
if(!$menu_items) print("\n");
else {
print("\n\n");
foreach($menu_items as $x) getChildren($x);
print("
\n\n");
}
}