mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'MDL-59921-master-fix2' of git://github.com/lameze/moodle
This commit is contained in:
commit
5bc84e9f17
@ -253,7 +253,7 @@ class create extends \moodleform {
|
|||||||
$options = ['limittoenrolled' => true];
|
$options = ['limittoenrolled' => true];
|
||||||
// Exclude courses without group.
|
// Exclude courses without group.
|
||||||
if (isset($eventtypes['course']) && isset($eventtypes['groupcourses'])) {
|
if (isset($eventtypes['course']) && isset($eventtypes['groupcourses'])) {
|
||||||
$options['excludedcourses'] = array_diff(array_keys($eventtypes['course']),
|
$options['exclude'] = array_diff(array_keys($eventtypes['course']),
|
||||||
array_keys($eventtypes['groupcourses']));
|
array_keys($eventtypes['groupcourses']));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ class create extends \moodleform {
|
|||||||
|
|
||||||
$mform->addElement('select', 'groupid', get_string('group'), $groupoptions);
|
$mform->addElement('select', 'groupid', get_string('group'), $groupoptions);
|
||||||
$mform->hideIf('groupid', 'eventtype', 'noteq', 'group');
|
$mform->hideIf('groupid', 'eventtype', 'noteq', 'group');
|
||||||
$mform->disabledIf('groupid', 'groupcourseid', 'eq', '');
|
// We handle the group select hide/show actions on the event_form module.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2407,19 +2407,11 @@ function calendar_get_all_allowed_types() {
|
|||||||
calendar_get_allowed_types($allowed, $course, $coursegroups);
|
calendar_get_allowed_types($allowed, $course, $coursegroups);
|
||||||
|
|
||||||
if (!empty($allowed->courses)) {
|
if (!empty($allowed->courses)) {
|
||||||
if (!isset($types['course'])) {
|
$types['course'][$course->id] = $course;
|
||||||
$types['course'] = [$course];
|
|
||||||
} else {
|
|
||||||
$types['course'][$course->id] = $course;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($allowed->groups)) {
|
if (!empty($allowed->groups)) {
|
||||||
if (!isset($types['groupcourses'])) {
|
$types['groupcourses'][$course->id] = $course;
|
||||||
$types['groupcourses'] = [$course];
|
|
||||||
} else {
|
|
||||||
$types['groupcourses'][$course->id] = $course;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($types['group'])) {
|
if (!isset($types['group'])) {
|
||||||
$types['group'] = array_values($allowed->groups);
|
$types['group'] = array_values($allowed->groups);
|
||||||
|
@ -72,7 +72,6 @@ Feature: Perform basic calendar functionality
|
|||||||
Scenario: Create a group event
|
Scenario: Create a group event
|
||||||
Given I log in as "teacher1"
|
Given I log in as "teacher1"
|
||||||
And I am on "Course 1" course homepage
|
And I am on "Course 1" course homepage
|
||||||
And I follow "Calendar"
|
|
||||||
And I create a calendar event with form data:
|
And I create a calendar event with form data:
|
||||||
| Type of event | group |
|
| Type of event | group |
|
||||||
| Group | Group 1 |
|
| Group | Group 1 |
|
||||||
|
@ -499,7 +499,7 @@ class core_calendar_lib_testcase extends advanced_testcase {
|
|||||||
$types = calendar_get_all_allowed_types();
|
$types = calendar_get_all_allowed_types();
|
||||||
$typecourses = $types['course'];
|
$typecourses = $types['course'];
|
||||||
$this->assertCount(1, $typecourses);
|
$this->assertCount(1, $typecourses);
|
||||||
$this->assertEquals($course1->id, $typecourses[0]->id);
|
$this->assertEquals($course1->id, $typecourses[$course1->id]->id);
|
||||||
|
|
||||||
assign_capability('moodle/calendar:manageentries', CAP_ALLOW, $roleid, $context2, true);
|
assign_capability('moodle/calendar:manageentries', CAP_ALLOW, $roleid, $context2, true);
|
||||||
|
|
||||||
@ -543,7 +543,7 @@ class core_calendar_lib_testcase extends advanced_testcase {
|
|||||||
$types = calendar_get_all_allowed_types();
|
$types = calendar_get_all_allowed_types();
|
||||||
$typecourses = $types['course'];
|
$typecourses = $types['course'];
|
||||||
$this->assertCount(1, $typecourses);
|
$this->assertCount(1, $typecourses);
|
||||||
$this->assertEquals($course->id, $typecourses[0]->id);
|
$this->assertEquals($course->id, $typecourses[$course->id]->id);
|
||||||
$this->assertArrayNotHasKey('group', $types);
|
$this->assertArrayNotHasKey('group', $types);
|
||||||
$this->assertArrayNotHasKey('groupcourses', $types);
|
$this->assertArrayNotHasKey('groupcourses', $types);
|
||||||
}
|
}
|
||||||
@ -570,7 +570,7 @@ class core_calendar_lib_testcase extends advanced_testcase {
|
|||||||
$types = calendar_get_all_allowed_types();
|
$types = calendar_get_all_allowed_types();
|
||||||
$typecourses = $types['course'];
|
$typecourses = $types['course'];
|
||||||
$this->assertCount(1, $typecourses);
|
$this->assertCount(1, $typecourses);
|
||||||
$this->assertEquals($course->id, $typecourses[0]->id);
|
$this->assertEquals($course->id, $typecourses[$course->id]->id);
|
||||||
$this->assertArrayNotHasKey('group', $types);
|
$this->assertArrayNotHasKey('group', $types);
|
||||||
$this->assertArrayNotHasKey('groupcourses', $types);
|
$this->assertArrayNotHasKey('groupcourses', $types);
|
||||||
}
|
}
|
||||||
@ -622,7 +622,7 @@ class core_calendar_lib_testcase extends advanced_testcase {
|
|||||||
$this->assertEquals($course1->id, $typecourses[0]->id);
|
$this->assertEquals($course1->id, $typecourses[0]->id);
|
||||||
$this->assertEquals($course2->id, $typecourses[1]->id);
|
$this->assertEquals($course2->id, $typecourses[1]->id);
|
||||||
$this->assertCount(1, $typegroupcourses);
|
$this->assertCount(1, $typegroupcourses);
|
||||||
$this->assertEquals($course1->id, $typegroupcourses[0]->id);
|
$this->assertEquals($course1->id, $typegroupcourses[$course1->id]->id);
|
||||||
$this->assertCount(2, $typegroups);
|
$this->assertCount(2, $typegroups);
|
||||||
$this->assertEquals($group1->id, $typegroups[0]->id);
|
$this->assertEquals($group1->id, $typegroups[0]->id);
|
||||||
$this->assertEquals($group2->id, $typegroups[1]->id);
|
$this->assertEquals($group2->id, $typegroups[1]->id);
|
||||||
@ -667,7 +667,7 @@ class core_calendar_lib_testcase extends advanced_testcase {
|
|||||||
usort($typegroups, $idascfunc);
|
usort($typegroups, $idascfunc);
|
||||||
|
|
||||||
$this->assertCount(1, $typegroupcourses);
|
$this->assertCount(1, $typegroupcourses);
|
||||||
$this->assertEquals($course->id, $typegroupcourses[0]->id);
|
$this->assertEquals($course->id, $typegroupcourses[$course->id]->id);
|
||||||
$this->assertCount(2, $typegroups);
|
$this->assertCount(2, $typegroups);
|
||||||
$this->assertEquals($group1->id, $typegroups[0]->id);
|
$this->assertEquals($group1->id, $typegroups[0]->id);
|
||||||
$this->assertEquals($group2->id, $typegroups[1]->id);
|
$this->assertEquals($group2->id, $typegroups[1]->id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user