1<!-- file menu.tpl.php -->
4if (empty($context) || !is_object($context)) {
5 print
"Error, template page can't be called as URL";
9global $conf, $hookmanager, $langs;
11$navMenu = $navGroupMenu = $navUserMenu = array();
15if ($context->userIsLog()) {
17 if (isModEnabled(
'propal') &&
getDolGlobalInt(
'WEBPORTAL_PROPAL_LIST_ACCESS')) {
18 $navMenu[
'propal_list'] = array(
19 'id' =>
'propal_list',
21 'url' => $context->getControllerUrl(
'propallist'),
22 'name' => $langs->trans(
'WebPortalPropalListMenu'),
23 'group' =>
'administrative'
28 if (isModEnabled(
'order') &&
getDolGlobalInt(
'WEBPORTAL_ORDER_LIST_ACCESS')) {
29 $navMenu[
'order_list'] = array(
32 'url' => $context->getControllerUrl(
'orderlist'),
33 'name' => $langs->trans(
'WebPortalOrderListMenu'),
34 'group' =>
'administrative'
39 if (isModEnabled(
'invoice') &&
getDolGlobalInt(
'WEBPORTAL_INVOICE_LIST_ACCESS')) {
40 $navMenu[
'invoice_list'] = array(
41 'id' =>
'invoice_list',
43 'url' => $context->getControllerUrl(
'invoicelist'),
44 'name' => $langs->trans(
'WebPortalInvoiceListMenu'),
45 'group' =>
'administrative'
51 if (isModEnabled(
'member')
52 && in_array($cardAccess, array(
'visible',
'edit'))
53 && $context->logged_member
54 && $context->logged_member->id > 0
56 $navMenu[
'member_card'] = array(
57 'id' =>
'member_card',
59 'url' => $context->getControllerUrl(
'membercard'),
60 'name' => $langs->trans(
'WebPortalMemberCardMenu'),
61 'group' =>
'administrative'
67 if (isModEnabled(
'partnership')
68 && in_array($cardAccess, array(
'visible',
'edit'))
69 && $context->logged_partnership
70 && $context->logged_partnership->id > 0
72 $navMenu[
'partnership_card'] = array(
73 'id' =>
'partnership_card',
75 'url' => $context->getControllerUrl(
'partnershipcard'),
76 'name' => $langs->trans(
'WebPortalPartnershipCardMenu'),
77 'group' =>
'administrative'
82 $navUserMenu[
'user_logout'] = array(
83 'id' =>
'user_logout',
85 'url' => $context->getControllerUrl() .
'logout.php',
86 'name' =>
img_picto($langs->trans(
'Logout'),
'logout',
'class="pictofixedwidth"'),
92 'administrative' => array(
93 'id' =>
'administrative',
96 'name' => $langs->trans(
'WebPortalGroupMenuAdmin'),
103 'name' => $langs->trans(
'WebPortalGroupMenuTechnical'),
104 'children' => array()
109 'controller' => $context->controller,
110 'Tmenu' => & $navMenu,
111 'TGroupMenu' => & $navGroupMenu,
112 'maxTopMenu' => & $maxTopMenu
115$reshook = $hookmanager->executeHooks(
'PrintTopMenu', $parameters, $context, $context->action);
117 $context->setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
120if (empty($reshook)) {
121 if (!empty($hookmanager->resArray)) {
123 $navMenu = array_replace($navMenu, $hookmanager->resArray);
126 if (!empty($navMenu)) {
128 uasort($navMenu,
'menuSortInv');
130 if (!empty($maxTopMenu) && $maxTopMenu < count($navMenu)) {
132 foreach ($navMenu as $menuId => $menuItem) {
134 if (!empty($menuItem[
'group']) && !empty($navGroupMenu[$menuItem[
'group']])) {
135 $goupId = $menuItem[
'group'];
138 $navGroupMenu[$goupId][
'children'][$menuId] = $menuItem;
141 if (!empty($navGroupMenu[$goupId][
'rank']) && $navGroupMenu[$goupId][
'rank'] > 0) {
143 $navGroupMenu[$goupId][
'rank'] = min(abs($navGroupMenu[$goupId][
'rank']), abs($menuItem[
'rank']));
149 foreach ($navGroupMenu as $groupId => $groupItem) {
151 if (!empty($groupItem[
'children']) && count($groupItem[
'children']) > 1) {
153 $navMenu[$groupId] = $groupItem;
156 foreach ($groupItem[
'children'] as $menuId => $menuItem) {
157 if (isset($navMenu[$menuId])) {
158 unset($navMenu[$menuId]);
165 uasort($navMenu,
'menuSortInv');
170<nav
class=
"primary-top-nav container-fluid">
175 print
'<a class="brand__logo-link" href="'.$context->getControllerUrl().
'" >';
176 if (!empty($context->theme->menuLogoUrl)) {
179 print
'<span class="brand__name">' . $brandTitle .
'</span>';
185 <ul
class=
"menu-entries">
187 if (empty($context->doNotDisplayMenu) && empty($reshook) && !empty($navMenu)) {
193 <ul
class=
"menu-entries-alt">
196 print
'<li data-deep="0" class="--item-propal-list nav-item "><a href="'.$context->getControllerUrl().
'">'.$langs->trans(
"Menu").
'...</a></li>';
201 if (empty($context->doNotDisplayMenu) && empty($reshook) && !empty($navUserMenu)) {
203 uasort($navUserMenu,
'menuSortInv');
204 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 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.