MDL-19756 Deprecated update_course_icon() and implemented a simple $OUTPUT->edit_button($moodleurl) method which uses $USER->editing

This commit is contained in:
nicolasconnault
2009-08-05 02:39:42 +00:00
parent c351150fca
commit cf13298081
4 changed files with 49 additions and 46 deletions
+23
View File
@@ -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
*