From ffe162d44d28ee96eb544cb5bf9bdbb0123091c5 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Fri, 7 Oct 2011 18:50:38 +0100 Subject: [PATCH] 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 --- mod/quiz/accessmanager_form.php | 2 +- .../en/quizaccess_delaybetweenattempts.php | 2 + .../accessrule/delaybetweenattempts/rule.php | 5 +- .../simpletest/testrule.php | 64 +++++++++---------- .../lang/en/quizaccess_ipaddress.php | 1 + mod/quiz/accessrule/ipaddress/rule.php | 2 +- .../lang/en/quizaccess_numattempts.php | 1 + mod/quiz/accessrule/numattempts/rule.php | 2 +- .../numattempts/simpletest/testrule.php | 3 +- .../lang/en/quizaccess_openclosedate.php | 2 + mod/quiz/accessrule/openclosedate/rule.php | 10 ++- .../openclosedate/simpletest/testrule.php | 12 ++-- .../password/lang/en/quizaccess_password.php | 4 +- mod/quiz/accessrule/password/rule.php | 9 +-- .../password/simpletest/testrule.php | 3 +- .../lang/en/quizaccess_safebrowser.php | 3 + mod/quiz/accessrule/safebrowser/rule.php | 7 +- .../safebrowser/simpletest/testrule.php | 6 +- .../lang/en/quizaccess_securewindow.php | 1 + mod/quiz/accessrule/securewindow/rule.php | 3 +- .../lang/en/quizaccess_timelimit.php | 1 + mod/quiz/accessrule/timelimit/rule.php | 3 +- .../timelimit/simpletest/testrule.php | 2 +- mod/quiz/lang/en/quiz.php | 13 ---- 24 files changed, 87 insertions(+), 74 deletions(-) diff --git a/mod/quiz/accessmanager_form.php b/mod/quiz/accessmanager_form.php index 0018791da5d..291068e947c 100644 --- a/mod/quiz/accessmanager_form.php +++ b/mod/quiz/accessmanager_form.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once ($CFG->libdir.'/formslib.php'); +require_once($CFG->libdir.'/formslib.php'); /** diff --git a/mod/quiz/accessrule/delaybetweenattempts/lang/en/quizaccess_delaybetweenattempts.php b/mod/quiz/accessrule/delaybetweenattempts/lang/en/quizaccess_delaybetweenattempts.php index ab749318b79..8b9fdcdce98 100644 --- a/mod/quiz/accessrule/delaybetweenattempts/lang/en/quizaccess_delaybetweenattempts.php +++ b/mod/quiz/accessrule/delaybetweenattempts/lang/en/quizaccess_delaybetweenattempts.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}.'; diff --git a/mod/quiz/accessrule/delaybetweenattempts/rule.php b/mod/quiz/accessrule/delaybetweenattempts/rule.php index addd269cf4f..947b91f2b69 100644 --- a/mod/quiz/accessrule/delaybetweenattempts/rule.php +++ b/mod/quiz/accessrule/delaybetweenattempts/rule.php @@ -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; diff --git a/mod/quiz/accessrule/delaybetweenattempts/simpletest/testrule.php b/mod/quiz/accessrule/delaybetweenattempts/simpletest/testrule.php index dae92e8d476..f7d7ec35fa1 100644 --- a/mod/quiz/accessrule/delaybetweenattempts/simpletest/testrule.php +++ b/mod/quiz/accessrule/delaybetweenattempts/simpletest/testrule.php @@ -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))); } } diff --git a/mod/quiz/accessrule/ipaddress/lang/en/quizaccess_ipaddress.php b/mod/quiz/accessrule/ipaddress/lang/en/quizaccess_ipaddress.php index f56a768b897..984b26632db 100644 --- a/mod/quiz/accessrule/ipaddress/lang/en/quizaccess_ipaddress.php +++ b/mod/quiz/accessrule/ipaddress/lang/en/quizaccess_ipaddress.php @@ -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.'; diff --git a/mod/quiz/accessrule/ipaddress/rule.php b/mod/quiz/accessrule/ipaddress/rule.php index 0b88416a517..fa666a1e2e8 100644 --- a/mod/quiz/accessrule/ipaddress/rule.php +++ b/mod/quiz/accessrule/ipaddress/rule.php @@ -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'); } } } diff --git a/mod/quiz/accessrule/numattempts/lang/en/quizaccess_numattempts.php b/mod/quiz/accessrule/numattempts/lang/en/quizaccess_numattempts.php index 075af113b16..b778ba03e7d 100644 --- a/mod/quiz/accessrule/numattempts/lang/en/quizaccess_numattempts.php +++ b/mod/quiz/accessrule/numattempts/lang/en/quizaccess_numattempts.php @@ -27,4 +27,5 @@ defined('MOODLE_INTERNAL') || die(); +$string['attemptsallowedn'] = 'Attempts allowed: {$a}'; $string['pluginname'] = 'Number of attempts quiz access rule'; diff --git a/mod/quiz/accessrule/numattempts/rule.php b/mod/quiz/accessrule/numattempts/rule.php index fad046a2e10..e69faf74bfb 100644 --- a/mod/quiz/accessrule/numattempts/rule.php +++ b/mod/quiz/accessrule/numattempts/rule.php @@ -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) { diff --git a/mod/quiz/accessrule/numattempts/simpletest/testrule.php b/mod/quiz/accessrule/numattempts/simpletest/testrule.php index 9297731352e..27d66571418 100644 --- a/mod/quiz/accessrule/numattempts/simpletest/testrule.php +++ b/mod/quiz/accessrule/numattempts/simpletest/testrule.php @@ -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)); diff --git a/mod/quiz/accessrule/openclosedate/lang/en/quizaccess_openclosedate.php b/mod/quiz/accessrule/openclosedate/lang/en/quizaccess_openclosedate.php index 4e2a9137fac..a7bdcc32246 100644 --- a/mod/quiz/accessrule/openclosedate/lang/en/quizaccess_openclosedate.php +++ b/mod/quiz/accessrule/openclosedate/lang/en/quizaccess_openclosedate.php @@ -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}'; diff --git a/mod/quiz/accessrule/openclosedate/rule.php b/mod/quiz/accessrule/openclosedate/rule.php index 36b98ede6ce..19519018bf8 100644 --- a/mod/quiz/accessrule/openclosedate/rule.php +++ b/mod/quiz/accessrule/openclosedate/rule.php @@ -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; } diff --git a/mod/quiz/accessrule/openclosedate/simpletest/testrule.php b/mod/quiz/accessrule/openclosedate/simpletest/testrule.php index d5a14505ab0..6ccc1503515 100644 --- a/mod/quiz/accessrule/openclosedate/simpletest/testrule.php +++ b/mod/quiz/accessrule/openclosedate/simpletest/testrule.php @@ -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)); diff --git a/mod/quiz/accessrule/password/lang/en/quizaccess_password.php b/mod/quiz/accessrule/password/lang/en/quizaccess_password.php index 132e8331549..16721144381 100644 --- a/mod/quiz/accessrule/password/lang/en/quizaccess_password.php +++ b/mod/quiz/accessrule/password/lang/en/quizaccess_password.php @@ -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'; \ No newline at end of file +$string['quizpassword'] = 'Quiz password'; +$string['requirepasswordmessage'] = 'To attempt this quiz you need to know the quiz password'; diff --git a/mod/quiz/accessrule/password/rule.php b/mod/quiz/accessrule/password/rule.php index 57141445121..369012d536d 100644 --- a/mod/quiz/accessrule/password/rule.php +++ b/mod/quiz/accessrule/password/rule.php @@ -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; } diff --git a/mod/quiz/accessrule/password/simpletest/testrule.php b/mod/quiz/accessrule/password/simpletest/testrule.php index 6fb0e12a59b..b3d1e56de2d 100644 --- a/mod/quiz/accessrule/password/simpletest/testrule.php +++ b/mod/quiz/accessrule/password/simpletest/testrule.php @@ -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)); diff --git a/mod/quiz/accessrule/safebrowser/lang/en/quizaccess_safebrowser.php b/mod/quiz/accessrule/safebrowser/lang/en/quizaccess_safebrowser.php index 0b91c9747d6..0847d5fd274 100644 --- a/mod/quiz/accessrule/safebrowser/lang/en/quizaccess_safebrowser.php +++ b/mod/quiz/accessrule/safebrowser/lang/en/quizaccess_safebrowser.php @@ -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.'; diff --git a/mod/quiz/accessrule/safebrowser/rule.php b/mod/quiz/accessrule/safebrowser/rule.php index e0d11e2274c..e73c5b83412 100644 --- a/mod/quiz/accessrule/safebrowser/rule.php +++ b/mod/quiz/accessrule/safebrowser/rule.php @@ -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')); } } diff --git a/mod/quiz/accessrule/safebrowser/simpletest/testrule.php b/mod/quiz/accessrule/safebrowser/simpletest/testrule.php index 5baab3015f3..a7266f4ff06 100644 --- a/mod/quiz/accessrule/safebrowser/simpletest/testrule.php +++ b/mod/quiz/accessrule/safebrowser/simpletest/testrule.php @@ -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)); diff --git a/mod/quiz/accessrule/securewindow/lang/en/quizaccess_securewindow.php b/mod/quiz/accessrule/securewindow/lang/en/quizaccess_securewindow.php index 9fa8292acc7..74897c91953 100644 --- a/mod/quiz/accessrule/securewindow/lang/en/quizaccess_securewindow.php +++ b/mod/quiz/accessrule/securewindow/lang/en/quizaccess_securewindow.php @@ -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'; diff --git a/mod/quiz/accessrule/securewindow/rule.php b/mod/quiz/accessrule/securewindow/rule.php index 7e471eff3a8..fb5ae669ebc 100644 --- a/mod/quiz/accessrule/securewindow/rule.php +++ b/mod/quiz/accessrule/securewindow/rule.php @@ -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')); } } diff --git a/mod/quiz/accessrule/timelimit/lang/en/quizaccess_timelimit.php b/mod/quiz/accessrule/timelimit/lang/en/quizaccess_timelimit.php index 1d030905cde..f0bee8bff4c 100644 --- a/mod/quiz/accessrule/timelimit/lang/en/quizaccess_timelimit.php +++ b/mod/quiz/accessrule/timelimit/lang/en/quizaccess_timelimit.php @@ -28,3 +28,4 @@ defined('MOODLE_INTERNAL') || die(); $string['pluginname'] = 'Time limit quiz access rule'; +$string['quiztimelimit'] = 'Time limit: {$a}'; diff --git a/mod/quiz/accessrule/timelimit/rule.php b/mod/quiz/accessrule/timelimit/rule.php index 7d274f99317..eff0dbbaf08 100644 --- a/mod/quiz/accessrule/timelimit/rule.php +++ b/mod/quiz/accessrule/timelimit/rule.php @@ -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) { diff --git a/mod/quiz/accessrule/timelimit/simpletest/testrule.php b/mod/quiz/accessrule/timelimit/simpletest/testrule.php index eb1332a8e87..f9c2d23e1e2 100644 --- a/mod/quiz/accessrule/timelimit/simpletest/testrule.php +++ b/mod/quiz/accessrule/timelimit/simpletest/testrule.php @@ -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); diff --git a/mod/quiz/lang/en/quiz.php b/mod/quiz/lang/en/quiz.php index a155ee74bc5..119a3926e8f 100644 --- a/mod/quiz/lang/en/quiz.php +++ b/mod/quiz/lang/en/quiz.php @@ -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!
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}.';