Skip to content

Commit

Permalink
MDL-74764 core_course: Activity is not in alphabetical order.
Browse files Browse the repository at this point in the history
  • Loading branch information
Khoa Nguyen Dang committed May 27, 2022
1 parent 0a3eedb commit 0475771
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions course/classes/local/service/content_item_service.php
Expand Up @@ -224,11 +224,8 @@ private function export_content_items(\stdClass $user, $contentitems) {
$exported = $ciexporter->export($PAGE->get_renderer('core'));

// Sort by title for return.
usort($exported->content_items, function($a, $b) {
return strcmp($a->title, $b->title);
});

return $exported->content_items;
\core_collator::asort_objects_by_property($exported->content_items, 'title');
return array_values($exported->content_items);
}

/**
Expand Down Expand Up @@ -300,11 +297,9 @@ public function get_content_items_for_user_in_course(\stdClass $user, \stdClass
$exported = $ciexporter->export($PAGE->get_renderer('course'));

// Sort by title for return.
usort($exported->content_items, function($a, $b) {
return strcmp($a->title, $b->title);
});
\core_collator::asort_objects_by_property($exported->content_items, 'title');

return $exported->content_items;
return array_values($exported->content_items);
}

/**
Expand Down

0 comments on commit 0475771

Please sign in to comment.