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';
$( document ).ready(function() {
console.log( "ready!" );
$("#menu_courses").prop("href", "javascript:void(0);");
//$("#menu_courses").prop("onClick", "javascript:return(false);");
$("#menu_courses").click(function(){
return false;
});
});
$(function() {
var isInCourse = $("body").data("in-course");

@ -82,14 +82,18 @@ class NavBuilder implements ContainerAwareInterface
'courses',
[
'label' => $translator->trans('Courses'),
'icon' => 'book'
'route' => 'legacy_main',
'icon' => 'book',
'routeParameters' => [
'name' => '../user_portal.php',
],
]
);
$menu['courses']->addChild(
'courses',
[
'label' => $translator->trans('My courses'),
'label' => $translator->trans('All my courses'),
'route' => 'legacy_main',
'icon' => 'book',
'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()) {
$lang = $translator->trans('CreateCourse');
$lang = $translator->trans('Create course');
if ($settingsManager->getSetting('course.course_validation') == 'true') {
$lang = $translator->trans('CreateCourseRequest');
$lang = $translator->trans('Create course request');
}
$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_STUDENT') && !api_is_drh(
) && !api_is_session_admin()
) {
$menu['courses']->addChild(
'catalog',
[
'label' => $translator->trans('CourseCatalog'),
'route' => 'legacy_main',
'routeParameters' => [
'name' => 'auth/courses.php'
],
]
);
}
if ($checker->isGranted('ROLE_ADMIN')) {
$menu['courses']->addChild(
$translator->trans('Add Session'),
[
'route' => 'legacy_main',
'routeParameters' => ['name' => 'session/session_add.php'],
]
);
}
$menu->addChild(
'calendar',
[
@ -173,6 +196,9 @@ class NavBuilder implements ContainerAwareInterface
],
]
);
}
if ($checker->isGranted('ROLE_ADMIN')) {

Loading…
Cancel
Save