mirror of
https://github.com/moodle/moodle.git
synced 2025-08-11 03:46:42 +02:00
Merge branch 'MDL-70972-main' of https://github.com/PhMemmel/moodle
This commit is contained in:
commit
94adf2ae31
2 changed files with 12 additions and 3 deletions
|
@ -157,7 +157,16 @@ class format_singleactivity extends core_courseformat\base {
|
||||||
foreach (array_keys($availabletypes) as $activity) {
|
foreach (array_keys($availabletypes) as $activity) {
|
||||||
$capability = "mod/{$activity}:addinstance";
|
$capability = "mod/{$activity}:addinstance";
|
||||||
if (!has_capability($capability, $testcontext)) {
|
if (!has_capability($capability, $testcontext)) {
|
||||||
unset($availabletypes[$activity]);
|
if (!$this->categoryid) {
|
||||||
|
unset($availabletypes[$activity]);
|
||||||
|
} else {
|
||||||
|
// We do not have a course yet, so we guess if the user will have the capability to add the activity after
|
||||||
|
// creating the course.
|
||||||
|
$categorycontext = \context_coursecat::instance($this->categoryid);
|
||||||
|
if (!guess_if_creator_will_have_course_capability($capability, $categorycontext)) {
|
||||||
|
unset($availabletypes[$activity]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ Feature: Courses can be created in Single Activity mode
|
||||||
| moodle/course:manageactivities | allow |
|
| moodle/course:manageactivities | allow |
|
||||||
| moodle/course:viewparticipants | allow |
|
| moodle/course:viewparticipants | allow |
|
||||||
| moodle/role:assign | allow |
|
| moodle/role:assign | allow |
|
||||||
| mod/quiz:addinstance | allow |
|
|
||||||
When I log in as "kevin"
|
When I log in as "kevin"
|
||||||
And I am on site homepage
|
And I am on site homepage
|
||||||
And I press "Add a new course"
|
And I press "Add a new course"
|
||||||
|
@ -31,6 +30,7 @@ Feature: Courses can be created in Single Activity mode
|
||||||
| Format | Single activity |
|
| Format | Single activity |
|
||||||
And I press "Update format"
|
And I press "Update format"
|
||||||
Then I should see "Quiz" in the "Type of activity" "field"
|
Then I should see "Quiz" in the "Type of activity" "field"
|
||||||
And I should not see "Forum" in the "Type of activity" "field"
|
And I should see "Forum" in the "Type of activity" "field"
|
||||||
|
And I set the field "Type of activity" to "Quiz"
|
||||||
And I press "Save and display"
|
And I press "Save and display"
|
||||||
And I should see "New Quiz"
|
And I should see "New Quiz"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue