diff --git a/assets/vue/components/layout/TopbarLoggedIn.vue b/assets/vue/components/layout/TopbarLoggedIn.vue index 38db2417e2..d4c2dedc1b 100644 --- a/assets/vue/components/layout/TopbarLoggedIn.vue +++ b/assets/vue/components/layout/TopbarLoggedIn.vue @@ -97,33 +97,44 @@ const ticketUrl = computed(() => { }) const elUserSubmenu = ref(null) -const userSubmenuItems = computed(() => [ - { - label: props.currentUser.fullName, - items: [ - { - label: t("My profile"), - url: router.resolve({ name: "AccountHome" }).href, - }, - { - label: t("My General Certificate"), - url: "/main/social/my_skills_report.php?a=generate_custom_skill", - }, - { - label: t("My skills"), - url: "/main/social/my_skills_report.php", - }, - { - separator: true, - }, - { - label: t("Sign out"), - url: "/logout", - icon: "mdi mdi-logout-variant", - }, - ], - }, -]) +const userSubmenuItems = computed(() => { + const items = [ + { + label: props.currentUser.fullName, + items: [ + { + label: t("My profile"), + url: router.resolve({ name: "AccountHome" }).href, + }, + ], + }, + ] + + if (platformConfigStore.getSetting("platform.show_tabs").indexOf("topbar_certificate") > -1) { + items[0].items.push({ + label: t("My General Certificate"), + url: "/main/social/my_skills_report.php?a=generate_custom_skill", + }) + } + + if (platformConfigStore.getSetting("platform.show_tabs").indexOf("topbar_skills") > -1) { + items[0].items.push({ + label: t("My skills"), + url: "/main/social/my_skills_report.php", + }) + } + + items[0].items.push( + { separator: true }, + { + label: t("Sign out"), + url: "/logout", + icon: "mdi mdi-logout-variant", + } + ) + + return items +}) function toggleUserMenu(event) { elUserSubmenu.value.toggle(event) diff --git a/assets/vue/composables/sidebarMenu.js b/assets/vue/composables/sidebarMenu.js index de7a4a4fa9..7618d7ea35 100644 --- a/assets/vue/composables/sidebarMenu.js +++ b/assets/vue/composables/sidebarMenu.js @@ -25,24 +25,29 @@ export function useSidebarMenu() { return false } - const menuItemsBeforeMyCourse = computed(() => { - const items = [] - - if (showTabsSetting.indexOf("campus_homepage") > -1) { - items.push({ - icon: "mdi mdi-home", - label: t("Home"), - route: { name: "Home" }, - }) + const createMenuItem = (key, icon, label, routeName, subItems = null) => { + if (showTabsSetting.indexOf(key) > -1) { + const item = { + icon: `mdi ${icon}`, + label: t(label), + } + if (routeName) item.route = { name: routeName } + if (subItems) item.items = subItems + return item } + return null + } - return items + const menuItemsBeforeMyCourse = computed(() => { + const items = [] + items.push(createMenuItem("campus_homepage", "mdi-home", "Home", "Home")) + return items.filter(Boolean) }) const menuItemMyCourse = computed(() => { const items = [] - if (securityStore.isAuthenticated) { + if (securityStore.isAuthenticated && showTabsSetting.indexOf("my_courses") > -1) { const courseItems = [] if (enrolledStore.isEnrolledInCourses) { @@ -76,33 +81,33 @@ export function useSidebarMenu() { const menuItemsAfterMyCourse = computed(() => { const items = [] - if (showCatalogue > -1) { + if (showTabsSetting.indexOf("catalogue") > -1) { if (showCatalogue == 0 || showCatalogue == 2) { - items.push({ - icon: "mdi mdi-bookmark-multiple", - label: t("Explore more courses"), - route: { name: "CatalogueCourses" }, - }) + items.push( + createMenuItem( + "catalogue", + "mdi-bookmark-multiple", + "Explore more courses", + "CatalogueCourses" + ) + ) } if (showCatalogue > 0) { - items.push({ - icon: "mdi mdi-bookmark-multiple-outline", - label: t("Sessions catalogue"), - route: { name: "CatalogueSessions" }, - }) + items.push( + createMenuItem( + "catalogue", + "mdi-bookmark-multiple-outline", + "Sessions catalogue", + "CatalogueSessions" + ) + ) } } - if (showTabsSetting.indexOf("my_agenda") > -1) { - items.push({ - icon: "mdi mdi-calendar-text", - label: t("Events"), - route: { name: "CCalendarEventList" }, - }) - } + items.push(createMenuItem("my_agenda", "mdi-calendar-text", "Events", "CCalendarEventList")) if (showTabsSetting.indexOf("reporting") > -1) { - let subItems = [] + const subItems = [] if (securityStore.isTeacher || securityStore.isHRM || securityStore.isSessionAdmin) { subItems.push({ @@ -155,75 +160,58 @@ export function useSidebarMenu() { }) } - if (platformConfigStore.plugins?.bbb?.show_global_conference_link) { - items.push({ - icon: "mdi mdi-video", - label: t("Videoconference"), - url: platformConfigStore.plugins.bbb.listingURL, - }) - } - - if (securityStore.isStudentBoss || securityStore.isStudent) { - items.push({ - icon: "mdi mdi-text-box-search", - items: [ - { - label: t("Diagnosis Management"), - url: "/main/search/load_search.php", - visible: securityStore.isStudentBoss, - }, - { - label: t("Diagnostic Form"), - url: "/main/search/search.php", - }, - ], - label: t("Diagnosis"), - }) - } - - if (securityStore.isAdmin || securityStore.isSessionAdmin) { - const adminItems = [ + items.push( + createMenuItem( + "videoconference", + "mdi-video", + "Videoconference", + null, + platformConfigStore.plugins?.bbb?.show_global_conference_link + ? [ + { + label: t("Conference Room"), + url: platformConfigStore.plugins.bbb.listingURL, + }, + ] + : null + ) + ) + + items.push( + createMenuItem("diagnostics", "mdi-text-box-search", "Diagnosis Management", null, [ { - label: t("Administration"), - route: { name: "AdminIndex" }, + label: t("Diagnosis Management"), + url: "/main/search/load_search.php", + visible: securityStore.isStudentBoss, }, - ] - - if ( - securityStore.isSessionAdmin && - "true" === platformConfigStore.getSetting("session.limit_session_admin_list_users") - ) { - adminItems.push({ - label: t("Add user"), - url: "/main/admin/user_add.php", - }) - } else { - adminItems.push({ - label: t("Users"), - url: "/main/admin/user_list.php", - }) - } + { + label: t("Diagnostic Form"), + url: "/main/search/search.php", + }, + ]) + ) + + if (showTabsSetting.indexOf("platform_administration") > -1) { + if (securityStore.isAdmin || securityStore.isSessionAdmin) { + const adminItems = [ + { label: t("Administration"), route: { name: "AdminIndex" } }, + ...(securityStore.isSessionAdmin && + "true" === platformConfigStore.getSetting("session.limit_session_admin_list_users") + ? [{ label: t("Add user"), url: "/main/admin/user_add.php" }] + : [{ label: t("Users"), url: "/main/admin/user_list.php" }]), + { label: t("Courses"), url: "/main/admin/course_list.php" }, + { label: t("Sessions"), url: "/main/session/session_list.php" }, + ] - if (securityStore.isAdmin) { - adminItems.push({ - label: t("Courses"), - url: "/main/admin/course_list.php", + items.push({ + icon: "mdi mdi-cog", + items: adminItems, + label: t("Administration"), }) } - - adminItems.push({ - label: t("Sessions"), - url: "/main/session/session_list.php", - }) - - items.push({ - icon: "mdi mdi-cog", - items: adminItems, - label: t("Administration"), - }) } - return items + return items.filter(Boolean) }) async function initialize() { diff --git a/src/CoreBundle/Settings/PlatformSettingsSchema.php b/src/CoreBundle/Settings/PlatformSettingsSchema.php index 1bbd829723..ae0d9a80bc 100644 --- a/src/CoreBundle/Settings/PlatformSettingsSchema.php +++ b/src/CoreBundle/Settings/PlatformSettingsSchema.php @@ -19,15 +19,17 @@ use Symfony\Component\Form\FormBuilderInterface; class PlatformSettingsSchema extends AbstractSettingsSchema { private static array $tabs = [ - 'TabsCampusHomepage' => 'campus_homepage', - 'TabsMyCourses' => 'my_courses', - 'TabsReporting' => 'reporting', - 'TabsPlatformAdministration' => 'platform_administration', - 'mypersonalopenarea' => 'my_agenda', - 'TabsMyAgenda' => 'my_profile', - 'TabsMyGradebook' => 'my_gradebook', - 'TabsSocial' => 'social', - 'TabsDashboard' => 'dashboard', + 'MenuCampusHomepage' => 'campus_homepage', + 'MenuMyCourses' => 'my_courses', + 'MenuReporting' => 'reporting', + 'MenuPlatformAdministration' => 'platform_administration', + 'MenuMyAgenda' => 'my_agenda', + 'MenuSocial' => 'social', + 'MenuVideoConference' => 'videoconference', + 'MenuDiagnostics' => 'diagnostics', + 'MenuCatalogue' => 'catalogue', + 'TopbarCertificate' => 'topbar_certificate', + 'TopbarSkills' => 'topbar_skills', ]; public function buildSettings(AbstractSettingsBuilder $builder): void