aboutsummaryrefslogtreecommitdiffstats
path: root/include/menu.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/menu.php')
-rw-r--r--include/menu.php27
1 files changed, 24 insertions, 3 deletions
diff --git a/include/menu.php b/include/menu.php
index b4f4555a5..5c0811437 100644
--- a/include/menu.php
+++ b/include/menu.php
@@ -24,26 +24,47 @@ function menu_fetch($name,$uid,$observer_xchan) {
return null;
}
-function menu_render($menu, $class='', $edit = false) {
+function menu_render($menu, $class='', $edit = false, $var = '') {
if(! $menu)
return '';
+ $channel_id = ((is_array(get_app()->profile)) ? get_app()->profile['profile_uid'] : 0);
+ $menu_list = menu_list($channel_id);
+
+ foreach($menu_list as $menus) {
+ if($menus['menu_name'] != $menu['menu']['menu_name'])
+ $menu_names[] = $menus['menu_name'];
+ }
+
for($x = 0; $x < count($menu['items']); $x ++) {
+ if(in_array($menu['items'][$x]['mitem_link'], $menu_names)) {
+ $m = menu_fetch($menu['items'][$x]['mitem_link'], $channel_id, get_observer_hash());
+ $submenu = menu_render($m, 'dropdown-menu', $edit = false, $var = array('wrap' => 'none'));
+ $menu['items'][$x]['submenu'] = $submenu;
+ }
+
if($menu['items'][$x]['mitem_flags'] & MENU_ITEM_ZID)
$menu['items'][$x]['mitem_link'] = zid($menu['items'][$x]['mitem_link']);
+
if($menu['items'][$x]['mitem_flags'] & MENU_ITEM_NEWWIN)
$menu['items'][$x]['newwin'] = '1';
+
$menu['items'][$x]['mitem_desc'] = bbcode($menu['items'][$x]['mitem_desc']);
}
- return replace_macros(get_markup_template('usermenu.tpl'),array(
+ $wrap = (($var['wrap'] === 'none') ? false : true);
+
+ $ret = replace_macros(get_markup_template('usermenu.tpl'),array(
'$menu' => $menu['menu'],
'$class' => $class,
'$edit' => (($edit) ? t("Edit") : ''),
'$id' => $menu['menu']['menu_id'],
- '$items' => $menu['items']
+ '$items' => $menu['items'],
+ '$wrap' => $wrap
));
+
+ return $ret;
}