diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 73faabf..3db166d 100644 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -150,8 +150,17 @@ final class BackendController extends Controller implements DashboardElementInte $view->setTemplate('/Modules/News/Theme/Backend/news-archive'); $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000701001, $request, $response)); - $articles = NewsArticleMapper::getNewest(50); - $view->addData('articles', $articles); + if ($request->getData('ptype') === '-') { + $view->setData('news', + NewsArticleMapper::getBeforePivot((int) ($request->getData('id') ?? 0), null, 25) + ); + } elseif ($request->getData('ptype') === '+') { + $view->setData('news', + NewsArticleMapper::getAfterPivot((int) ($request->getData('id') ?? 0), null, 25) + ); + } else { + $view->setData('news', NewsArticleMapper::getAfterPivot(0, null, 25)); + } return $view; } diff --git a/Theme/Backend/news-archive.tpl.php b/Theme/Backend/news-archive.tpl.php index c0723a7..dfa5a22 100644 --- a/Theme/Backend/news-archive.tpl.php +++ b/Theme/Backend/news-archive.tpl.php @@ -12,50 +12,52 @@ */ declare(strict_types=1); +use phpOMS\Uri\UriFactory; +use Modules\News\Models\NewsType; + +/** @var \Modules\News\Models\NewsArticle[] $newsList */ +$articles = $this->getData('news') ?? []; + +$previous = empty($newsList) ? '{/prefix}news/archive' : '{/prefix}news/archive?{?}&id=' . \reset($newsList)->getId() . '&ptype=-'; +$next = empty($newsList) ? '{/prefix}news/archive' : '{/prefix}news/archive?{?}&id=' . \end($newsList)->getId() . '&ptype=+'; + /** * @var \phpOMS\Views\View $this */ - -$footerView = new \phpOMS\Views\PaginationView($this->l11nManager, $this->request, $this->response); -$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig'); -$footerView->setPages(20); -$footerView->setPage(1); - -$articles = $this->getData('articles'); - echo $this->getData('nav')->render(); ?>
| = $this->getHtml('Type') ?> | = $this->getHtml('Title') ?> | = $this->getHtml('Author') ?> | = $this->getHtml('Date') ?> - |
| - | |||
| = $this->getHtml('TYPE' . $news->getType()) ?> - | = $this->printHtml($news->getTitle()); ?> - | = $this->printHtml($news->getCreatedBy()->getName1()); ?> - | = $this->printHtml($news->getPublish()->format('Y-m-d')); ?> - - - |
| = $this->getHtml('Empty', '0', '0'); ?> - + | |||
| = $this->getHtml('TYPE' . $news->getType()) ?> + | = $this->printHtml($news->getTitle()); ?> + | = $this->printHtml($news->getCreatedBy()->getName1()); ?> + | = $this->printHtml($news->getPublish()->format('Y-m-d')); ?> + + + |
| = $this->getHtml('Empty', '0', '0'); ?> + | |||