diff --git a/course/lib.php b/course/lib.php index 3ad961bc104..197394ac2c3 100644 --- a/course/lib.php +++ b/course/lib.php @@ -1343,6 +1343,8 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, /// Casting $course->modinfo to string prevents one notice when the field is null $modinfo = unserialize((string)$course->modinfo); + + $groupings = groups_get_all_groupings($course->id); //Acccessibility: replace table with list
-
- + + + |
@@ -161,12 +231,14 @@ print_header("$course->shortname: $strgroups", $course->fullname, $navigation, ' |
-
- + + + - shortname: $strgroups", $course->fullname, $navigation, ' '."\n"; + echo ' '."\n"; } ?> |
+ + + + |
diff --git a/group/overview.php b/group/overview.php
new file mode 100644
index 00000000000..463f075fc1c
--- /dev/null
+++ b/group/overview.php
@@ -0,0 +1,207 @@
+wwwroot.'/group/index.php?id='.$courseid;
+
+if (!$course = get_record('course', 'id',$courseid)) {
+ error('invalidcourse');
+}
+
+// Make sure that the user has permissions to manage groups.
+require_login($course);
+
+$context = get_context_instance(CONTEXT_COURSE, $courseid);
+require_capability('moodle/course:managegroups', $context);
+
+
+
+$strgroups = get_string('groups');
+$strparticipants = get_string('participants');
+$stroverview = get_string('overview', 'group');
+$strgrouping = get_string('grouping', 'group');
+$strgroup = get_string('group', 'group');
+$strnotingrouping = get_string('notingrouping', 'group');
+$strfiltergroups = get_string('filtergroups', 'group');
+$strnogroups = get_string('nogroups', 'group');
+$strnogroupsassigned = get_string('nogroupsassigned', 'group');
+
+// Print the page and form
+$navlinks = array(array('name'=>$strparticipants, 'link'=>$CFG->wwwroot.'/user/index.php?id='.$courseid, 'type'=>'misc'),
+ array('name'=>$strgroups, 'link'=>'', 'type'=>'misc'));
+$navigation = build_navigation($navlinks);
+
+/// Print header
+print_header_simple($strgroups, ': '.$strgroups, $navigation, '', '', true, '', navmenu($course));
+
+
+if (!empty($CFG->enablegroupings)) {
+ // Add tabs
+ $currenttab = 'overview';
+ require('tabs.php');
+}
+
+$groupings= array();
+
+// Get groupings and child group id's
+if (!empty($CFG->enablegroupings)) {
+ $sql = "SELECT gs.id, gs.name, gg.groupid " .
+ "FROM {$CFG->prefix}groupings gs " .
+ "LEFT JOIN {$CFG->prefix}groupings_groups gg ON gs.id = gg.groupingid " .
+ "WHERE gs.courseid = {$course->id} " .
+ "ORDER BY gs.name, gs.id ";
+
+ $rs = get_recordset_sql($sql);
+ while ($row = rs_fetch_next_record($rs)) {
+ $groupings[] = $row;
+ }
+}
+
+// Get groups & group members
+$sql = "SELECT g.id AS groupid, g.name, u.id AS userid, u.firstname, u.lastname, u.idnumber, u.username " .
+ "FROM {$CFG->prefix}groups g " .
+ "LEFT JOIN {$CFG->prefix}groups_members gm ON g.id = gm.groupid " .
+ "LEFT JOIN {$CFG->prefix}user u ON gm.userid = u.id " .
+ "WHERE g.courseid = {$course->id} " .
+ "ORDER BY g.name, g.id ";
+
+$rs = get_recordset_sql($sql);
+
+$groupsmembers = array();
+
+// Build a hash of keyed on groupid and userid;
+while ($row = rs_fetch_next_record($rs)) {
+ $groupsmembers[$row->groupid]->name = $row->name;
+ $groupsmembers[$row->groupid]->groupid = $row->groupid;
+ $groupsmembers[$row->groupid]->users[$row->userid] = $row;
+ $groupsmembers[$row->groupid]->printed = false;
+}
+
+if (empty($groupsmembers)) {
+ print_box($strnogroups);
+} else {
+
+ /// Print overview filter form
+
+ echo '';
+
+
+ /// Print overview
+ print_heading(format_string($course->shortname) .' '.$stroverview, 'center', 3);
+
+
+
+ echo '
';
print_tabs($tabs, $currenttab);
diff --git a/lang/en_utf8/group.php b/lang/en_utf8/group.php
index e3cc4bf03ad..57d32ebdeea 100644
--- a/lang/en_utf8/group.php
+++ b/lang/en_utf8/group.php
@@ -24,6 +24,7 @@ $string['groups'] = 'Groups';
$string['group'] = 'Group';
$string['groupsinselectedgrouping'] = 'Groups in:'; //'selected grouping'
$string['membersofselectedgroup'] = 'Members of:';
+$string['overview'] = 'Overview';
$string['showgroupsingrouping'] = 'Show groups in grouping';
$string['showmembersforgroup'] = 'Show members for group';
@@ -103,4 +104,25 @@ $string['groupmembersonlyerror'] = 'Sorry, you must be member of at least one gr
$string['groupaddedsuccesfully'] = 'Group $a added succesfully';
$string['nopermissionforcreation'] = 'Can\'t create group \"$a\" as you dont have the required permissions';
+
+$string['usergroupmembership'] = 'Selected user\'s membership:';
+$string['filtergroups'] = 'Filter groups by: ';
+$string['nogroups'] = 'There are no groups setup in this course yet';
+
+$string['autocreategroups'] = 'Auto-create groups';
+$string['selectfromrole'] = 'Role to select members from';
+$string['groupby'] = 'Create groups based on the number of ';
+$string['members'] = 'Members per group';
+$string['number'] = 'Number of groups or members per group';
+$string['allocateby'] = 'Allocate members';
+$string['random'] = 'randomly';
+$string['firstname'] = 'alphabetically by first name';
+$string['lastname'] = 'alphabetically by last name';
+$string['namingscheme'] = 'Naming scheme';
+$string['namingschemehelp'] = 'note: Use \'@\' to represent the group letter or \'#\' to represent the group number';
+$string['toomanygroups'] = 'Insufficient users to populate this number of groups - there are only $a users in the selected role.';
+$string['badnamingscheme'] = 'Must contain exactly one \'@\' or one \'#\' character';
+$string['groupspreview'] = 'Groups preview';
+$string['nousersinrole'] = 'There are no suitable users in the selected role';
+$string['nogroupsassigned'] = 'No groups assigned';
?>
diff --git a/lib/grouplib.php b/lib/grouplib.php
index 745b50ca944..5adde3dd336 100644
--- a/lib/grouplib.php
+++ b/lib/grouplib.php
@@ -106,10 +106,32 @@ function groups_get_all_groups($courseid, $userid=0, $groupingid=0) {
return get_records_sql("SELECT g.*
FROM {$CFG->prefix}groups g $userfrom $groupingfrom
- WHERE g.courseid = '$courseid' $userwhere $groupingwhere
+ WHERE g.courseid = $courseid $userwhere $groupingwhere
ORDER BY name ASC");
}
+
+/**
+ * Gets array of all groupings in a specified course.
+ * @param int $coursid return only groupings in this with this courseid
+ * @return array | false Returns an array of the group IDs or false if no records
+ * or an error occurred.
+ */
+function groups_get_all_groupings($courseid) {
+ global $CFG;
+
+ // groupings are ignored when not enabled
+ if (empty($CFG->enablegroupings)) {
+ return(false);
+ }
+ return get_records_sql("SELECT *
+ FROM {$CFG->prefix}groupings
+ WHERE courseid = $courseid
+ ORDER BY name ASC");
+}
+
+
+
/**
* Determines if the user is a member of the given group.
*
diff --git a/theme/standard/styles_fonts.css b/theme/standard/styles_fonts.css
index d6653d76617..168566439ae 100644
--- a/theme/standard/styles_fonts.css
+++ b/theme/standard/styles_fonts.css
@@ -460,6 +460,9 @@ h2.headingblock {
font-style: italic;
}
+.section .groupinglabel {
+ color: #666666;
+}
/***
*** Doc
diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css
index bcd11759a01..c86c857abbb 100644
--- a/theme/standard/styles_layout.css
+++ b/theme/standard/styles_layout.css
@@ -423,6 +423,45 @@ form.popupform label {
padding: 5px;
}
+#group-usersummary {
+ width: 14em;
+}
+
+
+#grouping-groups-overview {
+ margin: auto;
+ width: 90%;
+}
+
+#grouping-groups-overview ul {
+ list-style: none;
+ padding-left: 0;
+ margin-left: 0px;
+ font-weight: bold;
+}
+
+/* First level list items i.e. groupings */
+#grouping-groups-overview ul li {
+ padding-bottom: 1.8em;
+}
+
+/* Second level list items i.e. groups */
+#grouping-groups-overview ul li ul li {
+ font-style: italic;
+ font-weight: normal;
+ background-color: #ffffff;
+ border: 1px solid #DDDDDD;
+ padding: 1.1em;
+ margin: 0.1em;
+}
+
+/* Third level list items i.e. group members */
+#grouping-groups-overview ul li ul li ul li {
+ font-style: normal;
+ border: none;
+ padding: 0;
+}
+
img.icon {
vertical-align:middle;
|