Skip to content

Commit

Permalink
sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
vanekm committed Aug 29, 2024
1 parent 08f94e3 commit b5aca4d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/Modules/Fykos/DefaultModule/AboutPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,20 @@ public function renderOrganizers(): void
fn(array $organizer): bool => $organizer['until'] == null
|| $organizer['until'] == self::CURRENT_YEAR
);

// sort by order

// sort by order and last name
setlocale(LC_COLLATE, 'cs_CZ.utf8');
usort($currentOrganizers, function (array $a, array $b): int {
if ($a['order'] === $b['order']) {
$lastNameA = explode(' ', $a['name']);
$lastNameA = end($lastNameA);
$lastNameB = explode(' ', $b['name']);
$lastNameB = end($lastNameB);
return $lastNameA <=> $lastNameB;
return strcoll($lastNameA, $lastNameB);
}
return $b['order'] <=> $a['order'];
});

}
$this->template->currentOrganizers = $currentOrganizers;
}
Expand Down

0 comments on commit b5aca4d

Please sign in to comment.