-
Notifications
You must be signed in to change notification settings - Fork 446
[MDL-80945] Update quizaccess page #1410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!-- markdownlint-disable first-line-heading --> | ||
Most quiz settings can be overridden on a per user and/or group level and you can extend this ability to your rule as well. To make your rule overridable, you must create the `override_rule` class extending `mod_quiz\local\access_override_rule_base`. | ||
|
||
Please refer to the inline phpdocs of the [mod_quiz::access_override_rule_base class](https://github.com/moodle/moodle/blob/main/mod/quiz/classes/local/access_override_rule_base.php) for detailed descriptions of the functions and meaning. |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,48 @@ | ||||||||||||||||
use mod_quiz\local\access_override_rule_base; | ||||||||||||||||
use MoodleQuickForm; | ||||||||||||||||
use context_module; | ||||||||||||||||
use context; | ||||||||||||||||
|
||||||||||||||||
class override_rule extends access_override_rule_base { | ||||||||||||||||
|
||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please pass this file through the code style checker and fix it. It's worth noting tha twe also tend to further reduce line length limits to around 80 characters in docs because the way that code scrolls left-to-right makes it hard to view things in context. |
||||||||||||||||
/** | ||||||||||||||||
* All of the below access_override_rule_base functions to be implemented. | ||||||||||||||||
*/ | ||||||||||||||||
|
||||||||||||||||
public static function add_form_fields(context_module $context, int $overrideid, object $quiz, MoodleQuickForm $mform): void { | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Example of exagerated line length limit:
Suggested change
|
||||||||||||||||
// Do nothing. | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
public static function validate_form_fields(array $errors, | ||||||||||||||||
array $data, array $files, context_module $context): array { | ||||||||||||||||
Comment on lines
+16
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: This coding style is not accepted in Moodle core code any more. |
||||||||||||||||
return []; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
public static function save_settings(array $override): void { | ||||||||||||||||
// Do nothing. | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
public static function delete_settings(int $quizid, array $overrides): void { | ||||||||||||||||
// Do nothing. | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
public static function get_settings(): array { | ||||||||||||||||
return []; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
public static function get_required_settings(): array { | ||||||||||||||||
return []; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
public static function get_settings_sql(string $overridetablename): array { | ||||||||||||||||
return []; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
public static function add_table_fields(object $override, array $fields, array $values, context $context): array { | ||||||||||||||||
return []; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
public static function clean_form_data(array $formdata): array { | ||||||||||||||||
return $formdata; | ||||||||||||||||
} | ||||||||||||||||
} |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!-- markdownlint-disable first-line-heading --> | ||
Most quiz settings can be overridden on a per user and/or group level and you can extend this ability to your rule as well. To make your rule overridable, you must create the `override_rule` class extending `mod_quiz\local\access_override_rule_base`. | ||
|
||
Please refer to the inline phpdocs of the [mod_quiz::access_override_rule_base class](https://github.com/moodle/moodle/blob/main/mod/quiz/classes/local/access_override_rule_base.php) for detailed descriptions of the functions and meaning. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use mod_quiz\form\edit_override_form; | ||
use mod_quiz\local\access_override_rule_base; | ||
use MoodleQuickForm; | ||
use context_module; | ||
use context; | ||
|
||
class override_rule extends access_override_rule_base { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto the other exampels |
||
|
||
/** | ||
* All of the below access_override_rule_base be implemented below. | ||
*/ | ||
|
||
public static function add_form_fields(context_module $context, int $overrideid, object $quiz, MoodleQuickForm $mform): void { | ||
// Do nothing. | ||
} | ||
|
||
public static function validate_form_fields(array $errors, | ||
array $data, array $files, edit_override_form $quizform): array { | ||
return []; | ||
} | ||
|
||
public static function save_settings(array $override): void { | ||
// Do nothing. | ||
} | ||
|
||
public static function delete_settings(int $quizid, array $overrides): void { | ||
// Do nothing. | ||
} | ||
|
||
public static function get_settings(): array { | ||
return []; | ||
} | ||
|
||
public static function get_required_settings(): array { | ||
return []; | ||
} | ||
|
||
public static function get_settings_sql(string $overridetablename): array { | ||
return []; | ||
} | ||
|
||
public static function add_table_fields(object $override, array $fields, array $values, context $context): array { | ||
return []; | ||
} | ||
|
||
public static function clean_form_data(array $formdata): array { | ||
return $formdata; | ||
} | ||
} |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this - it is wrong.
The new component is a subplugin of mod_quiz and not a global plugin type.
The content of this file is automatically pulled in.