mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Merge branch 'MDL-63620-master' of git://github.com/junpataleta/moodle
This commit is contained in:
commit
fda676957d
@ -222,6 +222,7 @@ if ($editform->is_cancelled()) {
|
||||
$newgroup = new stdClass();
|
||||
$newgroup->courseid = $data->courseid;
|
||||
$newgroup->name = $group['name'];
|
||||
$newgroup->enablemessaging = $data->enablemessaging;
|
||||
$groupid = groups_create_group($newgroup);
|
||||
$createdgroups[] = $groupid;
|
||||
foreach($group['members'] as $user) {
|
||||
|
@ -42,7 +42,8 @@ class autogroup_form extends moodleform {
|
||||
* Form Definition
|
||||
*/
|
||||
function definition() {
|
||||
global $CFG, $COURSE;
|
||||
global $USER, $COURSE;
|
||||
$coursecontext = context_course::instance($COURSE->id);
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
||||
@ -68,6 +69,12 @@ class autogroup_form extends moodleform {
|
||||
$mform->addRule('number', null, 'numeric', null, 'client');
|
||||
$mform->addRule('number', get_string('required'), 'required', null, 'client');
|
||||
|
||||
// Enable group messaging for the groups to be auto-created.
|
||||
if (\core_message\api::can_create_group_conversation($USER->id, $coursecontext)) {
|
||||
$mform->addElement('selectyesno', 'enablemessaging', get_string('enablemessaging', 'group'));
|
||||
$mform->addHelpButton('enablemessaging', 'enablemessaging', 'group');
|
||||
}
|
||||
|
||||
$mform->addElement('header', 'groupmembershdr', get_string('groupmembers', 'group'));
|
||||
$mform->setExpanded('groupmembershdr', true);
|
||||
|
||||
|
@ -83,7 +83,9 @@ if ($mform_post->is_cancelled()) {
|
||||
"groupidnumber" => 1,
|
||||
"description" => 1,
|
||||
"enrolmentkey" => 1,
|
||||
"groupingname" => 1);
|
||||
"groupingname" => 1,
|
||||
"enablemessaging" => 1,
|
||||
);
|
||||
|
||||
// --- get header (field names) ---
|
||||
$header = explode($csv_delimiter, array_shift($rawlines));
|
||||
|
@ -57,6 +57,16 @@ Feature: Automatic creation of groups
|
||||
And I press "Submit"
|
||||
And the "groups" select box should contain "Group A (5)"
|
||||
And the "groups" select box should contain "Group B (5)"
|
||||
# Check that group messaging is not enabled for the auto-created groups.
|
||||
And I set the field "groups" to "Group A"
|
||||
And I press "Edit group settings"
|
||||
And I should see "No" in the "Group messaging" "select"
|
||||
And I press "Cancel"
|
||||
And I set the field "groups" to "Group B"
|
||||
And I press "Edit group settings"
|
||||
And I should see "No" in the "Group messaging" "select"
|
||||
And I press "Cancel"
|
||||
# Check groupings.
|
||||
And I follow "Groupings"
|
||||
And I should see "Grouping name"
|
||||
And I click on "Show groups in grouping" "link" in the "Grouping name" "table_row"
|
||||
@ -170,3 +180,20 @@ Feature: Automatic creation of groups
|
||||
And I set the field "Group/member count" to "11"
|
||||
And I press "Preview"
|
||||
And I should not see "Suspended Student 11"
|
||||
|
||||
@javascript
|
||||
Scenario: Auto-create groups with group messaging
|
||||
Given I set the following fields to these values:
|
||||
| Naming scheme | Group @ |
|
||||
| Auto create based on | Number of groups |
|
||||
| Group/member count | 2 |
|
||||
| Grouping of auto-created groups | No grouping |
|
||||
| Group messaging | Yes |
|
||||
And I press "Submit"
|
||||
And I set the field "groups" to "Group A"
|
||||
When I press "Edit group settings"
|
||||
Then I should see "Yes" in the "Group messaging" "select"
|
||||
And I press "Cancel"
|
||||
And I set the field "groups" to "Group B"
|
||||
And I press "Edit group settings"
|
||||
And I should see "Yes" in the "Group messaging" "select"
|
||||
|
@ -31,6 +31,17 @@ Feature: Importing of groups and groupings
|
||||
And I should see "group-id-1-duplicate"
|
||||
And I should see "group-noid-1"
|
||||
And I should see "group-noid-2"
|
||||
# Group messaging should have been enabled for group-id-1.
|
||||
And I set the field "groups" to "group-id-1"
|
||||
And I press "Edit group settings"
|
||||
And I should see "Yes" in the "Group messaging" "select"
|
||||
And I press "Cancel"
|
||||
# Group messaging should not have been enabled for group-id-2.
|
||||
And I set the field "groups" to "group-id-2"
|
||||
And I press "Edit group settings"
|
||||
And I should see "No" in the "Group messaging" "select"
|
||||
And I press "Cancel"
|
||||
# Check groupings
|
||||
And I follow "Groupings"
|
||||
And I should see "Grouping-1"
|
||||
And I should see "Grouping-2"
|
||||
|
12
group/tests/fixtures/groups_import.csv
vendored
12
group/tests/fixtures/groups_import.csv
vendored
@ -1,6 +1,6 @@
|
||||
groupname, description, groupidnumber,groupingname
|
||||
group-id-1, group-id-1, group-id-1,Grouping-1
|
||||
group-id-2, group-id-2, group-id-2,Grouping-2
|
||||
group-id-1-duplicate, Duplicate of group-id-1, group-id-1,Grouping-3
|
||||
group-noid-1, group-noid-1,,Grouping-3
|
||||
group-noid-2, group-noid-2,,Grouping-2
|
||||
groupname, description, groupidnumber,groupingname,enablemessaging
|
||||
group-id-1, group-id-1, group-id-1,Grouping-1,1
|
||||
group-id-2, group-id-2, group-id-2,Grouping-2,0
|
||||
group-id-1-duplicate, Duplicate of group-id-1, group-id-1,Grouping-3,0
|
||||
group-noid-1, group-noid-1,,Grouping-3,0
|
||||
group-noid-2, group-noid-2,,Grouping-2,0
|
||||
|
|
Loading…
x
Reference in New Issue
Block a user