diff --git a/lib/classes/MyRealmModel.php b/lib/classes/MyRealmModel.php index d82218980ef591b90db6d49a02c0cd69b54c525b..1ba90a574e2ed3feff1e4b70d73ea1822a2914f4 100644 --- a/lib/classes/MyRealmModel.php +++ b/lib/classes/MyRealmModel.php @@ -677,7 +677,7 @@ class MyRealmModel // Now sort courses by sem_tree entry order. uksort($_tmp_courses[$sem_key], function ($a, $b) use ($order, $max) { - return (str_pad($order[$a], $max, '0') - str_pad($order[$b], $max, '0')); + return str_pad($order[$a] ?? '', $max, '0') - str_pad($order[$b] ?? '', $max, '0'); }); //At this point the $_tmp_courses array is sorted by the ordering diff --git a/lib/models/OERHostOERSI.php b/lib/models/OERHostOERSI.php index 1b5528bea9f9319f8a46ac373c71b91f48896bdc..52e50d35a2b2a335c5316b870b0fae46ce62c6fd 100644 --- a/lib/models/OERHostOERSI.php +++ b/lib/models/OERHostOERSI.php @@ -81,9 +81,9 @@ class OERHostOERSI extends OERHost if (!$material['category']) { $material['category'] = $material->autoDetectCategory(); } - $material['front_image_content_type'] = $material_data['_source']['image'] ? 'image/jpg' : null; + $material['front_image_content_type'] = !empty($material_data['_source']['image']) ? 'image/jpg' : null; $material['data'] = [ - 'front_image_url' => $material_data['_source']['image'], + 'front_image_url' => $material_data['_source']['image'] ?? null, 'download' => $material_data['_source']['encoding'][0]['contentUrl'] ?: '', 'id' => $material_data['_id'], 'organization' => $material_data['_source']['sourceOrganization'][0]['name'] ?: $material_data['_source']['publisher'][0]['name'] @@ -102,7 +102,9 @@ class OERHostOERSI extends OERHost $material->setUsers($userdata); //set topics: - $material->setTopics($material_data['_source']['keywords']); + if (isset($material_data['_source']['keywords'])) { + $material->setTopics($material_data['_source']['keywords']); + } } } else {