MDL-50526 mod_assign: Highlight error message when user has no group
authorAndrew Hancox <andrewdchancox@googlemail.com>
Wed, 1 Jul 2015 15:32:12 +0000 (16:32 +0100)
committerDan Poltawski <dan@moodle.com>
Tue, 6 Oct 2015 15:41:25 +0000 (16:41 +0100)
If I set the "Require group to make submission" setting in an assignment
activity to yes, students who are not in any group are prevented from submitting
their assignment and are presented a warning instead that they should contact
their teacher. This message is now presented in an alert box.

mod/assign/renderer.php

index 265165e..7aa3c0d 100644 (file)
@@ -453,9 +453,13 @@ 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) {
-                    $cell2 = new html_table_cell(get_string('noteam', 'assign'));
+                    $cell2 = new html_table_cell(
+                        html_writer::span(get_string('noteam', 'assign'), 'alert alert-error')
+                    );
                 } else if (count($status->usergroups) > 1) {
-                    $cell2 = new html_table_cell(get_string('multipleteams', 'assign'));
+                    $cell2 = new html_table_cell(
+                        html_writer::span(get_string('multipleteams', 'assign'), 'alert alert-error')
+                    );
                 }
             } else {
                 $cell2 = new html_table_cell(get_string('defaultteam', 'assign'));