mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
MDL-71163 quizaccess_openclosedate: remove duplicate date info
The quiz module now showa the quiz open and close dates at the top of the page. So there is no need for the quizaccess_openclosedate plugin to display these dates in the middle of the page.
This commit is contained in:
parent
1da9d7a8c7
commit
e25be6bd22
1
mod/quiz/accessrule/openclosedate/lang/en/deprecated.txt
Normal file
1
mod/quiz/accessrule/openclosedate/lang/en/deprecated.txt
Normal file
@ -0,0 +1 @@
|
||||
quiznotavailable,quizaccess_openclosedate
|
@ -30,4 +30,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
$string['notavailable'] = 'This quiz is not currently available';
|
||||
$string['pluginname'] = 'Open and close date access rule';
|
||||
$string['privacy:metadata'] = 'The Open and close date quiz access rule plugin does not store any personal data.';
|
||||
|
||||
// Deprecated since Moodle 3.11.
|
||||
$string['quiznotavailable'] = 'The quiz will not be available until {$a}';
|
||||
|
||||
|
@ -42,30 +42,6 @@ class quizaccess_openclosedate extends quiz_access_rule_base {
|
||||
return new self($quizobj, $timenow);
|
||||
}
|
||||
|
||||
public function description() {
|
||||
$result = array();
|
||||
if ($this->timenow < $this->quiz->timeopen) {
|
||||
$result[] = get_string('quiznotavailable', 'quizaccess_openclosedate',
|
||||
userdate($this->quiz->timeopen));
|
||||
if ($this->quiz->timeclose) {
|
||||
$result[] = get_string('quizcloseson', 'quiz', userdate($this->quiz->timeclose));
|
||||
}
|
||||
|
||||
} else if ($this->quiz->timeclose && $this->timenow > $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));
|
||||
}
|
||||
if ($this->quiz->timeclose) {
|
||||
$result[] = get_string('quizcloseson', 'quiz', userdate($this->quiz->timeclose));
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function prevent_access() {
|
||||
$message = get_string('notavailable', 'quizaccess_openclosedate');
|
||||
|
||||
|
@ -50,7 +50,6 @@ class quizaccess_openclosedate_testcase extends basic_testcase {
|
||||
$attempt->preview = 0;
|
||||
|
||||
$rule = new quizaccess_openclosedate($quizobj, 10000);
|
||||
$this->assertEmpty($rule->description());
|
||||
$this->assertFalse($rule->prevent_access());
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->is_finished(0, $attempt));
|
||||
@ -59,7 +58,6 @@ class quizaccess_openclosedate_testcase extends basic_testcase {
|
||||
$this->assertFalse($rule->time_left_display($attempt, 0));
|
||||
|
||||
$rule = new quizaccess_openclosedate($quizobj, 0);
|
||||
$this->assertEmpty($rule->description());
|
||||
$this->assertFalse($rule->prevent_access());
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->is_finished(0, $attempt));
|
||||
@ -79,8 +77,6 @@ class quizaccess_openclosedate_testcase extends basic_testcase {
|
||||
$attempt->preview = 0;
|
||||
|
||||
$rule = new quizaccess_openclosedate($quizobj, 9999);
|
||||
$this->assertEquals($rule->description(),
|
||||
array(get_string('quiznotavailable', 'quizaccess_openclosedate', userdate(10000))));
|
||||
$this->assertEquals($rule->prevent_access(),
|
||||
get_string('notavailable', 'quizaccess_openclosedate'));
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
@ -89,8 +85,6 @@ class quizaccess_openclosedate_testcase extends basic_testcase {
|
||||
$this->assertFalse($rule->time_left_display($attempt, 0));
|
||||
|
||||
$rule = new quizaccess_openclosedate($quizobj, 10000);
|
||||
$this->assertEquals($rule->description(),
|
||||
array(get_string('quizopenedon', 'quiz', userdate(10000))));
|
||||
$this->assertFalse($rule->prevent_access());
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->is_finished(0, $attempt));
|
||||
@ -110,8 +104,6 @@ class quizaccess_openclosedate_testcase extends basic_testcase {
|
||||
$attempt->preview = 0;
|
||||
|
||||
$rule = new quizaccess_openclosedate($quizobj, 20000);
|
||||
$this->assertEquals($rule->description(),
|
||||
array(get_string('quizcloseson', 'quiz', userdate(20000))));
|
||||
$this->assertFalse($rule->prevent_access());
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->is_finished(0, $attempt));
|
||||
@ -123,8 +115,6 @@ class quizaccess_openclosedate_testcase extends basic_testcase {
|
||||
$this->assertEquals($rule->time_left_display($attempt, 20100), -100);
|
||||
|
||||
$rule = new quizaccess_openclosedate($quizobj, 20001);
|
||||
$this->assertEquals($rule->description(),
|
||||
array(get_string('quizclosed', 'quiz', userdate(20000))));
|
||||
$this->assertEquals($rule->prevent_access(),
|
||||
get_string('notavailable', 'quizaccess_openclosedate'));
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
@ -148,33 +138,22 @@ class quizaccess_openclosedate_testcase extends basic_testcase {
|
||||
$attempt->preview = 0;
|
||||
|
||||
$rule = new quizaccess_openclosedate($quizobj, 9999);
|
||||
$this->assertEquals($rule->description(),
|
||||
array(get_string('quiznotavailable', 'quizaccess_openclosedate', userdate(10000)),
|
||||
get_string('quizcloseson', 'quiz', userdate(20000))));
|
||||
$this->assertEquals($rule->prevent_access(),
|
||||
get_string('notavailable', 'quizaccess_openclosedate'));
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->is_finished(0, $attempt));
|
||||
|
||||
$rule = new quizaccess_openclosedate($quizobj, 10000);
|
||||
$this->assertEquals($rule->description(),
|
||||
array(get_string('quizopenedon', 'quiz', userdate(10000)),
|
||||
get_string('quizcloseson', 'quiz', userdate(20000))));
|
||||
$this->assertFalse($rule->prevent_access());
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->is_finished(0, $attempt));
|
||||
|
||||
$rule = new quizaccess_openclosedate($quizobj, 20000);
|
||||
$this->assertEquals($rule->description(),
|
||||
array(get_string('quizopenedon', 'quiz', userdate(10000)),
|
||||
get_string('quizcloseson', 'quiz', userdate(20000))));
|
||||
$this->assertFalse($rule->prevent_access());
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
$this->assertFalse($rule->is_finished(0, $attempt));
|
||||
|
||||
$rule = new quizaccess_openclosedate($quizobj, 20001);
|
||||
$this->assertEquals($rule->description(),
|
||||
array(get_string('quizclosed', 'quiz', userdate(20000))));
|
||||
$this->assertEquals($rule->prevent_access(),
|
||||
get_string('notavailable', 'quizaccess_openclosedate'));
|
||||
$this->assertFalse($rule->prevent_new_attempt(0, $attempt));
|
||||
|
@ -1670,8 +1670,8 @@ class mod_quiz_external_testcase extends externallib_advanced_testcase {
|
||||
$result = mod_quiz_external::get_quiz_access_information($quiz->id);
|
||||
$result = external_api::clean_returnvalue(mod_quiz_external::get_quiz_access_information_returns(), $result);
|
||||
|
||||
// Access limited by time and password.
|
||||
$this->assertCount(3, $result['accessrules']);
|
||||
// Access is limited by time and password, but only the password limit has a description.
|
||||
$this->assertCount(1, $result['accessrules']);
|
||||
// Two rule names, password and open/close date.
|
||||
$this->assertCount(2, $result['activerulenames']);
|
||||
$this->assertCount(1, $result['preventaccessreasons']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user