]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19756 Deprecated update_mymoodle_icon() and upgraded my/index.php with new output...
authornicolasconnault <nicolasconnault>
Wed, 5 Aug 2009 00:00:20 +0000 (00:00 +0000)
committernicolasconnault <nicolasconnault>
Wed, 5 Aug 2009 00:00:20 +0000 (00:00 +0000)
lib/deprecatedlib.php
lib/weblib.php
my/index.php

index 63c40e2516ef7800c73cfe68e6edd36f6b2fb2d9..f30f5c1b5f58fe7415eb97e6b8d164fbdb20476f 100644 (file)
@@ -3543,3 +3543,18 @@ function print_heading_with_help($text, $helppage, $module='moodle', $icon=false
         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.');
+}
index 42e0776b67d95afa5d841e6c57303762891abd90..6b970717ed50f8c5a4a622f31cdd34b260e9ea9e 100644 (file)
@@ -2764,33 +2764,6 @@ function switchroles_form($courseid) {
 }
 
 
-/**
- * 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.
  *
index 57f1a022af8429243442e0a874ac46e67528d183..1523c6ea3da0fd2f4d56b905e115f425b121d63f 100644 (file)
         $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();