Línea 26... |
Línea 26... |
26 |
require_once $CFG->libdir.'/gradelib.php';
|
26 |
require_once $CFG->libdir.'/gradelib.php';
|
27 |
require_once $CFG->dirroot.'/grade/lib.php';
|
27 |
require_once $CFG->dirroot.'/grade/lib.php';
|
28 |
require_once $CFG->dirroot.'/grade/report/user/lib.php';
|
28 |
require_once $CFG->dirroot.'/grade/report/user/lib.php';
|
Línea 29... |
Línea 29... |
29 |
|
29 |
|
- |
|
30 |
$courseid = required_param('id', PARAM_INT);
|
30 |
$courseid = required_param('id', PARAM_INT);
|
31 |
// 0 - view all reports. null - view own report. non-zero and non-null - view other user report.
|
31 |
$userid = optional_param('userid', null, PARAM_INT);
|
32 |
$userid = optional_param('userid', null, PARAM_INT);
|
Línea 32... |
Línea 33... |
32 |
$userview = optional_param('userview', 0, PARAM_INT);
|
33 |
$userview = optional_param('userview', 0, PARAM_INT);
|
Línea 82... |
Línea 83... |
82 |
$USER->grade_last_report = [];
|
83 |
$USER->grade_last_report = [];
|
83 |
}
|
84 |
}
|
84 |
$USER->grade_last_report[$course->id] = 'user';
|
85 |
$USER->grade_last_report[$course->id] = 'user';
|
Línea 85... |
Línea 86... |
85 |
|
86 |
|
- |
|
87 |
// First make sure we have proper final grades.
|
- |
|
88 |
$taskindicator = new \core\output\task_indicator(
|
- |
|
89 |
\core_course\task\regrade_final_grades::create($courseid),
|
- |
|
90 |
get_string('recalculatinggrades', 'grades'),
|
- |
|
91 |
get_string('recalculatinggradesadhoc', 'grades'),
|
- |
|
92 |
$PAGE->url,
|
- |
|
93 |
);
|
86 |
// First make sure we have proper final grades.
|
94 |
if (!$taskindicator->has_task_record()) {
|
- |
|
95 |
grade_regrade_final_grades_if_required($course);
|
Línea 87... |
Línea 96... |
87 |
grade_regrade_final_grades_if_required($course);
|
96 |
}
|
Línea 88... |
Línea 97... |
88 |
|
97 |
|
89 |
$gradesrenderer = $PAGE->get_renderer('core_grades');
|
98 |
$gradesrenderer = $PAGE->get_renderer('core_grades');
|
- |
|
99 |
|
- |
|
100 |
// Teachers will see all student reports.
|
- |
|
101 |
if (has_capability('moodle/grade:viewall', $context)) {
|
- |
|
102 |
if ($taskindicator->has_task_record()) {
|
- |
|
103 |
// We need to bail out early as getting the gradeable users requires calculations to be complete,
|
- |
|
104 |
// so just display a basic header with navigation, and the indicator.
|
- |
|
105 |
$actionbar = new \core_grades\output\general_action_bar($context, $PAGE->url, 'report', 'user');
|
- |
|
106 |
print_grade_page_head($course->id, 'report', 'user', actionbar: $actionbar);
|
- |
|
107 |
echo $OUTPUT->render($taskindicator);
|
- |
|
108 |
echo $OUTPUT->footer();
|
90 |
|
109 |
exit;
|
91 |
// Teachers will see all student reports.
|
110 |
}
|
92 |
if (has_capability('moodle/grade:viewall', $context)) {
|
111 |
|
93 |
// Verify if we are using groups or not.
|
112 |
// Verify if we are using groups or not.
|
94 |
$groupmode = groups_get_course_groupmode($course);
|
113 |
$groupmode = groups_get_course_groupmode($course);
|
- |
|
114 |
$currentgroup = $gpr->groupid;
|
95 |
$currentgroup = $gpr->groupid;
|
115 |
// Conditionally add the group JS if we have groups enabled.
|
96 |
// Conditionally add the group JS if we have groups enabled.
|
116 |
if ($groupmode) {
|
Línea 97... |
Línea 117... |
97 |
if ($groupmode) {
|
117 |
$baseurl = new moodle_url('/grade/report/user/index.php', ['id' => $courseid]);
|
98 |
$PAGE->requires->js_call_amd('gradereport_user/group', 'init');
|
118 |
$PAGE->requires->js_call_amd('core_course/actionbar/group', 'init', [$baseurl->out(false)]);
|
99 |
}
|
119 |
}
|
Línea 199... |
Línea 219... |
199 |
$report = new gradereport_user\report\user($courseid, $gpr, $context, $userid ?? $USER->id);
|
219 |
$report = new gradereport_user\report\user($courseid, $gpr, $context, $userid ?? $USER->id);
|
Línea 200... |
Línea 220... |
200 |
|
220 |
|
201 |
// Print the page.
|
221 |
// Print the page.
|
Línea -... |
Línea 222... |
- |
|
222 |
print_grade_page_head($courseid, 'report', 'user', false, false, false, true, null, null, $report->user);
|
- |
|
223 |
|
202 |
print_grade_page_head($courseid, 'report', 'user', false, false, false, true, null, null, $report->user);
|
224 |
if ($taskindicator->has_task_record()) {
|
203 |
|
225 |
echo $OUTPUT->render($taskindicator);
|
204 |
if ($report->fill_table()) {
|
226 |
} else if ($report->fill_table()) {
|
205 |
echo $report->print_table(true);
|
227 |
echo $report->print_table(true);
|
Línea 206... |
Línea 228... |
206 |
}
|
228 |
}
|