mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Merge branch 'MDL-71163-master' of git://github.com/rezaies/moodle
This commit is contained in:
commit
b04d1c3041
@ -21,5 +21,5 @@ Feature: Transform date time string arguments
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should see "##yesterday##%A, %d %B %Y##"
|
||||
And I should see "##yesterday##%d %B %Y##"
|
||||
And I log out
|
||||
|
@ -80,12 +80,35 @@ class activity_information implements renderable, templatable {
|
||||
|
||||
$data->cmid = $this->cminfo->id;
|
||||
$data->activityname = $this->cminfo->name;
|
||||
$data->activitydates = $this->activitydates;
|
||||
$this->build_dates_data($data);
|
||||
$data->hasdates = !empty($this->activitydates);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the dates data for export.
|
||||
*
|
||||
* @param stdClass $data
|
||||
*/
|
||||
protected function build_dates_data(stdClass $data): void {
|
||||
foreach ($this->activitydates as $date) {
|
||||
if (empty($date['relativeto'])) {
|
||||
$date['datestring'] = userdate($date['timestamp'], get_string('strftimedatetime', 'core_langconfig'));
|
||||
} else {
|
||||
$diffstr = get_time_interval_string($date['timestamp'], $date['relativeto']);
|
||||
if ($date['timestamp'] >= $date['relativeto']) {
|
||||
$date['datestring'] = get_string('relativedatessubmissionduedateafter', 'core_course',
|
||||
['datediffstr' => $diffstr]);
|
||||
} else {
|
||||
$date['datestring'] = get_string('relativedatessubmissionduedatebefore', 'core_course',
|
||||
['datediffstr' => $diffstr]);
|
||||
}
|
||||
}
|
||||
$data->activitydates[] = $date;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the completion data for export.
|
||||
*
|
||||
|
@ -22,9 +22,9 @@
|
||||
Example context (json):
|
||||
{
|
||||
"label": "Opens:",
|
||||
"timestamp": 1293876000
|
||||
"datestring": "6 April 2021, 6:46 PM"
|
||||
}
|
||||
}}
|
||||
<div>
|
||||
<strong>{{label}}</strong> {{#userdate}} {{timestamp}}, {{#str}} strftimedatetime, core_langconfig {{/str}} {{/userdate}}
|
||||
<strong>{{label}}</strong> {{datestring}}
|
||||
</div>
|
||||
|
@ -97,6 +97,8 @@ $string['privacy:metadata:completionsummary'] = 'The course contains completion
|
||||
$string['privacy:metadata:favouritessummary'] = 'The course contains information relating to the course being starred by the user.';
|
||||
$string['recommend'] = 'Recommend';
|
||||
$string['recommendcheckbox'] = 'Recommend activity: {$a}';
|
||||
$string['relativedatessubmissionduedateafter'] = '{$a->datediffstr} after course start';
|
||||
$string['relativedatessubmissionduedatebefore'] = '{$a->datediffstr} before course start';
|
||||
$string['searchactivitiesbyname'] = 'Search for activities by name';
|
||||
$string['searchresults'] = 'Search results: {$a}';
|
||||
$string['submitsearch'] = 'Submit search';
|
||||
|
@ -19,15 +19,16 @@ Feature: Any day / month / year combination in date form elements works ok.
|
||||
And I set the field "Due date" to "<initial_date>"
|
||||
And I set the field "Due date" to "<final_date>"
|
||||
When I press "Save and display"
|
||||
Then I should see "<date_result>" in the "Due date" "table_row"
|
||||
Then the activity date in "Assignment 01" should contain "Due:"
|
||||
And the activity date in "Assignment 01" should contain "<date_result>"
|
||||
|
||||
Examples:
|
||||
| initial_date | final_date | date_result | case_explanation (times Australia/Perth) |
|
||||
| ##today## | ##tomorrow noon## | ##tomorrow noon##%A, %d %B %Y, %I:%M## | change of day, any day, back and forth |
|
||||
| ##tomorrow## | ##today noon## | ##today noon##%A, %d %B %Y, %I:%M## | |
|
||||
| 1617256800 | 1617170400 | Wednesday, 31 March 2021, 2:00 | change of month, back and forth |
|
||||
| 1617170400 | 1617256800 | Thursday, 1 April 2021, 2:00 | |
|
||||
| 1740808800 | 1709186400 | Thursday, 29 February 2024, 2:00 | change of month, leap year, back and forth |
|
||||
| 1709186400 | 1740808800 | Saturday, 1 March 2025, 2:00 | |
|
||||
| 1577858400 | 1577772000 | Tuesday, 31 December 2019, 2:00 | change of year, back and forth |
|
||||
| 1577772000 | 1577858400 | Wednesday, 1 January 2020, 2:00 | |
|
||||
| ##today## | ##tomorrow noon## | ##tomorrow noon##%d %B %Y, %I:%M %p## | change of day, any day, back and forth |
|
||||
| ##tomorrow## | ##today noon## | ##today noon##%d %B %Y, %I:%M %p## | |
|
||||
| 1617256800 | 1617170400 | 31 March 2021, 2:00 PM | change of month, back and forth |
|
||||
| 1617170400 | 1617256800 | 1 April 2021, 2:00 PM | |
|
||||
| 1740808800 | 1709186400 | 29 February 2024, 2:00 PM | change of month, leap year, back and forth |
|
||||
| 1709186400 | 1740808800 | 1 March 2025, 2:00 PM | |
|
||||
| 1577858400 | 1577772000 | 31 December 2019, 2:00 PM | change of year, back and forth |
|
||||
| 1577772000 | 1577858400 | 1 January 2020, 2:00 PM | |
|
||||
|
@ -42,24 +42,54 @@ class dates extends activity_dates {
|
||||
* @return array
|
||||
*/
|
||||
protected function get_dates(): array {
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/mod/assign/locallib.php');
|
||||
|
||||
$course = get_course($this->cm->course);
|
||||
$context = \context_module::instance($this->cm->id);
|
||||
$assign = new \assign($context, $this->cm, $course);
|
||||
|
||||
$timeopen = $this->cm->customdata['allowsubmissionsfromdate'] ?? null;
|
||||
$timedue = $this->cm->customdata['duedate'] ?? null;
|
||||
|
||||
$activitygroup = groups_get_activity_group($this->cm, true);
|
||||
if ($activitygroup) {
|
||||
if ($assign->can_view_grades()) {
|
||||
$groupoverride = \cache::make('mod_assign', 'overrides')->get("{$this->cm->instance}_g_{$activitygroup}");
|
||||
if (!empty($groupoverride->allowsubmissionsfromdate)) {
|
||||
$timeopen = $groupoverride->allowsubmissionsfromdate;
|
||||
}
|
||||
if (!empty($groupoverride->duedate)) {
|
||||
$timedue = $groupoverride->duedate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$now = time();
|
||||
$dates = [];
|
||||
|
||||
if ($timeopen) {
|
||||
$openlabelid = $timeopen > $now ? 'activitydate:submissionsopen' : 'activitydate:submissionsopened';
|
||||
$dates[] = [
|
||||
$date = [
|
||||
'label' => get_string($openlabelid, 'mod_assign'),
|
||||
'timestamp' => (int) $timeopen,
|
||||
];
|
||||
if ($course->relativedatesmode && $assign->can_view_grades()) {
|
||||
$date['relativeto'] = $course->startdate;
|
||||
}
|
||||
$dates[] = $date;
|
||||
}
|
||||
|
||||
if ($timedue) {
|
||||
$dates[] = [
|
||||
$date = [
|
||||
'label' => get_string('activitydate:submissionsdue', 'mod_assign'),
|
||||
'timestamp' => (int) $timedue,
|
||||
];
|
||||
if ($course->relativedatesmode && $assign->can_view_grades()) {
|
||||
$date['relativeto'] = $course->startdate;
|
||||
}
|
||||
$dates[] = $date;
|
||||
}
|
||||
|
||||
return $dates;
|
||||
|
@ -22,9 +22,9 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['activitydate:submissionsdue'] = 'Submissions due:';
|
||||
$string['activitydate:submissionsopen'] = 'Submissions open:';
|
||||
$string['activitydate:submissionsopened'] = 'Submissions opened:';
|
||||
$string['activitydate:submissionsdue'] = 'Due:';
|
||||
$string['activitydate:submissionsopen'] = 'Opens:';
|
||||
$string['activitydate:submissionsopened'] = 'Opened:';
|
||||
$string['activityoverview'] = 'You have assignments that need attention';
|
||||
$string['addsubmission'] = 'Add submission';
|
||||
$string['addsubmission_help'] = 'You have not made a submission yet.';
|
||||
@ -41,8 +41,6 @@ $string['allowsubmissions'] = 'Allow the user to continue making submissions to
|
||||
$string['allowsubmissionsshort'] = 'Allow submission changes';
|
||||
$string['allowsubmissionsfromdate'] = 'Allow submissions from';
|
||||
$string['allowsubmissionsfromdate_help'] = 'If enabled, students will not be able to submit before this date. If disabled, students will be able to start submitting right away.';
|
||||
$string['allowsubmissionsfromdatesummary'] = 'This assignment will accept submissions from <strong>{$a}</strong>';
|
||||
$string['allowsubmissionsanddescriptionfromdatesummary'] = 'The assignment details and submission form will be available from <strong>{$a}</strong>';
|
||||
$string['alwaysshowdescription'] = 'Always show description';
|
||||
$string['alwaysshowdescription_help'] = 'If disabled, the assignment description above will only become visible to students on the "Allow submissions from" date.';
|
||||
$string['applytoteam'] = 'Apply grades and feedback to entire group';
|
||||
@ -451,8 +449,6 @@ $string['quickgradingresult'] = 'Quick grading';
|
||||
$string['quickgradingchangessaved'] = 'The grade changes were saved';
|
||||
$string['quickgrading_help'] = 'Quick grading allows you to assign grades (and outcomes) directly in the submissions table. Quick grading is not compatible with advanced grading and is not recommended when there are multiple markers.';
|
||||
$string['relativedatessubmissiontimeleft'] = 'Calculated for each student';
|
||||
$string['relativedatessubmissionduedateafter'] = '{$a->datediffstr} after course start';
|
||||
$string['relativedatessubmissionduedatebefore'] = '{$a->datediffstr} before course start';
|
||||
$string['removeallgroupoverrides'] = 'Delete all group overrides';
|
||||
$string['removealluseroverrides'] = 'Delete all user overrides';
|
||||
$string['reopenuntilpassincompatiblewithblindmarking'] = 'Reopen until pass option is incompatible with anonymous submissions, because the grades are not released to the gradebook until the student identities are revealed.';
|
||||
@ -641,3 +637,9 @@ $string['nolatesubmissions'] = 'No late submissions accepted. ';
|
||||
$string['nosubmissionsacceptedafter'] = 'No submissions accepted after ';
|
||||
$string['notsubmittedyet'] = 'Not submitted yet';
|
||||
$string['submissionsnotgraded'] = 'Submissions not graded: {$a}';
|
||||
|
||||
// Deprecated since Moodle 3.11.
|
||||
$string['allowsubmissionsfromdatesummary'] = 'This assignment will accept submissions from <strong>{$a}</strong>';
|
||||
$string['allowsubmissionsanddescriptionfromdatesummary'] = 'The assignment details and submission form will be available from <strong>{$a}</strong>';
|
||||
$string['relativedatessubmissionduedateafter'] = '{$a->datediffstr} after course start';
|
||||
$string['relativedatessubmissionduedatebefore'] = '{$a->datediffstr} before course start';
|
||||
|
@ -1,6 +1,10 @@
|
||||
allowsubmissionsfromdatesummary,mod_assign
|
||||
allowsubmissionsanddescriptionfromdatesummary,mod_assign
|
||||
duedateno,mod_assign
|
||||
mysubmission,mod_assign
|
||||
nolatesubmissions,mod_assign
|
||||
nosubmissionsacceptedafter,mod_assign
|
||||
notsubmittedyet,mod_assign
|
||||
relativedatessubmissionduedateafter,mod_assign
|
||||
relativedatessubmissionduedatebefore,mod_assign
|
||||
submissionsnotgraded,mod_assign
|
@ -572,6 +572,16 @@ function mod_assign_cm_info_dynamic(cm_info $cm) {
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate relative dates. The assignment module calculates relative date only for duedate.
|
||||
// A user or group override always has higher priority over any relative date calculation.
|
||||
if (empty($override->duedate) && !empty($cm->customdata['duedate'])) {
|
||||
$course = get_course($cm->course);
|
||||
$usercoursedates = course_get_course_dates_for_user_id($course, $USER->id);
|
||||
if ($usercoursedates['start']) {
|
||||
$override->duedate = $cm->customdata['duedate'] + $usercoursedates['startoffset'];
|
||||
}
|
||||
}
|
||||
|
||||
// Populate some other values that can be used in calendar or on dashboard.
|
||||
if (!is_null($override->allowsubmissionsfromdate)) {
|
||||
$cm->override_customdata('allowsubmissionsfromdate', $override->allowsubmissionsfromdate);
|
||||
|
@ -335,26 +335,8 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||
|
||||
$time = time();
|
||||
if ($summary->duedate) {
|
||||
// Due date.
|
||||
$cell1content = get_string('duedate', 'assign');
|
||||
$duedate = $summary->duedate;
|
||||
if ($summary->courserelativedatesmode) {
|
||||
// Returns a formatted string, in the format '10d 10h 45m'.
|
||||
$diffstr = get_time_interval_string($duedate, $summary->coursestartdate);
|
||||
if ($duedate >= $summary->coursestartdate) {
|
||||
$cell2content = get_string('relativedatessubmissionduedateafter', 'mod_assign',
|
||||
['datediffstr' => $diffstr]);
|
||||
} else {
|
||||
$cell2content = get_string('relativedatessubmissionduedatebefore', 'mod_assign',
|
||||
['datediffstr' => $diffstr]);
|
||||
}
|
||||
} else {
|
||||
$cell2content = userdate($duedate);
|
||||
}
|
||||
|
||||
$this->add_table_row_tuple($t, $cell1content, $cell2content);
|
||||
|
||||
// Time remaining.
|
||||
$duedate = $summary->duedate;
|
||||
$cell1content = get_string('timeremaining', 'assign');
|
||||
if ($summary->courserelativedatesmode) {
|
||||
$cell2content = get_string('relativedatessubmissiontimeleft', 'mod_assign');
|
||||
@ -667,18 +649,6 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||
$o .= $this->output->heading(get_string('submissionstatusheading', 'assign'), 3);
|
||||
$time = time();
|
||||
|
||||
if ($status->allowsubmissionsfromdate &&
|
||||
$time <= $status->allowsubmissionsfromdate) {
|
||||
$o .= $this->output->box_start('generalbox boxaligncenter submissionsalloweddates');
|
||||
if ($status->alwaysshowdescription) {
|
||||
$date = userdate($status->allowsubmissionsfromdate);
|
||||
$o .= get_string('allowsubmissionsfromdatesummary', 'assign', $date);
|
||||
} else {
|
||||
$date = userdate($status->allowsubmissionsfromdate);
|
||||
$o .= get_string('allowsubmissionsanddescriptionfromdatesummary', 'assign', $date);
|
||||
}
|
||||
$o .= $this->output->box_end();
|
||||
}
|
||||
$o .= $this->output->box_start('boxaligncenter submissionsummarytable');
|
||||
|
||||
$t = new html_table();
|
||||
@ -810,11 +780,6 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||
$submission = $status->teamsubmission ? $status->teamsubmission : $status->submission;
|
||||
$duedate = $status->duedate;
|
||||
if ($duedate > 0) {
|
||||
// Due date.
|
||||
$cell1content = get_string('duedate', 'assign');
|
||||
$cell2content = userdate($duedate);
|
||||
$this->add_table_row_tuple($t, $cell1content, $cell2content);
|
||||
|
||||
if ($status->view == assign_submission_status::GRADER_VIEW) {
|
||||
if ($status->cutoffdate) {
|
||||
// Cut off date.
|
||||
|
@ -93,12 +93,12 @@ Feature: Assign group override
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
Then I should see "Saturday, 1 January 2000, 8:00"
|
||||
Then the activity date in "Test assignment name" should contain "Due: 1 January 2000, 8:00 AM"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should see "Wednesday, 1 January 2020, 8:00"
|
||||
And the activity date in "Test assignment name" should contain "Due: 1 January 2020, 8:00 AM"
|
||||
|
||||
Scenario: Allow a group to have a different cut off date
|
||||
Given I log in as "teacher1"
|
||||
@ -149,13 +149,13 @@ Feature: Assign group override
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
Then I should see "This assignment will accept submissions from Tuesday, 1 January 2030, 8:00"
|
||||
Then the activity date in "Test assignment name" should contain "Opens: 1 January 2030, 8:00 AM"
|
||||
And I should not see "Add submission"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should not see "This assignment will accept submissions from Tuesday, 1 January 2030, 8:00"
|
||||
And I should not see "1 January 2030, 8:00 AM"
|
||||
|
||||
@javascript
|
||||
Scenario: Add both a user and group override and verify that both are applied correctly
|
||||
@ -187,17 +187,17 @@ Feature: Assign group override
|
||||
Then I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should see "This assignment will accept submissions from Wednesday, 1 January 2031, 8:00"
|
||||
And the activity date in "Test assignment name" should contain "Opens: 1 January 2031, 8:00 AM"
|
||||
And I log out
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should see "This assignment will accept submissions from Sunday, 1 January 2040, 8:00"
|
||||
And the activity date in "Test assignment name" should contain "Opens: 1 January 2040, 8:00 AM"
|
||||
And I log out
|
||||
And I log in as "student3"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should see "This assignment will accept submissions from Tuesday, 1 January 2030, 8:00"
|
||||
And the activity date in "Test assignment name" should contain "Opens: 1 January 2030, 8:00 AM"
|
||||
|
||||
Scenario: Override a group when teacher is in no group, and does not have accessallgroups permission, and the activity's group mode is "separate groups"
|
||||
Given the following "permission overrides" exist:
|
||||
|
@ -85,12 +85,12 @@ Feature: Assign user override
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
Then I should see "Saturday, 1 January 2000, 8:00"
|
||||
Then the activity date in "Test assignment name" should contain "Due: 1 January 2000, 8:00 AM"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should see "Wednesday, 1 January 2020, 8:00"
|
||||
And the activity date in "Test assignment name" should contain "Due: 1 January 2020, 8:00 AM"
|
||||
|
||||
@javascript
|
||||
Scenario: Allow a user to have a different cut off date
|
||||
@ -143,12 +143,12 @@ Feature: Assign user override
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
Then I should see "This assignment will accept submissions from Tuesday, 1 January 2030, 8:00"
|
||||
Then the activity date in "Test assignment name" should contain "Opens: 1 January 2030, 8:00 AM"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should not see "This assignment will accept submissions from Tuesday, 1 January 2030, 8:00"
|
||||
And I should not see "1 January 2030, 8:00 AM"
|
||||
|
||||
Scenario: Override a user when teacher is in no group, and does not have accessallgroups permission, and the activity's group mode is "separate groups"
|
||||
Given the following "permission overrides" exist:
|
||||
|
@ -35,6 +35,29 @@ I should be able to create an assignment with a due date relative to the course
|
||||
And I follow "Test assignment name"
|
||||
And I should not see "Assignment is overdue by:" in the "Time remaining" "table_row"
|
||||
|
||||
Scenario: As a student the due date I see for submitting my assignment is relative to my course start date
|
||||
Given the following config values are set as admin:
|
||||
| enablecourserelativedates | 1 |
|
||||
And the following "courses" exist:
|
||||
# A course with start date set to 1 Jan 2021.
|
||||
| fullname | shortname | category | groupmode | relativedatesmode | startdate |
|
||||
| Course 1 | C1 | 0 | 1 | 1 | 1609459200 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
# User's enrolment starts from 5 Jan 2021.
|
||||
| user | course | role | timestart |
|
||||
| student1 | C1 | student | 1609804800 |
|
||||
And the following "activities" exist:
|
||||
# The assignment's due date is 3 Jan 2021.
|
||||
| activity | name | intro | course | idnumber | assignsubmission_onlinetext_enabled | duedate |
|
||||
| assign | Test assignment name | Test assignment description | C1 | assign0 | 1 | 1609632000 |
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
Then the activity date in "Test assignment name" should contain "Due: 7 January 2021, 8:00 AM"
|
||||
|
||||
Scenario: As a teacher, I should see the relative dates when reviewing assignment submissions
|
||||
Given the following config values are set as admin:
|
||||
| enablecourserelativedates | 1 |
|
||||
@ -59,7 +82,7 @@ I should be able to create an assignment with a due date relative to the course
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should see "after course start" in the "Due date" "table_row"
|
||||
And the activity date in "Test assignment name" should contain "after course start"
|
||||
And I should see "Calculated for each student" in the "Time remaining" "table_row"
|
||||
When I navigate to "View all submissions" in current page administration
|
||||
Then I should see "No submission" in the "Student 1" "table_row"
|
||||
|
@ -43,8 +43,8 @@ Feature: Set availability dates for an assignment
|
||||
And I am on "Course 1" course homepage
|
||||
When I follow "Assignment name"
|
||||
Then "Add submission" "button" should not exist
|
||||
And I should see "This assignment will accept submissions from"
|
||||
And I should see "##tomorrow noon##%A, %d %B %Y, %I:%M %p##"
|
||||
And the activity date in "Assignment name" should contain "Opens:"
|
||||
And the activity date in "Assignment name" should contain "##tomorrow noon##%d %B %Y, %I:%M %p##"
|
||||
|
||||
Scenario: Student can see the assignment's due date in the course calendar
|
||||
Given I log in as "teacher1"
|
||||
@ -82,7 +82,8 @@ Feature: Set availability dates for an assignment
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Assignment name"
|
||||
And I should see "##+2 days 5 hours 30 minutes##%A, %d %B %Y##" in the "Due date" "table_row"
|
||||
And the activity date in "Assignment name" should contain "Due:"
|
||||
And the activity date in "Assignment name" should contain "##+2 days 5 hours 30 minutes##%d %B %Y##"
|
||||
And I should see "2 days 5 hours" in the "Time remaining" "table_row"
|
||||
And "Add submission" "button" should exist
|
||||
And I press "Add submission"
|
||||
@ -115,7 +116,8 @@ Feature: Set availability dates for an assignment
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Assignment name"
|
||||
And I should see "##2 days 5 hours 30 minutes ago##%A, %d %B %Y##" in the "Due date" "table_row"
|
||||
And the activity date in "Assignment name" should contain "Due:"
|
||||
And the activity date in "Assignment name" should contain "##2 days 5 hours 30 minutes ago##%d %B %Y##"
|
||||
And I should see "Assignment is overdue by: 2 days 5 hours" in the "Time remaining" "table_row"
|
||||
And "Add submission" "button" should exist
|
||||
And I press "Add submission"
|
||||
|
@ -4219,10 +4219,44 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
|
||||
}
|
||||
|
||||
/**
|
||||
* Test showing group override duedate for admin
|
||||
* Data provider for test_view_group_override
|
||||
*
|
||||
* @return array Provider data
|
||||
*/
|
||||
public function test_view_group_override() {
|
||||
global $DB, $PAGE;
|
||||
public function view_group_override_provider() {
|
||||
return [
|
||||
'Other users should see their duedate' => [
|
||||
'student',
|
||||
['group2'],
|
||||
'group1',
|
||||
'7 June 2019, 5:37 PM',
|
||||
],
|
||||
'Teacher should be able to see all group override duedate' => [
|
||||
'teacher',
|
||||
['group1'],
|
||||
'group1',
|
||||
'20 September 2019, 10:37 PM',
|
||||
],
|
||||
'Teacher should be able to see all group override duedate even if they are not member' => [
|
||||
'editingteacher',
|
||||
['group1'],
|
||||
'group2',
|
||||
'7 June 2019, 5:37 PM',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test showing group override duedate for admin
|
||||
*
|
||||
* @dataProvider view_group_override_provider
|
||||
* @param string $role the role of the user (teacher, student, etc)
|
||||
* @param string[] $groups the groups the user are member of
|
||||
* @param string $activegroup The selected group
|
||||
* @param string $expecteddate The expected due date
|
||||
*/
|
||||
public function test_view_group_override(string $role, array $groups, string $activegroup, string $expecteddate) {
|
||||
global $DB, $PAGE, $SESSION;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
@ -4230,17 +4264,18 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
|
||||
$group1 = $this->getDataGenerator()->create_group(['courseid' => $course->id]);
|
||||
$group2 = $this->getDataGenerator()->create_group(['courseid' => $course->id]);
|
||||
|
||||
$student1 = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
||||
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
||||
groups_add_member($group1, $student1);
|
||||
groups_add_member($group1, $teacher);
|
||||
|
||||
$student2 = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
||||
groups_add_member($group2, $student2);
|
||||
$user = $this->getDataGenerator()->create_and_enrol($course, $role);
|
||||
if (in_array('group1', $groups)) {
|
||||
groups_add_member($group1, $user);
|
||||
}
|
||||
if (in_array('group2', $groups)) {
|
||||
groups_add_member($group2, $user);
|
||||
}
|
||||
$activegroup = $$activegroup;
|
||||
|
||||
$assign = $this->create_instance($course, [
|
||||
'groupmode' => 1,
|
||||
'duedate' => 1558999899,
|
||||
'groupmode' => SEPARATEGROUPS,
|
||||
'duedate' => 1558999899, // 28 May 2019, 7:31 AM.
|
||||
]);
|
||||
$instance = $assign->get_instance();
|
||||
|
||||
@ -4251,14 +4286,14 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
|
||||
'groupid' => $group1->id,
|
||||
'userid' => null,
|
||||
'sortorder' => 1,
|
||||
'duedate' => 1568990258,
|
||||
'duedate' => 1568990258, // 20 September 2019, 10:37 PM.
|
||||
],
|
||||
(object) [
|
||||
'assignid' => $instance->id,
|
||||
'groupid' => $group2->id,
|
||||
'userid' => null,
|
||||
'sortorder' => 2,
|
||||
'duedate' => 1559900258,
|
||||
'duedate' => 1559900258, // 7 June 2019, 5:37 PM.
|
||||
],
|
||||
];
|
||||
|
||||
@ -4266,25 +4301,21 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
|
||||
$override->id = $DB->insert_record('assign_overrides', $override);
|
||||
}
|
||||
|
||||
$currenturl = new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id));
|
||||
$currenturl = new moodle_url('/mod/assign/view.php', ['id' => $assign->get_course_module()->id]);
|
||||
$PAGE->set_url($currenturl);
|
||||
$output1 = '';
|
||||
// Other users should see duedate of the assignment.
|
||||
$this->setUser($student2);
|
||||
$summary = $assign->get_assign_grading_summary_renderable($group1->id);
|
||||
$output1 .= $assign->get_renderer()->render($summary);
|
||||
$this->assertStringContainsStringIgnoringCase('Tuesday, 28 May 2019, 7:31 AM', $output1);
|
||||
|
||||
$output2 = '';
|
||||
// Teacher should be able to see all group override duedate.
|
||||
$this->setUser($teacher);
|
||||
$summary = $assign->get_assign_grading_summary_renderable($group1->id);
|
||||
$output2 .= $assign->get_renderer()->render($summary);
|
||||
$this->assertStringContainsStringIgnoringCase('Friday, 20 September 2019, 10:37 PM', $output2);
|
||||
$summary = $assign->get_assign_grading_summary_renderable($group2->id);
|
||||
$output3 = '';
|
||||
$output3 .= $assign->get_renderer()->render($summary);
|
||||
$this->assertStringContainsStringIgnoringCase('Friday, 7 June 2019, 5:37 PM', $output3);
|
||||
$this->setUser($user);
|
||||
$_GET['group'] = $activegroup->id;
|
||||
|
||||
/** @var assign $assign */
|
||||
$header = new assign_header(
|
||||
$assign->get_instance(),
|
||||
$assign->get_context(),
|
||||
false,
|
||||
$assign->get_course_module()->id
|
||||
);
|
||||
$output = $assign->get_renderer()->render($header);
|
||||
$this->assertStringContainsStringIgnoringCase($expecteddate, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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';
|
||||
|
@ -36,7 +36,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 the following "activities" exist:
|
||||
@ -97,4 +99,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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -362,13 +362,9 @@
|
||||
}
|
||||
|
||||
// If data activity closed dont let students in.
|
||||
// No need to display warnings because activity dates are displayed at the top of the page.
|
||||
list($showactivity, $warnings) = data_get_time_availability_status($data, $canmanageentries);
|
||||
|
||||
if (!$showactivity) {
|
||||
$reason = current(array_keys($warnings));
|
||||
echo $OUTPUT->notification(get_string($reason, 'data', $warnings[$reason]));
|
||||
}
|
||||
|
||||
if ($showactivity) {
|
||||
// Print the tabs
|
||||
if ($record or $mode == 'single') {
|
||||
|
@ -46,20 +46,20 @@ class summary implements renderable, templatable {
|
||||
/** @var int */
|
||||
protected $mygroupid;
|
||||
|
||||
/** @var bool */
|
||||
protected $extradetails;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @todo MDL-71494 Final deprecation of the $extradetails parameter in Moodle 4.3
|
||||
* @param mod_feedback_structure $feedbackstructure
|
||||
* @param int $mygroupid currently selected group
|
||||
* @param bool $extradetails display additional details (time open, time closed)
|
||||
* @param bool|null $extradetails Deprecated
|
||||
*/
|
||||
public function __construct($feedbackstructure, $mygroupid = false, $extradetails = false) {
|
||||
public function __construct($feedbackstructure, $mygroupid = false, $extradetails = null) {
|
||||
if (isset($extradetails)) {
|
||||
debugging('The $extradetails parameter is deprecated.', DEBUG_DEVELOPER);
|
||||
}
|
||||
$this->feedbackstructure = $feedbackstructure;
|
||||
$this->mygroupid = $mygroupid;
|
||||
$this->extradetails = $extradetails;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,12 +72,6 @@ class summary implements renderable, templatable {
|
||||
$r = new stdClass();
|
||||
$r->completedcount = $this->feedbackstructure->count_completed_responses($this->mygroupid);
|
||||
$r->itemscount = count($this->feedbackstructure->get_items(true));
|
||||
if ($this->extradetails && ($timeopen = $this->feedbackstructure->get_feedback()->timeopen)) {
|
||||
$r->timeopen = userdate($timeopen);
|
||||
}
|
||||
if ($this->extradetails && ($timeclose = $this->feedbackstructure->get_feedback()->timeclose)) {
|
||||
$r->timeclose = userdate($timeclose);
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
@ -31,8 +31,7 @@
|
||||
Example context (json):
|
||||
{
|
||||
"completedcount" : 15,
|
||||
"itemscount" : 5,
|
||||
"timeopen" : "May 15, 2016"
|
||||
"itemscount" : 5
|
||||
}
|
||||
|
||||
}}
|
||||
@ -48,20 +47,3 @@
|
||||
class="feedback_info">{{#str}}questions, mod_feedback{{/str}}: </span><span
|
||||
class="feedback_info_value">{{itemscount}}</span>
|
||||
</div>
|
||||
|
||||
{{#timeopen}}
|
||||
<div class="feedback_info">
|
||||
<span
|
||||
class="feedback_info">{{#str}}feedbackopen, mod_feedback{{/str}}: </span><span
|
||||
class="feedback_info_value">{{timeopen}}</span>
|
||||
</div>
|
||||
{{/timeopen}}
|
||||
|
||||
{{#timeclose}}
|
||||
<div class="feedback_info">
|
||||
<span
|
||||
class="feedback_info">{{#str}}feedbackclose, mod_feedback{{/str}}: </span><span
|
||||
class="feedback_info_value">{{timeclose}}</span>
|
||||
</div>
|
||||
{{/timeclose}}
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
=== 3.11 ===
|
||||
The $extradetails parameter in the constructor of the mod_feedback\output\summary class has been deprecated and is not used anymore.
|
||||
|
||||
=== 3.8 ===
|
||||
|
||||
* The following functions have been finally deprecated and can not be used anymore:
|
||||
|
@ -102,7 +102,7 @@ if (has_capability('mod/feedback:edititems', $context)) {
|
||||
$mygroupid = groups_get_activity_group($cm);
|
||||
|
||||
echo $groupselect.'<div class="clearer"> </div>';
|
||||
$summary = new mod_feedback\output\summary($feedbackcompletion, $mygroupid, true);
|
||||
$summary = new mod_feedback\output\summary($feedbackcompletion, $mygroupid);
|
||||
echo $OUTPUT->render_from_template('mod_feedback/summary', $summary->export_for_template($OUTPUT));
|
||||
|
||||
if ($pageaftersubmit = $feedbackcompletion->page_after_submit()) {
|
||||
|
@ -383,23 +383,25 @@ class discussion {
|
||||
$notifications = $this->notifications;
|
||||
$discussion = $this->discussion;
|
||||
$forum = $this->forum;
|
||||
$renderer = $this->renderer;
|
||||
|
||||
if ($forum->is_cutoff_date_reached()) {
|
||||
$notifications[] = (new notification(
|
||||
get_string('cutoffdatereached', 'forum'),
|
||||
notification::NOTIFY_INFO
|
||||
))->set_show_closebutton();
|
||||
} else if ($forum->is_due_date_reached()) {
|
||||
$notifications[] = (new notification(
|
||||
} else if ($forum->get_type() != 'single') {
|
||||
// Due date is already shown at the top of the page for single simple discussion forums.
|
||||
if ($forum->is_due_date_reached()) {
|
||||
$notifications[] = (new notification(
|
||||
get_string('thisforumisdue', 'forum', userdate($forum->get_due_date())),
|
||||
notification::NOTIFY_INFO
|
||||
))->set_show_closebutton();
|
||||
} else if ($forum->has_due_date()) {
|
||||
$notifications[] = (new notification(
|
||||
))->set_show_closebutton();
|
||||
} else if ($forum->has_due_date()) {
|
||||
$notifications[] = (new notification(
|
||||
get_string('thisforumhasduedate', 'forum', userdate($forum->get_due_date())),
|
||||
notification::NOTIFY_INFO
|
||||
))->set_show_closebutton();
|
||||
))->set_show_closebutton();
|
||||
}
|
||||
}
|
||||
|
||||
if ($forum->is_discussion_locked($discussion)) {
|
||||
|
@ -337,7 +337,6 @@ class discussion_list {
|
||||
private function get_notifications(stdClass $user, ?int $groupid) : array {
|
||||
$notifications = $this->notifications;
|
||||
$forum = $this->forum;
|
||||
$renderer = $this->renderer;
|
||||
$capabilitymanager = $this->capabilitymanager;
|
||||
|
||||
if ($forum->is_cutoff_date_reached()) {
|
||||
@ -345,16 +344,6 @@ class discussion_list {
|
||||
get_string('cutoffdatereached', 'forum'),
|
||||
notification::NOTIFY_INFO
|
||||
))->set_show_closebutton();
|
||||
} else if ($forum->is_due_date_reached()) {
|
||||
$notifications[] = (new notification(
|
||||
get_string('thisforumisdue', 'forum', userdate($forum->get_due_date())),
|
||||
notification::NOTIFY_INFO
|
||||
))->set_show_closebutton();
|
||||
} else if ($forum->has_due_date()) {
|
||||
$notifications[] = (new notification(
|
||||
get_string('thisforumhasduedate', 'forum', userdate($forum->get_due_date())),
|
||||
notification::NOTIFY_INFO
|
||||
))->set_show_closebutton();
|
||||
}
|
||||
|
||||
if ($forum->has_blocking_enabled()) {
|
||||
|
@ -69,7 +69,8 @@ if ($lesson->usepassword && !empty($userpassword)) {
|
||||
// Check these for students only TODO: Find a better method for doing this!
|
||||
if ($timerestriction = $lesson->get_time_restriction_status()) { // Deadline restrictions.
|
||||
echo $lessonoutput->header($lesson, $cm, '', false, null, get_string('notavailable'));
|
||||
echo $lessonoutput->lesson_inaccessible(get_string($timerestriction->reason, 'lesson', userdate($timerestriction->time)));
|
||||
// No need to display warnings because activity dates are displayed at the top of the page.
|
||||
echo $lessonoutput->lesson_inaccessible('');
|
||||
echo $lessonoutput->footer();
|
||||
exit();
|
||||
} else if ($passwordrestriction = $lesson->get_password_restriction_status($userpassword)) { // Password protected lesson code.
|
||||
|
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']);
|
||||
|
@ -170,12 +170,8 @@ if (empty($launch) && ($scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTAT
|
||||
}
|
||||
echo $OUTPUT->box(format_module_intro('scorm', $scorm, $cm->id).$attemptstatus, 'container', 'intro');
|
||||
|
||||
// Check if SCORM available.
|
||||
// Check if SCORM available. No need to display warnings because activity dates are displayed at the top of the page.
|
||||
list($available, $warnings) = scorm_get_availability_status($scorm);
|
||||
if (!$available) {
|
||||
$reason = current(array_keys($warnings));
|
||||
echo $OUTPUT->box(get_string($reason, "scorm", $warnings[$reason]), "container");
|
||||
}
|
||||
|
||||
if ($available && empty($launch)) {
|
||||
scorm_print_launch($USER, $scorm, 'view.php?id='.$cm->id, $cm);
|
||||
|
Loading…
x
Reference in New Issue
Block a user