diff --git a/main/gradebook/all_my_gradebooks.php b/main/gradebook/all_my_gradebooks.php
new file mode 100644
index 0000000000..7213c5b605
--- /dev/null
+++ b/main/gradebook/all_my_gradebooks.php
@@ -0,0 +1,123 @@
+
+var show_icon = "'.Display::returnIconPath('view_more_stats.gif').'";
+var hide_icon = "'.Display::returnIconPath('view_less_stats.gif').'";
+
+$(function() {
+ $("body").on("click", ".view_children", function() {
+ var id = $(this).attr("data-cat-id");
+ $(".hidden_"+id).removeClass("hidden");
+ $(this).removeClass("view_children");
+ $(this).find("img").attr("src", hide_icon);
+ $(this).attr("class", "hide_children");
+ });
+
+ $("body").on("click", ".hide_children", function(event) {
+ var id = $(this).attr("data-cat-id");
+ $(".hidden_"+id).addClass("hidden");
+ $(this).removeClass("hide_children");
+ $(this).addClass("view_children");
+ $(this).find("img").attr("src", show_icon);
+ });
+
+ for (i=0;i<$(".actions").length;i++) {
+ if ($(".actions:eq("+i+")").html()=="
" || $(".actions:eq("+i+")").html()=="" || $(".actions:eq("+i+")").html()==null || $(".actions:eq("+i+")").html().split("").length==2) {
+ $(".actions:eq("+i+")").hide();
+ }
+ }
+});
+';
+
+Display::display_header(get_lang('GlobalGradebook'));
+
+api_block_anonymous_users();
+
+$user_id = api_get_user_id();
+$userCoursesList = CourseManager::get_courses_list_by_user_id ($user_id, true, false, false, [], true, true);
+
+foreach ($userCoursesList as $course) {
+ $course_code = $course['code'];
+ $stud_id = $user_id;
+ $session_id = $course['session_id'];
+ $course_id = $course['real_id'];
+ $courseInfo = api_get_course_info($course_code);
+
+ if (!empty($course['session_name'])) {
+ $title = "" . $courseInfo['title'] . " (" . $course['session_name'] . ")
";
+ } else {
+ $title = "" . $courseInfo['title'] . "
";
+ }
+
+ $cats = Category::load(
+ null,
+ null,
+ $course_code,
+ null,
+ null,
+ $session_id,
+ false
+ );
+
+$showTitle = true;
+ foreach ($cats as $cat) {
+ $allcat = $cat->get_subcategories($stud_id, $course_code, $session_id);
+ $alleval = $cat->get_evaluations($stud_id, false, $course_code, $session_id);
+ $alllink = $cat->get_links($stud_id, true, $course_code, $session_id);
+
+ if ($cat->get_parent_id() != 0) {
+ $i++;
+ } else {
+ if (empty($allcat) && empty($alleval) && empty($alllink)) {
+ continue;
+ }
+ if ($showTitle) {
+ echo $title;
+ $showTitle = false;
+ }
+ // This is the father
+ // Create gradebook/add gradebook links.
+ DisplayGradebook::header(
+ $cat,
+ 0,
+ $cat->get_id(),
+ false,
+ false,
+ null,
+ false,
+ false,
+ []
+ );
+
+ $gradebookTable = new GradebookTable(
+ $cat,
+ $allcat,
+ $alleval,
+ $alllink,
+ null,
+ false,
+ null,
+ api_get_user_id(),
+ [],
+ []
+ );
+
+ $table = '';
+ $table = $gradebookTable->return_table();
+ echo $table;
+ }
+ }
+}
+
diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php
index 2f07eefa62..398c222313 100755
--- a/main/inc/lib/userportal.lib.php
+++ b/main/inc/lib/userportal.lib.php
@@ -948,6 +948,14 @@ class IndexManager
];
}
+ if (api_get_configuration_value('show_all_my_gradebooks_page')) {
+ $items[] = [
+ 'icon' => Display::return_icon('gradebook.png', get_lang('GlobalGradebook')),
+ 'link' => api_get_path(WEB_CODE_PATH).'gradebook/all_my_gradebooks.php',
+ 'title' => get_lang('GlobalGradebook'),
+ ];
+ }
+
if (api_get_configuration_value('show_missing_signatures_page') && api_get_configuration_value('enable_sign_attendance_sheet')) {
$items[] = [
'icon' => Display::return_icon('attendance.png', get_lang('MyMissingSignatures')),
diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php
index 3e55c6a557..0e36e17b4e 100644
--- a/main/install/configuration.dist.php
+++ b/main/install/configuration.dist.php
@@ -1179,6 +1179,10 @@ VALUES (2, 13, 'session_courses_read_only_mode', 'Lock Course In Session', 1, 1,
// Hide gradebook "download report in PDF" button
// $_configuration['gradebook_hide_pdf_report_button'] = false;
+// Shows a link to the "Global gradebooks" page in the /index.php and /user_portal.php page.
+// It also enables the main/gradebook/all_my_gradebooks.php page.
+//$_configuration['show_all_my_gradebooks_page'] = false;
+
// Show pending survey link in user menu
// $_configuration['show_pending_survey_in_menu'] = false;