Skip to content

Commit

Permalink
MDL-71163 mod_choice: remove duplicate info for timeopen and timeclose
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies committed Apr 30, 2021
1 parent 1abf669 commit c49d99d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions mod/choice/lang/en/choice.php
Expand Up @@ -116,6 +116,7 @@
$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';
Expand Down
8 changes: 6 additions & 2 deletions mod/choice/tests/behat/choice_availability.feature
Expand Up @@ -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:
Expand Down Expand Up @@ -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
6 changes: 2 additions & 4 deletions mod/choice/view.php
Expand Up @@ -151,21 +151,19 @@
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;
}

Expand Down

0 comments on commit c49d99d

Please sign in to comment.