From 0fc6bfab6cb84f3bdb309cda1c86e5c4364a4d78 Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Mon, 26 Apr 2021 11:33:01 +1000 Subject: [PATCH] MDL-71163 mod_choice: remove duplicate info for timeopen and timeclose --- mod/choice/lang/en/choice.php | 1 + mod/choice/tests/behat/choice_availability.feature | 8 ++++++-- mod/choice/view.php | 6 ++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/mod/choice/lang/en/choice.php b/mod/choice/lang/en/choice.php index 033a0a6efc8..7234b1de93f 100644 --- a/mod/choice/lang/en/choice.php +++ b/mod/choice/lang/en/choice.php @@ -116,6 +116,7 @@ $string['options'] = 'Options'; $string['page-mod-choice-x'] = 'Any choice module page'; $string['pluginadministration'] = 'Choice administration'; $string['pluginname'] = 'Choice'; +$string['previewing'] = 'This is just a preview of the available options for this activity. You will be able to make a choice when it opens.'; $string['previewonly'] = 'This is just a preview of the available options for this activity. You will not be able to submit your choice until {$a}.'; $string['privacy'] = 'Privacy of results'; $string['privacy:metadata:choice_answers'] = 'Information about the user\'s chosen answer(s) for a given choice activity'; diff --git a/mod/choice/tests/behat/choice_availability.feature b/mod/choice/tests/behat/choice_availability.feature index 0ed93dbba96..a75926fc337 100644 --- a/mod/choice/tests/behat/choice_availability.feature +++ b/mod/choice/tests/behat/choice_availability.feature @@ -33,7 +33,9 @@ Feature: Restrict availability of the choice module to a deadline When I log in as "student1" And I am on "Course 1" course homepage And I follow "Choice name" - Then I should see "This activity is not available until" + Then "choice_1" "radio" should not exist + And "choice_2" "radio" should not exist + And "Save my choice" "button" should not exist Scenario: Enable the choice activity with a start deadline in the past Given I add a "Choice" to section "1" and I fill the form with: @@ -85,4 +87,6 @@ Feature: Restrict availability of the choice module to a deadline When I log in as "student1" And I am on "Course 1" course homepage And I follow "Choice name" - Then I should see "This activity closed on" + Then "choice_1" "radio" should not exist + And "choice_2" "radio" should not exist + And "Save my choice" "button" should not exist diff --git a/mod/choice/view.php b/mod/choice/view.php index 495ed91d62e..271a6b1bf2b 100644 --- a/mod/choice/view.php +++ b/mod/choice/view.php @@ -151,21 +151,19 @@ if (isloggedin() && (!empty($current)) && foreach ($current as $c) { $choicetexts[] = format_string(choice_get_option_text($choice, $c->optionid)); } - echo $OUTPUT->box(get_string("yourselection", "choice", userdate($choice->timeopen)).": ".implode('; ', $choicetexts), 'generalbox', 'yourselection'); + echo $OUTPUT->box(get_string("yourselection", "choice") . ": " . implode('; ', $choicetexts), 'generalbox', 'yourselection'); } /// Print the form $choiceopen = true; if ((!empty($choice->timeopen)) && ($choice->timeopen > $timenow)) { if ($choice->showpreview) { - echo $OUTPUT->box(get_string('previewonly', 'choice', userdate($choice->timeopen)), 'generalbox alert'); + echo $OUTPUT->box(get_string('previewing', 'choice'), 'generalbox alert'); } else { - echo $OUTPUT->box(get_string("notopenyet", "choice", userdate($choice->timeopen)), "generalbox notopenyet"); echo $OUTPUT->footer(); exit; } } else if ((!empty($choice->timeclose)) && ($timenow > $choice->timeclose)) { - echo $OUTPUT->box(get_string("expired", "choice", userdate($choice->timeclose)), "generalbox expired"); $choiceopen = false; }