Browse Source

Fix query.

See BT#7682
Julio Montoya 9 years ago
parent
commit
3263daf660
2 changed files with 7 additions and 5 deletions
  1. 3 1
      main/group/group.php
  2. 4 4
      main/inc/lib/groupmanager.lib.php

+ 3 - 1
main/group/group.php

@@ -185,10 +185,12 @@ echo UserManager::getUserSubscriptionTab(4);
 if (api_get_setting('allow_group_categories') == 'true') {
     $defaultCategory = [
         'id' => 0,
+        'iid' => 0,
         'description' => '',
         'title' => get_lang('DefaultGroupCategory')
     ];
-    $group_cats = array_merge($group_cats, [$defaultCategory]);
+    $group_cats = array_merge([$defaultCategory], $group_cats);
+
     foreach ($group_cats as $index => $category) {
         $categoryId = $category['id'];
         $group_list = GroupManager::get_group_list($categoryId);

+ 4 - 4
main/inc/lib/groupmanager.lib.php

@@ -73,12 +73,12 @@ class GroupManager
 
     /**
      * Get list of groups for current course.
-     * @param int $category The id of the category from which the groups are
+     * @param int $categoryId The id of the category from which the groups are
      * requested
      * @param string $course_code Default is current course
      * @return array An array with all information about the groups.
      */
-    public static function get_group_list($category = null, $course_code = null, $status = null)
+    public static function get_group_list($categoryId = null, $course_code = null, $status = null)
     {
         $course_info = api_get_course_info($course_code);
         $session_id = api_get_session_id();
@@ -109,8 +109,8 @@ class GroupManager
 
         $sql .= " WHERE 1=1 ";
 
-        if ($category != null) {
-            $sql .= "  AND  g.category_id = '".intval($category)."' ";
+        if (!is_null($categoryId)) {
+            $sql .= " AND g.category_id = '".intval($categoryId)."' ";
             $session_condition = api_get_session_condition($session_id);
             if (!empty($session_condition)) {
                 $sql .= $session_condition;