diff --git a/functions.php b/functions.php index 185df5c9de..34e25f5006 100644 --- a/functions.php +++ b/functions.php @@ -666,7 +666,15 @@ function getTerms($connection2, $gibbonSchoolYearID, $short = false) return $output; } -//Array sort for multidimensional arrays +/** + * Array sort for multidimensional arrays. + * + * Deprecated in favor of native usort. + * + * @since 2013 + * @version v12.0.00 + * @deprecated v26.0.00 + */ function msort($array, $id = 'id', $sort_ascending = true) { $temp_array = array(); diff --git a/modules/Planner/moduleFunctions.php b/modules/Planner/moduleFunctions.php index a1f2978c42..39b5078538 100644 --- a/modules/Planner/moduleFunctions.php +++ b/modules/Planner/moduleFunctions.php @@ -674,7 +674,8 @@ function getResourcesTagCloud($guid, $connection2, $tagCount = 50) { ++$count; } - $tags = msort($tags, 0, true); + // Sort tags by the value of their tag name (i.e. key=0) asecendingly. + usort($tags, fn($a, $b) => $a[0] <=> $b[0]); $min_font_size = 16; $max_font_size = 30; diff --git a/modules/Timetable/moduleFunctions.php b/modules/Timetable/moduleFunctions.php index 079ff24c83..a712ab4618 100644 --- a/modules/Timetable/moduleFunctions.php +++ b/modules/Timetable/moduleFunctions.php @@ -795,7 +795,9 @@ function renderTT($guid, $connection2, $gibbonPersonID, $gibbonTTID, $title = '' $eventsCombined = $eventsPersonal; } - $eventsCombined = msort($eventsCombined, 2, true); + // Sort $eventsCombined by the value of their start timestamp (key = 2) ascendingly. + // See getCalendarEvents() for field details of each events. + usort($eventsCombined, fn($a, $b) => $a[2] <=> $b[2]); $currentAllDays = 0; $lastDate = '';