Skip to content

Commit

Permalink
Merge pull request ILIAS-eLearning#8215 from kroepelin-projekte/9-fix…
Browse files Browse the repository at this point in the history
…-mb42278

fix Mantis #42278: Sortierung der Sprachen
  • Loading branch information
pbechtold authored Oct 18, 2024
2 parents 1b331de + 1b9f9a2 commit c7ea5dc
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Services/Language/classes/class.ilLanguageTableGUI.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -19,6 +17,8 @@
********************************************************************
*/

declare(strict_types=1);

include_once "./Services/Table/classes/class.ilTable2GUI.php";

/**
Expand Down Expand Up @@ -81,14 +81,18 @@ public function __construct(object $a_parent_obj, string $a_parent_cmd, $a_folde
public function getItems(): void
{
$languages = $this->folder->getLanguages();
$data = array();
$data = [];
$names = [];
$installed = [];

foreach ($languages as $k => $l) {
$data[] = array_merge($l, array("key" => $k));
$data[] = array_merge($l, ["key" => $k]);
$names[] = $l['name'];
$installed[] = str_starts_with($l["desc"], 'installed') ? 1 : 2;
}

// sort alphabetically but shoe installed languages first
$data = ilArrayUtil::stableSortArray($data, "name", "asc", false);
$data = ilArrayUtil::stableSortArray($data, "desc", "asc", false);
// sort alphabetically but show installed languages first
array_multisort($installed, SORT_ASC, $names, SORT_ASC, $data);

$this->setData($data);
}
Expand Down

0 comments on commit c7ea5dc

Please sign in to comment.