diff options
author | zotlabs <mike@macgirvin.com> | 2018-03-22 16:34:27 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-03-22 16:34:27 -0700 |
commit | 4ba91cf4e3da5637a8c2a4a65f84c3178ce0d343 (patch) | |
tree | d7eee0e4d4a881378fa61fd27b97b0175f8fb818 /Zotlabs/Module/Articles.php | |
parent | 9a52b90f227e8ff774110cc2f5cd536714d9802d (diff) | |
download | volse-hubzilla-4ba91cf4e3da5637a8c2a4a65f84c3178ce0d343.tar.gz volse-hubzilla-4ba91cf4e3da5637a8c2a4a65f84c3178ce0d343.tar.bz2 volse-hubzilla-4ba91cf4e3da5637a8c2a4a65f84c3178ce0d343.zip |
make alt_pager work for articles/cards
Diffstat (limited to 'Zotlabs/Module/Articles.php')
-rw-r--r-- | Zotlabs/Module/Articles.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Zotlabs/Module/Articles.php b/Zotlabs/Module/Articles.php index 81f7b6543..c622edd10 100644 --- a/Zotlabs/Module/Articles.php +++ b/Zotlabs/Module/Articles.php @@ -127,6 +127,10 @@ class Articles extends \Zotlabs\Web\Controller { $editor = ''; } + $itemspage = get_pconfig(local_channel(),'system','itemspage'); + \App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start'])); + $sql_extra = item_permissions_sql($owner); $sql_item = ''; @@ -142,7 +146,7 @@ class Articles extends \Zotlabs\Web\Controller { $r = q("select * from item where item.uid = %d and item_type = %d - $sql_extra $sql_item order by item.created desc", + $sql_extra $sql_item order by item.created desc $pager_sql", intval($owner), intval(ITEM_TYPE_ARTICLE) ); @@ -153,6 +157,8 @@ class Articles extends \Zotlabs\Web\Controller { if($r) { + $pager_total = count($r); + $parents_str = ids_to_querystr($r,'id'); $items = q("SELECT item.*, item.id AS item_id @@ -174,13 +180,18 @@ class Articles extends \Zotlabs\Web\Controller { $mode = 'articles'; - $content = conversation($items,$mode,false,'traditional'); + if(get_pconfig(local_channel(),'system','articles_list_mode')) + $page_mode = 'list'; + else + $page_mode = 'traditional'; + + $content = conversation($items,$mode,false,$page_mode); $o = replace_macros(get_markup_template('cards.tpl'), [ '$title' => t('Articles'), '$editor' => $editor, '$content' => $content, - '$pager' => alt_pager($a,count($items)) + '$pager' => alt_pager($a,$pager_total) ]); return $o; |