From e7f3fd59d48fd3b6a33e640e7ce1cb1b53dd4b85 Mon Sep 17 00:00:00 2001 From: Davo Smith Date: Tue, 6 Dec 2016 13:03:01 +0000 Subject: [PATCH 1/2] MDL-56449 mod_assign: fuller description of group submission problems --- mod/assign/lang/en/assign.php | 2 ++ mod/assign/renderer.php | 4 ++++ mod/assign/tests/behat/submit_without_group.feature | 3 +++ 3 files changed, 9 insertions(+) diff --git a/mod/assign/lang/en/assign.php b/mod/assign/lang/en/assign.php index dabe025ccd6..893b4d88e4d 100644 --- a/mod/assign/lang/en/assign.php +++ b/mod/assign/lang/en/assign.php @@ -314,6 +314,7 @@ $string['modulename_link'] = 'mod/assignment/view'; $string['modulenameplural'] = 'Assignments'; $string['moreusers'] = '{$a} more...'; $string['multipleteams'] = 'Member of more than one group'; +$string['multipleteams_desc'] = 'The assignment requires submission in groups. You are a member of more than one group. To be able to submit you must be member of exactly one group so that your submission can be mapped correctly to your group. Please contact your teacher to update your group membership.'; $string['multipleteamsgrader'] = 'Member of more than one group, so unable to make submissions.'; $string['mysubmission'] = 'My submission: '; $string['newsubmissions'] = 'Assignments submitted'; @@ -332,6 +333,7 @@ $string['nosavebutnext'] = 'Next'; $string['nosubmission'] = 'Nothing has been submitted for this assignment'; $string['nosubmissionsacceptedafter'] = 'No submissions accepted after '; $string['noteam'] = 'Not a member of any group'; +$string['noteam_desc'] = 'This assignment requires submission in groups. You are not a member of any group, so you cannot create a submission. Please contact your teacher to be added to a group.'; $string['noteamgrader'] = 'Not a member of any group, so unable to make submissions.'; $string['notgraded'] = 'Not graded'; $string['notgradedyet'] = 'Not graded yet'; diff --git a/mod/assign/renderer.php b/mod/assign/renderer.php index 665a0d3c002..d80634e969b 100644 --- a/mod/assign/renderer.php +++ b/mod/assign/renderer.php @@ -635,6 +635,7 @@ class mod_assign_renderer extends plugin_renderer_base { $t = new html_table(); + $warningmsg = ''; if ($status->teamsubmissionenabled) { $row = new html_table_row(); $cell1 = new html_table_cell(get_string('submissionteam', 'assign')); @@ -646,10 +647,12 @@ class mod_assign_renderer extends plugin_renderer_base { $cell2 = new html_table_cell( html_writer::span(get_string('noteam', 'assign'), 'alert alert-error') ); + $warningmsg = $this->output->notification(get_string('noteam_desc', 'assign'), 'error'); } else if (count($status->usergroups) > 1) { $cell2 = new html_table_cell( html_writer::span(get_string('multipleteams', 'assign'), 'alert alert-error') ); + $warningmsg = $this->output->notification(get_string('multipleteams_desc', 'assign'), 'error'); } } else { $cell2 = new html_table_cell(get_string('defaultteam', 'assign')); @@ -906,6 +909,7 @@ class mod_assign_renderer extends plugin_renderer_base { } } + $o .= $warningmsg; $o .= html_writer::table($t); $o .= $this->output->box_end(); diff --git a/mod/assign/tests/behat/submit_without_group.feature b/mod/assign/tests/behat/submit_without_group.feature index 6c24033cbb4..bffaf6503d9 100644 --- a/mod/assign/tests/behat/submit_without_group.feature +++ b/mod/assign/tests/behat/submit_without_group.feature @@ -48,6 +48,7 @@ Feature: Submit assignment without group And I follow "Course 1" And I follow "Allow default group" Then I should not see "Not a member of any group" + And I should not see "This assignment requires submission in groups. You are not a member of any group" And I should see "Nothing has been submitted for this assignment" And I press "Add submission" And I set the following fields to these values: @@ -59,6 +60,7 @@ Feature: Submit assignment without group And I follow "Course 1" And I follow "Require group membership" And I should see "Not a member of any group" + And I should see "This assignment requires submission in groups. You are not a member of any group" And I should see "Nothing has been submitted for this assignment" And I should not see "Add submission" And I am on homepage @@ -121,6 +123,7 @@ Feature: Submit assignment without group And I follow "Course 3" And I follow "Require group membership" And I should see "Member of more than one group" + And I should see "The assignment requires submission in groups. You are a member of more than one group." And I should see "Nothing has been submitted for this assignment" And I should not see "Add submission" And I log out From 255d3aaaed1f1d1c3c8c8abe112e44b054667cad Mon Sep 17 00:00:00 2001 From: Davo Smith Date: Thu, 5 Jan 2017 15:30:09 +0000 Subject: [PATCH 2/2] MDL-56449 mod_assign: fix formatting of group warnings --- mod/assign/renderer.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mod/assign/renderer.php b/mod/assign/renderer.php index d80634e969b..19ec082f9f9 100644 --- a/mod/assign/renderer.php +++ b/mod/assign/renderer.php @@ -644,13 +644,17 @@ class mod_assign_renderer extends plugin_renderer_base { $cell2 = new html_table_cell(format_string($group->name, false, $status->context)); } else if ($status->preventsubmissionnotingroup) { if (count($status->usergroups) == 0) { + $notification = new \core\output\notification(get_string('noteam', 'assign'), 'error'); + $notification->set_show_closebutton(false); $cell2 = new html_table_cell( - html_writer::span(get_string('noteam', 'assign'), 'alert alert-error') + $this->output->render($notification) ); $warningmsg = $this->output->notification(get_string('noteam_desc', 'assign'), 'error'); } else if (count($status->usergroups) > 1) { + $notification = new \core\output\notification(get_string('multipleteams', 'assign'), 'error'); + $notification->set_show_closebutton(false); $cell2 = new html_table_cell( - html_writer::span(get_string('multipleteams', 'assign'), 'alert alert-error') + $this->output->render($notification) ); $warningmsg = $this->output->notification(get_string('multipleteams_desc', 'assign'), 'error'); }