MDL-80744 mod_assign: Add user search.

This commit is contained in:
Ilya Tregubov 2024-06-12 17:12:59 +08:00
parent 8087893fcb
commit de54a993d3
16 changed files with 656 additions and 97 deletions

View file

@ -24,6 +24,8 @@
namespace mod_assign\output;
use assign;
use context_module;
use templatable;
use renderable;
use moodle_url;
@ -71,14 +73,35 @@ class grading_actionmenu implements templatable, renderable {
$course = $PAGE->course;
$data = [];
$context = context_module::instance($this->cmid);
$assign = new assign($context, null, null);
$assignid = $assign->get_instance()->id;
if ($this->submissionpluginenabled && $this->submissioncount) {
$data['downloadall'] = (
new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'downloadall'])
)->out(false);
}
$userid = optional_param('userid', null, PARAM_INT);
// If the user ID is set, it indicates that a user has been selected. In this case, override the user search
// string with the full name of the selected user.
$usersearch = $userid ? fullname(\core_user::get_user($userid)) : optional_param('search', '', PARAM_NOTAGS);
$actionbarrenderer = $PAGE->get_renderer('core_course', 'actionbar');
$resetlink = new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'grading']);
$groupid = groups_get_course_group($course, true);
$userselector = new \core_course\output\actionbar\user_selector(
course: $course,
resetlink: $resetlink,
userid: $userid,
groupid: $groupid,
usersearch: $usersearch,
instanceid: $assignid
);
$data['userselector'] = $actionbarrenderer->render($userselector);
if ($course->groupmode) {
$actionbarrenderer = $PAGE->get_renderer('core_course', 'actionbar');
$data['groupselector'] = $actionbarrenderer->render(new \core_course\output\actionbar\group_selector($course));
}