Skip to content

Commit

Permalink
Sort the dynamic course items in ascending order.
Browse files Browse the repository at this point in the history
  • Loading branch information
prasanna-lmsace committed Aug 9, 2023
1 parent 8e0c9e2 commit 6da18db
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions classes/smartmenu_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,9 @@ protected function generate_dynamic_item() {
$sql = " SELECT $select FROM {course} c $join";
$sql .= $where ? " WHERE $where " : '';

// Sort the courses in ascending order by its display field.
$sql .= ($this->item->displayfield == self::FIELD_SHORTNAME) ? " ORDER BY c.shortname ASC " : " ORDER BY c.fullname ASC ";

// Fetch the course records based on the sql.
$records = $DB->get_records_sql($sql, $params);

Expand Down

0 comments on commit 6da18db

Please sign in to comment.