1<!-- file menu.tpl.php -->
21if (empty($context) || !is_object($context)) {
22 print
"Error, template page can't be called as URL";
26global $conf, $hookmanager, $langs;
28$navMenu = $navGroupMenu = $navUserMenu = array();
32if ($context->userIsLog()) {
34 if (isModEnabled(
'propal') &&
getDolGlobalInt(
'WEBPORTAL_PROPAL_LIST_ACCESS')) {
35 $navMenu[
'propal_list'] = array(
36 'id' =>
'propal_list',
38 'url' => $context->getControllerUrl(
'propallist'),
39 'name' => $langs->trans(
'WebPortalPropalListMenu'),
40 'group' =>
'administrative'
45 if (isModEnabled(
'order') &&
getDolGlobalInt(
'WEBPORTAL_ORDER_LIST_ACCESS')) {
46 $navMenu[
'order_list'] = array(
49 'url' => $context->getControllerUrl(
'orderlist'),
50 'name' => $langs->trans(
'WebPortalOrderListMenu'),
51 'group' =>
'administrative'
56 if (isModEnabled(
'invoice') &&
getDolGlobalInt(
'WEBPORTAL_INVOICE_LIST_ACCESS')) {
57 $navMenu[
'invoice_list'] = array(
58 'id' =>
'invoice_list',
60 'url' => $context->getControllerUrl(
'invoicelist'),
61 'name' => $langs->trans(
'WebPortalInvoiceListMenu'),
62 'group' =>
'administrative'
68 if (isModEnabled(
'member')
69 && in_array($cardAccess, array(
'visible',
'edit'))
70 && $context->logged_member
71 && $context->logged_member->id > 0
73 $navMenu[
'member_card'] = array(
74 'id' =>
'member_card',
76 'url' => $context->getControllerUrl(
'membercard'),
77 'name' => $langs->trans(
'WebPortalMemberCardMenu'),
78 'group' =>
'administrative'
84 if (isModEnabled(
'partnership')
85 && in_array($cardAccess, array(
'visible',
'edit'))
86 && $context->logged_partnership
87 && $context->logged_partnership->id > 0
89 $navMenu[
'partnership_card'] = array(
90 'id' =>
'partnership_card',
92 'url' => $context->getControllerUrl(
'partnershipcard'),
93 'name' => $langs->trans(
'WebPortalPartnershipCardMenu'),
94 'group' =>
'administrative'
99 $navUserMenu[
'user_logout'] = array(
100 'id' =>
'user_logout',
102 'url' => $context->getControllerUrl() .
'logout.php',
103 'name' =>
img_picto($langs->trans(
'Logout'),
'logout',
'class="pictofixedwidth"'),
108$navGroupMenu = array(
109 'administrative' => array(
110 'id' =>
'administrative',
113 'name' => $langs->trans(
'WebPortalGroupMenuAdmin'),
114 'children' => array()
116 'technical' => array(
120 'name' => $langs->trans(
'WebPortalGroupMenuTechnical'),
121 'children' => array()
126 'controller' => $context->controller,
127 'Tmenu' => & $navMenu,
128 'TGroupMenu' => & $navGroupMenu,
129 'maxTopMenu' => & $maxTopMenu
132$reshook = $hookmanager->executeHooks(
'PrintTopMenu', $parameters, $context, $context->action);
134 $context->setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
137if (empty($reshook)) {
138 if (!empty($hookmanager->resArray)) {
140 $navMenu = array_replace($navMenu, $hookmanager->resArray);
143 if (!empty($navMenu)) {
145 uasort($navMenu,
'menuSortInv');
147 if (!empty($maxTopMenu) && $maxTopMenu < count($navMenu)) {
149 foreach ($navMenu as $menuId => $menuItem) {
151 if (!empty($menuItem[
'group']) && !empty($navGroupMenu[$menuItem[
'group']])) {
152 $goupId = $menuItem[
'group'];
155 $navGroupMenu[$goupId][
'children'][$menuId] = $menuItem;
158 if (!empty($navGroupMenu[$goupId][
'rank']) && $navGroupMenu[$goupId][
'rank'] > 0) {
160 $navGroupMenu[$goupId][
'rank'] = min(abs($navGroupMenu[$goupId][
'rank']), abs($menuItem[
'rank']));
166 foreach ($navGroupMenu as $groupId => $groupItem) {
168 if (!empty($groupItem[
'children']) && count($groupItem[
'children']) > 1) {
170 $navMenu[$groupId] = $groupItem;
173 foreach ($groupItem[
'children'] as $menuId => $menuItem) {
174 if (isset($navMenu[$menuId])) {
175 unset($navMenu[$menuId]);
182 uasort($navMenu,
'menuSortInv');
187<nav
class=
"primary-top-nav container-fluid">
192 print
'<a class="brand__logo-link" href="'.$context->getControllerUrl().
'" >';
193 if (!empty($context->theme->menuLogoUrl)) {
196 print
'<span class="brand__name">' . $brandTitle .
'</span>';
202 <ul
class=
"menu-entries">
204 if (empty($context->doNotDisplayMenu) && empty($reshook) && !empty($navMenu)) {
210 <ul
class=
"menu-entries-alt">
213 print
'<li data-deep="0" class="--item-propal-list nav-item "><a href="'.$context->getControllerUrl().
'">'.$langs->trans(
"Menu").
'...</a></li>';
218 if (empty($context->doNotDisplayMenu) && empty($reshook) && !empty($navUserMenu)) {
220 uasort($navUserMenu,
'menuSortInv');
221 print
getNav($navUserMenu);
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
getNav($Tmenu)
Get nav menu.