mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 23:35:12 +00:00
add new conv_sort option
This commit is contained in:
parent
64cf36a2b5
commit
f2e802229a
2 changed files with 7 additions and 1 deletions
|
@ -159,7 +159,7 @@ class Cards extends \Zotlabs\Web\Controller {
|
||||||
if($items) {
|
if($items) {
|
||||||
xchan_query($items);
|
xchan_query($items);
|
||||||
$items = fetch_post_tags($items, true);
|
$items = fetch_post_tags($items, true);
|
||||||
$items = conv_sort($items,'created');
|
$items = conv_sort($items,'updated');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$items = [];
|
$items = [];
|
||||||
|
|
|
@ -1461,6 +1461,8 @@ function conv_sort($arr, $order) {
|
||||||
usort($parents,'sort_thr_created');
|
usort($parents,'sort_thr_created');
|
||||||
elseif(stristr($order,'commented'))
|
elseif(stristr($order,'commented'))
|
||||||
usort($parents,'sort_thr_commented');
|
usort($parents,'sort_thr_commented');
|
||||||
|
elseif(stristr($order,'updated'))
|
||||||
|
usort($parents,'sort_thr_updated');
|
||||||
elseif(stristr($order,'ascending'))
|
elseif(stristr($order,'ascending'))
|
||||||
usort($parents,'sort_thr_created_rev');
|
usort($parents,'sort_thr_created_rev');
|
||||||
|
|
||||||
|
@ -1502,6 +1504,10 @@ function sort_thr_commented($a,$b) {
|
||||||
return strcmp($b['commented'],$a['commented']);
|
return strcmp($b['commented'],$a['commented']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sort_thr_updated($a,$b) {
|
||||||
|
return strcmp($b['updated'],$a['updated']);
|
||||||
|
}
|
||||||
|
|
||||||
function find_thread_parent_index($arr,$x) {
|
function find_thread_parent_index($arr,$x) {
|
||||||
foreach($arr as $k => $v)
|
foreach($arr as $k => $v)
|
||||||
if($v['id'] == $x['parent'])
|
if($v['id'] == $x['parent'])
|
||||||
|
|
Loading…
Reference in a new issue