]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18265 fixed regression in menu field - discovered and patched by Vlas Voloshin...
authorskodak <skodak>
Sun, 15 Mar 2009 13:44:28 +0000 (13:44 +0000)
committerskodak <skodak>
Sun, 15 Mar 2009 13:44:28 +0000 (13:44 +0000)
user/profile/field/menu/field.class.php

index fa60ab631d9f9768376dc43e595490d1a7eeb125..69317ff45ce36f176b6c3a1d4c87957b90f0f61a 100644 (file)
@@ -71,6 +71,19 @@ class profile_field_menu extends profile_field_base {
         $user->{$this->inputname} = $this->datakey;
     }
 
+    /**
+     * HardFreeze the field if locked.
+     * @param   object   instance of the moodleform class
+     */
+    function edit_field_set_locked(&$mform) {
+        if (!$mform->elementExists($this->inputname)) {
+            return;
+        }
+        if ($this->is_locked() and !has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM))) {
+            $mform->hardFreeze($this->inputname);
+            $mform->setConstant($this->inputname, $this->datakey);
+        }
+    }
 }
 
 ?>