diff --git a/enrol/manual/lib.php b/enrol/manual/lib.php index 24e312260ad..2e052760c56 100644 --- a/enrol/manual/lib.php +++ b/enrol/manual/lib.php @@ -197,14 +197,14 @@ class enrol_manual_plugin extends enrol_plugin { global $CFG, $PAGE; require_once($CFG->dirroot.'/cohort/lib.php'); + static $called = false; + $instance = null; - $instances = array(); foreach ($manager->get_enrolment_instances() as $tempinstance) { if ($tempinstance->enrol == 'manual') { if ($instance === null) { $instance = $tempinstance; } - $instances[] = array('id' => $tempinstance->id, 'name' => $this->get_instance_name($tempinstance)); } } if (empty($instance)) { @@ -222,7 +222,11 @@ class enrol_manual_plugin extends enrol_plugin { $context = context_course::instance($instance->courseid); $arguments = array('contextid' => $context->id); - $PAGE->requires->js_call_amd('enrol_manual/quickenrolment', 'init', array($arguments)); + if (!$called) { + $called = true; + // Calling the following more than once will cause unexpected results. + $PAGE->requires->js_call_amd('enrol_manual/quickenrolment', 'init', array($arguments)); + } return $button; } diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 505e04d4d85..fa9a76f5ed5 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -2089,12 +2089,10 @@ class html_writer { */ public static function script($jscode, $url=null) { if ($jscode) { - $attributes = array('type'=>'text/javascript'); - return self::tag('script', "\n//\n", $attributes) . "\n"; + return self::tag('script', "\n//\n") . "\n"; } else if ($url) { - $attributes = array('type'=>'text/javascript', 'src'=>$url); - return self::tag('script', '', $attributes) . "\n"; + return self::tag('script', '', ['src' => $url]) . "\n"; } else { return ''; diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php index 3eb24e2b680..89bca869e3a 100644 --- a/lib/outputrequirementslib.php +++ b/lib/outputrequirementslib.php @@ -1467,14 +1467,14 @@ class page_requirements_manager { ); if ($this->yui3loader->combine) { - return ''; } else { $code = ''; foreach ($baserollups as $rollup) { - $code .= ''; + $code .= ''; } return $code; } diff --git a/lib/tablelib.php b/lib/tablelib.php index 81a944a308e..067f9869f5c 100644 --- a/lib/tablelib.php +++ b/lib/tablelib.php @@ -1523,7 +1523,6 @@ class table_sql extends flexible_table { function __construct($uniqueid) { parent::__construct($uniqueid); // some sensible defaults - $this->set_attribute('cellspacing', '0'); $this->set_attribute('class', 'generaltable generalbox'); } diff --git a/user/classes/participants_table.php b/user/classes/participants_table.php index 0224f52c82c..5074d1d3eda 100644 --- a/user/classes/participants_table.php +++ b/user/classes/participants_table.php @@ -220,6 +220,9 @@ class participants_table extends \table_sql { $this->define_columns($columns); $this->define_headers($headers); + // The name column is a header. + $this->define_header_column('fullname'); + // Make this table sorted by last name by default. $this->sortable(true, 'lastname'); diff --git a/user/index.php b/user/index.php index 6821dd4de77..b8b07c14923 100644 --- a/user/index.php +++ b/user/index.php @@ -278,7 +278,7 @@ if ($bulkoperations) { if ($participanttable->get_page_size() < $participanttable->totalrows) { // Select all users, refresh page showing all users and mark them all selected. $label = get_string('selectalluserswithcount', 'moodle', $participanttable->totalrows); - echo html_writer::tag('input', "", array('type' => 'button', 'id' => 'checkall', 'class' => 'btn btn-secondary', + echo html_writer::empty_tag('input', array('type' => 'button', 'id' => 'checkall', 'class' => 'btn btn-secondary', 'value' => $label, 'data-showallink' => $showalllink)); } echo html_writer::end_tag('div'); @@ -338,14 +338,12 @@ if ($bulkoperations) { 'data-toggle' => 'action', 'disabled' => empty($selectall) ); - echo html_writer::tag('div', html_writer::tag('label', get_string("withselectedusers"), - array('for' => 'formactionid', 'class' => 'col-form-label d-inline')) . - html_writer::select($displaylist, 'formaction', '', array('' => 'choosedots'), $selectactionparams)); + $label = html_writer::tag('label', get_string("withselectedusers"), + ['for' => 'formactionid', 'class' => 'col-form-label d-inline']); + $select = html_writer::select($displaylist, 'formaction', '', ['' => 'choosedots'], $selectactionparams); + echo html_writer::tag('div', $label . $select); - echo ''; - echo ''; + echo ''; echo ''; echo ''; @@ -360,6 +358,8 @@ echo ''; // Userlist. $enrolrenderer = $PAGE->get_renderer('core_enrol'); echo '
'; +// Need to re-generate the buttons to avoid having elements with duplicate ids on the page. +$enrolbuttons = $manager->get_manual_enrol_buttons(); foreach ($enrolbuttons as $enrolbutton) { echo $enrolrenderer->render($enrolbutton); }