MDL-76704 core_course: Add settings to control selected provider
This commit is contained in:
@@ -214,6 +214,18 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/groupmode', new lang_string('groupmode'), '', key($choices),$choices));
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/groupmodeforce', new lang_string('force'), new lang_string('coursehelpforce'), 0,array(0 => new lang_string('no'), 1 => new lang_string('yes'))));
|
||||
|
||||
// Communication.
|
||||
$temp->add(new admin_setting_heading('communication',
|
||||
new lang_string('communication', 'core_communication'), ''));
|
||||
|
||||
list($communicationproviders, $defaulprovider) = \core_communication\api::
|
||||
get_enabled_providers_and_default('communication_matrix');
|
||||
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/coursecommunicationprovider',
|
||||
new lang_string('seleccommunicationprovider', 'communication'),
|
||||
new lang_string('coursecommunication_desc', 'course'),
|
||||
$defaulprovider, $communicationproviders));
|
||||
|
||||
$ADMIN->add('courses', $temp);
|
||||
|
||||
// Download course content.
|
||||
|
||||
+15
-2
@@ -389,11 +389,24 @@ class course_edit_form extends moodleform {
|
||||
|
||||
// Add communication plugins to the form.
|
||||
if (core_communication\api::is_available()) {
|
||||
|
||||
$instanceconfig = core_communication\processor::PROVIDER_NONE;
|
||||
// For new courses.
|
||||
if (empty($course->id)) {
|
||||
$instanceid = 0;
|
||||
if (!empty($courseconfig->coursecommunicationprovider)) {
|
||||
$instanceconfig = $courseconfig->coursecommunicationprovider;
|
||||
}
|
||||
} else {
|
||||
// For existing courses.
|
||||
$instanceid = $course->id;
|
||||
}
|
||||
|
||||
$communication = \core_communication\api::load_by_instance(
|
||||
'core_course',
|
||||
'coursecommunication',
|
||||
empty($course->id) ? 0 : $course->id);
|
||||
$communication->form_definition($mform);
|
||||
$instanceid);
|
||||
$communication->form_definition($mform, $instanceconfig);
|
||||
$communication->set_data($course);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
@core @core_course
|
||||
Feature: Course communication
|
||||
In order to create a new communication room in for course
|
||||
As an admin
|
||||
I should have matrix plugin enabled by default
|
||||
I should not have any plugins enabled by default for existing courses
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Test course | C |
|
||||
And I enable communication experimental feature
|
||||
And I log in as "admin"
|
||||
|
||||
Scenario: I should have matrix plugin by default for new courses
|
||||
Given I go to the courses management page
|
||||
And I should see the "Categories" management page
|
||||
And I click on category "Category 1" in the management interface
|
||||
And I should see the "Course categories and courses" management page
|
||||
And I follow "Create new course"
|
||||
When I click on "Communication" "link"
|
||||
Then the field "Communication service" matches value "Matrix"
|
||||
|
||||
Scenario: I should have communication disabled by default for existing courses
|
||||
Given I am on "Test course" course homepage
|
||||
When I navigate to "Settings" in current page administration
|
||||
And I click on "Communication" "link"
|
||||
Then the field "Communication service" matches value "None"
|
||||
@@ -66,6 +66,7 @@ $string['completion_setby:manual:markdone'] = '{$a->activityname} is marked by {
|
||||
$string['completionrequirements'] = 'Completion requirements for {$a}';
|
||||
$string['courseaccess'] = 'Course access';
|
||||
$string['coursealreadyfinished'] = 'Course already finished';
|
||||
$string['coursecommunication_desc'] = 'The default communication service for the new courses. All the existing courses will not have any provider selected by default.';
|
||||
$string['coursecontentnotification'] = 'Send content change notification';
|
||||
$string['coursecontentnotifnew'] = '{$a->coursename} new content';
|
||||
$string['coursecontentnotifnewbody'] = '<p>{$a->moduletypename} <a href="{$a->link}">{$a->modulename}</a> is new in the course <a href="{$a->courselink}">{$a->coursename}</a>.</p><p><a href="{$a->notificationpreferenceslink}">Change your notification preferences</a></p>';
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2023061600.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2023061600.01; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
$release = '4.3dev (Build: 20230616)'; // Human-friendly version name
|
||||
|
||||
Reference in New Issue
Block a user