File tree Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change 1010api_protect_course_script (true );
1111
1212api_block_anonymous_users ();
13+
14+ $ currentUserId = api_get_user_id ();
15+ $ sessionId = api_get_session_id ();
16+
1317$ isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh (
14- api_get_user_id () ,
18+ $ currentUserId ,
1519 api_get_course_info ()
1620);
1721
18- if (!$ isDrhOfCourse ) {
22+ $ isDrhOfSession = $ sessionId && !empty (SessionManager::getSessionFollowedByDrh ($ currentUserId , $ sessionId ));
23+
24+ if (!$ isDrhOfCourse && !$ isDrhOfSession ) {
1925 GradebookUtils::block_students ();
2026}
2127
Original file line number Diff line number Diff line change @@ -429,6 +429,7 @@ public static function header(
429429 }
430430
431431 // for course admin & platform admin add item buttons are added to the header
432+ $ toolbarActions = [];
432433 $ actionsLeft = '' ;
433434 $ actionsRight = '' ;
434435 $ my_api_cidreq = api_get_cidreq ();
@@ -562,11 +563,13 @@ public static function header(
562563 }
563564
564565 $ isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh (
565- api_get_user_id () ,
566+ $ userId ,
566567 api_get_course_info ()
567568 );
568569
569- if ($ isDrhOfCourse ) {
570+ $ isDrhOfSession = $ sessionId && !empty (SessionManager::getSessionFollowedByDrh ($ userId , $ sessionId ));
571+
572+ if ($ isDrhOfCourse || $ isDrhOfSession ) {
570573 $ actionsLeft .= '<a href="gradebook_flatview.php? ' .$ my_api_cidreq .'&selectcat= ' .$ catobj ->get_id ().'"> '
571574 .Display::return_icon (
572575 'statistics.png ' ,
@@ -578,9 +581,17 @@ public static function header(
578581 }
579582
580583 if ($ isCoach || api_is_allowed_to_edit (null , true )) {
581- echo $ toolbar = Display::toolbarAction (
584+ $ toolbarActions = [$ actionsLeft , $ actionsRight ];
585+ }
586+
587+ if (empty ($ toolbarActions ) && ($ isDrhOfCourse || $ isDrhOfSession )) {
588+ $ toolbarActions = [$ actionsLeft ];
589+ }
590+
591+ if ($ toolbarActions ) {
592+ echo Display::toolbarAction (
582593 'gradebook-actions ' ,
583- [ $ actionsLeft , $ actionsRight ]
594+ $ toolbarActions
584595 );
585596 }
586597
You can’t perform that action at this time.
0 commit comments