From 15fbf01a29f1e0805e45516dfa2bcbb310fbcae6 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 1 Dec 2014 21:03:34 +0100 Subject: [PATCH] [ticket/416] Allow multiple inclusions of main menu B3P-416 --- modules/leaders.php | 8 ++++---- modules/main_menu.php | 15 ++++++++------- .../template/portal/modules/main_menu_side.html | 14 ++++++++------ .../template/portal/modules/main_menu_side.html | 16 +++++++++------- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/modules/leaders.php b/modules/leaders.php index f3d208f5..9c23576c 100644 --- a/modules/leaders.php +++ b/modules/leaders.php @@ -47,10 +47,10 @@ class leaders extends module_base /** @var \phpbb\config\config */ protected $config; - /** @var \phpbb\db\driver */ + /** @var \phpbb\db\driver\driver_interface */ protected $db; - /** @var \phpbb\template */ + /** @var \phpbb\template\template */ protected $template; /** @var string PHP file extension */ @@ -67,8 +67,8 @@ class leaders extends module_base * * @param \phpbb\auth\auth $auth phpBB auth service * @param \phpbb\config\config $config phpBB config - * @param \phpbb\db\driver $db phpBB db driver - * @param \phpbb\template $template phpBB template + * @param \phpbb\db\driver\driver_interface $db phpBB db driver + * @param \phpbb\template\template $template phpBB template * @param string $phpEx php file extension * @param string $phpbb_root_path phpBB root path * @param \phpbb\user $user phpBB user object diff --git a/modules/main_menu.php b/modules/main_menu.php index 44752b08..66c2e304 100644 --- a/modules/main_menu.php +++ b/modules/main_menu.php @@ -57,13 +57,13 @@ class main_menu extends module_base /** @var \phpbb\config\config */ protected $config; - /** @var \phpbb\db\driver */ + /** @var \phpbb\db\driver\driver_interface */ protected $db; /** @var \phpbb\request\request */ protected $request; - /** @var \phpbb\template */ + /** @var \phpbb\template\template */ protected $template; /** @var string PHP file extension */ @@ -82,9 +82,9 @@ class main_menu extends module_base * Construct a main menu object * * @param \phpbb\config\config $config phpBB config - * @param \phpbb\db\driver $db phpBB db driver + * @param \phpbb\db\driver\driver_interface $db phpBB db driver * @param \phpbb\request\request $request phpBB request - * @param \phpbb\template $template phpBB template + * @param \phpbb\template\template $template phpBB template * @param string $phpbb_root_path phpBB root path * @param string $phpEx php file extension * @param \phpbb\user $user phpBB user object @@ -111,6 +111,8 @@ class main_menu extends module_base $links = $this->utf_unserialize($portal_config['board3_menu_array_' . $module_id]); + $this->template->assign_block_vars('portal_menu', array('MODULE_ID' => $module_id)); + // get user's groups $groups_ary = get_user_groups(); @@ -118,9 +120,8 @@ class main_menu extends module_base { if ($links[$i]['type'] == self::LINK_CAT) { - $this->template->assign_block_vars('portalmenu', array( + $this->template->assign_block_vars('portal_menu.category', array( 'CAT_TITLE' => (isset($this->user->lang[$links[$i]['title']])) ? $this->user->lang[$links[$i]['title']] : $links[$i]['title'], - 'MODULE_ID' => $module_id, )); } else @@ -140,7 +141,7 @@ class main_menu extends module_base if (!empty($permission_check) || $links[$i]['permission'] == '') { - $this->template->assign_block_vars('portalmenu.links', array( + $this->template->assign_block_vars('portal_menu.category.links', array( 'LINK_TITLE' => (isset($this->user->lang[$links[$i]['title']])) ? $this->user->lang[$links[$i]['title']] : $links[$i]['title'], 'LINK_URL' => $cur_url, 'NEW_WINDOW' => ($links[$i]['type'] != self::LINK_INT && $this->config['board3_menu_url_new_window_' . $module_id]) ? true : false, diff --git a/styles/prosilver/template/portal/modules/main_menu_side.html b/styles/prosilver/template/portal/modules/main_menu_side.html index 99efd49e..28c9ecd6 100644 --- a/styles/prosilver/template/portal/modules/main_menu_side.html +++ b/styles/prosilver/template/portal/modules/main_menu_side.html @@ -1,19 +1,21 @@ + + {$LR_BLOCK_H_L} {$TITLE}{$LR_BLOCK_H_R}
- - - + +
- - +
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R} + + diff --git a/styles/subsilver2/template/portal/modules/main_menu_side.html b/styles/subsilver2/template/portal/modules/main_menu_side.html index d9afadbe..b71f3aec 100644 --- a/styles/subsilver2/template/portal/modules/main_menu_side.html +++ b/styles/subsilver2/template/portal/modules/main_menu_side.html @@ -1,26 +1,28 @@ + + {$LR_BLOCK_H_L} {$TITLE}{$LR_BLOCK_H_R} - - + - - +
- {portalmenu.CAT_TITLE} + {portal_menu.category.CAT_TITLE}
- onclick="window.open('{portalmenu.links.LINK_URL}'); return false;"> {portalmenu.links.LINK_TITLE} + onclick="window.open('{portal_menu.category.links.LINK_URL}'); return false;"> {portal_menu.category.links.LINK_TITLE}
{L_MENU_NO_LINKS}
-{$LR_BLOCK_F_L}{$LR_BLOCK_F_R} \ No newline at end of file +{$LR_BLOCK_F_L}{$LR_BLOCK_F_R} + +