echo $output;
}
}
+
+/**
+ * Returns a turn edit on/off button for course in a self contained form.
+ * Used to be an icon, but it's now a simple form button
+ *
+ * @deprecated since Moodle 2.0
+ *
+ * @global object
+ * @global object
+ * @param int $courseid The course to update by id as found in 'course' table
+ * @return string
+ */
+function update_mymoodle_icon() {
+ throw new coding_exception('update_mymoodle_icon() has been completely deprecated.');
+}
}
-/**
- * Returns a turn edit on/off button for course in a self contained form.
- * Used to be an icon, but it's now a simple form button
- *
- * @global object
- * @global object
- * @param int $courseid The course to update by id as found in 'course' table
- * @return string
- */
-function update_mymoodle_icon() {
-
- global $CFG, $USER;
-
- if (!empty($USER->editing)) {
- $string = get_string('updatemymoodleoff');
- $edit = '0';
- } else {
- $string = get_string('updatemymoodleon');
- $edit = '1';
- }
-
- return "<form $CFG->frametarget method=\"get\" action=\"$CFG->wwwroot/my/index.php\">".
- "<div>".
- "<input type=\"hidden\" name=\"edit\" value=\"$edit\" />".
- "<input type=\"submit\" value=\"$string\" /></div></form>";
-}
-
/**
* Returns a turn edit on/off button for tag in a self contained form.
*
$USER->editing = $edit;
}
- $button = update_mymoodle_icon($USER->id);
+ if (!empty($USER->editing)) {
+ $string = get_string('updatemymoodleoff');
+ $edit = '0';
+ } else {
+ $string = get_string('updatemymoodleon');
+ $edit = '1';
+ }
+
+ $form = new html_form();
+ $form->url = new moodle_url("$CFG->wwwroot/my/index.php", array('edit' => $edit));
+ $form->button->text = $string;
+ $button = $OUTPUT->button($form);
+
$header = $SITE->shortname . ': ' . $strmymoodle;
$navigation = build_navigation($strmymoodle);
$loggedinas = user_login_string();