Skip to content
Snippets Groups Projects
Commit b28f172d authored by Tim Wagner's avatar Tim Wagner
Browse files

Merge branch 'feature_allowRestrictingNewsOverview' into 'master'

[FEATURE] News Overview Tag / Category Restrictions

See merge request !28
parents 88b02a26 1c714616
No related branches found
No related tags found
1 merge request!28[FEATURE] News Overview Tag / Category Restrictions
......@@ -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 = [];
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
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