NOMDL - edit_button() change internals to be 100% in pair with settings block urls

This commit is contained in:
Eloy Lafuente 2010-08-03 10:56:35 +00:00
parent e10367a4cf
commit 3362dfdca5

View file

@ -1882,18 +1882,17 @@ EOD;
* @return string HTML the button * @return string HTML the button
*/ */
public function edit_button(moodle_url $url) { public function edit_button(moodle_url $url) {
global $USER;
if (!empty($USER->editing)) { $url->param('sesskey', sesskey());
$string = get_string('turneditingoff'); if ($this->page->user_is_editing()) {
$edit = '0'; $url->param('edit', 'off');
$editstring = get_string('turneditingoff');
} else { } else {
$string = get_string('turneditingon'); $url->param('edit', 'on');
$edit = '1'; $editstring = get_string('turneditingon');
} }
$url = new moodle_url($url, array('edit'=>$edit)); return $this->single_button($url, $editstring);
return $this->single_button($url, $string);
} }
/** /**