Browse Source

Fix name + add "items" in userportal array

jmontoyaa 9 years ago
parent
commit
86c98cf154
2 changed files with 18 additions and 3 deletions
  1. 17 2
      main/inc/lib/course.lib.php
  2. 1 1
      main/install/configuration.dist.php

+ 17 - 2
main/inc/lib/course.lib.php

@@ -3522,6 +3522,7 @@ class CourseManager
         $result = Database::query($sql);
         $html = null;
         $courseCount = 0;
+        $items = [];
         while ($row = Database::fetch_array($result)) {
             // We simply display the title of the category.
             $params = array(
@@ -3538,10 +3539,14 @@ class CourseManager
                 $load_dirs
             );
 
-            $html .= self::course_item_parent(
+            $item = self::course_item_parent(
                 self::course_item_html($params, true),
                 $courseInCategory['html']
             );
+
+            $html .= $item;
+
+            $items[] = $item;
             $courseCount += $courseInCategory['course_count'];
         }
 
@@ -3549,10 +3554,16 @@ class CourseManager
         $courseInCategory = self::displayCoursesInCategory(0, $load_dirs);
 
         $html .= $courseInCategory['html'];
+
+        if (!empty($courseInCategory['items'])) {
+            $items = array_merge($items, $courseInCategory['items']);
+        }
+
         $courseCount += $courseInCategory['course_count'];
 
         return [
             'html' => $html,
+            'items' => $items,
             'course_count' => $courseCount
         ];
     }
@@ -3611,6 +3622,7 @@ class CourseManager
 
         $result = Database::query($sql);
         $html = '';
+        $items = [];
 
         $course_list = array();
         $showCustomIcon = api_get_setting('course_images_in_courses_list');
@@ -3729,11 +3741,14 @@ class CourseManager
             if (empty($user_category_id)) {
                 $isSubContent = false;
             }
-            $html .= self::course_item_html($params, $isSubContent);
+            $item = self::course_item_html($params, $isSubContent);
+            $html .= $item;
+            $items[] = $item;
         }
 
         return [
             'html' => $html,
+            'items' => $items,
             'course_count' => $courseCount
         ];
     }

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

@@ -238,5 +238,5 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE;
 //$_configuration['messaging_gdc_project_number'] = '';
 //Api Key in the Google Developer Console
 //$_configuration['messaging_gdc_api_key'] = '';
-// Userportal template located in main/template/default/layout/user_portal
+// Userportal template located in main/template/default/user_portal
 //$_configuration['user_portal_tpl'] = 'index_grid.tpl';