@@ -88,20 +114,34 @@
{{>core_course/local/activitychooser/favourites}}
-
+
{{#default}}
{{>core_course/local/activitychooser/item}}
{{/default}}
+
+
+ {{#activities}}
+ {{>core_course/local/activitychooser/item}}
+ {{/activities}}
+
+
+
+
+ {{#resources}}
+ {{>core_course/local/activitychooser/item}}
+ {{/resources}}
+
+
+
+
+ {{#recommended}}
+ {{>core_course/local/activitychooser/item}}
+ {{/recommended}}
+
+
diff --git a/course/tests/behat/activity_chooser.feature b/course/tests/behat/activity_chooser.feature
index 98ef06a6432..578e19c8aaa 100644
--- a/course/tests/behat/activity_chooser.feature
+++ b/course/tests/behat/activity_chooser.feature
@@ -58,7 +58,7 @@ Feature: Display and choose from the available activities in course
When I log out
And I log in as "admin"
And I am on site homepage
- And I navigate to "Courses > Recommended activities" in site administration
+ And I navigate to "Courses > Activity chooser > Recommended activities" in site administration
And I click on ".activity-recommend-checkbox" "css_element" in the "Book" "table_row"
# Setup done, lets check it works with a teacher.
And I log out
@@ -148,3 +148,40 @@ Feature: Display and choose from the available activities in course
Then I should not see "Search query"
And ".searchresultscontainer" "css_element" should not exist
And ".optionscontainer" "css_element" should exist
+
+ Scenario: Teacher gets the base case for the Activity Chooser tab mode
+ Given I click on "Add an activity" "button" in the "Topic 1" "section"
+ And I should see "Activities" in the "Add an activity" "dialogue"
+ When I click on "Activities" "link" in the "Add an activity" "dialogue"
+ Then I should not see "Book" in the "activity" "core_course > Activity chooser tab"
+ And I click on "Resources" "link" in the "Add an activity" "dialogue"
+ And I should not see "Assignment" in the "resources" "core_course > Activity chooser tab"
+
+ Scenario: Teacher gets the simple case for the Activity Chooser tab mode
+ Given I log out
+ And I log in as "admin"
+ And I am on site homepage
+ When I navigate to "Courses > Activity chooser > Activity chooser settings" in site administration
+ And I select "Starred, All, Recommended" from the "Activity chooser tabs" singleselect
+ And I press "Save changes"
+ And I log out
+ And I log in as "teacher"
+ And I am on "Course" course homepage with editing mode on
+ And I click on "Add an activity" "button" in the "Topic 1" "section"
+ Then I should not see "Activities" in the "Add an activity" "dialogue"
+ And I should not see "Resources" in the "Add an activity" "dialogue"
+
+ Scenario: Teacher gets the final case for the Activity Chooser tab mode
+ Given I log out
+ And I log in as "admin"
+ And I am on site homepage
+ When I navigate to "Courses > Activity chooser > Activity chooser settings" in site administration
+ And I select "Starred, Activities, Resources, Recommended" from the "Activity chooser tabs" singleselect
+ And I press "Save changes"
+ And I log out
+ And I log in as "teacher"
+ And I am on "Course" course homepage with editing mode on
+ And I click on "Add an activity" "button" in the "Topic 1" "section"
+ Then I should not see "All" in the "Add an activity" "dialogue"
+ And I should see "Activities" in the "Add an activity" "dialogue"
+ And I should see "Resources" in the "Add an activity" "dialogue"
diff --git a/course/tests/behat/recommend_activities.feature b/course/tests/behat/recommend_activities.feature
index 2b2e68d0395..818d9358d4e 100644
--- a/course/tests/behat/recommend_activities.feature
+++ b/course/tests/behat/recommend_activities.feature
@@ -5,24 +5,24 @@ Feature: Recommending activities
Scenario: As an admin I can recommend activities from an admin setting page.
Given I log in as "admin"
And I am on site homepage
- And I navigate to "Courses > Recommended activities" in site administration
+ And I navigate to "Courses > Activity chooser > Recommended activities" in site administration
And I click on ".activity-recommend-checkbox" "css" in the "Assignment" "table_row"
And I navigate to "Courses > Add a new course" in site administration
- When I navigate to "Courses > Recommended activities" in site administration
+ When I navigate to "Courses > Activity chooser > Recommended activities" in site administration
Then "input[aria-label=\"Recommend activity: Assignment\"][checked=checked]" "css_element" should exist
And "input[aria-label=\"Recommend activity: Book\"]:not([checked=checked])" "css_element" should exist
Scenario: As an admin I can remove recommend activities from an admin setting page.
Given I log in as "admin"
And I am on site homepage
- And I navigate to "Courses > Recommended activities" in site administration
+ And I navigate to "Courses > Activity chooser > Recommended activities" in site administration
And I click on ".activity-recommend-checkbox" "css" in the "Assignment" "table_row"
And I navigate to "Courses > Add a new course" in site administration
- And I navigate to "Courses > Recommended activities" in site administration
+ And I navigate to "Courses > Activity chooser > Recommended activities" in site administration
And "input[aria-label=\"Recommend activity: Assignment\"][checked=checked]" "css_element" should exist
And "input[aria-label=\"Recommend activity: Book\"]:not([checked=checked])" "css_element" should exist
And I click on ".activity-recommend-checkbox" "css" in the "Assignment" "table_row"
And I navigate to "Courses > Add a new course" in site administration
- When I navigate to "Courses > Recommended activities" in site administration
+ When I navigate to "Courses > Activity chooser > Recommended activities" in site administration
Then "input[aria-label=\"Recommend activity: Assignment\"]:not([checked=checked])" "css_element" should exist
And "input[aria-label=\"Recommend activity: Book\"]:not([checked=checked])" "css_element" should exist
diff --git a/course/tests/behat/search_recommended_activities.feature b/course/tests/behat/search_recommended_activities.feature
index 3575aaf6fe7..202839dd1c1 100644
--- a/course/tests/behat/search_recommended_activities.feature
+++ b/course/tests/behat/search_recommended_activities.feature
@@ -5,7 +5,7 @@ Feature: Search recommended activities
Scenario: Search results are returned if the search query matches any activity names
Given I log in as "admin"
And I am on site homepage
- And I navigate to "Courses > Recommended activities" in site administration
+ And I navigate to "Courses > Activity chooser > Recommended activities" in site administration
When I set the field "search" to "assign"
And I click on "Submit search" "button"
Then I should see "Search results: 1"
@@ -15,7 +15,7 @@ Feature: Search recommended activities
Scenario: Search results are not returned if the search query does not match with any activity names
Given I log in as "admin"
And I am on site homepage
- And I navigate to "Courses > Recommended activities" in site administration
+ And I navigate to "Courses > Activity chooser > Recommended activities" in site administration
When I set the field "search" to "random query"
And I click on "Submit search" "button"
Then I should see "Search results: 0"
diff --git a/lang/en/course.php b/lang/en/course.php
index c6a8d9a9e0f..0a19d434cff 100644
--- a/lang/en/course.php
+++ b/lang/en/course.php
@@ -22,7 +22,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+$string['activitychoosercategory'] = 'Activity chooser';
$string['activitychooserrecommendations'] = 'Recommended activities';
+$string['activitychoosersettings'] = 'Activity chooser settings';
+$string['activitychoosertabmode'] = 'Activity chooser tabs';
+$string['activitychoosertabmode_desc'] = "The activity chooser enables a teacher to easily select activities and resources to add to their course. This setting determines which tabs should be displayed in it. Note that the starred tab is only displayed for a user if they have starred one or more activities and the recommended tab is only displayed if a site administrator has specified some recommended activities.";
+$string['activitychoosertabmodeone'] = 'Starred, All, Activities, Resources, Recommended';
+$string['activitychoosertabmodetwo'] = 'Starred, All, Recommended';
+$string['activitychoosertabmodethree'] = 'Starred, Activities, Resources, Recommended';
$string['aria:coursecategory'] = 'Course category';
$string['aria:courseimage'] = 'Course image';
$string['aria:courseshortname'] = 'Course short name';