Skip to content

Commit

Permalink
Groups - check if group is in a category.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Nov 4, 2020
1 parent 57e9880 commit 38e65c1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions main/inc/lib/groupmanager.lib.php
Expand Up @@ -88,6 +88,7 @@ public static function get_groups($courseId = 0)
* @param int $status group status
* @param int $sessionId
* @param bool $getCount
* @param bool $notInGroup Get groups not in a category
*
* @return array an array with all information about the groups
*/
Expand All @@ -96,7 +97,8 @@ public static function get_group_list(
$course_info = [],
$status = null,
$sessionId = 0,
$getCount = false
$getCount = false,
$notInGroup = false
) {
$course_info = empty($course_info) ? api_get_course_info() : $course_info;
if (empty($course_info)) {
Expand Down Expand Up @@ -142,6 +144,10 @@ public static function get_group_list(

$sql .= " AND g.c_id = $course_id ";

if ($notInGroup) {
$sql .= " AND (g.category_id IS NULL OR g.category_id = 0) ";
}

if (!empty($session_condition)) {
$sql .= $session_condition;
}
Expand Down Expand Up @@ -2987,12 +2993,12 @@ public static function getOverview($courseId, $keyword = '')
}

// Check groups with no categories.
$groups = self::get_group_list();
$groups = self::get_group_list(null, api_get_course_info(), null, api_get_session_id(), false, true);
if (!empty($groups)) {
$content .= '<h2>'.get_lang('NoCategorySelected').'</h2>';
$content .= '<ul>';
foreach ($groups as $group) {
if (!empty($group['category'])) {
if (!empty($group['category_id'])) {
continue;
}
$content .= self::groupOverview($group, $url);
Expand Down

0 comments on commit 38e65c1

Please sign in to comment.