mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
MDL-75337 core: Single button - core changes
* Change all core calls toward single_button to use single_button::BUTTON_PRIMARY when needed
This commit is contained in:
parent
377c962f11
commit
fc72a1d7b1
@ -213,7 +213,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$output .= $this->container_end();
|
||||
}
|
||||
|
||||
$button = new single_button($continueurl, get_string('upgradestart', 'admin'), 'get', true);
|
||||
$button = new single_button($continueurl, get_string('upgradestart', 'admin'), 'get', single_button::BUTTON_PRIMARY);
|
||||
$button->class = 'continuebutton';
|
||||
$output .= $this->render($button);
|
||||
$output .= $this->footer();
|
||||
|
@ -77,7 +77,7 @@ if ($action) {
|
||||
$cancelurl = new moodle_url('/admin/searchareas.php');
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->confirm(get_string('confirm_' . $action, 'search', $a),
|
||||
new single_button($actionurl, get_string('continue'), 'post', true),
|
||||
new single_button($actionurl, get_string('continue'), 'post', single_button::BUTTON_PRIMARY),
|
||||
new single_button($cancelurl, get_string('cancel'), 'get'));
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
|
@ -83,7 +83,7 @@ if (optional_param('sesskey', '', PARAM_ALPHANUM)) {
|
||||
// Display confirmation prompt.
|
||||
echo $OUTPUT->confirm(get_string('gradualreindex_confirm', 'search', html_writer::tag('strong', $areaname)),
|
||||
new single_button(new moodle_url('/admin/searchreindex.php', ['areaid' => $areaid,
|
||||
'sesskey' => sesskey()]), get_string('continue'), 'post', true),
|
||||
'sesskey' => sesskey()]), get_string('continue'), 'post', single_button::BUTTON_PRIMARY),
|
||||
new single_button(new moodle_url('/admin/searchareas.php'), get_string('cancel'), 'get'));
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ class renderer extends plugin_renderer_base {
|
||||
$link,
|
||||
get_string('schedule:requestanalysis', manager::PLUGINNAME),
|
||||
'post',
|
||||
true,
|
||||
\single_button::BUTTON_PRIMARY,
|
||||
['class' => $classname]
|
||||
);
|
||||
|
||||
|
@ -148,7 +148,7 @@ echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('managetokens', 'core_webservice'));
|
||||
|
||||
echo html_writer::div($OUTPUT->render(new single_button(new moodle_url($PAGE->url, ['action' => 'create']),
|
||||
get_string('createtoken', 'core_webservice'), 'get', true)), 'my-3');
|
||||
get_string('createtoken', 'core_webservice'), 'get', single_button::BUTTON_PRIMARY)), 'my-3');
|
||||
|
||||
$filter->display();
|
||||
|
||||
|
@ -60,6 +60,9 @@ class bulk_action extends action {
|
||||
$this->url = new \moodle_url('/report/insights/action.php', $params);
|
||||
|
||||
$label = $OUTPUT->render($icon) . $this->text;
|
||||
$this->actionlink = new \single_button($this->url, $label, 'get', $primary, $attributes);
|
||||
$this->actionlink = new \single_button($this->url, $label,
|
||||
'get',
|
||||
$primary ? \single_button::BUTTON_PRIMARY : \single_button::BUTTON_SECONDARY,
|
||||
$attributes);
|
||||
}
|
||||
}
|
||||
|
@ -567,7 +567,7 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
if ($method != 'post') {
|
||||
$method = 'get';
|
||||
}
|
||||
$button = new single_button($url, get_string('continue'), $method, true);
|
||||
$button = new single_button($url, get_string('continue'), $method, single_button::BUTTON_PRIMARY);
|
||||
$button->class = 'continuebutton';
|
||||
return $this->render($button);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class recipients_action_bar extends manage_badge_action_bar {
|
||||
if ($this->badge->has_manual_award_criteria()
|
||||
&& has_capability('moodle/badges:awardbadge', $this->page->context) && $this->badge->is_active()) {
|
||||
$url = new moodle_url('/badges/award.php', ['id' => $this->badge->id]);
|
||||
$button = new single_button($url, get_string('award', 'badges'), 'post', true);
|
||||
$button = new single_button($url, get_string('award', 'badges'), 'post', single_button::BUTTON_PRIMARY);
|
||||
$elements['awardbutton'] = $button->export_for_template($output);
|
||||
}
|
||||
$thirdpartynav = $this->get_third_party_nav_action($output);
|
||||
|
@ -89,7 +89,7 @@ class standard_action_bar extends base_action_bar {
|
||||
|
||||
if ($this->showaddbadge && has_capability('moodle/badges:createbadge', $this->page->context)) {
|
||||
$buttons[] = new single_button(new moodle_url('/badges/newbadge.php', $params),
|
||||
get_string('newbadge', 'core_badges'), 'post', true);
|
||||
get_string('newbadge', 'core_badges'), 'post', single_button::BUTTON_PRIMARY);
|
||||
}
|
||||
|
||||
foreach ($buttons as $key => $button) {
|
||||
|
@ -155,7 +155,7 @@ class block_accessreview extends block_base {
|
||||
|
||||
$button = new single_button(
|
||||
new moodle_url(accessibility::get_plugin_url(), ['action' => 'requestanalysis', 'courseid' => $COURSE->id]),
|
||||
get_string('schedule:requestanalysis', manager::PLUGINNAME), 'post', true,
|
||||
get_string('schedule:requestanalysis', manager::PLUGINNAME), 'post', single_button::BUTTON_PRIMARY,
|
||||
['class' => 'block_accessreview_analysisbutton']);
|
||||
$this->content->text .= html_writer::tag('div', $OUTPUT->render($button),
|
||||
['class' => 'block_accessreview_analysisbutton']);
|
||||
|
@ -502,7 +502,7 @@ class main implements renderable, templatable {
|
||||
new \moodle_url('/course/request.php', ['category' => $category->id]),
|
||||
get_string('requestcourse'),
|
||||
'post',
|
||||
true
|
||||
\single_button::BUTTON_PRIMARY
|
||||
);
|
||||
return $this->generate_zero_state_data($nocoursesimg, [$button], 'request');
|
||||
}
|
||||
@ -523,7 +523,7 @@ class main implements renderable, templatable {
|
||||
new \moodle_url('/course/edit.php', ['category' => $category->id]),
|
||||
get_string('createcourse', 'block_myoverview'),
|
||||
'post',
|
||||
true
|
||||
\single_button::BUTTON_PRIMARY
|
||||
);
|
||||
$buttons[] = $createbutton->export_for_template($output);
|
||||
return $this->generate_zero_state_data($nocoursesimg, $buttons, 'nocourses');
|
||||
@ -534,7 +534,7 @@ class main implements renderable, templatable {
|
||||
new \moodle_url('/course/edit.php', ['category' => $categorytocreate->id]),
|
||||
get_string('createcourse', 'block_myoverview'),
|
||||
'post',
|
||||
true
|
||||
\single_button::BUTTON_PRIMARY
|
||||
);
|
||||
$buttons = [$createbutton->export_for_template($output)];
|
||||
if ($categorytomanage = \core_course_category::get_nearest_editable_subcategory($coursecat, ['manage'])) {
|
||||
|
@ -325,10 +325,10 @@ class core_calendar_renderer extends plugin_renderer_base {
|
||||
*/
|
||||
public function render_subscriptions_header(): string {
|
||||
$importcalendarbutton = new single_button(new moodle_url('/calendar/import.php', calendar_get_export_import_link_params()),
|
||||
get_string('importcalendar', 'calendar'), 'get', true);
|
||||
get_string('importcalendar', 'calendar'), 'get', single_button::BUTTON_PRIMARY);
|
||||
$importcalendarbutton->class .= ' float-sm-right float-right';
|
||||
$exportcalendarbutton = new single_button(new moodle_url('/calendar/export.php', calendar_get_export_import_link_params()),
|
||||
get_string('exportcalendar', 'calendar'), 'get', true);
|
||||
get_string('exportcalendar', 'calendar'), 'get', single_button::BUTTON_PRIMARY);
|
||||
$exportcalendarbutton->class .= ' float-sm-right float-right';
|
||||
$output = $this->output->heading(get_string('managesubscriptions', 'calendar'));
|
||||
$output .= html_writer::start_div('header d-flex flex-wrap mt-5');
|
||||
|
@ -218,7 +218,7 @@ class enrol_manual_plugin extends enrol_plugin {
|
||||
|
||||
$button = new enrol_user_button($link, get_string('enrolusers', 'enrol_manual'), 'get');
|
||||
$button->class .= ' enrol_manual_plugin';
|
||||
$button->primary = true;
|
||||
$button->type = single_button::BUTTON_PRIMARY;
|
||||
|
||||
$context = context_course::instance($instance->courseid);
|
||||
$arguments = array('contextid' => $context->id);
|
||||
|
@ -98,7 +98,7 @@ echo $OUTPUT->header();
|
||||
// Check we have a search button to render.
|
||||
$searchbuttonrender = null;
|
||||
if ($searchbutton = $table->get_user_search_button()) {
|
||||
$searchbutton->primary = true;
|
||||
$searchbutton->type = single_button::BUTTON_PRIMARY;
|
||||
$searchbuttonrender = $OUTPUT->render($searchbutton);
|
||||
}
|
||||
|
||||
|
@ -37,12 +37,15 @@ class core_enrol_renderer extends plugin_renderer_base {
|
||||
* @return string XHTML
|
||||
*/
|
||||
protected function render_enrol_user_button(enrol_user_button $button) {
|
||||
$attributes = array('type' => 'submit',
|
||||
'value' => $button->label,
|
||||
'disabled' => $button->disabled ? 'disabled' : null,
|
||||
'title' => $button->tooltip,
|
||||
'class' => 'btn ' . ($button->primary ? 'btn-primary' : 'btn-secondary'));
|
||||
$buttoninfo = $button->export_for_template($this->output);
|
||||
|
||||
$attributes = [
|
||||
'type' => 'submit',
|
||||
'value' => $buttoninfo->label,
|
||||
'disabled' => $buttoninfo->disabled ? 'disabled' : null,
|
||||
'title' => $buttoninfo->tooltip,
|
||||
'class' => 'btn ' . "btn-{$buttoninfo->type}",
|
||||
];
|
||||
if ($button->actions) {
|
||||
$id = html_writer::random_id('single_button');
|
||||
$attributes['id'] = $id;
|
||||
|
@ -56,7 +56,7 @@ class course_outcomes_action_bar extends action_bar {
|
||||
// Add a button to the action bar with a link to the 'manage outcomes' page.
|
||||
$manageoutcomeslink = new moodle_url('/grade/edit/outcome/index.php', ['id' => $courseid]);
|
||||
$manageoutcomesbutton = new \single_button($manageoutcomeslink, get_string('manageoutcomes', 'grades'),
|
||||
'get', true);
|
||||
'get', \single_button::BUTTON_PRIMARY);
|
||||
$data['manageoutcomesbutton'] = $manageoutcomesbutton->export_for_template($output);
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ class export_key_manager_action_bar extends action_bar {
|
||||
// Add a button to the action bar with a link to the 'add user key' page.
|
||||
$adduserkeylink = new moodle_url('/grade/export/key.php', ['courseid' => $courseid]);
|
||||
$adduserkeybutton = new \single_button($adduserkeylink, get_string('adduserkey', 'userkey'),
|
||||
'get', true);
|
||||
'get', \single_button::BUTTON_PRIMARY);
|
||||
$data['adduserkeybutton'] = $adduserkeybutton->export_for_template($output);
|
||||
|
||||
return $data;
|
||||
|
@ -53,7 +53,7 @@ class grade_letters_action_bar extends action_bar {
|
||||
}
|
||||
// Add a button to the action bar with a link to the 'edit grade letters' page.
|
||||
$editbuttonlink = new moodle_url('/grade/edit/letter/index.php', ['id' => $this->context->id, 'edit' => 1]);
|
||||
$editbutton = new \single_button($editbuttonlink, get_string('edit'), 'get', true);
|
||||
$editbutton = new \single_button($editbuttonlink, get_string('edit'), 'get', \single_button::BUTTON_PRIMARY);
|
||||
$data['editbutton'] = $editbutton->export_for_template($output);
|
||||
|
||||
return $data;
|
||||
|
@ -54,7 +54,7 @@ class import_key_manager_action_bar extends action_bar {
|
||||
// Add a button to the action bar with a link to the 'add user key' page.
|
||||
$adduserkeylink = new moodle_url('/grade/import/key.php', ['courseid' => $courseid]);
|
||||
$adduserkeybutton = new \single_button($adduserkeylink, get_string('adduserkey', 'userkey'),
|
||||
'get', true);
|
||||
'get', \single_button::BUTTON_PRIMARY);
|
||||
$data['adduserkeybutton'] = $adduserkeybutton->export_for_template($output);
|
||||
|
||||
return $data;
|
||||
|
@ -78,7 +78,7 @@ class manage_outcomes_action_bar extends action_bar {
|
||||
// Add a button to the action bar with a link to the 'add new outcome' page.
|
||||
$addoutcomelink = new moodle_url('/grade/edit/outcome/edit.php', ['courseid' => $courseid]);
|
||||
$addoutcomebutton = new \single_button($addoutcomelink, get_string('outcomecreate', 'grades'),
|
||||
'get', true);
|
||||
'get', \single_button::BUTTON_PRIMARY);
|
||||
$data['addoutcomebutton'] = $addoutcomebutton->export_for_template($output);
|
||||
|
||||
if ($this->hasoutcomes) {
|
||||
|
@ -56,7 +56,7 @@ class scales_action_bar extends action_bar {
|
||||
// Add a button to the action bar with a link to the 'add new scale' page.
|
||||
$addnewscalelink = new moodle_url('/grade/edit/scale/edit.php', ['courseid' => $courseid]);
|
||||
$addnewscalebutton = new \single_button($addnewscalelink, get_string('scalescustomcreate'),
|
||||
'get', true);
|
||||
'get', \single_button::BUTTON_PRIMARY);
|
||||
$data['addnewscalebutton'] = $addnewscalebutton->export_for_template($output);
|
||||
|
||||
return $data;
|
||||
|
@ -2051,12 +2051,16 @@ class core_renderer extends renderer_base {
|
||||
$displayoptions['cancelstr'] = $displayoptions['cancelstr'] ?? get_string('cancel');
|
||||
|
||||
if ($continue instanceof single_button) {
|
||||
// ok
|
||||
$continue->primary = true;
|
||||
// Continue button should be primary if set to secondary type as it is the fefault.
|
||||
if ($continue->type === single_button::BUTTON_SECONDARY) {
|
||||
$continue->type = single_button::BUTTON_PRIMARY;
|
||||
}
|
||||
} else if (is_string($continue)) {
|
||||
$continue = new single_button(new moodle_url($continue), $displayoptions['continuestr'], 'post', true);
|
||||
$continue = new single_button(new moodle_url($continue), $displayoptions['continuestr'], 'post',
|
||||
$displayoptions['type'] ?? single_button::BUTTON_PRIMARY);
|
||||
} else if ($continue instanceof moodle_url) {
|
||||
$continue = new single_button($continue, $displayoptions['continuestr'], 'post', true);
|
||||
$continue = new single_button($continue, $displayoptions['continuestr'], 'post',
|
||||
$displayoptions['type'] ?? single_button::BUTTON_PRIMARY);
|
||||
} else {
|
||||
throw new coding_exception('The continue param to $OUTPUT->confirm() must be either a URL (string/moodle_url) or a single_button instance.');
|
||||
}
|
||||
@ -3120,7 +3124,7 @@ EOD;
|
||||
if (!($url instanceof moodle_url)) {
|
||||
$url = new moodle_url($url);
|
||||
}
|
||||
$button = new single_button($url, get_string('continue'), 'get', true);
|
||||
$button = new single_button($url, get_string('continue'), 'get', single_button::BUTTON_PRIMARY);
|
||||
$button->class = 'continuebutton';
|
||||
|
||||
return $this->render($button);
|
||||
@ -5567,11 +5571,13 @@ class core_renderer_maintenance extends core_renderer {
|
||||
// We need plain styling of confirm boxes on upgrade because we don't know which stylesheet we have (it could be
|
||||
// from any previous version of Moodle).
|
||||
if ($continue instanceof single_button) {
|
||||
$continue->primary = true;
|
||||
$continue->type = single_button::BUTTON_PRIMARY;
|
||||
} else if (is_string($continue)) {
|
||||
$continue = new single_button(new moodle_url($continue), get_string('continue'), 'post', true);
|
||||
$continue = new single_button(new moodle_url($continue), get_string('continue'), 'post',
|
||||
$displayoptions['type'] ?? single_button::BUTTON_PRIMARY);
|
||||
} else if ($continue instanceof moodle_url) {
|
||||
$continue = new single_button($continue, get_string('continue'), 'post', true);
|
||||
$continue = new single_button($continue, get_string('continue'), 'post',
|
||||
$displayoptions['type'] ?? single_button::BUTTON_PRIMARY);
|
||||
} else {
|
||||
throw new coding_exception('The continue param to $OUTPUT->confirm() must be either a URL' .
|
||||
' (string/moodle_url) or a single_button instance.');
|
||||
|
@ -150,7 +150,7 @@ class override_actionmenu implements templatable, renderable {
|
||||
} else if ($action === 'adduser' && !$this->show_useroverride()) {
|
||||
$options = ['disabled' => 'true'];
|
||||
}
|
||||
$overridebutton = new single_button($url, $text, 'post', true, $options);
|
||||
$overridebutton = new single_button($url, $text, 'post', single_button::BUTTON_PRIMARY, $options);
|
||||
|
||||
$urlselect = $this->get_select_menu();
|
||||
return [
|
||||
|
@ -119,7 +119,12 @@ class user_submission_actionmenu implements templatable, renderable {
|
||||
'help' => $help->export_for_template($output)
|
||||
];
|
||||
$url = new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'editsubmission']);
|
||||
$newattemptbutton = new single_button($url, get_string('addnewattempt', 'mod_assign'), 'get', true);
|
||||
$newattemptbutton = new single_button(
|
||||
$url,
|
||||
get_string('addnewattempt', 'mod_assign'),
|
||||
'get',
|
||||
single_button::BUTTON_PRIMARY
|
||||
);
|
||||
$newattempthelp = new help_icon('addnewattempt', 'mod_assign');
|
||||
$data['edit']['button'] = $newattemptbutton->export_for_template($output);
|
||||
$data['edit']['help'] = $newattempthelp->export_for_template($output);
|
||||
@ -143,7 +148,12 @@ class user_submission_actionmenu implements templatable, renderable {
|
||||
$data['edit']['begin'] = true;
|
||||
$data['edit']['help'] = '';
|
||||
} else {
|
||||
$newattemptbutton = new single_button($url, get_string('addsubmission', 'mod_assign'), 'get', true);
|
||||
$newattemptbutton = new single_button(
|
||||
$url,
|
||||
get_string('addsubmission', 'mod_assign'),
|
||||
'get',
|
||||
single_button::BUTTON_PRIMARY
|
||||
);
|
||||
$data['edit']['button'] = $newattemptbutton->export_for_template($output);
|
||||
$data['edit']['help'] = '';
|
||||
}
|
||||
@ -151,7 +161,7 @@ class user_submission_actionmenu implements templatable, renderable {
|
||||
}
|
||||
if ($this->showsubmit) {
|
||||
$url = new moodle_url('/mod/assign/view.php', ['id' => $this->cmid, 'action' => 'submit']);
|
||||
$button = new single_button($url, get_string('submitassignment', 'mod_assign'), 'get', true);
|
||||
$button = new single_button($url, get_string('submitassignment', 'mod_assign'), 'get', single_button::BUTTON_PRIMARY);
|
||||
$help = new help_icon('submitassignment', 'mod_assign');
|
||||
$data['submit'] = [
|
||||
'button' => $button->export_for_template($output),
|
||||
|
@ -587,7 +587,7 @@ class mod_bigbluebuttonbn_mod_form extends moodleform_mod {
|
||||
$action = new single_button(new moodle_url(qualified_me()),
|
||||
get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn'),
|
||||
'post',
|
||||
false,
|
||||
single_button::BUTTON_SECONDARY,
|
||||
['name' => 'bigbluebuttonbn_participant_selection_add']
|
||||
);
|
||||
$pformcontext = [
|
||||
|
@ -58,7 +58,7 @@ class add_entries_action implements templatable, renderable {
|
||||
|
||||
if (data_user_can_add_entry($database, $currentgroup, $groupmode, $PAGE->context)) {
|
||||
$addentrylink = new moodle_url('/mod/data/edit.php', ['d' => $this->id, 'backto' => $PAGE->url->out(false)]);
|
||||
$button = new \single_button($addentrylink, get_string('add', 'mod_data'), 'get', true);
|
||||
$button = new \single_button($addentrylink, get_string('add', 'mod_data'), 'get', \single_button::BUTTON_PRIMARY);
|
||||
return $button->export_for_template($output);
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ class empty_database_action_bar implements templatable, renderable {
|
||||
|
||||
$importentrieslink = new moodle_url('/mod/data/import.php', $params);
|
||||
$importentriesbutton = new \single_button($importentrieslink,
|
||||
get_string('importentries', 'mod_data'), 'get', false);
|
||||
get_string('importentries', 'mod_data'), 'get');
|
||||
$data['importentriesbutton'] = $importentriesbutton->export_for_template($output);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ class zero_state_action_bar implements templatable, renderable {
|
||||
|
||||
$usepresetlink = new moodle_url('/mod/data/preset.php', $params);
|
||||
$usepresetbutton = new \single_button($usepresetlink,
|
||||
get_string('usestandard', 'mod_data'), 'get', true);
|
||||
get_string('usestandard', 'mod_data'), 'get', \single_button::BUTTON_PRIMARY);
|
||||
$data['usepresetbutton'] = $usepresetbutton->export_for_template($output);
|
||||
|
||||
$actionbar = new \mod_data\output\action_bar($instance->id, $PAGE->url);
|
||||
@ -68,7 +68,7 @@ class zero_state_action_bar implements templatable, renderable {
|
||||
|
||||
$importpresetlink = new moodle_url('/mod/data/preset.php', $params);
|
||||
$importpresetbutton = new \single_button($importpresetlink,
|
||||
get_string('importapreset', 'mod_data'), 'get', false, [
|
||||
get_string('importapreset', 'mod_data'), 'get', \single_button::BUTTON_SECONDARY, [
|
||||
'data-action' => 'importpresets',
|
||||
'data-dataid' => $cm->id,
|
||||
]);
|
||||
|
@ -60,7 +60,7 @@ class mod_folder_renderer extends plugin_renderer_base {
|
||||
$canmanagecourseactivities = has_capability('moodle/course:manageactivities', $context);
|
||||
if ($canmanagefolderfiles && ($folder->display != FOLDER_DISPLAY_INLINE || !$canmanagecourseactivities)) {
|
||||
$editbutton = new single_button(new moodle_url('/mod/folder/edit.php', ['id' => $cm->id]),
|
||||
get_string('edit'), 'post', true);
|
||||
get_string('edit'), 'post', single_button::BUTTON_PRIMARY);
|
||||
$editbutton->class = 'navitem';
|
||||
$buttons .= $this->render($editbutton);
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ class standard_action_bar implements renderable, templatable {
|
||||
return null;
|
||||
}
|
||||
$btn = new single_button(new moodle_url('/mod/glossary/edit.php', ['cmid' => $this->cm->id]),
|
||||
get_string('addsingleentry', 'glossary'), 'post', true);
|
||||
get_string('addsingleentry', 'glossary'), 'post', single_button::BUTTON_PRIMARY);
|
||||
|
||||
return $btn->export_for_template($output);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ class edit_action_buttons implements templatable, renderable {
|
||||
|
||||
if ($this->lesson->can_manage()) {
|
||||
$url = new moodle_url('/mod/lesson/edit.php', ['id' => $this->lesson->get_cm()->id]);
|
||||
$editbutton = new single_button($url, get_string('editlesson', 'mod_lesson'), 'get', true);
|
||||
$editbutton = new single_button($url, get_string('editlesson', 'mod_lesson'), 'get', single_button::BUTTON_PRIMARY);
|
||||
$url = new moodle_url('/mod/lesson/essay.php', ['id' => $this->lesson->get_cm()->id]);
|
||||
$essaybutton = new single_button($url, get_string('manualgrading', 'mod_lesson'), 'get');
|
||||
$data += [
|
||||
|
@ -77,7 +77,7 @@ class overrides_actions implements renderable, templatable {
|
||||
$label = get_string('addnewuseroverride', 'quiz');
|
||||
}
|
||||
|
||||
$addoverridebutton = new \single_button($addoverrideurl, $label, 'get', true);
|
||||
$addoverridebutton = new \single_button($addoverrideurl, $label, 'get', \single_button::BUTTON_PRIMARY);
|
||||
if (!$this->addenabled) {
|
||||
$addoverridebutton->disabled = true;
|
||||
}
|
||||
|
@ -823,7 +823,7 @@ class renderer extends plugin_renderer_base {
|
||||
}
|
||||
$this->page->requires->js_call_amd('mod_quiz/submission_confirmation', 'init', [$totalunanswered]);
|
||||
}
|
||||
$button->primary = true;
|
||||
$button->type = \single_button::BUTTON_PRIMARY;
|
||||
|
||||
$duedate = $attemptobj->get_due_date();
|
||||
$message = '';
|
||||
@ -935,7 +935,7 @@ class renderer extends plugin_renderer_base {
|
||||
preflight_check_form $preflightcheckform = null,
|
||||
$popuprequired = false, $popupoptions = null) {
|
||||
|
||||
$button = new single_button($url, $buttontext, 'post', true);
|
||||
$button = new single_button($url, $buttontext, 'post', single_button::BUTTON_PRIMARY);
|
||||
$button->class .= ' quizstartbuttondiv';
|
||||
if ($popuprequired) {
|
||||
$button->class .= ' quizsecuremoderequired';
|
||||
|
@ -1225,7 +1225,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
|
||||
if (!$workshop->get_submission_by_author($USER->id)) {
|
||||
$btnurl = new moodle_url($workshop->submission_url(), ['edit' => 'on']);
|
||||
$btntxt = get_string('createsubmission', 'workshop');
|
||||
$output .= $this->single_button($btnurl, $btntxt, 'get', ['primary' => true]);
|
||||
$output .= $this->single_button($btnurl, $btntxt, 'get', ['type' => single_button::BUTTON_PRIMARY]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1236,7 +1236,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
|
||||
if ($workshop->creating_submission_allowed($USER->id)) {
|
||||
$btnurl = new moodle_url($workshop->submission_url(), ['edit' => 'on']);
|
||||
$btntxt = get_string('createsubmission', 'workshop');
|
||||
$output .= $this->single_button($btnurl, $btntxt, 'get', ['primary' => true]);
|
||||
$output .= $this->single_button($btnurl, $btntxt, 'get', ['type' => single_button::BUTTON_PRIMARY]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,11 @@ $PAGE->set_secondary_active_tab("modulepage");
|
||||
//
|
||||
echo $OUTPUT->header();
|
||||
$continuebtn = new single_button(
|
||||
new moodle_url($PAGE->url, array('confirm' => 1)), get_string('continue'), 'post', true);
|
||||
new moodle_url($PAGE->url, array('confirm' => 1)),
|
||||
get_string('continue'),
|
||||
'post',
|
||||
single_button::BUTTON_PRIMARY
|
||||
);
|
||||
$continuebtn->class .= ' mr-3';
|
||||
echo $OUTPUT->confirm(get_string('switchphase' . $phase . 'info', 'workshop'),
|
||||
$continuebtn, $workshop->view_url());
|
||||
|
@ -243,7 +243,7 @@ class infectedfiles_table extends \table_sql implements \renderable {
|
||||
// Delete All.
|
||||
$deleteallparams = ['action' => 'deleteall', 'sesskey' => sesskey()];
|
||||
$deleteallurl = new \moodle_url($managefilepage, $deleteallparams);
|
||||
$deletebutton = new \single_button($deleteallurl, get_string('deleteall'), 'post', true);
|
||||
$deletebutton = new \single_button($deleteallurl, get_string('deleteall'), 'post', \single_button::BUTTON_PRIMARY);
|
||||
$deletebutton->add_confirm_action(get_string('confirmdeleteall', 'report_infectedfiles'));
|
||||
echo $OUTPUT->render($deletebutton);
|
||||
|
||||
@ -252,7 +252,7 @@ class infectedfiles_table extends \table_sql implements \renderable {
|
||||
// Download All.
|
||||
$downloadallparams = ['action' => 'downloadall', 'sesskey' => sesskey()];
|
||||
$downloadallurl = new \moodle_url($managefilepage, $downloadallparams);
|
||||
$downloadbutton = new \single_button($downloadallurl, get_string('downloadall'), 'post', true);
|
||||
$downloadbutton = new \single_button($downloadallurl, get_string('downloadall'), 'post', \single_button::BUTTON_PRIMARY);
|
||||
$downloadbutton->add_confirm_action(get_string('confirmdownloadall', 'report_infectedfiles'));
|
||||
echo $OUTPUT->render($downloadbutton);
|
||||
}
|
||||
|
@ -164,7 +164,12 @@ class repository_googledocs extends repository {
|
||||
|
||||
$repositoryname = get_string('pluginname', 'repository_googledocs');
|
||||
|
||||
$button = new single_button($url, get_string('logintoaccount', 'repository', $repositoryname), 'post', true);
|
||||
$button = new single_button(
|
||||
$url,
|
||||
get_string('logintoaccount', 'repository', $repositoryname),
|
||||
'post',
|
||||
single_button::BUTTON_PRIMARY
|
||||
);
|
||||
$button->add_action(new popup_action('click', $url, 'Login'));
|
||||
$button->class = 'mdl-align';
|
||||
$button = $OUTPUT->render($button);
|
||||
|
@ -857,7 +857,7 @@ class repository_nextcloud extends repository {
|
||||
echo $OUTPUT->header();
|
||||
|
||||
$button = new single_button($url, get_string('logintoaccount', 'repository', $this->get_name()),
|
||||
'post', true);
|
||||
'post', single_button::BUTTON_PRIMARY);
|
||||
$button->add_action(new popup_action('click', $url, 'Login'));
|
||||
$button->class = 'mdl-align';
|
||||
$button = $OUTPUT->render($button);
|
||||
|
@ -145,7 +145,12 @@ class repository_onedrive extends repository {
|
||||
|
||||
$repositoryname = get_string('pluginname', 'repository_onedrive');
|
||||
|
||||
$button = new single_button($url, get_string('logintoaccount', 'repository', $repositoryname), 'post', true);
|
||||
$button = new single_button(
|
||||
$url,
|
||||
get_string('logintoaccount', 'repository', $repositoryname),
|
||||
'post',
|
||||
single_button::BUTTON_PRIMARY
|
||||
);
|
||||
$button->add_action(new popup_action('click', $url, 'Login'));
|
||||
$button->class = 'mdl-align';
|
||||
$button = $OUTPUT->render($button);
|
||||
|
Loading…
x
Reference in New Issue
Block a user