Просмотр исходного кода

Ticket #4558 - Build-in API support: Courses.

AntonLV 1 год назад
Родитель
Сommit
4109ffad4e

+ 8 - 7
modules/boonex/courses/classes/BxCoursesModule.php

@@ -746,13 +746,14 @@ class BxCoursesModule extends BxBaseModGroupsModule
             $aEntryCounters = $this->_oDb->getContentStructure(['sample' => 'entry_id_counters', 'entry_id' => $iEntryId]);
 
             $aCounters = [];
-            for($i = 1; $i <= $iLevelMax; $i++) {
-                $aCounters[] = [
-                    'level' => $i,
-                    'title' => $aLevelToNode[$i],
-                    'total' => $aEntryCounters['cn_l' . $i]
-                ];
-            }
+            if(!empty($aEntryCounters) && is_array($aEntryCounters))
+                for($i = 1; $i <= $iLevelMax; $i++) {
+                    $aCounters[] = [
+                        'level' => $i,
+                        'title' => $aLevelToNode[$i],
+                        'total' => $aEntryCounters['cn_l' . $i]
+                    ];
+                }
 
             $aResultAdd = [
                 'counters' => $aCounters,

+ 1 - 1
modules/boonex/courses/classes/BxCoursesSearchResult.php

@@ -39,7 +39,7 @@ class BxCoursesSearchResult extends BxBaseModGroupsSearchResult
                     'table' => 'bx_courses_data',
                     'mainField' => 'content_id',
                     'onField' => 'id',
-                    'joinFields' => array('id', 'name', 'desc', 'picture', 'cover', 'cover_data', 'added', 'author', 'allow_view_to'),
+                    'joinFields' => array('id', 'name', 'desc', 'picture', 'cover', 'cover_data', 'added', 'author', 'allow_view_to', 'status'),
                 ),
                 'account' => array(
                     'type' => 'INNER',