Skip to content
Snippets Groups Projects
Commit 3f998baf authored by André Noack's avatar André Noack
Browse files

Resolve #1831 "Individuelle Raumgruppen werden unsortiert angezeigt"

Closes #1831

Merge request studip/studip!1206
parent 25b8530e
No related branches found
No related tags found
No related merge requests found
...@@ -188,6 +188,8 @@ class Clipboard extends SimpleORMap ...@@ -188,6 +188,8 @@ class Clipboard extends SimpleORMap
* to output the data of the clipboard with appropriate names * to output the data of the clipboard with appropriate names
* and other attributes which may be needed. * and other attributes which may be needed.
* *
* @param string $order_by sort column and direction
*
* @returns string[][] A two-dimensional array with strings. * @returns string[][] A two-dimensional array with strings.
* The first dimension represents the list of clipboard items. * The first dimension represents the list of clipboard items.
* The second dimension represents an item and holds at least * The second dimension represents an item and holds at least
...@@ -207,13 +209,13 @@ class Clipboard extends SimpleORMap ...@@ -207,13 +209,13 @@ class Clipboard extends SimpleORMap
* Derived classes may add further attributes to the array, * Derived classes may add further attributes to the array,
* if necessary. * if necessary.
*/ */
public function getContent() public function getContent($order_by = 'name asc')
{ {
if (!$this->items) { if (!$this->items) {
return []; return [];
} }
$content = []; $content = new SimpleCollection();
foreach ($this->items as $item) { foreach ($this->items as $item) {
//Only those elements which store the IDs of objects //Only those elements which store the IDs of objects
//from the allowed content class or its descendants //from the allowed content class or its descendants
...@@ -228,7 +230,7 @@ class Clipboard extends SimpleORMap ...@@ -228,7 +230,7 @@ class Clipboard extends SimpleORMap
} }
} }
return $content; return $content->orderBy($order_by)->getArrayCopy();
} }
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<colgroup> <colgroup>
<col style="width: 70%"> <col style="width: 70%">
</colgroup> </colgroup>
<? $items = $clipboard->getContent(false) ?> <? $items = $clipboard->getContent() ?>
<? if ($items): ?> <? if ($items): ?>
<? foreach ($items as $item): ?> <? foreach ($items as $item): ?>
<? <?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment