Skip to content

Commit

Permalink
Hotfix - Add paging bar navigation for admin page Courses without tea…
Browse files Browse the repository at this point in the history
…chers, in view to apply to orphaned submissions admin page
  • Loading branch information
oliviervalentin committed May 27, 2024
1 parent 6176797 commit 9d224eb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion admin_dashboard/courses_without_teachers.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@

$site = get_site();

$page = optional_param('page', 0, PARAM_INT);
$perpage = optional_param('perpage', 2, PARAM_INT); // how many per page

$PAGE = new moodle_page();
$PAGE->set_context(context_system::instance());
$PAGE->set_heading(get_string('title', 'report_coursemanager'));
Expand Down Expand Up @@ -111,7 +114,8 @@
$table->head[] = get_string('table_actions', 'report_coursemanager');

// For each course, retrieve informations for table.
foreach ($existsnoteacherincourse as $course) {
$selectnoteacherincourse = array_slice($existsnoteacherincourse, $page * $perpage, $perpage);
foreach ($selectnoteacherincourse as $course) {
$coursecontext = \context_course::instance($course->course);
// Retrieve course general information.
$courseinfo = $DB->get_record('course', ['id' => $course->course]);
Expand Down Expand Up @@ -180,6 +184,9 @@

// Print the whole table.
echo html_writer::table($table);

$baseurl = new moodle_url('/report/coursemanager/admin_dashboard/courses_without_teachers.php', array('perpage' => $perpage));
echo $OUTPUT->paging_bar(count($existsnoteacherincourse), $page, $perpage, $baseurl);
} else {
// If no course without teacher, add a message in place of table.
echo html_writer::div(get_string('emptytablenoteacherincourses', 'report_coursemanager'), 'alert alert-success');
Expand Down

0 comments on commit 9d224eb

Please sign in to comment.