Browse Source

Adding setting hide_course_group_if_no_tools_available see BT#7682

Julio Montoya 10 years ago
parent
commit
b2327d8f38
2 changed files with 11 additions and 2 deletions
  1. 8 1
      main/inc/lib/groupmanager.lib.php
  2. 3 1
      main/install/configuration.dist.php

+ 8 - 1
main/inc/lib/groupmanager.lib.php

@@ -2126,6 +2126,8 @@ class GroupManager
 
         $orig = isset($origin) ? $origin : null;
 
+        $hideGroup = api_get_configuration_value('hide_course_group_if_no_tools_available');
+
         foreach ($group_list as $this_group) {
 
             // Validation when belongs to a session
@@ -2151,7 +2153,9 @@ class GroupManager
                     self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_CALENDAR) ||
                     self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_ANNOUNCEMENT) ||
                     self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_WORK) ||
-                    self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_WIKI))
+                    self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_WIKI) ||
+                    self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_CHAT)
+                )
                 && !(api_is_course_coach() && intval($this_group['session_id']) != $session_id)
             ) {
                 $group_name = '<a href="group_space.php?cidReq='.api_get_course_id().'&amp;origin='.$orig.'&amp;gidReq='.$this_group['id'].'">'.
@@ -2168,6 +2172,9 @@ class GroupManager
                 $group_name .= $session_img;
                 $row[] = $group_name.'<br />'.stripslashes(trim($this_group['description']));
             } else {
+                if ($hideGroup) {
+                    continue;
+                }
                 $row[] = $this_group['name'].'<br />'.stripslashes(trim($this_group['description']));
             }
 

+ 3 - 1
main/install/configuration.dist.php

@@ -41,7 +41,7 @@ $_configuration['db_password'] = '{DATABASE_PASSWORD}';
 // For separate web and DB servers, reduce the bandwidth used by compressing
 // data returning from the DB server. By default, it is ignored. Uncomment
 // the following to enable compression.
-//$_configuration['db_client_flags'] = MYSQL_CLIENT_COMPRESS; 
+//$_configuration['db_client_flags'] = MYSQL_CLIENT_COMPRESS;
 
 /**
  * Database settings
@@ -299,3 +299,5 @@ $_configuration['system_stable']     = NEW_VERSION_STABLE;
 // Filters administration users lists by the session admin who created them.
 // Change to true to restrict the visibility
 //$_configuration['prevent_session_admins_to_manage_all_users'] = false;
+// If there are any tool available and the user is not registered hide the group
+// $_configuration['hide_course_group_if_no_tools_available'] = false;