Index: group/overview.php
===================================================================
--- group/overview.php	(revision 157)
+++ group/overview.php	(revision 163)
@@ -10,6 +10,7 @@
 
 require_once('../config.php');
 require_once($CFG->libdir . '/filelib.php');
+require_once($CFG->dirroot . '/group/lib.php');
 
 $courseid   = required_param('id', PARAM_INT);
 $groupid    = optional_param('group', 0, PARAM_INT);
@@ -47,6 +48,11 @@
 $strnogroups         = get_string('nogroups', 'group');
 $strdescription      = get_string('description');
 
+// CMDL-1130 Add option to participants list to view students not assigned to a group
+// Get all the users in this course that can join groups
+$allMembers = groups_get_potential_members($courseid);
+// end CMDL-1130
+
 // Get all groupings
 $groupings = $DB->get_records('groupings', array('courseid'=>$courseid), 'name');
 $members = array();
@@ -59,7 +65,12 @@
 $groups = $DB->get_records('groups', array('courseid'=>$courseid), 'name');
 
 $params = array('courseid'=>$courseid);
-if ($groupid) {
+
+// CMDL-1130 Add option to participants list to view students not assigned to a group
+//if ($groupid) {
+if ($groupid && $groupid != -1) {
+// end CMDL-1130 
+    
     $groupwhere = "AND g.id = :groupid";
     $params['groupid']   = $groupid;
 } else {
@@ -67,8 +78,18 @@
 }
 
 if ($groupingid) {
-    $groupingwhere = "AND gg.groupingid = :groupingid";
-    $params['groupingid'] = $groupingid;
+    
+    // CMDL-1130 Add option to participants list to view students not assigned to a group
+    //$groupingwhere = "AND gg.groupingid = :groupingid";
+    //$params['groupingid'] = $groupingid;    
+    if ($groupingid == -1) {
+        $groupingwhere = "AND gg.groupingid is null";
+    } else { 
+        $groupingwhere = "AND gg.groupingid = :groupingid";
+        $params['groupingid'] = $groupingid;
+    }
+    // end CMDL-1130
+    
 } else {
     $groupingwhere = "";
 }
@@ -82,6 +103,11 @@
 
 $rs = $DB->get_recordset_sql($sql, $params);
 foreach ($rs as $row) {
+    
+    // CMDL-1130 Add option to participants list to view students not assigned to a group
+    unset($allMembers[$row->userid]);    
+    // end CMDL-1130
+    
     $user = new stdClass();
     $user->id        = $row->userid;
     $user->firstname = $row->firstname;
@@ -100,6 +126,10 @@
 }
 $rs->close();
 
+// CMDL-1130 Add option to participants list to view students not assigned to a group
+$members[-1][-1]=$allMembers;
+// end CMDL-1130
+
 navigation_node::override_active_url(new moodle_url('/group/index.php', array('id'=>$courseid)));
 $PAGE->navbar->add(get_string('overview', 'group'));
 
@@ -119,6 +149,11 @@
 echo $strfiltergroups;
 
 $options = array();
+
+// CMDL-1130 Add option to participants list to view students not assigned to a group
+$options[-1] = get_string('none');
+// end CMDL-1130
+
 $options[0] = get_string('all');
 foreach ($groupings as $grouping) {
     $options[$grouping->id] = strip_tags(format_string($grouping->name));
@@ -144,7 +179,12 @@
 $printed = false;
 $hoverevents = array();
 foreach ($members as $gpgid=>$groupdata) {
-    if ($groupingid and $groupingid != $gpgid) {
+    
+    // CMDL-1130 Add option to participants list to view students not assigned to a group
+    //if ($groupingid and $groupingid != $gpgid) {
+    if ($groupingid and $groupingid != $gpgid and $gpgid != -1) {
+    // end CMDL-1130
+        
         continue; // do not show
     }
     $table = new html_table();
@@ -155,15 +195,35 @@
     $table->data  = array();
     foreach ($groupdata as $gpid=>$users) {
         if ($groupid and $groupid != $gpid) {
-            continue;
+            
+            // CMDL-1130 Add option to participants list to view students not assigned to a group
+            //continue;
+            // end CMDL-1130
         }
         $line = array();
-        $name = print_group_picture($groups[$gpid], $course->id, false, true, false) . format_string($groups[$gpid]->name);
-        $description = file_rewrite_pluginfile_urls($groups[$gpid]->description, 'pluginfile.php', $context->id, 'group', 'description', $gpid);
-        $options = new stdClass;
-        $options->noclean = true;
-        $options->overflowdiv = true;
-        $jsdescription = trim(format_text($description, $groups[$gpid]->descriptionformat, $options));
+        
+        // CMDL-1130 Add option to participants list to view students not assigned to a group
+        //$name = print_group_picture($groups[$gpid], $course->id, false, true, false) . format_string($groups[$gpid]->name);
+        //$description = file_rewrite_pluginfile_urls($groups[$gpid]->description, 'pluginfile.php', $context->id, 'group', 'description', $gpid);
+        //$options = new stdClass;
+        //$options->noclean = true;
+        //$options->overflowdiv = true;
+        //$jsdescription = trim(format_text($description, $groups[$gpid]->descriptionformat, $options));
+        
+        if ($gpid == -1) {
+            $name = get_string('nogroupsassigned','group');
+            $description = "";
+            $jsdescription = "";
+        } else {
+            $name = print_group_picture($groups[$gpid], $course->id, false, true, false) . format_string($groups[$gpid]->name);
+            $description = file_rewrite_pluginfile_urls($groups[$gpid]->description, 'pluginfile.php', $context->id, 'group', 'description', $gpid);
+    	    $options = new stdClass;
+	        $options->noclean = true;
+        	$options->overflowdiv = true;
+            $jsdescription = trim(format_text($description, $groups[$gpid]->descriptionformat, $options));
+        }
+        // end CMDL-1130
+        
         if (empty($jsdescription)) {
             $line[] = $name;
         } else {
