From 8bddaa789d0df7a91b95a0461142f7d3e22073f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Noack?= <noack@data-quest.de> Date: Tue, 29 Nov 2022 13:10:02 +0000 Subject: [PATCH] Resolve #1831 "Individuelle Raumgruppen werden unsortiert angezeigt" Closes #1831 Merge request studip/studip!1206 --- lib/models/Clipboard.class.php | 8 +++++--- templates/sidebar/clipboard-area.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/models/Clipboard.class.php b/lib/models/Clipboard.class.php index 61f926c6939..2f4d0f2436b 100644 --- a/lib/models/Clipboard.class.php +++ b/lib/models/Clipboard.class.php @@ -188,6 +188,8 @@ class Clipboard extends SimpleORMap * to output the data of the clipboard with appropriate names * and other attributes which may be needed. * + * @param string $order_by sort column and direction + * * @returns string[][] A two-dimensional array with strings. * The first dimension represents the list of clipboard items. * The second dimension represents an item and holds at least @@ -207,13 +209,13 @@ class Clipboard extends SimpleORMap * Derived classes may add further attributes to the array, * if necessary. */ - public function getContent() + public function getContent($order_by = 'name asc') { if (!$this->items) { return []; } - $content = []; + $content = new SimpleCollection(); foreach ($this->items as $item) { //Only those elements which store the IDs of objects //from the allowed content class or its descendants @@ -228,7 +230,7 @@ class Clipboard extends SimpleORMap } } - return $content; + return $content->orderBy($order_by)->getArrayCopy(); } diff --git a/templates/sidebar/clipboard-area.php b/templates/sidebar/clipboard-area.php index 64c3d031b2e..d103b506949 100644 --- a/templates/sidebar/clipboard-area.php +++ b/templates/sidebar/clipboard-area.php @@ -57,7 +57,7 @@ <colgroup> <col style="width: 70%"> </colgroup> - <? $items = $clipboard->getContent(false) ?> + <? $items = $clipboard->getContent() ?> <? if ($items): ?> <? foreach ($items as $item): ?> <? -- GitLab