diff --git a/group/members.php b/group/members.php index 9a013bde696..910d170c884 100644 --- a/group/members.php +++ b/group/members.php @@ -99,25 +99,40 @@ $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('adduserstogroup', 'group').": $groupname", 3); -/// Print group info - TODO: remove tables for layout here -$groupinfotable = new html_table(); -$groupinfotable->attributes['class'] = 'groupinfobox'; -$picturecell = new html_table_cell(); -$picturecell->attributes['class'] = 'left side picture'; -$picturecell->text = print_group_picture($group, $course->id, true, true, false); +// Store the rows we want to display in the group info. +$groupinforow = array(); -$contentcell = new html_table_cell(); -$contentcell->attributes['class'] = 'content'; +// Check if there is a picture to display. +if (!empty($group->picture)) { + $picturecell = new html_table_cell(); + $picturecell->attributes['class'] = 'left side picture'; + $picturecell->text = print_group_picture($group, $course->id, true, true, false); + $groupinforow[] = $picturecell; +} +// Check if there is a description to display. $group->description = file_rewrite_pluginfile_urls($group->description, 'pluginfile.php', $context->id, 'group', 'description', $group->id); -if (!isset($group->descriptionformat)) { - $group->descriptionformat = FORMAT_MOODLE; +if (!empty($group->description)) { + if (!isset($group->descriptionformat)) { + $group->descriptionformat = FORMAT_MOODLE; + } + + $options = new stdClass; + $options->overflowdiv = true; + + $contentcell = new html_table_cell(); + $contentcell->attributes['class'] = 'content'; + $contentcell->text = format_text($group->description, $group->descriptionformat, $options); + $groupinforow[] = $contentcell; +} + +// Check if we have something to show. +if (!empty($groupinforow)) { + $groupinfotable = new html_table(); + $groupinfotable->attributes['class'] = 'groupinfobox'; + $groupinfotable->data[] = new html_table_row($groupinforow); + echo html_writer::table($groupinfotable); } -$options = new stdClass; -$options->overflowdiv = true; -$contentcell->text = format_text($group->description, $group->descriptionformat, $options); -$groupinfotable->data[] = new html_table_row(array($picturecell, $contentcell)); -echo html_writer::table($groupinfotable); /// Print the editing form ?>