From 568a7397c2dc997dcda4f69c9e57b0e879fcf9f2 Mon Sep 17 00:00:00 2001 From: John Crisp Date: Thu, 2 Apr 2020 14:19:15 +0200 Subject: [PATCH] Add secondary date sort for Status --- include/my_functions.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/include/my_functions.php b/include/my_functions.php index ff8b776..ca2e8e5 100644 --- a/include/my_functions.php +++ b/include/my_functions.php @@ -81,9 +81,16 @@ function csort($array, $column, $ascdec=SORT_ASC){ if ($column == 'issued') $column = "issuedSort"; if ($column == 'expires') $column = 'expiresSort'; - foreach($array as $x) $sortarr[]=$x[$column]; - array_multisort($sortarr, $ascdec, $array); - + if ($column == 'status') { + foreach($array as $x) { + $sortarr[]=$x[$column]; + $sortdate[] = $x['expiresSort']; + } + array_multisort($sortarr, $ascdec, $sortdate, SORT_ASC, $array); + } else { + foreach($array as $x) $sortarr[]=$x[$column]; + array_multisort($sortarr, $ascdec, $array); + } return $array; }