Skip to content
This repository has been archived by the owner on Dec 13, 2024. It is now read-only.

Commit

Permalink
Merge branch 'MDL-68148-master' of git://github.com/rezaies/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Apr 8, 2020
2 parents f1f1497 + 8aecd85 commit 7aa6398
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 19 deletions.
10 changes: 7 additions & 3 deletions enrol/manual/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,14 @@ public function get_manual_enrol_button(course_enrolment_manager $manager) {
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)) {
Expand All @@ -222,7 +222,11 @@ public function get_manual_enrol_button(course_enrolment_manager $manager) {
$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;
}
Expand Down
6 changes: 2 additions & 4 deletions lib/outputcomponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -2089,12 +2089,10 @@ public static function input_hidden_params(moodle_url $url, array $exclude = nul
*/
public static function script($jscode, $url=null) {
if ($jscode) {
$attributes = array('type'=>'text/javascript');
return self::tag('script', "\n//<![CDATA[\n$jscode\n//]]>\n", $attributes) . "\n";
return self::tag('script', "\n//<![CDATA[\n$jscode\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 '';
Expand Down
4 changes: 2 additions & 2 deletions lib/outputrequirementslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1467,14 +1467,14 @@ protected function get_yui3lib_headcode() {
);

if ($this->yui3loader->combine) {
return '<script type="text/javascript" src="' .
return '<script src="' .
$this->yui3loader->local_comboBase .
implode('&amp;', $baserollups) .
'"></script>';
} else {
$code = '';
foreach ($baserollups as $rollup) {
$code .= '<script type="text/javascript" src="'.$this->yui3loader->local_comboBase.$rollup.'"></script>';
$code .= '<script src="'.$this->yui3loader->local_comboBase.$rollup.'"></script>';
}
return $code;
}
Expand Down
1 change: 0 additions & 1 deletion lib/tablelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,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');
}

Expand Down
3 changes: 3 additions & 0 deletions user/classes/participants_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ public function out($pagesize, $useinitialsbar, $downloadhelpbutton = '') {
$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');

Expand Down
18 changes: 9 additions & 9 deletions user/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
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');
Expand Down Expand Up @@ -387,14 +387,12 @@
'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));

echo '<input type="hidden" name="id" value="'.$course->id.'" />';
echo '<noscript style="display:inline">';
echo '<div><input type="submit" value="'.get_string('ok').'" /></div>';
echo '</noscript>';
$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 '<input type="hidden" name="id" value="' . $course->id . '" />';
echo '</div></div></div>';
echo '</form>';

Expand All @@ -409,6 +407,8 @@

$enrolrenderer = $PAGE->get_renderer('core_enrol');
echo '<div class="float-right">';
// 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);
}
Expand Down

0 comments on commit 7aa6398

Please sign in to comment.