Merge branch 'MDL-78670-main' of https://github.com/rmady/moodle
This commit is contained in:
@@ -27,10 +27,10 @@ defined('MOODLE_INTERNAL') || die();
|
||||
$string['allowofflineattempts'] = 'Allow quiz to be attempted offline using the mobile app';
|
||||
$string['allowofflineattempts_help'] = 'If enabled, a mobile app user can download the quiz and attempt it offline.
|
||||
|
||||
Note: It is not possible for a quiz to be attempted offline if it has a time limit, or requires a network address, or uses any question behaviour other than deferred feedback (with or without CBM).';
|
||||
Note: It is not possible for a quiz to be attempted offline if it has a time limit, or requires a network address, or uses any question behaviour other than deferred feedback (with or without CBM), or uses sequential navigation.';
|
||||
$string['confirmdatasaved'] = 'I confirm that I do not have any unsaved work on a mobile device.';
|
||||
$string['mobileapp'] = 'Mobile app';
|
||||
$string['offlineattemptserror'] = 'It is not possible for a quiz to be attempted offline if it has a time limit, or requires a network address, or uses any question behaviour other than deferred feedback (with or without CBM).';
|
||||
$string['offlineattemptserror'] = 'It is not possible for a quiz to be attempted offline if it has a time limit, or requires a network address, or uses any question behaviour other than deferred feedback (with or without CBM), or uses sequential navigation.';
|
||||
$string['offlinedatamessage'] = 'You have worked on this attempt using a mobile device. Data was last saved to this site {$a} ago.';
|
||||
$string['pleaseconfirm'] = 'Please check and confirm that you do not have any unsaved work.';
|
||||
$string['pluginname'] = 'Offline attempts access rule';
|
||||
|
||||
@@ -106,6 +106,7 @@ class quizaccess_offlineattempts extends access_rule_base {
|
||||
$mform->setAdvanced('allowofflineattempts');
|
||||
$mform->disabledIf('allowofflineattempts', 'timelimit[number]', 'neq', 0);
|
||||
$mform->disabledIf('allowofflineattempts', 'subnet', 'neq', '');
|
||||
$mform->disabledIf('allowofflineattempts', 'navmethod', 'eq', 'sequential');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,9 +119,11 @@ class quizaccess_offlineattempts extends access_rule_base {
|
||||
// - The quiz uses a timer.
|
||||
// - The quiz is restricted by subnet.
|
||||
// - The question behaviour is not deferred feedback or deferred feedback with CBM.
|
||||
if (!empty($data['allowofflineattempts']) and
|
||||
(!empty($data['timelimit']) or !empty($data['subnet']) or
|
||||
($data['preferredbehaviour'] != 'deferredfeedback' and $data['preferredbehaviour'] != 'deferredcbm'))) {
|
||||
// - The quiz uses the sequential navigation.
|
||||
if (!empty($data['allowofflineattempts']) &&
|
||||
(!empty($data['timelimit']) || !empty($data['subnet']) ||
|
||||
$data['navmethod'] === 'sequential' ||
|
||||
($data['preferredbehaviour'] != 'deferredfeedback' && $data['preferredbehaviour'] != 'deferredcbm'))) {
|
||||
|
||||
$errors['allowofflineattempts'] = get_string('offlineattemptserror', 'quizaccess_offlineattempts');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user