|
| __construct (protected stdClass readonly stdClass $quiz, public context_module readonly context_module $context) |
| Create override manager.
|
|
| can_view_override (\stdClass $override, stdClass $course, cm_info $cm) |
| Determine whether user can view a given override record.
|
|
| delete_all_overrides (bool $shouldlog=true) |
| Deletes all the overrides for the linked quiz.
|
|
| delete_overrides (array $overrides, bool $shouldlog=true) |
| Deletes the given overrides in the quiz linked to the override manager.
|
|
| delete_overrides_by_id (array $ids, bool $shouldlog=true) |
| Deletes overrides given just their ID.
|
|
| get_all_overrides () |
| Returns all overrides for the linked quiz.
|
|
| parse_formdata (array $formdata) |
| Parses the formdata by finding only the OVERRIDEABLE_QUIZ_SETTINGS, clearing any values that match the existing quiz, and re-adds the user or group id.
|
|
| require_manage_capability () |
| Requires the user has the override management capability.
|
|
| require_read_capability () |
| Requires the user has the override viewing capability.
|
|
| save_override (array $formdata) |
| Saves the given override.
|
|
| validate_data (array $formdata) |
| Validates the data, usually from a moodleform or a webservice call.
|
|
◆ __construct()
mod_quiz\local\override_manager::__construct |
( |
protected stdClass readonly stdClass | $quiz, |
|
|
public context_module readonly context_module | $context ) |
Create override manager.
- Parameters
-
stdClass | $quiz | The quiz to link the manager to. |
context_module | $context | Context being operated in |
- Parameters
-
$quiz | The quiz linked to this manager instance * |
$context | The context being operated in * |
◆ can_view_override()
mod_quiz\local\override_manager::can_view_override |
( |
\stdClass | $override, |
|
|
stdClass | $course, |
|
|
cm_info | $cm ) |
Determine whether user can view a given override record.
- Parameters
-
stdClass | $override | |
stdClass | $course | |
cm_info | $cm | |
- Return values
-
◆ delete_all_overrides()
mod_quiz\local\override_manager::delete_all_overrides |
( |
bool | $shouldlog = true | ) |
|
Deletes all the overrides for the linked quiz.
- Parameters
-
bool | $shouldlog | If true, will log a override_deleted event |
◆ delete_orphaned_group_overrides_in_course()
static mod_quiz\local\override_manager::delete_orphaned_group_overrides_in_course |
( |
int | $courseid | ) |
|
|
static |
Deletes orphaned group overrides in a given course.
Note - permissions are not checked and events are not logged for performance reasons.
- Parameters
-
int | $courseid | ID of course to delete orphaned group overrides in |
- Return values
-
array | array of quizzes that had orphaned group overrides. |
◆ delete_overrides()
mod_quiz\local\override_manager::delete_overrides |
( |
array | $overrides, |
|
|
bool | $shouldlog = true ) |
Deletes the given overrides in the quiz linked to the override manager.
Note - capabilities are not checked, {
- See also
- require_manage_capability()}
- Parameters
-
array | $overrides | override to delete. Must specify an id, quizid, and either a userid or groupid. |
bool | $shouldlog | If true, will log a override_deleted event |
◆ delete_overrides_by_id()
mod_quiz\local\override_manager::delete_overrides_by_id |
( |
array | $ids, |
|
|
bool | $shouldlog = true ) |
Deletes overrides given just their ID.
Note, the given IDs must exist and user must have access to them otherwise an exception will be thrown. Also note, capabilities are not checked, {
- See also
- require_manage_capability()}
- Parameters
-
array | $ids | IDs of overrides to delete |
bool | $shouldlog | If true, will log a override_deleted event |
◆ get_all_overrides()
mod_quiz\local\override_manager::get_all_overrides |
( |
| ) |
|
Returns all overrides for the linked quiz.
- Return values
-
array | of quiz_override records |
◆ parse_formdata()
mod_quiz\local\override_manager::parse_formdata |
( |
array | $formdata | ) |
|
Parses the formdata by finding only the OVERRIDEABLE_QUIZ_SETTINGS, clearing any values that match the existing quiz, and re-adds the user or group id.
- Parameters
-
array | $formdata | data usually from moodleform or webservice call. |
- Return values
-
array | array containing parsed formdata, with keys as the properties and values as the values. Any values set the same as the existing quiz are set to null. |
◆ save_override()
mod_quiz\local\override_manager::save_override |
( |
array | $formdata | ) |
|
Saves the given override.
If an id is given, it updates, otherwise it creates a new one. Note, capabilities are not checked, {
- See also
- require_manage_capability()}
- Parameters
-
array | $formdata | data usually from moodleform or webservice call. |
- Return values
-
int | updated/inserted record id |
◆ validate_data()
mod_quiz\local\override_manager::validate_data |
( |
array | $formdata | ) |
|
Validates the data, usually from a moodleform or a webservice call.
If it contains an 'id' property, additional validation is performed against the existing record.
- Parameters
-
array | $formdata | data from moodleform or webservice call. |
- Return values
-
array | array where the keys are error elements, and the values are lists of errors for each element. |
The documentation for this class was generated from the following file:
- mod/quiz/classes/local/override_manager.php