]> git.mxchange.org Git - friendica.git/blobdiff - mod/videos.php
Move $pager and $page_offset out of App
[friendica.git] / mod / videos.php
index 521201394b24aeb37e5bc11f9674af7c9c2552c4..ee50d26d77c2db2efd4f1d56f38187127b77f8fb 100644 (file)
@@ -5,6 +5,7 @@
 
 use Friendica\App;
 use Friendica\Content\Nav;
+use Friendica\Content\Pager;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
@@ -334,15 +335,15 @@ function videos_content(App $a)
        // Default - show recent videos (no upload link for now)
        //$o = '';
 
+       $total = 0;
        $r = q("SELECT hash FROM `attach` WHERE `uid` = %d AND filetype LIKE '%%video%%'
                $sql_extra GROUP BY hash",
                intval($a->data['user']['uid'])
        );
-
        if (DBA::isResult($r)) {
-               $a->setPagerTotal(count($r));
-               $a->setPagerItemsPage(20);
+               $total = count($r);
        }
+       $pager = new Pager($a->query_string, $total, 20);
 
        $r = q("SELECT hash, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`created`) AS `created`,
                ANY_VALUE(`filename`) AS `filename`, ANY_VALUE(`filetype`) as `filetype`
@@ -350,8 +351,8 @@ function videos_content(App $a)
                WHERE `uid` = %d AND filetype LIKE '%%video%%'
                $sql_extra GROUP BY hash ORDER BY `created` DESC LIMIT %d , %d",
                intval($a->data['user']['uid']),
-               intval($a->pager['start']),
-               intval($a->pager['itemspage'])
+               $pager->getStart(),
+               $pager->getItemsPerPage()
        );
 
        $videos = [];
@@ -388,7 +389,7 @@ function videos_content(App $a)
                '$delete_url' => (($can_post) ? System::baseUrl() . '/videos/' . $a->data['user']['nickname'] : false)
        ]);
 
-       $o .= paginate($a);
+       $o .= $pager->renderFull();
 
        return $o;
 }