-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
executable file
·104 lines (88 loc) · 3.72 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Gradebook marking guide report
*
* @package gradereport_markingguide
* @copyright 2014 Learning Technology Services, www.lts.ie - Lead Developer: Karen Holland
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use gradereport_markingguide\report;
require_once('../../../config.php');
require_once($CFG->libdir .'/gradelib.php');
require_once($CFG->dirroot.'/grade/lib.php');
require_once("select_form.php");
$activityid = optional_param('activityid', 0, PARAM_INT);
$displayremark = optional_param('displayremark', 1, PARAM_INT);
$displaysummary = optional_param('displaysummary', 1, PARAM_INT);
$displayidnumber = optional_param('displayidnumber', 1, PARAM_INT);
$displayemail = optional_param('displayemail', 1, PARAM_INT);
$format = optional_param('format', '', PARAM_ALPHA);
$courseid = required_param('id', PARAM_INT);// Course id.
if (!$course = $DB->get_record('course', ['id' => $courseid])) {
throw new moodle_exception(get_string('invalidcourseid', 'grade_markingguide'));
}
// CSV format.
$excel = $format == 'excelcsv';
$csv = $format == 'csv' || $excel;
if (!$csv) {
$PAGE->set_url(new moodle_url('/grade/report/markingguide/index.php', ['id' => $courseid]));
}
require_login($courseid);
if (!$csv) {
$PAGE->set_pagelayout('report');
}
$context = context_course::instance($course->id);
require_capability('gradereport/markingguide:view', $context);
$activityname = '';
// Set up the form.
$mform = new report_markingguide_select_form(null, array('courseid' => $courseid));
// Did we get anything from the form?
if ($formdata = $mform->get_data()) {
// Get the users markingguide.
$activityid = $formdata->activityid;
}
if ($activityid != 0) {
$cm = get_fast_modinfo($courseid)->cms[$activityid];
$activityname = format_string($cm->name, true, ['context' => $context]);
// Determine whether or not to display general feedback.
$gradables = report::get_gradables();
$displayfeedback = $gradables[$cm->modname]['showfeedback'] ?? false;
}
if (!$csv) {
print_grade_page_head($COURSE->id, 'report', 'markingguide',
get_string('pluginname', 'gradereport_markingguide') .
$OUTPUT->help_icon('pluginname', 'gradereport_markingguide'));
// Display the form.
$mform->display();
grade_regrade_final_grades($courseid); // First make sure we have proper final grades.
}
$gpr = new grade_plugin_return(['type' => 'report', 'plugin' => 'grader',
'courseid' => $courseid]); // Return tracking object.
$report = new report($courseid, $gpr, $context); // Initialise the grader report object.
$report->activityid = $activityid;
$report->format = $format;
$report->excel = $format == 'excelcsv';
$report->csv = $format == 'csv' || $report->excel;
$report->displayremark = ($displayremark == 1);
$report->displaysummary = ($displaysummary == 1);
$report->displayidnumber = ($displayidnumber == 1);
$report->displayemail = ($displayemail == 1);
$report->activityname = $activityname;
$report->displayfeedback = $displayfeedback ?? false;
$table = $report->show();
echo $table;
echo $OUTPUT->footer();