MDL-19756 Deprecated update_course_icon() and implemented a simple $OUTPUT->edit_button($moodleurl) method which uses $USER->editing
This commit is contained in:
@@ -2797,6 +2797,29 @@ class moodle_core_renderer extends moodle_renderer_base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a "Turn editing on/off" button in a form.
|
||||
* @param moodle_url $url The URL + params to send through when clicking the button
|
||||
* @return string HTML the button
|
||||
*/
|
||||
public function edit_button(moodle_url $url) {
|
||||
global $USER;
|
||||
if (!empty($USER->editing)) {
|
||||
$string = get_string('turneditingoff');
|
||||
$edit = '0';
|
||||
} else {
|
||||
$string = get_string('turneditingon');
|
||||
$edit = '1';
|
||||
}
|
||||
|
||||
$form = new html_form();
|
||||
$form->url = $url;
|
||||
$form->url->param('edit', $edit);
|
||||
$form->button->text = $string;
|
||||
|
||||
return $this->button($form);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs a HTML nested list
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user