diff --git a/Classes/Controller/OverviewController.php b/Classes/Controller/OverviewController.php index a4d7b4e284718e1a34b4e303b88cd67979461d0f..7b6b2ede07d2dd14454235754bf375f382e9a7c1 100644 --- a/Classes/Controller/OverviewController.php +++ b/Classes/Controller/OverviewController.php @@ -160,6 +160,19 @@ class OverviewController extends AbstractController { return; } + $categoryRestrictions = GeneralUtility::intExplode(',', $this->settings['categoryRestrictions'], TRUE); + if (count($categoryRestrictions) > 0) { + foreach ($categories as $key => $category) { + if (!in_array($category->getUid(), $categoryRestrictions, TRUE)) { + unset($categories[$key]); + } + } + } + + if (count($categories) <= 0) { + return; + } + $startTime = (int) $this->settings['starttime']; $endTime = (int) $this->settings['endtime']; @@ -331,6 +344,15 @@ class OverviewController extends AbstractController { $tags = $this->tagRepository->findAll()->toArray(); } + $tagRestrictions = GeneralUtility::intExplode(',', $this->settings['tagRestrictions'], TRUE); + if (count($tagRestrictions) > 0) { + foreach ($tags as $key => $tag) { + if (!in_array($tag->getUid(), $tagRestrictions, TRUE)) { + unset($tags[$key]); + } + } + } + // Get news by tag id $tagIds = []; $tagsById = []; diff --git a/Configuration/FlexForms/Overview.xml b/Configuration/FlexForms/Overview.xml index 07f900705588d5819e8de897e059390adff7e8c8..e41b3c61dc9d0aa052c86ec86d78cb891a5352e5 100644 --- a/Configuration/FlexForms/Overview.xml +++ b/Configuration/FlexForms/Overview.xml @@ -13,6 +13,7 @@ <settings.groupBy> <TCEforms> <label>LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.overview.flexForm.groupBy</label> + <onChange>reload</onChange> <config> <type>select</type> <renderType>selectSingle</renderType> @@ -34,6 +35,48 @@ </config> </TCEforms> </settings.groupBy> + + <settings.categoryRestrictions> + <TCEforms> + <label>LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.overview.flexForm.categoryRestrictions</label> + <description>LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.overview.flexForm.categoryRestrictions.description</description> + <displayCond>FIELD:settings.groupBy:=:1</displayCond> + <config> + <type>select</type> + <renderType>selectMultipleSideBySide</renderType> + <size>5</size> + <minitems>0</minitems> + <maxitems>99</maxitems> + <foreign_table>pages</foreign_table> + <foreign_table_where>AND pages.sys_language_uid IN (-1, 0) AND pages.doktype = 117 ORDER BY pages.title</foreign_table_where> + </config> + </TCEforms> + </settings.categoryRestrictions> + + <settings.tagRestrictions> + <TCEforms> + <label>LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.tags</label> + <description>LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.overview.flexForm.tags.description</description> + <displayCond>FIELD:settings.groupBy:=:2</displayCond> + <config> + <type>select</type> + <renderType>selectTree</renderType> + <size>10</size> + <maxitems>9999</maxitems> + <foreign_table>sys_category</foreign_table> + <foreign_table_where>AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.sorting ASC</foreign_table_where> + <treeConfig> + <parentField>parent</parentField> + <appearance> + <expandAll>1</expandAll> + <maxLevels>99</maxLevels> + <showHeader>1</showHeader> + </appearance> + </treeConfig> + </config> + </TCEforms> + </settings.tagRestrictions> + <settings.enableFilter> <TCEforms> <label>LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.overview.flexForm.enableFilter</label> diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index af0288e6e827287f35a1d89ff65cac70859a560f..16c8126a01e2359a189e98707003e18dbc62f4c2 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -169,6 +169,16 @@ <source><![CDATA[only if endless scrolling is not enabled]]></source> <target><![CDATA[nur wenn Endless Scrolling nicht aktiv ist]]></target> </trans-unit> + <trans-unit id="plugin.overview.flexForm.categoryRestrictions" approved="yes"> + <source><![CDATA[Category Selection]]></source> + <target><![CDATA[Kategorienauswahl]]></target> + </trans-unit> + <trans-unit id="plugin.overview.flexForm.categoryRestrictions.description" approved="yes"> + <source><![CDATA[You can select specific categories to be shown in the tabs. +If none are selected, all categories will be available in the frontend.]]></source> + <target><![CDATA[Es werden nur ausgewählte Kategorien in den Tabs angezeigt. +Wenn keine ausgewählt werden, sind alle Kategorien im Frontend verfügbar.]]></target> + </trans-unit> <trans-unit id="plugin.overview.flexForm.enableFilter" approved="yes"> <source><![CDATA[Enable filtering by criteria that are not grouped in tabs]]></source> <target><![CDATA[Filtern nach Kriterien, die nicht in Tabs sortiert sind, ermöglichen]]></target> @@ -201,6 +211,12 @@ <source><![CDATA[Include only news subpages of the page containing this overview]]></source> <target><![CDATA[Beachte nur News-Unterseiten der Seite, die diese Übersicht beinhaltet]]></target> </trans-unit> + <trans-unit id="plugin.overview.flexForm.tags.description" approved="yes"> + <source><![CDATA[You can select specific tags to be shown in the tabs. +If none are selected, all tags will be available in the frontend.]]></source> + <target><![CDATA[Es werden nur ausgewählte Tags in den Tabs angezeigt. +Wenn keine ausgewählt werden, sind alle Tags im Frontend verfügbar.]]></target> + </trans-unit> <trans-unit id="tx_sgnews_domain_model_author" approved="yes"> <source><![CDATA[Author]]></source> <target><![CDATA[Autor]]></target> diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index d0b3cc707179a07d667fc042089cb9cf3939fcf0..8172b5ebfe911b48f751d10ae607f925cba41376 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -129,6 +129,13 @@ <trans-unit id="plugin.listByCategory.flexForm.newsLimitPerPage.description"> <source><![CDATA[only if endless scrolling is not enabled]]></source> </trans-unit> + <trans-unit id="plugin.overview.flexForm.categoryRestrictions"> + <source><![CDATA[Category Selection]]></source> + </trans-unit> + <trans-unit id="plugin.overview.flexForm.categoryRestrictions.description"> + <source><![CDATA[You can select specific categories to be shown in the tabs. +If none are selected, all categories will be available in the frontend.]]></source> + </trans-unit> <trans-unit id="plugin.overview.flexForm.enableFilter"> <source><![CDATA[Enable filtering by criteria that are not grouped in tabs]]></source> </trans-unit> @@ -153,6 +160,10 @@ <trans-unit id="plugin.overview.flexForm.onlyNewsWithinThisPageSection"> <source><![CDATA[Include only news subpages of the page containing this overview]]></source> </trans-unit> + <trans-unit id="plugin.overview.flexForm.tags.description"> + <source><![CDATA[You can select specific tags to be shown in the tabs. +If none are selected, all tags will be available in the frontend.]]></source> + </trans-unit> <trans-unit id="tx_sgnews_domain_model_author"> <source><![CDATA[Author]]></source> </trans-unit>