mirror of
https://github.com/moodle/moodle.git
synced 2025-08-11 11:56:40 +02:00
MDL-55472 assign: Show userlist on extension form error page
This commit is contained in:
parent
26162efe4a
commit
ffcfffbe64
3 changed files with 106 additions and 63 deletions
|
@ -43,6 +43,8 @@ class mod_assign_extension_form extends moodleform {
|
|||
* Define the form - called by parent constructor
|
||||
*/
|
||||
public function definition() {
|
||||
global $DB;
|
||||
|
||||
$mform = $this->_form;
|
||||
$params = $this->_customdata;
|
||||
|
||||
|
@ -50,13 +52,37 @@ class mod_assign_extension_form extends moodleform {
|
|||
$instance = $params['instance'];
|
||||
$this->instance = $instance;
|
||||
|
||||
if (!empty($params['userscount'])) {
|
||||
$listusersmessage = get_string('grantextensionforusers', 'assign', $params['userscount']);
|
||||
$mform->addElement('header', 'general', $listusersmessage);
|
||||
$mform->addElement('static', 'userslist', get_string('selectedusers', 'assign'), $params['usershtml']);
|
||||
} else {
|
||||
$mform->addElement('static', 'userslist', '', $params['usershtml']);
|
||||
// Get the assignment class.
|
||||
$assign = $params['assign'];
|
||||
$userlist = $params['userlist'];
|
||||
$usercount = 0;
|
||||
$usershtml = '';
|
||||
|
||||
$extrauserfields = get_extra_user_fields($assign->get_context());
|
||||
foreach ($userlist as $userid) {
|
||||
if ($usercount >= 5) {
|
||||
$usershtml .= get_string('moreusers', 'assign', count($userlist) - 5);
|
||||
break;
|
||||
}
|
||||
$user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
|
||||
|
||||
$usershtml .= $assign->get_renderer()->render(new assign_user_summary($user,
|
||||
$assign->get_course()->id,
|
||||
has_capability('moodle/site:viewfullnames',
|
||||
$assign->get_course_context()),
|
||||
$assign->is_blind_marking(),
|
||||
$assign->get_uniqueid_for_user($user->id),
|
||||
$extrauserfields,
|
||||
!$assign->is_active_user($userid)));
|
||||
$usercount += 1;
|
||||
}
|
||||
|
||||
$userscount = count($userlist);
|
||||
|
||||
$listusersmessage = get_string('grantextensionforusers', 'assign', $userscount);
|
||||
$mform->addElement('header', 'general', $listusersmessage);
|
||||
$mform->addElement('static', 'userslist', get_string('selectedusers', 'assign'), $usershtml);
|
||||
|
||||
if ($instance->allowsubmissionsfromdate) {
|
||||
$mform->addElement('static', 'allowsubmissionsfromdate', get_string('allowsubmissionsfromdate', 'assign'),
|
||||
userdate($instance->allowsubmissionsfromdate));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue