Browse Source

fix breadcrumbs in atrisk and coursesummary reports.

MOODLE_34_STABLE
Dan Marsden 8 years ago
parent
commit
35511aca9a
  1. 4
      atrisk.php
  2. 17
      coursesummary.php

4
atrisk.php

@ -23,6 +23,7 @@
*/ */
require_once('../../config.php'); require_once('../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot.'/mod/attendance/lib.php'); require_once($CFG->dirroot.'/mod/attendance/lib.php');
require_once($CFG->dirroot.'/mod/attendance/locallib.php'); require_once($CFG->dirroot.'/mod/attendance/locallib.php');
require_once($CFG->libdir.'/tablelib.php'); require_once($CFG->libdir.'/tablelib.php');
@ -47,10 +48,9 @@ if (!empty($category)) {
$context = context_module::instance($cm->id); $context = context_module::instance($cm->id);
require_login($course, false, $cm); require_login($course, false, $cm);
} else { } else {
admin_externalpage_setup('managemodules');
$context = context_system::instance(); $context = context_system::instance();
$courses = array(); // Show all courses. $courses = array(); // Show all courses.
$PAGE->set_context($context);
require_login();
} }
// Check permissions. // Check permissions.
require_capability('mod/attendance:viewreports', $context); require_capability('mod/attendance:viewreports', $context);

17
coursesummary.php

@ -23,6 +23,7 @@
*/ */
require_once('../../config.php'); require_once('../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot.'/mod/attendance/lib.php'); require_once($CFG->dirroot.'/mod/attendance/lib.php');
require_once($CFG->dirroot.'/mod/attendance/locallib.php'); require_once($CFG->dirroot.'/mod/attendance/locallib.php');
require_once($CFG->libdir.'/tablelib.php'); require_once($CFG->libdir.'/tablelib.php');
@ -31,17 +32,21 @@ require_once($CFG->libdir.'/coursecatlib.php');
$category = optional_param('category', 0, PARAM_INT); $category = optional_param('category', 0, PARAM_INT);
$download = optional_param('download', '', PARAM_ALPHA); $download = optional_param('download', '', PARAM_ALPHA);
$sort = optional_param('tsort', '', PARAM_ALPHA); $sort = optional_param('tsort', '', PARAM_ALPHA);
$fromcourse = optional_param('fromcourse', 0, PARAM_INT);
if (empty($fromcourse)) {
admin_externalpage_setup('managemodules');
} else {
require_login($fromcourse);
}
require_login();
if (empty($category)) { if (empty($category)) {
$context = context_system::instance(); $context = context_system::instance();
$courses = array(); // Show all courses. $courses = array(); // Show all courses.
$PAGE->set_context(context_system::instance());
} else { } else {
$context = context_coursecat::instance($category); $context = context_coursecat::instance($category);
$coursecat = coursecat::get($category); $coursecat = coursecat::get($category);
$courses = $coursecat->get_courses(array('recursive' => true, 'idonly' => true)); $courses = $coursecat->get_courses(array('recursive' => true, 'idonly' => true));
$PAGE->set_category_by_id($category);
} }
// Check permissions. // Check permissions.
require_capability('mod/attendance:viewsummaryreports', $context); require_capability('mod/attendance:viewsummaryreports', $context);
@ -57,7 +62,11 @@ $table->define_baseurl($PAGE->url);
if (!$table->is_downloading($download, $exportfilename)) { if (!$table->is_downloading($download, $exportfilename)) {
echo $OUTPUT->header(); echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('coursesummary', 'mod_attendance')); $heading = get_string('coursesummary', 'mod_attendance');
if (!empty($category)) {
$heading .= " (".$coursecat->name.")";
}
echo $OUTPUT->heading($heading);
if (empty($category)) { if (empty($category)) {
// Only show tabs if displaying via the admin page. // Only show tabs if displaying via the admin page.
$tabmenu = attendance_print_settings_tabs('coursesummary'); $tabmenu = attendance_print_settings_tabs('coursesummary');

Loading…
Cancel
Save