Línea 105... |
Línea 105... |
105 |
}
|
105 |
}
|
106 |
// If the item id (user id) cannot be defined or the user id is not part of the list of gradable users,
|
106 |
// If the item id (user id) cannot be defined or the user id is not part of the list of gradable users,
|
107 |
// display the user select zero state.
|
107 |
// display the user select zero state.
|
108 |
if (is_null($itemid) || !array_key_exists($itemid, grade_report::get_gradable_users($courseid, $currentgroup))) {
|
108 |
if (is_null($itemid) || !array_key_exists($itemid, grade_report::get_gradable_users($courseid, $currentgroup))) {
|
109 |
$itemtype = 'user_select';
|
109 |
$itemtype = 'user_select';
|
- |
|
110 |
unset($SESSION->gradereport_singleview["useritem-{$context->id}"]);
|
110 |
}
|
111 |
}
|
111 |
break;
|
112 |
break;
|
112 |
case 'grade_select':
|
113 |
case 'grade_select':
|
113 |
// If there is a stored grade item (last viewed) in a session variable, bypass the grade item select zero state
|
114 |
// If there is a stored grade item (last viewed) in a session variable, bypass the grade item select zero state
|
114 |
// and display this grade item.
|
115 |
// and display this grade item.
|
Línea 127... |
Línea 128... |
127 |
$gtree = new grade_tree($courseid, false, false, null, !$CFG->enableoutcomes);
|
128 |
$gtree = new grade_tree($courseid, false, false, null, !$CFG->enableoutcomes);
|
128 |
$gradeableitems = $gtree->get_items();
|
129 |
$gradeableitems = $gtree->get_items();
|
129 |
// The item id (grade item id) cannot be defined, display the grade select zero state.
|
130 |
// The item id (grade item id) cannot be defined, display the grade select zero state.
|
130 |
if (is_null($itemid) || !array_key_exists($itemid, $gtree->get_items())) {
|
131 |
if (is_null($itemid) || !array_key_exists($itemid, $gtree->get_items())) {
|
131 |
$itemtype = 'grade_select';
|
132 |
$itemtype = 'grade_select';
|
- |
|
133 |
unset($SESSION->gradereport_singleview["gradeitem-{$context->id}"]);
|
132 |
}
|
134 |
}
|
133 |
break;
|
135 |
break;
|
134 |
}
|
136 |
}
|
Línea 135... |
Línea -... |
135 |
|
- |
|
136 |
$report = new gradereport_singleview\report\singleview($courseid, $gpr, $context, $itemtype, $itemid);
|
- |
|
137 |
|
137 |
|
138 |
$pageparams = [
|
138 |
$pageparams = [
|
139 |
'id' => $courseid,
|
139 |
'id' => $courseid,
|
140 |
'userid' => $userid,
|
140 |
'userid' => $userid,
|
141 |
'itemid' => $itemid,
|
141 |
'itemid' => $itemid,
|
Línea 148... |
Línea 148... |
148 |
$pageparams['group'] = $groupid;
|
148 |
$pageparams['group'] = $groupid;
|
149 |
}
|
149 |
}
|
Línea 150... |
Línea 150... |
150 |
|
150 |
|
Línea -... |
Línea 151... |
- |
|
151 |
$PAGE->set_url(new moodle_url('/grade/report/singleview/index.php', $pageparams));
|
- |
|
152 |
|
- |
|
153 |
// Make sure we have proper final grades.
|
- |
|
154 |
$taskindicator = new \core\output\task_indicator(
|
- |
|
155 |
\core_course\task\regrade_final_grades::create($courseid),
|
- |
|
156 |
get_string('recalculatinggrades', 'grades'),
|
- |
|
157 |
get_string('recalculatinggradesadhoc', 'grades'),
|
- |
|
158 |
$PAGE->url,
|
- |
|
159 |
);
|
- |
|
160 |
|
- |
|
161 |
if ($taskindicator->has_task_record()) {
|
- |
|
162 |
// We need to bail out early as the report requires recalculations to be complete, so just display a basic header
|
- |
|
163 |
// with navigation, and the indicator.
|
- |
|
164 |
$actionbar = new \core_grades\output\general_action_bar(
|
- |
|
165 |
$context,
|
- |
|
166 |
new moodle_url('/grade/report/singleview/index.php', ['id' => $courseid]),
|
- |
|
167 |
'report',
|
- |
|
168 |
'singleview'
|
- |
|
169 |
);
|
- |
|
170 |
print_grade_page_head($course->id, 'report', 'singleview', actionbar: $actionbar);
|
- |
|
171 |
echo $OUTPUT->render($taskindicator);
|
- |
|
172 |
echo $OUTPUT->footer();
|
- |
|
173 |
exit;
|
- |
|
174 |
}
|
- |
|
175 |
|
151 |
$PAGE->set_url(new moodle_url('/grade/report/singleview/index.php', $pageparams));
|
176 |
$report = new gradereport_singleview\report\singleview($courseid, $gpr, $context, $itemtype, $itemid);
|
152 |
|
177 |
|
153 |
// Build editing on/off button for themes that need it.
|
178 |
// Build editing on/off button for themes that need it.
|
154 |
$button = '';
|
179 |
$button = '';
|
155 |
if ($PAGE->user_allowed_editing() && !$PAGE->theme->haseditswitch) {
|
180 |
if ($PAGE->user_allowed_editing() && !$PAGE->theme->haseditswitch) {
|
Línea 162... |
Línea 187... |
162 |
$button = $OUTPUT->edit_button(new moodle_url($PAGE->url, $options), 'get');
|
187 |
$button = $OUTPUT->edit_button(new moodle_url($PAGE->url, $options), 'get');
|
163 |
}
|
188 |
}
|
Línea 164... |
Línea 189... |
164 |
|
189 |
|
Línea -... |
Línea 190... |
- |
|
190 |
$reportname = $report->screen->heading();
|
165 |
$reportname = $report->screen->heading();
|
191 |
|
166 |
|
192 |
$baseurl = new moodle_url('/grade/report/singleview/index.php', ['id' => $courseid, 'item' => $itemtype]);
|
167 |
if ($itemtype == 'user' || $itemtype == 'user_select') {
|
193 |
if ($itemtype == 'user' || $itemtype == 'user_select') {
|
168 |
$PAGE->requires->js_call_amd('gradereport_singleview/user', 'init');
|
194 |
$PAGE->requires->js_call_amd('gradereport_singleview/user', 'init', [$baseurl->out(false)]);
|
169 |
$actionbar = new \gradereport_singleview\output\action_bar($context, $report, 'user');
|
195 |
$actionbar = new \gradereport_singleview\output\action_bar($context, $report, 'user');
|
170 |
} else if ($itemtype == 'grade' || $itemtype == 'grade_select') {
|
196 |
} else if ($itemtype == 'grade' || $itemtype == 'grade_select') {
|
171 |
$PAGE->requires->js_call_amd('gradereport_singleview/grade', 'init');
|
197 |
$PAGE->requires->js_call_amd('gradereport_singleview/grade', 'init', [$baseurl->out(false)]);
|
172 |
$actionbar = new \gradereport_singleview\output\action_bar($context, $report, 'grade');
|
198 |
$actionbar = new \gradereport_singleview\output\action_bar($context, $report, 'grade');
|
173 |
} else {
|
199 |
} else {
|
174 |
$actionbar = new \core_grades\output\general_action_bar($context, new moodle_url('/grade/report/singleview/index.php',
|
200 |
$actionbar = new \core_grades\output\general_action_bar($context, new moodle_url('/grade/report/singleview/index.php',
|
175 |
['id' => $courseid]), 'report', 'singleview');
|
201 |
['id' => $courseid]), 'report', 'singleview');
|
176 |
}
|
202 |
}
|
177 |
if ($course->groupmode && $itemtype !== 'select') {
|
203 |
if ($course->groupmode && $itemtype !== 'select') {
|
Línea 178... |
Línea 204... |
178 |
$PAGE->requires->js_call_amd('gradereport_singleview/group', 'init', [$itemtype]);
|
204 |
$PAGE->requires->js_call_amd('core_course/actionbar/group', 'init', [$baseurl->out(false)]);
|
179 |
}
|
205 |
}
|
180 |
|
206 |
|
Línea 208... |
Línea 234... |
208 |
}
|
234 |
}
|
Línea 209... |
Línea 235... |
209 |
|
235 |
|
210 |
// Make sure we have proper final grades.
|
236 |
// Make sure we have proper final grades.
|
Línea -... |
Línea 237... |
- |
|
237 |
grade_regrade_final_grades_if_required($course);
|
- |
|
238 |
|
- |
|
239 |
if ($taskindicator->has_task_record()) {
|
- |
|
240 |
echo $OUTPUT->render($taskindicator);
|
- |
|
241 |
echo $OUTPUT->footer();
|
- |
|
242 |
exit;
|
211 |
grade_regrade_final_grades_if_required($course);
|
243 |
}
|
212 |
|
244 |
|
213 |
// Save the screen state in a session variable as last viewed state.
|
245 |
// Save the screen state in a session variable as last viewed state.
|
214 |
$SESSION->gradereport_singleview["itemtype-{$context->id}"] = $itemtype;
|
246 |
$SESSION->gradereport_singleview["itemtype-{$context->id}"] = $itemtype;
|
215 |
if ($itemid) {
|
247 |
if ($itemid) {
|