MDL-29627 quiz access move strings only used in one subplugin into that plugin.
AMOS BEGIN MOV [youcannotwait,mod_quiz],[youcannotwait,quizaccess_delaybetweenattempts] MOV [youmustwait,mod_quiz],[youmustwait,quizaccess_delaybetweenattempts] MOV [subnetwrong,mod_quiz],[subnetwrong,quizaccess_ipaddress] MOV [attemptsallowedn,mod_quiz],[attemptsallowedn,quizaccess_numattempts] MOV [notavailable,mod_quiz],[notavailable,quizaccess_openclosedate] MOV [quiznotavailable,mod_quiz],[quiznotavailable,quizaccess_openclosedate] MOV [passworderror,mod_quiz],[passworderror,quizaccess_password] MOV [requirepasswordmessage,mod_quiz],[requirepasswordmessage,quizaccess_password] MOV [requiresafeexambrowser,mod_quiz],[requiresafeexambrowser,quizaccess_safebrowser] MOV [safebrowsererror,mod_quiz],[safebrowsererror,quizaccess_safebrowser] MOV [safebrowsernotice,mod_quiz],[safebrowsernotice,quizaccess_safebrowser] MOV [popupwithjavascriptsupport,mod_quiz],[popupwithjavascriptsupport,quizaccess_securewindow] MOV [quiztimelimit,mod_quiz],[quiztimelimit,quizaccess_timelimit] AMOS END
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once ($CFG->libdir.'/formslib.php');
|
||||
require_once($CFG->libdir.'/formslib.php');
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,3 +28,5 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
$string['pluginname'] = 'Delay between attempts quiz access rule';
|
||||
$string['youcannotwait'] = 'This quiz closes before you will be allowed to start another attempt.';
|
||||
$string['youmustwait'] = 'You must wait before you may re-attempt this quiz. You will be allowed to start another attempt after {$a}.';
|
||||
|
||||
@@ -57,9 +57,10 @@ class quizaccess_delaybetweenattempts extends quiz_access_rule_base {
|
||||
$nextstarttime = $this->compute_next_start_time($numprevattempts, $lastattempt);
|
||||
if ($this->timenow < $nextstarttime) {
|
||||
if ($this->quiz->timeclose == 0 || $nextstarttime <= $this->quiz->timeclose) {
|
||||
return get_string('youmustwait', 'quiz', userdate($nextstarttime));
|
||||
return get_string('youmustwait', 'quizaccess_delaybetweenattempts',
|
||||
userdate($nextstarttime));
|
||||
} else {
|
||||
return get_string('youcannotwait', 'quiz');
|
||||
return get_string('youcannotwait', 'quizaccess_delaybetweenattempts');
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -59,14 +59,14 @@ class quizaccess_delaybetweenattempts_test extends UnitTestCase {
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->prevent_new_attempt(3, $attempt));
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(11000)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(11000)));
|
||||
$this->assertFalse($rule->prevent_new_attempt(2, $attempt));
|
||||
$attempt->timefinish = 9000;
|
||||
$this->assertFalse($rule->prevent_new_attempt(1, $attempt));
|
||||
$this->assertFalse($rule->prevent_new_attempt(2, $attempt));
|
||||
$attempt->timefinish = 9001;
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(10001)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
|
||||
$this->assertFalse($rule->prevent_new_attempt(2, $attempt));
|
||||
}
|
||||
|
||||
@@ -94,9 +94,9 @@ class quizaccess_delaybetweenattempts_test extends UnitTestCase {
|
||||
$this->assertFalse($rule->prevent_new_attempt(5, $attempt));
|
||||
$this->assertFalse($rule->prevent_new_attempt(1, $attempt));
|
||||
$this->assertEqual($rule->prevent_new_attempt(2, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(11000)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(11000)));
|
||||
$this->assertEqual($rule->prevent_new_attempt(3, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(11000)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(11000)));
|
||||
$attempt->timefinish = 9000;
|
||||
$this->assertFalse($rule->prevent_new_attempt(1, $attempt));
|
||||
$this->assertFalse($rule->prevent_new_attempt(2, $attempt));
|
||||
@@ -104,9 +104,9 @@ class quizaccess_delaybetweenattempts_test extends UnitTestCase {
|
||||
$attempt->timefinish = 9001;
|
||||
$this->assertFalse($rule->prevent_new_attempt(1, $attempt));
|
||||
$this->assertEqual($rule->prevent_new_attempt(2, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(10001)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
|
||||
$this->assertEqual($rule->prevent_new_attempt(4, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(10001)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
|
||||
}
|
||||
|
||||
public function test_just_both_delays() {
|
||||
@@ -132,32 +132,32 @@ class quizaccess_delaybetweenattempts_test extends UnitTestCase {
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->prevent_new_attempt(5, $attempt));
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(12000)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(12000)));
|
||||
$this->assertEqual($rule->prevent_new_attempt(2, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(11000)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(11000)));
|
||||
$this->assertEqual($rule->prevent_new_attempt(3, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(11000)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(11000)));
|
||||
$attempt->timefinish = 8000;
|
||||
$this->assertFalse($rule->prevent_new_attempt(1, $attempt));
|
||||
$this->assertFalse($rule->prevent_new_attempt(2, $attempt));
|
||||
$this->assertFalse($rule->prevent_new_attempt(3, $attempt));
|
||||
$attempt->timefinish = 8001;
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(10001)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
|
||||
$this->assertFalse($rule->prevent_new_attempt(2, $attempt));
|
||||
$this->assertFalse($rule->prevent_new_attempt(4, $attempt));
|
||||
$attempt->timefinish = 9000;
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(11000)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(11000)));
|
||||
$this->assertFalse($rule->prevent_new_attempt(2, $attempt));
|
||||
$this->assertFalse($rule->prevent_new_attempt(3, $attempt));
|
||||
$attempt->timefinish = 9001;
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(11001)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(11001)));
|
||||
$this->assertEqual($rule->prevent_new_attempt(2, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(10001)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
|
||||
$this->assertEqual($rule->prevent_new_attempt(4, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(10001)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
|
||||
}
|
||||
|
||||
public function test_with_close_date() {
|
||||
@@ -182,28 +182,28 @@ class quizaccess_delaybetweenattempts_test extends UnitTestCase {
|
||||
|
||||
$attempt->timefinish = 13000;
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(15000)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(15000)));
|
||||
$attempt->timefinish = 13001;
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youcannotwait', 'quiz'));
|
||||
get_string('youcannotwait', 'quizaccess_delaybetweenattempts'));
|
||||
$attempt->timefinish = 14000;
|
||||
$this->assertEqual($rule->prevent_new_attempt(2, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(15000)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(15000)));
|
||||
$attempt->timefinish = 14001;
|
||||
$this->assertEqual($rule->prevent_new_attempt(2, $attempt),
|
||||
get_string('youcannotwait', 'quiz'));
|
||||
get_string('youcannotwait', 'quizaccess_delaybetweenattempts'));
|
||||
|
||||
$rule = new quizaccess_delaybetweenattempts($quizobj, 15000);
|
||||
$attempt->timefinish = 13000;
|
||||
$this->assertFalse($rule->prevent_new_attempt(1, $attempt));
|
||||
$attempt->timefinish = 13001;
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youcannotwait', 'quiz'));
|
||||
get_string('youcannotwait', 'quizaccess_delaybetweenattempts'));
|
||||
$attempt->timefinish = 14000;
|
||||
$this->assertFalse($rule->prevent_new_attempt(2, $attempt));
|
||||
$attempt->timefinish = 14001;
|
||||
$this->assertEqual($rule->prevent_new_attempt(2, $attempt),
|
||||
get_string('youcannotwait', 'quiz'));
|
||||
get_string('youcannotwait', 'quizaccess_delaybetweenattempts'));
|
||||
|
||||
$rule = new quizaccess_delaybetweenattempts($quizobj, 15001);
|
||||
$attempt->timefinish = 13000;
|
||||
@@ -240,11 +240,11 @@ class quizaccess_delaybetweenattempts_test extends UnitTestCase {
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->prevent_new_attempt(5, $attempt));
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(12000)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(12000)));
|
||||
$this->assertEqual($rule->prevent_new_attempt(2, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(11000)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(11000)));
|
||||
$this->assertEqual($rule->prevent_new_attempt(3, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(11000)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(11000)));
|
||||
$attempt->timestart = 7950;
|
||||
$attempt->timefinish = 8000;
|
||||
$this->assertFalse($rule->prevent_new_attempt(1, $attempt));
|
||||
@@ -253,36 +253,36 @@ class quizaccess_delaybetweenattempts_test extends UnitTestCase {
|
||||
$attempt->timestart = 7950;
|
||||
$attempt->timefinish = 8001;
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(10001)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
|
||||
$this->assertFalse($rule->prevent_new_attempt(2, $attempt));
|
||||
$this->assertFalse($rule->prevent_new_attempt(4, $attempt));
|
||||
$attempt->timestart = 8950;
|
||||
$attempt->timefinish = 9000;
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(11000)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(11000)));
|
||||
$this->assertFalse($rule->prevent_new_attempt(2, $attempt));
|
||||
$this->assertFalse($rule->prevent_new_attempt(3, $attempt));
|
||||
$attempt->timestart = 8950;
|
||||
$attempt->timefinish = 9001;
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(11001)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(11001)));
|
||||
$this->assertEqual($rule->prevent_new_attempt(2, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(10001)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
|
||||
$this->assertEqual($rule->prevent_new_attempt(4, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(10001)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
|
||||
$attempt->timestart = 8900;
|
||||
$attempt->timefinish = 9100;
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(11000)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(11000)));
|
||||
$this->assertFalse($rule->prevent_new_attempt(2, $attempt));
|
||||
$this->assertFalse($rule->prevent_new_attempt(3, $attempt));
|
||||
$attempt->timestart = 8901;
|
||||
$attempt->timefinish = 9100;
|
||||
$this->assertEqual($rule->prevent_new_attempt(1, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(11001)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(11001)));
|
||||
$this->assertEqual($rule->prevent_new_attempt(2, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(10001)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
|
||||
$this->assertEqual($rule->prevent_new_attempt(4, $attempt),
|
||||
get_string('youmustwait', 'quiz', userdate(10001)));
|
||||
get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,3 +28,4 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
$string['pluginname'] = 'IP address quiz access rule';
|
||||
$string['subnetwrong'] = 'This quiz is only accessible from certain locations, and this computer is not on the allowed list.';
|
||||
|
||||
@@ -49,7 +49,7 @@ class quizaccess_ipaddress extends quiz_access_rule_base {
|
||||
if (address_in_subnet(getremoteaddr(), $this->quiz->subnet)) {
|
||||
return false;
|
||||
} else {
|
||||
return get_string('subnetwrong', 'quiz');
|
||||
return get_string('subnetwrong', 'quizaccess_ipaddress');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,4 +27,5 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
$string['attemptsallowedn'] = 'Attempts allowed: {$a}';
|
||||
$string['pluginname'] = 'Number of attempts quiz access rule';
|
||||
|
||||
@@ -47,7 +47,7 @@ class quizaccess_numattempts extends quiz_access_rule_base {
|
||||
}
|
||||
|
||||
public function description() {
|
||||
return get_string('attemptsallowedn', 'quiz', $this->quiz->attempts);
|
||||
return get_string('attemptsallowedn', 'quizaccess_numattempts', $this->quiz->attempts);
|
||||
}
|
||||
|
||||
public function prevent_new_attempt($numprevattempts, $lastattempt) {
|
||||
|
||||
@@ -48,7 +48,8 @@ class quizaccess_numattempts_test extends UnitTestCase {
|
||||
$rule = new quizaccess_numattempts($quizobj, 0);
|
||||
$attempt = new stdClass();
|
||||
|
||||
$this->assertEqual($rule->description(), get_string('attemptsallowedn', 'quiz', 3));
|
||||
$this->assertEqual($rule->description(),
|
||||
get_string('attemptsallowedn', 'quizaccess_numattempts', 3));
|
||||
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->prevent_new_attempt(2, $attempt));
|
||||
|
||||
@@ -27,4 +27,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
$string['notavailable'] = 'This quiz is not currently available';
|
||||
$string['pluginname'] = 'Open and close date access rule';
|
||||
$string['quiznotavailable'] = 'The quiz will not be available until {$a}';
|
||||
|
||||
@@ -45,9 +45,12 @@ class quizaccess_openclosedate extends quiz_access_rule_base {
|
||||
public function description() {
|
||||
$result = array();
|
||||
if ($this->timenow < $this->quiz->timeopen) {
|
||||
$result[] = get_string('quiznotavailable', 'quiz', userdate($this->quiz->timeopen));
|
||||
$result[] = get_string('quiznotavailable', 'quizaccess_openclosedate',
|
||||
userdate($this->quiz->timeopen));
|
||||
|
||||
} else if ($this->quiz->timeclose && $this->timenow > $this->quiz->timeclose) {
|
||||
$result[] = get_string("quizclosed", "quiz", userdate($this->quiz->timeclose));
|
||||
$result[] = get_string('quizclosed', 'quiz', userdate($this->quiz->timeclose));
|
||||
|
||||
} else {
|
||||
if ($this->quiz->timeopen) {
|
||||
$result[] = get_string('quizopenedon', 'quiz', userdate($this->quiz->timeopen));
|
||||
@@ -56,13 +59,14 @@ class quizaccess_openclosedate extends quiz_access_rule_base {
|
||||
$result[] = get_string('quizcloseson', 'quiz', userdate($this->quiz->timeclose));
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function prevent_access() {
|
||||
if ($this->timenow < $this->quiz->timeopen ||
|
||||
($this->quiz->timeclose && $this->timenow > $this->quiz->timeclose)) {
|
||||
return get_string('notavailable', 'quiz');
|
||||
return get_string('notavailable', 'quizaccess_openclosedate');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -78,9 +78,9 @@ class quizaccess_openclosedate_test extends UnitTestCase {
|
||||
|
||||
$rule = new quizaccess_openclosedate($quizobj, 9999);
|
||||
$this->assertEqual($rule->description(),
|
||||
array(get_string('quiznotavailable', 'quiz', userdate(10000))));
|
||||
array(get_string('quiznotavailable', 'quizaccess_openclosedate', userdate(10000))));
|
||||
$this->assertEqual($rule->prevent_access(),
|
||||
get_string('notavailable', 'quiz'));
|
||||
get_string('notavailable', 'quizaccess_openclosedate'));
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->is_finished(0, $attempt));
|
||||
$this->assertFalse($rule->time_left($attempt, 0));
|
||||
@@ -120,7 +120,7 @@ class quizaccess_openclosedate_test extends UnitTestCase {
|
||||
$this->assertEqual($rule->description(),
|
||||
array(get_string('quizclosed', 'quiz', userdate(20000))));
|
||||
$this->assertEqual($rule->prevent_access(),
|
||||
get_string('notavailable', 'quiz'));
|
||||
get_string('notavailable', 'quizaccess_openclosedate'));
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertTrue($rule->is_finished(0, $attempt));
|
||||
$this->assertFalse($rule->time_left($attempt, 20000 - QUIZ_SHOW_TIME_BEFORE_DEADLINE));
|
||||
@@ -142,9 +142,9 @@ class quizaccess_openclosedate_test extends UnitTestCase {
|
||||
|
||||
$rule = new quizaccess_openclosedate($quizobj, 9999);
|
||||
$this->assertEqual($rule->description(),
|
||||
array(get_string('quiznotavailable', 'quiz', userdate(10000))));
|
||||
array(get_string('quiznotavailable', 'quizaccess_openclosedate', userdate(10000))));
|
||||
$this->assertEqual($rule->prevent_access(),
|
||||
get_string('notavailable', 'quiz'));
|
||||
get_string('notavailable', 'quizaccess_openclosedate'));
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->is_finished(0, $attempt));
|
||||
|
||||
@@ -168,7 +168,7 @@ class quizaccess_openclosedate_test extends UnitTestCase {
|
||||
$this->assertEqual($rule->description(),
|
||||
array(get_string('quizclosed', 'quiz', userdate(20000))));
|
||||
$this->assertEqual($rule->prevent_access(),
|
||||
get_string('notavailable', 'quiz'));
|
||||
get_string('notavailable', 'quizaccess_openclosedate'));
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertTrue($rule->is_finished(0, $attempt));
|
||||
|
||||
|
||||
@@ -26,5 +26,7 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
$string['passworderror'] = 'The password entered was incorrect';
|
||||
$string['pluginname'] = 'Password quiz access rule';
|
||||
$string['quizpassword'] = 'Quiz password';
|
||||
$string['quizpassword'] = 'Quiz password';
|
||||
$string['requirepasswordmessage'] = 'To attempt this quiz you need to know the quiz password';
|
||||
|
||||
@@ -46,7 +46,7 @@ class quizaccess_password extends quiz_access_rule_base {
|
||||
}
|
||||
|
||||
public function description() {
|
||||
return get_string('requirepasswordmessage', 'quiz');
|
||||
return get_string('requirepasswordmessage', 'quizaccess_password');
|
||||
}
|
||||
|
||||
public function is_preflight_check_required($attemptid) {
|
||||
@@ -59,11 +59,12 @@ class quizaccess_password extends quiz_access_rule_base {
|
||||
|
||||
$mform->addElement('header', 'passwordheader', get_string('password'));
|
||||
$mform->addElement('static', 'passwordmessage', '',
|
||||
get_string('requirepasswordmessage', 'quiz'));
|
||||
get_string('requirepasswordmessage', 'quizaccess_password'));
|
||||
|
||||
// don't use the 'proper' field name of 'password' since that get's
|
||||
// Firefox's password auto-complete over-excited.
|
||||
$mform->addElement('password', 'quizpassword', get_string('quizpassword', 'quizaccess_password'));
|
||||
$mform->addElement('password', 'quizpassword',
|
||||
get_string('quizpassword', 'quizaccess_password'));
|
||||
}
|
||||
|
||||
public function validate_preflight_check($data, $files, $errors, $attemptid) {
|
||||
@@ -81,7 +82,7 @@ class quizaccess_password extends quiz_access_rule_base {
|
||||
}
|
||||
}
|
||||
|
||||
$errors['quizpassword'] = get_string('passworderror', 'quiz');
|
||||
$errors['quizpassword'] = get_string('passworderror', 'quizaccess_password');
|
||||
return $errors;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,8 @@ class quizaccess_password_test extends UnitTestCase {
|
||||
$attempt = new stdClass();
|
||||
|
||||
$this->assertFalse($rule->prevent_access());
|
||||
$this->assertEqual($rule->description(), get_string('requirepasswordmessage', 'quiz'));
|
||||
$this->assertEqual($rule->description(),
|
||||
get_string('requirepasswordmessage', 'quizaccess_password'));
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->is_finished(0, $attempt));
|
||||
$this->assertFalse($rule->time_left($attempt, 1));
|
||||
|
||||
@@ -28,3 +28,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
$string['pluginname'] = 'Safe Exam Browser quiz access rule';
|
||||
$string['requiresafeexambrowser'] = 'Require the use of Safe Exam Browser';
|
||||
$string['safebrowsererror'] = 'This quiz has been set up so that it may only be attempted using the Safe Exam Browser. You cannot attempt it from this web browser.';
|
||||
$string['safebrowsernotice'] = 'This quiz has been configured so that students may only attempt it using the Safe Exam Browser.';
|
||||
|
||||
@@ -48,14 +48,14 @@ class quizaccess_safebrowser extends quiz_access_rule_base {
|
||||
|
||||
public function prevent_access() {
|
||||
if (!$this->check_safe_browser()) {
|
||||
return get_string('safebrowsererror', 'quiz');
|
||||
return get_string('safebrowsererror', 'quizaccess_safebrowser');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function description() {
|
||||
return get_string('safebrowsernotice', 'quiz');
|
||||
return get_string('safebrowsernotice', 'quizaccess_safebrowser');
|
||||
}
|
||||
|
||||
public function setup_attempt_page($page) {
|
||||
@@ -83,6 +83,7 @@ class quizaccess_safebrowser extends quiz_access_rule_base {
|
||||
return array();
|
||||
}
|
||||
|
||||
return array('safebrowser' => get_string('requiresafeexambrowser', 'quiz'));
|
||||
return array('safebrowser' =>
|
||||
get_string('requiresafeexambrowser', 'quizaccess_safebrowser'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,9 +50,11 @@ class quizaccess_safebrowser_test extends UnitTestCase {
|
||||
$attempt = new stdClass();
|
||||
|
||||
// This next test assumes the unit tests are not being run using Safe Exam Browser!
|
||||
$this->assertEqual(get_string('safebrowsererror', 'quiz'), $rule->prevent_access());
|
||||
$this->assertEqual(get_string('safebrowsererror', 'quizaccess_safebrowser'),
|
||||
$rule->prevent_access());
|
||||
|
||||
$this->assertEqual(get_string('safebrowsernotice', 'quiz'), $rule->description());
|
||||
$this->assertEqual(get_string('safebrowsernotice', 'quizaccess_safebrowser'),
|
||||
$rule->description());
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->is_finished(0, $attempt));
|
||||
$this->assertFalse($rule->time_left($attempt, 1));
|
||||
|
||||
@@ -28,3 +28,4 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
$string['pluginname'] = 'JavaScript security quiz access rule';
|
||||
$string['popupwithjavascriptsupport'] = 'Full screen pop-up with some JavaScript security';
|
||||
|
||||
@@ -89,6 +89,7 @@ class quizaccess_securewindow extends quiz_access_rule_base {
|
||||
* security settings menu.
|
||||
*/
|
||||
public static function get_browser_security_choices() {
|
||||
return array('securewindow' => get_string('popupwithjavascriptsupport', 'quiz'));
|
||||
return array('securewindow' =>
|
||||
get_string('popupwithjavascriptsupport', 'quizaccess_securewindow'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,3 +28,4 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
$string['pluginname'] = 'Time limit quiz access rule';
|
||||
$string['quiztimelimit'] = 'Time limit: {$a}';
|
||||
|
||||
@@ -48,7 +48,8 @@ class quizaccess_timelimit extends quiz_access_rule_base {
|
||||
}
|
||||
|
||||
public function description() {
|
||||
return get_string('quiztimelimit', 'quiz', format_time($this->quiz->timelimit));
|
||||
return get_string('quiztimelimit', 'quizaccess_timelimit',
|
||||
format_time($this->quiz->timelimit));
|
||||
}
|
||||
|
||||
public function time_left($attempt, $timenow) {
|
||||
|
||||
@@ -49,7 +49,7 @@ class quizaccess_timelimit_test extends UnitTestCase {
|
||||
$attempt = new stdClass();
|
||||
|
||||
$this->assertEqual($rule->description(),
|
||||
get_string('quiztimelimit', 'quiz', format_time(3600)));
|
||||
get_string('quiztimelimit', 'quizaccess_timelimit', format_time(3600)));
|
||||
|
||||
$attempt->timestart = 10000;
|
||||
$this->assertEqual($rule->time_left($attempt, 10000), 3600);
|
||||
|
||||
@@ -87,7 +87,6 @@ $string['attemptnumber'] = 'Attempt';
|
||||
$string['attemptquiznow'] = 'Attempt quiz now';
|
||||
$string['attempts'] = 'Attempts';
|
||||
$string['attemptsallowed'] = 'Attempts allowed';
|
||||
$string['attemptsallowedn'] = 'Attempts allowed: {$a}';
|
||||
$string['attemptsdeleted'] = 'Quiz attempts deleted';
|
||||
$string['attemptselection'] = 'Select which attempts to analyze per user:';
|
||||
$string['attemptsexist'] = 'You can no longer add or remove questions.';
|
||||
@@ -447,7 +446,6 @@ $string['noreviewshort'] = 'Not permitted';
|
||||
$string['noreviewuntil'] = 'You are not allowed to review this quiz until {$a}';
|
||||
$string['noreviewuntilshort'] = 'Available {$a}';
|
||||
$string['noscript'] = 'JavaScript must be enabled to continue!';
|
||||
$string['notavailable'] = 'This quiz is not currently available';
|
||||
$string['notavailabletostudents'] = 'Note: This quiz is not currently available to your students';
|
||||
$string['notenoughrandomquestions'] = 'There are not enough questions in category {$a->category} to create the question {$a->name} ({$a->id}).';
|
||||
$string['notenoughsubquestions'] = 'Not enough sub-questions have been defined!<br />Do you want to go back and fix this question?';
|
||||
@@ -495,7 +493,6 @@ $string['parent'] = 'Parent';
|
||||
$string['parentcategory'] = 'Parent category';
|
||||
$string['parsingquestions'] = 'Parsing questions from import file.';
|
||||
$string['partiallycorrect'] = 'Partially correct';
|
||||
$string['passworderror'] = 'The password entered was incorrect';
|
||||
$string['penalty'] = 'Penalty';
|
||||
$string['penaltyscheme'] = 'Apply penalties';
|
||||
$string['penaltyscheme_help'] = 'If enabled, a penalty is subtracted from the final mark for a question for a wrong response. The amount of penalty is specified in the question settings. This setting only applies if adaptive mode is enabled.';
|
||||
@@ -506,7 +503,6 @@ $string['pluginname'] = 'Quiz';
|
||||
$string['popup'] = 'Show quiz in a "secure" window';
|
||||
$string['popupblockerwarning'] = 'This section of the test is in secure mode, this means that you need to take the quiz in a secure window. Please turn off your popup blocker. Thank you.';
|
||||
$string['popupnotice'] = 'Students will see this quiz in a secure window';
|
||||
$string['popupwithjavascriptsupport'] = 'Full screen pop-up with some JavaScript security';
|
||||
$string['preprocesserror'] = 'Error occurred during pre-processing!';
|
||||
$string['preview'] = 'Preview';
|
||||
$string['previewquestion'] = 'Preview question';
|
||||
@@ -561,7 +557,6 @@ $string['quizisopenwillclose'] = 'Quiz open (closes {$a})';
|
||||
$string['quiz:manage'] = 'Manage quizzes';
|
||||
$string['quiz:manageoverrides'] = 'Manage quiz overrides';
|
||||
$string['quiznavigation'] = 'Quiz navigation';
|
||||
$string['quiznotavailable'] = 'The quiz will not be available until {$a}';
|
||||
$string['quizopen'] = 'Open the quiz';
|
||||
$string['quizopenclose'] = 'Open and close dates';
|
||||
$string['quizopenclose_help'] = 'Students can only start their attempt(s) after the open time and they must complete their attempts before the close time.';
|
||||
@@ -575,7 +570,6 @@ $string['quiz:preview'] = 'Preview quizzes';
|
||||
$string['quiz:regrade'] = 'Regrade quiz attempts';
|
||||
$string['quiz:reviewmyattempts'] = 'Review your own attempts';
|
||||
$string['quizsettings'] = 'Quiz settings';
|
||||
$string['quiztimelimit'] = 'Time limit: {$a}';
|
||||
$string['quiz:view'] = 'View quiz information';
|
||||
$string['quiz:viewreports'] = 'View quiz reports';
|
||||
$string['quiztimer'] = 'Quiz Timer';
|
||||
@@ -625,8 +619,6 @@ $string['reports'] = 'Reports';
|
||||
$string['reportsimplestat'] = 'Simple statistics';
|
||||
$string['requirepassword'] = 'Require password';
|
||||
$string['requirepassword_help'] = 'If a password is specified, a student must enter it in order to attempt the quiz.';
|
||||
$string['requirepasswordmessage'] = 'To attempt this quiz you need to know the quiz password';
|
||||
$string['requiresafeexambrowser'] = 'Require the use of Safe Exam Browser';
|
||||
$string['requiresubnet'] = 'Require network address';
|
||||
$string['requiresubnet_help'] = 'Quiz access may be restricted to particular subnets on the LAN or Internet by specifying a comma-separated list of partial or full IP address numbers. This can be useful for an invigilated (proctored) quiz, to ensure that only people in a certain location can access the quiz.';
|
||||
$string['response'] = 'Response';
|
||||
@@ -656,8 +648,6 @@ $string['reviewresponsetoq'] = 'Review response (question {$a})';
|
||||
$string['reviewthisattempt'] = 'Review your responses to this attempt';
|
||||
$string['rqp'] = 'Remote question';
|
||||
$string['rqps'] = 'Remote questions';
|
||||
$string['safebrowsererror'] = 'This quiz has been set up so that it may only be attempted using the Safe Exam Browser. You cannot attempt it from this web browser.';
|
||||
$string['safebrowsernotice'] = 'This quiz has been configured so that students may only attempt it using the Safe Exam Browser.';
|
||||
$string['sameasoverall'] = 'Same as for overall grades';
|
||||
$string['save'] = 'Save';
|
||||
$string['saveandedit'] = 'Save changes and edit questions';
|
||||
@@ -728,7 +718,6 @@ $string['stoponerror'] = 'Stop on error';
|
||||
$string['submitallandfinish'] = 'Submit all and finish';
|
||||
$string['subneterror'] = 'Sorry, this quiz has been locked so that it is only accessible from certain locations. Currently your computer is not one of those allowed to use this quiz.';
|
||||
$string['subnetnotice'] = 'This quiz has been locked so that it is only accessible from certain locations. Your computer is not on an allowed subnet. As teacher you are allowed to preview anyway.';
|
||||
$string['subnetwrong'] = 'This quiz is only accessible from certain locations, and this computer is not on the allowed list.';
|
||||
$string['subplugintype_quiz'] = 'Report';
|
||||
$string['subplugintype_quiz_plural'] = 'Reports';
|
||||
$string['substitutedby'] = 'will be substituted by';
|
||||
@@ -784,7 +773,5 @@ $string['windowclosing'] = 'This window will close shortly.';
|
||||
$string['withsummary'] = 'with summary statistics';
|
||||
$string['wronguse'] = 'You can not use this page like that';
|
||||
$string['xhtml'] = 'XHTML';
|
||||
$string['youcannotwait'] = 'This quiz closes before you will be allowed to start another attempt.';
|
||||
$string['youmustwait'] = 'You must wait before you may re-attempt this quiz. You will be allowed to start another attempt after {$a}.';
|
||||
$string['youneedtoenrol'] = 'You need to enrol in this course before you can attempt this quiz';
|
||||
$string['yourfinalgradeis'] = 'Your final grade for this quiz is {$a}.';
|
||||
|
||||
Reference in New Issue
Block a user