MDL-71163 mod_choice: remove duplicate info for timeopen and timeclose

This commit is contained in:
Shamim Rezaie 2021-04-26 11:33:01 +10:00
parent 7dbd7ee195
commit 0fc6bfab6c
3 changed files with 9 additions and 6 deletions

View File

@ -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';

View File

@ -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

View File

@ -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;
}