diff --git a/lib/models/Clipboard.class.php b/lib/models/Clipboard.class.php index 61f926c69390e15dadd4344579501aa85f9ede49..2f4d0f2436ba22ac28a6ebc258498fce087a5930 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 7905ea295701c638253d024c50cc0fa975b8f827..a2b946d3aa64d7ebbdfe5b5a4283f362ba0a2346 100644 --- a/templates/sidebar/clipboard-area.php +++ b/templates/sidebar/clipboard-area.php @@ -54,7 +54,7 @@ <colgroup> <col style="width: 70%"> </colgroup> - <? $items = $clipboard->getContent(false) ?> + <? $items = $clipboard->getContent() ?> <? if ($items): ?> <? foreach ($items as $item): ?> <?