Skip to content
Snippets Groups Projects
Commit a7d90462 authored by Stefan Galinski's avatar Stefan Galinski :video_game:
Browse files

[FEATURE] Implement a sorting setting (values: date, positionInTree)

parent 082865de
No related branches found
No related tags found
No related merge requests found
Showing
with 193 additions and 159 deletions
...@@ -187,5 +187,3 @@ abstract class AbstractController extends ActionController { ...@@ -187,5 +187,3 @@ abstract class AbstractController extends ActionController {
]; ];
} }
} }
?>
...@@ -61,7 +61,7 @@ class LatestController extends AbstractController { ...@@ -61,7 +61,7 @@ class LatestController extends AbstractController {
} }
$latestNewsEntries = $this->newsRepository->findLastUpdatedOrHighlightedNewsByCategories( $latestNewsEntries = $this->newsRepository->findLastUpdatedOrHighlightedNewsByCategories(
$limit, FALSE, $categoryUids, 0, TRUE $limit, FALSE, $categoryUids, 0, TRUE, $this->settings['sortBy']
); );
$newsMetaData = []; $newsMetaData = [];
......
...@@ -26,8 +26,8 @@ namespace SGalinski\SgNews\Controller; ...@@ -26,8 +26,8 @@ namespace SGalinski\SgNews\Controller;
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
use SGalinski\SgNews\Service\HeaderMetaDataService;
use SGalinski\SgNews\Domain\Model\News; use SGalinski\SgNews\Domain\Model\News;
use SGalinski\SgNews\Service\HeaderMetaDataService;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
/** /**
...@@ -81,7 +81,9 @@ class ListByCategoryController extends AbstractController { ...@@ -81,7 +81,9 @@ class ListByCategoryController extends AbstractController {
$newsMetaData = []; $newsMetaData = [];
$headerSet = FALSE; $headerSet = FALSE;
$news = $this->newsRepository->findAllSortedNewsByCategories($categoryUids, $newsPerPage, $offset)->toArray(); $news = $this->newsRepository->findAllSortedNewsByCategories(
$categoryUids, $newsPerPage, $offset, $this->settings['sortBy']
)->toArray();
foreach ($news as $newsEntry) { foreach ($news as $newsEntry) {
/** @var News $newsEntry */ /** @var News $newsEntry */
$data = $this->getMetaDataForNews($newsEntry, $categories[$newsEntry->getPid()]); $data = $this->getMetaDataForNews($newsEntry, $categories[$newsEntry->getPid()]);
...@@ -103,5 +105,3 @@ class ListByCategoryController extends AbstractController { ...@@ -103,5 +105,3 @@ class ListByCategoryController extends AbstractController {
$this->view->assign('categories', $categories); $this->view->assign('categories', $categories);
} }
} }
?>
...@@ -2,29 +2,29 @@ ...@@ -2,29 +2,29 @@
namespace SGalinski\SgNews\Controller; namespace SGalinski\SgNews\Controller;
/*************************************************************** /***************************************************************
* Copyright notice * Copyright notice
* *
* (c) sgalinski Internet Services (https://www.sgalinski.de) * (c) sgalinski Internet Services (https://www.sgalinski.de)
* *
* All rights reserved * All rights reserved
* *
* This script is part of the TYPO3 project. The TYPO3 project is * This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify * free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* The GNU General Public License can be found at * The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html. * http://www.gnu.org/copyleft/gpl.html.
* *
* This script is distributed in the hope that it will be useful, * This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
/** /**
* Controller that handles the news feed rendering * Controller that handles the news feed rendering
...@@ -46,5 +46,3 @@ class NewsFeedController extends AbstractController { ...@@ -46,5 +46,3 @@ class NewsFeedController extends AbstractController {
$this->view->assign('news', $news); $this->view->assign('news', $news);
} }
} }
?>
...@@ -69,7 +69,9 @@ class OverviewController extends AbstractController { ...@@ -69,7 +69,9 @@ class OverviewController extends AbstractController {
protected function highlightBestFitNews(array $categoryIds = NULL) { protected function highlightBestFitNews(array $categoryIds = NULL) {
/** @var News $highlightedNews */ /** @var News $highlightedNews */
$highlightedNews = $this->newsRepository $highlightedNews = $this->newsRepository
->findLastUpdatedOrHighlightedNewsByCategories(1, FALSE, $categoryIds)->getFirst(); ->findLastUpdatedOrHighlightedNewsByCategories(
1, FALSE, $categoryIds, 0, FALSE, $this->settings['sortBy']
)->getFirst();
if (!$highlightedNews) { if (!$highlightedNews) {
return; return;
} }
...@@ -119,7 +121,9 @@ class OverviewController extends AbstractController { ...@@ -119,7 +121,9 @@ class OverviewController extends AbstractController {
$categoryIds[] = $category->getUid(); $categoryIds[] = $category->getUid();
$categoriesById[$categoryId] = $category; $categoriesById[$categoryId] = $category;
$news = $this->newsRepository->findAllSortedNewsByCategories([$categoryId], $newsLimitPerCategory, $offset); $news = $this->newsRepository->findAllSortedNewsByCategories(
[$categoryId], $newsLimitPerCategory, $offset, $this->settings['sortBy']
);
foreach ($news as $newsEntry) { foreach ($news as $newsEntry) {
/** @var News $newsEntry */ /** @var News $newsEntry */
$categoryId = $newsEntry->getPid(); $categoryId = $newsEntry->getPid();
...@@ -141,7 +145,9 @@ class OverviewController extends AbstractController { ...@@ -141,7 +145,9 @@ class OverviewController extends AbstractController {
} }
$allNews = []; $allNews = [];
$news = $this->newsRepository->findAllSortedNewsByCategories($categoryIds, $newsLimitPerCategory, $offset); $news = $this->newsRepository->findAllSortedNewsByCategories(
$categoryIds, $newsLimitPerCategory, $offset, $this->settings['sortBy']
);
foreach ($news as $newsEntry) { foreach ($news as $newsEntry) {
/** @var News $newsEntry */ /** @var News $newsEntry */
$categoryId = $newsEntry->getPid(); $categoryId = $newsEntry->getPid();
...@@ -200,7 +206,9 @@ class OverviewController extends AbstractController { ...@@ -200,7 +206,9 @@ class OverviewController extends AbstractController {
} }
$newsMetaData = []; $newsMetaData = [];
$news = $this->newsRepository->findAllSortedNewsByCategories($categoryIds, $newsPerPage, $offset); $news = $this->newsRepository->findAllSortedNewsByCategories(
$categoryIds, $newsPerPage, $offset, $this->settings['sortBy']
);
foreach ($news as $newsEntry) { foreach ($news as $newsEntry) {
/** @var News $newsEntry */ /** @var News $newsEntry */
$data = $this->getMetaDataForNews($newsEntry, $categoriesById[$newsEntry->getPid()]); $data = $this->getMetaDataForNews($newsEntry, $categoriesById[$newsEntry->getPid()]);
......
...@@ -143,5 +143,3 @@ class PageBrowserController extends ActionController { ...@@ -143,5 +143,3 @@ class PageBrowserController extends ActionController {
return $this->uriBuilder->reset()->setUseCacheHash(FALSE)->uriFor('index', ['currentPage' => $page,]); return $this->uriBuilder->reset()->setUseCacheHash(FALSE)->uriFor('index', ['currentPage' => $page,]);
} }
} }
?>
...@@ -26,11 +26,9 @@ namespace SGalinski\SgNews\Controller; ...@@ -26,11 +26,9 @@ namespace SGalinski\SgNews\Controller;
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
use SGalinski\SgNews\Service\HeaderMetaDataService;
use SGalinski\SgNews\Domain\Model\Category; use SGalinski\SgNews\Domain\Model\Category;
use SGalinski\SgNews\Domain\Model\News; use SGalinski\SgNews\Domain\Model\News;
use TYPO3\CMS\Core\Page\PageRenderer; use SGalinski\SgNews\Service\HeaderMetaDataService;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
/** /**
* Controller that handles the news single view page * Controller that handles the news single view page
...@@ -73,24 +71,18 @@ class SingleViewController extends AbstractController { ...@@ -73,24 +71,18 @@ class SingleViewController extends AbstractController {
return; return;
} }
$similarNewsMetaData = []; // $similarNewsMetaData = [];
$similarNews = $this->newsRepository->findRandomNews(3, $news); // $similarNews = $this->newsRepository->findRandomNews(3, $news);
foreach ($similarNews as $similarNewsEntry) { // foreach ($similarNews as $similarNewsEntry) {
/** @var News $similarNewsEntry */ // /** @var News $similarNewsEntry */
/** @var Category $category */ // /** @var Category $category */
$category = $this->categoryRepository->findByUid($similarNewsEntry->getPid()); // $category = $this->categoryRepository->findByUid($similarNewsEntry->getPid());
if (!$category) { // if (!$category) {
continue; // continue;
} // }
//
$similarNewsMetaData[] = $this->getMetaDataForNews($similarNewsEntry, $category); // $similarNewsMetaData[] = $this->getMetaDataForNews($similarNewsEntry, $category);
} // }
/** @var $typoScriptController TypoScriptFrontendController */
$typoScriptController = $GLOBALS['TSFE'];
/** @var PageRenderer $pageRenderer */
$pageRenderer = $typoScriptController->getPageRenderer();
$newsAuthor = $news->getAuthorFrontendUser(); $newsAuthor = $news->getAuthorFrontendUser();
$newsMetaData = $this->getMetaDataForNews($news, $newsCategory); $newsMetaData = $this->getMetaDataForNews($news, $newsCategory);
...@@ -100,16 +92,19 @@ class SingleViewController extends AbstractController { ...@@ -100,16 +92,19 @@ class SingleViewController extends AbstractController {
HeaderMetaDataService::addOgImageToHeader($newsMetaData['teaserImage']); HeaderMetaDataService::addOgImageToHeader($newsMetaData['teaserImage']);
} }
$previousNews = $this->newsRepository->findPreviousNewsEntryFromCurrentNews($news, $this->settings['sortBy'])
->getFirst();
$nextNews = $this->newsRepository->findNextNewsEntryFromCurrentNews($news, $this->settings['sortBy'])
->getFirst();
$this->view->assignMultiple( $this->view->assignMultiple(
[ [
'newsMetaData' => $newsMetaData, 'newsMetaData' => $newsMetaData,
'similarNewsMetaData' => $similarNewsMetaData, // 'similarNewsMetaData' => $similarNewsMetaData,
'previousNews' => $this->newsRepository->findPreviousNewsEntryFromCurrentNews($news)->getFirst(), 'previousNews' => $previousNews,
'nextNews' => $this->newsRepository->findNextNewsEntryFromCurrentNews($news)->getFirst(), 'nextNews' => $nextNews,
'newsAuthor' => $newsAuthor, 'newsAuthor' => $newsAuthor,
] ]
); );
} }
} }
?>
...@@ -2,34 +2,32 @@ ...@@ -2,34 +2,32 @@
namespace SGalinski\SgNews\Domain\Model; namespace SGalinski\SgNews\Domain\Model;
/*************************************************************** /***************************************************************
* Copyright notice * Copyright notice
* *
* (c) sgalinski Internet Services (https://www.sgalinski.de) * (c) sgalinski Internet Services (https://www.sgalinski.de)
* *
* All rights reserved * All rights reserved
* *
* This script is part of the TYPO3 project. The TYPO3 project is * This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify * free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* The GNU General Public License can be found at * The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html. * http://www.gnu.org/copyleft/gpl.html.
* *
* This script is distributed in the hope that it will be useful, * This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
/** /**
* Category * Category
*/ */
class Category extends CategoryAndNews { class Category extends CategoryAndNews {
} }
?>
...@@ -227,5 +227,3 @@ abstract class CategoryAndNews extends AbstractEntity { ...@@ -227,5 +227,3 @@ abstract class CategoryAndNews extends AbstractEntity {
$this->sorting = (int) $sorting; $this->sorting = (int) $sorting;
} }
} }
?>
...@@ -240,5 +240,3 @@ class News extends CategoryAndNews { ...@@ -240,5 +240,3 @@ class News extends CategoryAndNews {
return $this->authorFrontendUser; return $this->authorFrontendUser;
} }
} }
?>
...@@ -2,34 +2,32 @@ ...@@ -2,34 +2,32 @@
namespace SGalinski\SgNews\Domain\Repository; namespace SGalinski\SgNews\Domain\Repository;
/*************************************************************** /***************************************************************
* Copyright notice * Copyright notice
* *
* (c) sgalinski Internet Services (https://www.sgalinski.de) * (c) sgalinski Internet Services (https://www.sgalinski.de)
* *
* All rights reserved * All rights reserved
* *
* This script is part of the TYPO3 project. The TYPO3 project is * This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify * free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* The GNU General Public License can be found at * The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html. * http://www.gnu.org/copyleft/gpl.html.
* *
* This script is distributed in the hope that it will be useful, * This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/ ***************************************************************/
/** /**
* Category Repository * Category Repository
*/ */
class CategoryRepository extends AbstractRepository { class CategoryRepository extends AbstractRepository {
} }
?>
...@@ -41,9 +41,10 @@ class NewsRepository extends AbstractRepository { ...@@ -41,9 +41,10 @@ class NewsRepository extends AbstractRepository {
* @param array $categoryIds NULL, if the category filter isn't applied, otherwise an array with the categories uid. * @param array $categoryIds NULL, if the category filter isn't applied, otherwise an array with the categories uid.
* @param int $limit * @param int $limit
* @param int $offset * @param int $offset
* @param string $sortBy date or positionInTree
* @return QueryResultInterface * @return QueryResultInterface
*/ */
public function findAllSortedNewsByCategories($categoryIds = NULL, $limit = 0, $offset = 0) { public function findAllSortedNewsByCategories($categoryIds = NULL, $limit = 0, $offset = 0, $sortBy = 'date') {
$query = $this->createQuery(); $query = $this->createQuery();
$categoryConstraint = []; $categoryConstraint = [];
...@@ -63,12 +64,23 @@ class NewsRepository extends AbstractRepository { ...@@ -63,12 +64,23 @@ class NewsRepository extends AbstractRepository {
$query->setOffset($offset); $query->setOffset($offset);
} }
$query->setOrderings( if ($sortBy === 'date') {
[ $query->setOrderings(
'lastUpdated' => QueryInterface::ORDER_DESCENDING, [
'crdate' => QueryInterface::ORDER_DESCENDING, 'lastUpdated' => QueryInterface::ORDER_DESCENDING,
] 'crdate' => QueryInterface::ORDER_DESCENDING,
); ]
);
} else {
$query->setOrderings(
[
'sorting' => QueryInterface::ORDER_ASCENDING,
'lastUpdated' => QueryInterface::ORDER_DESCENDING,
'crdate' => QueryInterface::ORDER_DESCENDING,
]
);
}
return $query->execute(); return $query->execute();
} }
...@@ -97,10 +109,12 @@ class NewsRepository extends AbstractRepository { ...@@ -97,10 +109,12 @@ class NewsRepository extends AbstractRepository {
* @param array $categoryIds NULL, if the category filter isn't applied, otherwise an array with the categories uid. * @param array $categoryIds NULL, if the category filter isn't applied, otherwise an array with the categories uid.
* @param int $offset * @param int $offset
* @param bool $hideNeverHighlightedNews * @param bool $hideNeverHighlightedNews
* @param string $sortBy date or positionInTree
* @return QueryResult * @return QueryResult
*/ */
public function findLastUpdatedOrHighlightedNewsByCategories( public function findLastUpdatedOrHighlightedNewsByCategories(
$limit = 1, $onlyHighlighted = FALSE, array $categoryIds = NULL, $offset = 0, $hideNeverHighlightedNews = FALSE $limit = 1, $onlyHighlighted = FALSE, array $categoryIds = NULL,
$offset = 0, $hideNeverHighlightedNews = FALSE, $sortBy = 'date'
) { ) {
$query = $this->createQuery(); $query = $this->createQuery();
$constraints = NULL; $constraints = NULL;
...@@ -116,13 +130,24 @@ class NewsRepository extends AbstractRepository { ...@@ -116,13 +130,24 @@ class NewsRepository extends AbstractRepository {
$constraints[] = $query->equals('tx_sgnews_never_highlighted', 0); $constraints[] = $query->equals('tx_sgnews_never_highlighted', 0);
} }
$query->setOrderings( if ($sortBy === 'date') {
[ $query->setOrderings(
'tx_sgnews_highlighted' => QueryInterface::ORDER_DESCENDING, [
'lastUpdated' => QueryInterface::ORDER_DESCENDING, 'tx_sgnews_highlighted' => QueryInterface::ORDER_DESCENDING,
'crdate' => QueryInterface::ORDER_DESCENDING, 'lastUpdated' => QueryInterface::ORDER_DESCENDING,
] 'crdate' => QueryInterface::ORDER_DESCENDING,
); ]
);
} else {
$query->setOrderings(
[
'tx_sgnews_highlighted' => QueryInterface::ORDER_DESCENDING,
'sorting' => QueryInterface::ORDER_ASCENDING,
'lastUpdated' => QueryInterface::ORDER_DESCENDING,
'crdate' => QueryInterface::ORDER_DESCENDING,
]
);
}
if ($constraints !== NULL) { if ($constraints !== NULL) {
$constraints = $query->logicalAnd($constraints); $constraints = $query->logicalAnd($constraints);
...@@ -139,39 +164,46 @@ class NewsRepository extends AbstractRepository { ...@@ -139,39 +164,46 @@ class NewsRepository extends AbstractRepository {
return $query->matching($constraints)->execute(); return $query->matching($constraints)->execute();
} }
/** // /**
* Method returns the random News of the given amount. // * Method returns the random News of the given amount.
* // *
* @param int $limit // * @param int $limit
* @param News $excludeNews // * @param News $excludeNews
* @return QueryResult // * @return QueryResult
*/ // */
public function findRandomNews($limit = 0, News $excludeNews = NULL) { // public function findRandomNews($limit = 0, News $excludeNews = NULL) {
$query = $this->createQuery(); // $query = $this->createQuery();
$excludeClause = ($excludeNews ? 'AND uid != ' . $excludeNews->getUid() : ''); // $excludeClause = ($excludeNews ? 'AND uid != ' . $excludeNews->getUid() : '');
$statement = 'SELECT * FROM pages WHERE doktype = 116 ' . $excludeClause . // $statement = 'SELECT * FROM pages WHERE doktype = 116 ' . $excludeClause .
$this->getEnableFieldsStatement('pages') . ' ORDER BY RAND()'; // $this->getEnableFieldsStatement('pages') . ' ORDER BY RAND()';
//
if ($limit > 0) { // if ($limit > 0) {
$statement .= ' LIMIT ' . $limit; // $statement .= ' LIMIT ' . $limit;
} // }
//
/** @noinspection PhpUndefinedMethodInspection */ // /** @noinspection PhpUndefinedMethodInspection */
return $query->statement($statement)->execute(); // return $query->statement($statement)->execute();
} // }
/** /**
* Method returns the next News of the given news. * Method returns the next News of the given news.
* *
* @param News $news * @param News $news
* @param string $sortBy date or positionInTree
* @return QueryResult * @return QueryResult
*/ */
public function findNextNewsEntryFromCurrentNews(News $news) { public function findNextNewsEntryFromCurrentNews(News $news, $sortBy = 'date') {
$query = $this->createQuery(); $query = $this->createQuery();
if ($sortBy === 'date') {
$orderBy = 'ORDER BY lastUpdated DESC, crdate DESC';
} else {
$orderBy = 'ORDER BY sorting ASC, lastUpdated DESC, crdate DESC';
}
$statement = 'SELECT * FROM pages WHERE uid = $statement = 'SELECT * FROM pages WHERE uid =
(SELECT MIN(uid) FROM pages WHERE pid = ' . $news->getPid() . ' AND uid > ' . $news->getUid() . (SELECT MIN(uid) FROM pages WHERE pid = ' . $news->getPid() . ' AND uid > ' . $news->getUid() .
$this->getEnableFieldsStatement('pages') . ' ORDER BY lastUpdated DESC, crdate DESC)' . $this->getEnableFieldsStatement('pages') . ' ' . $orderBy . ')' .
$this->getEnableFieldsStatement('pages'); $this->getEnableFieldsStatement('pages');
/** @noinspection PhpUndefinedMethodInspection */ /** @noinspection PhpUndefinedMethodInspection */
...@@ -182,19 +214,24 @@ class NewsRepository extends AbstractRepository { ...@@ -182,19 +214,24 @@ class NewsRepository extends AbstractRepository {
* Method returns the previous News of the given news. * Method returns the previous News of the given news.
* *
* @param News $news * @param News $news
* @param string $sortBy date or positionInTree
* @return QueryResult * @return QueryResult
*/ */
public function findPreviousNewsEntryFromCurrentNews(News $news) { public function findPreviousNewsEntryFromCurrentNews(News $news, $sortBy = 'date') {
$query = $this->createQuery(); $query = $this->createQuery();
if ($sortBy === 'date') {
$orderBy = 'ORDER BY lastUpdated DESC, crdate DESC';
} else {
$orderBy = 'ORDER BY sorting ASC, lastUpdated DESC, crdate DESC';
}
$statement = 'SELECT * FROM pages WHERE uid = $statement = 'SELECT * FROM pages WHERE uid =
(SELECT MAX(uid) FROM pages WHERE pid = ' . $news->getPid() . ' AND uid < ' . $news->getUid() . (SELECT MAX(uid) FROM pages WHERE pid = ' . $news->getPid() . ' AND uid < ' . $news->getUid() .
$this->getEnableFieldsStatement('pages') . ' ORDER BY lastUpdated DESC, crdate DESC)' . $this->getEnableFieldsStatement('pages') . ' ' . $orderBy . ')' .
$this->getEnableFieldsStatement('pages'); $this->getEnableFieldsStatement('pages');
/** @noinspection PhpUndefinedMethodInspection */ /** @noinspection PhpUndefinedMethodInspection */
return $query->statement($statement)->execute(); return $query->statement($statement)->execute();
} }
} }
?>
...@@ -55,9 +55,17 @@ plugin.tx_sgnews { ...@@ -55,9 +55,17 @@ plugin.tx_sgnews {
} }
settings { settings {
# Name of your site - required for the news.xml
siteName = siteName =
# Your rootpage id - required for the news.xml to retrieve the base path
rootpageId = 1 rootpageId = 1
# News limit (can be usually set also inside the flexforms)
newsLimitPerPage = {$plugin.tx_sgnews.settings.newsLimitPerPage} newsLimitPerPage = {$plugin.tx_sgnews.settings.newsLimitPerPage}
# How to sort the news in general (date, positionInTree)
sortBy = date
} }
features { features {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment