Use network paging
This commit is contained in:
parent
174a1bb54b
commit
04e802e0f6
2 changed files with 34 additions and 19 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
|
||||||
function community_init(App $a) {
|
function community_init(App $a) {
|
||||||
|
@ -32,15 +33,23 @@ function community_content(App $a, $update = 0) {
|
||||||
nav_set_selected('community');
|
nav_set_selected('community');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($a->data,'search')) {
|
if (Config::get('system', 'comment_public')) {
|
||||||
$search = notags(trim($a->data['search']));
|
// check if we serve a mobile device and get the user settings
|
||||||
} else {
|
// accordingly
|
||||||
$search = (x($_GET,'search') ? notags(trim(rawurldecode($_GET['search']))) : '');
|
if ($a->is_mobile) {
|
||||||
}
|
$itemspage_network = PConfig::get(local_user(),'system','itemspage_mobile_network', 20);
|
||||||
|
} else {
|
||||||
|
$itemspage_network = PConfig::get(local_user(),'system','itemspage_network', 40);
|
||||||
|
}
|
||||||
|
|
||||||
// Here is the way permissions work in this module...
|
// now that we have the user settings, see if the theme forces
|
||||||
// Only public posts can be shown
|
// a maximum item number which is lower then the user choice
|
||||||
// OR your own posts if you are a logged in member
|
if (($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network)) {
|
||||||
|
$itemspage_network = $a->force_max_items;
|
||||||
|
}
|
||||||
|
|
||||||
|
$a->set_pager_itemspage($itemspage_network);
|
||||||
|
}
|
||||||
|
|
||||||
$r = community_getitems($a->pager['start'], $a->pager['itemspage']);
|
$r = community_getitems($a->pager['start'], $a->pager['itemspage']);
|
||||||
|
|
||||||
|
@ -77,7 +86,6 @@ function community_content(App $a, $update = 0) {
|
||||||
} else {
|
} else {
|
||||||
$s = $r;
|
$s = $r;
|
||||||
}
|
}
|
||||||
// we behave the same in message lists as the search module
|
|
||||||
|
|
||||||
$o .= conversation($a, $s, 'community', $update);
|
$o .= conversation($a, $s, 'community', $update);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ namespace Friendica\Module;
|
||||||
|
|
||||||
use Friendica\BaseModule;
|
use Friendica\BaseModule;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use dba;
|
use dba;
|
||||||
|
|
||||||
|
@ -51,15 +52,23 @@ class GlobalModule extends BaseModule {
|
||||||
nav_set_selected('global');
|
nav_set_selected('global');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($a->data,'search')) {
|
if (Config::get('system', 'comment_public')) {
|
||||||
$search = notags(trim($a->data['search']));
|
// check if we serve a mobile device and get the user settings
|
||||||
} else {
|
// accordingly
|
||||||
$search = (x($_GET,'search') ? notags(trim(rawurldecode($_GET['search']))) : '');
|
if ($a->is_mobile) {
|
||||||
}
|
$itemspage_network = PConfig::get(local_user(),'system','itemspage_mobile_network', 20);
|
||||||
|
} else {
|
||||||
|
$itemspage_network = PConfig::get(local_user(),'system','itemspage_network', 40);
|
||||||
|
}
|
||||||
|
|
||||||
// Here is the way permissions work in this module...
|
// now that we have the user settings, see if the theme forces
|
||||||
// Only public posts can be shown
|
// a maximum item number which is lower then the user choice
|
||||||
// OR your own posts if you are a logged in member
|
if (($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network)) {
|
||||||
|
$itemspage_network = $a->force_max_items;
|
||||||
|
}
|
||||||
|
|
||||||
|
$a->set_pager_itemspage($itemspage_network);
|
||||||
|
}
|
||||||
|
|
||||||
$r = self::getPublicItems($a->pager['start'], $a->pager['itemspage']);
|
$r = self::getPublicItems($a->pager['start'], $a->pager['itemspage']);
|
||||||
|
|
||||||
|
@ -68,8 +77,6 @@ class GlobalModule extends BaseModule {
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we behave the same in message lists as the search module
|
|
||||||
|
|
||||||
$o .= conversation($a, $r, 'community', $update);
|
$o .= conversation($a, $r, 'community', $update);
|
||||||
|
|
||||||
$o .= alt_pager($a, count($r));
|
$o .= alt_pager($a, count($r));
|
||||||
|
|
Loading…
Reference in a new issue