Exemple #1
0
}
$context = context_course::instance($course->id);
// This is the normal requirements.
require_capability('gradereport/singleview:view', $context);
require_capability('moodle/grade:viewall', $context);
require_capability('moodle/grade:edit', $context);
$gpr = new grade_plugin_return(array('type' => 'report', 'plugin' => 'singleview', 'courseid' => $courseid));
// Last selected report session tracking.
if (!isset($USER->grade_last_report)) {
    $USER->grade_last_report = array();
}
$USER->grade_last_report[$course->id] = 'singleview';
// First make sure we have proper final grades -
// this must be done before constructing of the grade tree.
grade_regrade_final_grades($courseid);
$report = new gradereport_singleview($courseid, $gpr, $context, $itemtype, $itemid);
$reportname = $report->screen->heading();
$pluginname = get_string('pluginname', 'gradereport_singleview');
$pageparams = array('id' => $courseid, 'itemid' => $itemid, 'item' => $itemtype, 'userid' => $userid, 'group' => $groupid, 'page' => $page, 'perpage' => $perpage);
$currentpage = new moodle_url('/grade/report/singleview/index.php', $pageparams);
if ($data = data_submitted()) {
    $PAGE->set_pagelayout('redirect');
    $PAGE->set_title(get_string('savegrades', 'gradereport_singleview'));
    echo $OUTPUT->header();
    require_sesskey();
    // Must have a sesskey for all actions.
    $result = $report->process_data($data);
    if (!empty($result->warnings)) {
        foreach ($result->warnings as $warning) {
            echo $OUTPUT->notification($warning);
        }
Exemple #2
0
}
$context = context_course::instance($course->id);
// This is the normal requirements.
require_capability('gradereport/singleview:view', $context);
require_capability('moodle/grade:viewall', $context);
require_capability('moodle/grade:edit', $context);
$gpr = new grade_plugin_return(array('type' => 'report', 'plugin' => 'singleview', 'courseid' => $courseid));
// Last selected report session tracking.
if (!isset($USER->grade_last_report)) {
    $USER->grade_last_report = array();
}
$USER->grade_last_report[$course->id] = 'singleview';
// First make sure we have proper final grades -
// this must be done before constructing of the grade tree.
grade_regrade_final_grades($courseid);
$report = new gradereport_singleview($courseid, $gpr, $context, $itemtype, $itemid, $groupid);
$reportname = $report->screen->heading();
$pluginname = get_string('pluginname', 'gradereport_singleview');
$pageparams = array('id' => $courseid, 'itemid' => $itemid, 'item' => $itemtype, 'userid' => $userid, 'group' => $groupid, 'page' => $page, 'perpage' => $perpage);
$currentpage = new moodle_url('/grade/report/singleview/index.php', $pageparams);
if ($data = data_submitted()) {
    require_sesskey();
    // Must have a sesskey for all actions.
    $warnings = $report->process_data($data);
    if (empty($warnings)) {
        redirect($currentpage);
        die;
    }
}
print_grade_page_head($course->id, 'report', 'singleview', $reportname);
$graderrightnav = $graderleftnav = null;