add submenu - refs #2681

pull/2818/head
Alex Aragón 6 years ago
parent 9f8e492b55
commit 5a1055757c
  1. 6
      assets/js/app.js
  2. 68
      src/CoreBundle/Menu/NavBuilder.php

@ -26,8 +26,10 @@ var connect_lang = 'ChatConnected';
var disconnect_lang = 'ChatDisconnected'; var disconnect_lang = 'ChatDisconnected';
$( document ).ready(function() { $( document ).ready(function() {
console.log( "ready!" ); //$("#menu_courses").prop("onClick", "javascript:return(false);");
$("#menu_courses").prop("href", "javascript:void(0);"); $("#menu_courses").click(function(){
return false;
});
}); });
$(function() { $(function() {
var isInCourse = $("body").data("in-course"); var isInCourse = $("body").data("in-course");

@ -82,14 +82,18 @@ class NavBuilder implements ContainerAwareInterface
'courses', 'courses',
[ [
'label' => $translator->trans('Courses'), 'label' => $translator->trans('Courses'),
'icon' => 'book' 'route' => 'legacy_main',
'icon' => 'book',
'routeParameters' => [
'name' => '../user_portal.php',
],
] ]
); );
$menu['courses']->addChild( $menu['courses']->addChild(
'courses', 'courses',
[ [
'label' => $translator->trans('My courses'), 'label' => $translator->trans('All my courses'),
'route' => 'legacy_main', 'route' => 'legacy_main',
'icon' => 'book', 'icon' => 'book',
'routeParameters' => [ 'routeParameters' => [
@ -98,11 +102,29 @@ class NavBuilder implements ContainerAwareInterface
] ]
); );
$browse = $settingsManager->getSetting('display.allow_students_to_browse_courses');
if ($browse == 'true') {
if ($checker->isGranted('ROLE_STUDENT') && !api_is_drh(
) && !api_is_session_admin()
) {
$menu['courses']->addChild(
'catalog',
[
'label' => $translator->trans('Course catalog'),
'route' => 'legacy_main',
'routeParameters' => [
'name' => 'auth/courses.php'
],
]
);
}
}
if (api_is_allowed_to_create_course()) { if (api_is_allowed_to_create_course()) {
$lang = $translator->trans('CreateCourse'); $lang = $translator->trans('Create course');
if ($settingsManager->getSetting('course.course_validation') == 'true') { if ($settingsManager->getSetting('course.course_validation') == 'true') {
$lang = $translator->trans('CreateCourseRequest'); $lang = $translator->trans('Create course request');
} }
$menu['courses']->addChild( $menu['courses']->addChild(
@ -117,26 +139,27 @@ class NavBuilder implements ContainerAwareInterface
); );
} }
$browse = $settingsManager->getSetting('display.allow_students_to_browse_courses'); $menu['courses']->addChild(
$translator->trans('Course history'),
[
'route' => 'userportal',
'routeParameters' => [
'type' => 'sessions',
'filter' => 'history',
],
]
);
if ($browse == 'true') { if ($checker->isGranted('ROLE_ADMIN')) {
if ($checker->isGranted('ROLE_STUDENT') && !api_is_drh( $menu['courses']->addChild(
) && !api_is_session_admin() $translator->trans('Add Session'),
) { [
$menu['courses']->addChild( 'route' => 'legacy_main',
'catalog', 'routeParameters' => ['name' => 'session/session_add.php'],
[ ]
'label' => $translator->trans('CourseCatalog'), );
'route' => 'legacy_main',
'routeParameters' => [
'name' => 'auth/courses.php'
],
]
);
}
} }
$menu->addChild( $menu->addChild(
'calendar', 'calendar',
[ [
@ -173,6 +196,9 @@ class NavBuilder implements ContainerAwareInterface
], ],
] ]
); );
} }
if ($checker->isGranted('ROLE_ADMIN')) { if ($checker->isGranted('ROLE_ADMIN')) {

Loading…
Cancel
Save