use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Content\Nav;
+use Friendica\Content\Pager;
use Friendica\Content\Text\BBCode;
use Friendica\Core\ACL;
use Friendica\Core\Addon;
use Friendica\Protocol\DFRN;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Map;
-use Friendica\Util\Temporal;
use Friendica\Util\Security;
+use Friendica\Util\Temporal;
require_once 'include/items.php';
if ($datatype === 'album') {
$album = hex2bin($datum);
+ $total = 0;
$r = q("SELECT `resource-id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s'
AND `scale` <= 4 $sql_extra GROUP BY `resource-id`",
intval($owner_uid),
DBA::escape($album)
);
if (DBA::isResult($r)) {
- $a->setPagerTotal(count($r));
- $a->setPagerItemsPage(20);
+ $total = count($r);
}
+ $pager = new Pager($a->query_string, $total, 20);
+
/// @TODO I have seen this many times, maybe generalize it script-wide and encapsulate it?
$order_field = defaults($_GET, 'order', '');
if ($order_field === 'posted') {
AND `scale` <= 4 $sql_extra GROUP BY `resource-id` ORDER BY `created` $order LIMIT %d , %d",
intval($owner_uid),
DBA::escape($album),
- intval($a->pager['start']),
- intval($a->pager['itemspage'])
+ $pager->getStart(),
+ $pager->getItemsPerPage()
);
// edit album name
'$upload' => [L10n::t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album)],
'$order' => $order,
'$edit' => $edit,
- '$paginate' => paginate($a),
+ '$paginate' => $pager->renderFull(),
]);
return $o;
$link_item = Item::selectFirst([], ['id' => $linked_items[0]['id']]);
$condition = ["`parent` = ? AND `parent` != `id`", $link_item['parent']];
- $a->setPagerTotal(DBA::count('item', $condition));
+ $pager = new Pager($a->query_string, DBA::count('item', $condition));
- $params = ['order' => ['id'], 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
+ $params = ['order' => ['id'], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
$result = Item::selectForUser($link_item['uid'], Item::ITEM_FIELDLIST, $condition, $params);
$items = Item::inArray($result);
}
$responses = get_responses($conv_responses, $response_verbs, '', $link_item);
- $paginate = paginate($a);
+ $paginate = $pager->renderFull();
}
$photo_tpl = get_markup_template('photo_view.tpl');
);
if (DBA::isResult($r)) {
- $a->setPagerTotal(count($r));
- $a->setPagerItemsPage(20);
+ $pager = new Pager($a->query_string, count($r), 20);
}
$r = q("SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`,
intval($a->data['user']['uid']),
DBA::escape('Contact Photos'),
DBA::escape(L10n::t('Contact Photos')),
- intval($a->pager['start']),
- intval($a->pager['itemspage'])
+ $pager->getStart(),
+ $pager->getItemsPerPage()
);
$photos = [];
'$can_post' => $can_post,
'$upload' => [L10n::t('Upload New Photos'), 'photos/'.$a->data['user']['nickname'].'/upload'],
'$photos' => $photos,
- '$paginate' => paginate($a),
+ '$paginate' => $pager->renderFull(),
]);
return $o;