Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'MDL-39167_23' of git://github.com/timhunt/moodle into M…

…OODLE_23_STABLE
  • Loading branch information...
commit 8f6894b5f161d935a9398c99b2f80852eff826d5 2 parents 8be4f7d + ef8d4d5
@damyon damyon authored
View
18 mod/quiz/accessmanager.php
@@ -124,6 +124,24 @@ public static function get_browser_security_choices() {
}
/**
+ * Validate the data from any form fields added using {@link add_settings_form_fields()}.
+ * @param array $errors the errors found so far.
+ * @param array $data the submitted form data.
+ * @param array $files information about any uploaded files.
+ * @param mod_quiz_mod_form $quizform the quiz form object.
+ * @return array $errors the updated $errors array.
+ */
+ public static function validate_settings_form_fields(array $errors,
+ array $data, $files, mod_quiz_mod_form $this) {
+
+ foreach (self::get_rule_classes() as $rule) {
+ $errors = $rule::validate_settings_form_fields($errors, $data, $files, $this);
+ }
+
+ return $errors;
+ }
+
+ /**
* Save any submitted settings when the quiz settings form is submitted.
*
* Note that the standard plugins do not use this mechanism, becuase all their
View
14 mod/quiz/accessrule/accessrulebase.php
@@ -257,6 +257,20 @@ public static function add_settings_form_fields(
}
/**
+ * Validate the data from any form fields added using {@link add_settings_form_fields()}.
+ * @param array $errors the errors found so far.
+ * @param array $data the submitted form data.
+ * @param array $files information about any uploaded files.
+ * @param mod_quiz_mod_form $quizform the quiz form object.
+ * @return array $errors the updated $errors array.
+ */
+ public static function validate_settings_form_fields(array $errors,
+ array $data, $files, mod_quiz_mod_form $quizform) {
+
+ return $errors;
+ }
+
+ /**
* @return array key => lang string any choices to add to the quiz Browser
* security settings menu.
*/
View
3  mod/quiz/mod_form.php
@@ -568,6 +568,9 @@ public function validation($data, $files) {
}
}
+ // Any other rule plugins.
+ $errors = quiz_access_manager::validate_settings_form_fields($errors, $data, $files, $this);
+
return $errors;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.