1<!-- file menu.tpl.php -->
23 print
"Error, template page can't be called as URL";
26'@phan-var-force Context $context';
28global
$conf, $hookmanager, $langs;
30$navMenu = $navGroupMenu = $navUserMenu = array();
36 if (isModEnabled(
'propal') &&
getDolGlobalInt(
'WEBPORTAL_PROPAL_LIST_ACCESS')) {
37 $navMenu[
'propal_list'] = array(
38 'id' =>
'propal_list',
40 'url' =>
$context->getControllerUrl(
'propallist'),
41 'name' => $langs->trans(
'WebPortalPropalListMenu'),
42 'group' =>
'administrative'
47 if (isModEnabled(
'order') &&
getDolGlobalInt(
'WEBPORTAL_ORDER_LIST_ACCESS')) {
48 $navMenu[
'order_list'] = array(
51 'url' =>
$context->getControllerUrl(
'orderlist'),
52 'name' => $langs->trans(
'WebPortalOrderListMenu'),
53 'group' =>
'administrative'
58 if (isModEnabled(
'invoice') &&
getDolGlobalInt(
'WEBPORTAL_INVOICE_LIST_ACCESS')) {
59 $navMenu[
'invoice_list'] = array(
60 'id' =>
'invoice_list',
62 'url' =>
$context->getControllerUrl(
'invoicelist'),
63 'name' => $langs->trans(
'WebPortalInvoiceListMenu'),
64 'group' =>
'administrative'
70 if (isModEnabled(
'member')
71 && in_array($cardAccess, array(
'visible',
'edit'))
75 $navMenu[
'member_card'] = array(
76 'id' =>
'member_card',
78 'url' =>
$context->getControllerUrl(
'membercard'),
79 'name' => $langs->trans(
'WebPortalMemberCardMenu'),
80 'group' =>
'administrative'
86 if (isModEnabled(
'partnership')
87 && in_array($cardAccess, array(
'visible',
'edit'))
89 &&
$context->logged_partnership->id > 0
91 $navMenu[
'partnership_card'] = array(
92 'id' =>
'partnership_card',
94 'url' =>
$context->getControllerUrl(
'partnershipcard'),
95 'name' => $langs->trans(
'WebPortalPartnershipCardMenu'),
96 'group' =>
'administrative'
101 $navUserMenu[
'user_logout'] = array(
102 'id' =>
'user_logout',
104 'url' =>
$context->getControllerUrl() .
'logout.php',
105 'name' =>
img_picto($langs->trans(
'Logout'),
'logout',
'class="pictofixedwidth"'),
110$navGroupMenu = array(
111 'administrative' => array(
112 'id' =>
'administrative',
115 'name' => $langs->trans(
'WebPortalGroupMenuAdmin'),
116 'children' => array()
118 'technical' => array(
122 'name' => $langs->trans(
'WebPortalGroupMenuTechnical'),
123 'children' => array()
128 'controller' =>
$context->controller,
129 'Tmenu' => & $navMenu,
130 'TGroupMenu' => & $navGroupMenu,
131 'maxTopMenu' => & $maxTopMenu
134$reshook = $hookmanager->executeHooks(
'PrintTopMenu', $parameters,
$context,
$context->action);
136 $context->setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
139if (empty($reshook)) {
140 if (!empty($hookmanager->resArray)) {
142 $navMenu = array_replace($navMenu, $hookmanager->resArray);
145 if (!empty($navMenu)) {
147 uasort($navMenu,
'menuSortInv');
149 if (!empty($maxTopMenu) && $maxTopMenu < count($navMenu)) {
151 foreach ($navMenu as $menuId => $menuItem) {
153 if (!empty($menuItem[
'group']) && !empty($navGroupMenu[$menuItem[
'group']])) {
154 $goupId = $menuItem[
'group'];
157 $navGroupMenu[$goupId][
'children'][$menuId] = $menuItem;
160 if (!empty($navGroupMenu[$goupId][
'rank']) && $navGroupMenu[$goupId][
'rank'] > 0) {
162 $navGroupMenu[$goupId][
'rank'] = min(abs($navGroupMenu[$goupId][
'rank']), abs($menuItem[
'rank']));
168 foreach ($navGroupMenu as $groupId => $groupItem) {
170 if (!empty($groupItem[
'children']) && count($groupItem[
'children']) > 1) {
172 $navMenu[$groupId] = $groupItem;
175 foreach ($groupItem[
'children'] as $menuId => $menuItem) {
176 if (isset($navMenu[$menuId])) {
177 unset($navMenu[$menuId]);
184 uasort($navMenu,
'menuSortInv');
189<nav
class=
"primary-top-nav container-fluid">
194 print
'<a class="brand__logo-link" href="'.$context->getControllerUrl().
'" >';
195 if (!empty(
$context->theme->menuLogoUrl)) {
198 print
'<span class="brand__name">' . $brandTitle .
'</span>';
204 <ul
class=
"menu-entries">
206 if (empty(
$context->doNotDisplayMenu) && empty($reshook) && !empty($navMenu)) {
212 <ul
class=
"menu-entries-alt">
215 print
'<li data-deep="0" class="--item-propal-list nav-item "><a href="'.$context->getControllerUrl().
'">'.$langs->trans(
"Menu").
'...</a></li>';
220 if (empty(
$context->doNotDisplayMenu) && empty($reshook) && !empty($navUserMenu)) {
222 uasort($navUserMenu,
'menuSortInv');
223 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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
getNav($Tmenu)
Get nav menu.
$context
@method int call_trigger(string $triggerName, User $user)