Skip to content

Commit

Permalink
Add option for sorting of matchtable in plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
digedag committed Dec 16, 2023
1 parent 0fc25c0 commit c2f500e
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changes

v1.11.3 (??.12.2023)
* Add video assists to fixtures
* Add option for sort order in match table view

v1.11.2 (09.12.2023)
* Fix statistics view
Expand Down
5 changes: 5 additions & 0 deletions Classes/Filter/MatchFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Sys25\RnBase\Frontend\Marker\Templates;
use Sys25\RnBase\Frontend\Request\RequestInterface;
use Sys25\RnBase\Utility\Misc;
use Sys25\RnBase\Utility\Strings;
use System25\T3sports\Model\Profile;
use System25\T3sports\Utility\MatchTableBuilder;
use System25\T3sports\Utility\ScopeController;
Expand Down Expand Up @@ -59,6 +60,10 @@ protected function initFilter(&$fields, &$options, RequestInterface $request)
$teamId = $parameters->get('teamId');
}

if (!is_array($options['orderby'] ?? null) && $orderby = $options['orderby']) {
list($key, $value) = Strings::trimExplode('=', $orderby);
$options['orderby'] = [$key => $value];
}
$matchtable = new MatchTableBuilder();
$matchtable->setScope($scopeArr);
$matchtable->setTeams($teamId);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Frontend/Action/MatchTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2007-2017 Rene Nitzsche ([email protected])
* (c) 2007-2023 Rene Nitzsche ([email protected])
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
Expand Down
32 changes: 32 additions & 0 deletions Configuration/Flexform/plugin_competition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,38 @@
</config>
</TCEforms>
</matchtable.options.limit>
<matchtable.options.orderby>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:cfc_league_fe/Resources/Private/Language/locallang_db.xlf:plugin.competition.flexform.matchtable.orderby
</label>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:cfc_league_fe/Resources/Private/Language/locallang_db.xlf:plugin.competition.flexform.matchtable.orderby.typoscript</numIndex>
<numIndex index="1"></numIndex>
</numIndex>
<numIndex index="5" type="array">
<numIndex index="0">LLL:EXT:cfc_league_fe/Resources/Private/Language/locallang_db.xlf:plugin.competition.flexform.matchtable.orderby.date.desc</numIndex>
<numIndex index="1">MATCH.DATE=desc</numIndex>
</numIndex>
<numIndex index="6" type="array">
<numIndex index="0">LLL:EXT:cfc_league_fe/Resources/Private/Language/locallang_db.xlf:plugin.competition.flexform.matchtable.orderby.date.asc</numIndex>
<numIndex index="1">MATCH.DATE=asc</numIndex>
</numIndex>
<numIndex index="10" type="array">
<numIndex index="0">LLL:EXT:cfc_league_fe/Resources/Private/Language/locallang_db.xlf:plugin.competition.flexform.matchtable.orderby.number.asc</numIndex>
<numIndex index="1">MATCH.MATCH_NO=asc</numIndex>
</numIndex>
</items>
<multiple>0</multiple>
<maxitems>1</maxitems>
<size>1</size>
</config>
</TCEforms>
</matchtable.options.orderby>

<matchtable.timeRangePast>
<TCEforms>
Expand Down
20 changes: 20 additions & 0 deletions Resources/Private/Language/de.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,26 @@
<source>Max matches to show</source>
<target>Max. Anzahl Spiele</target>
</trans-unit>
<trans-unit id="plugin.competition.flexform.matchtable.orderby" xml:space="preserve">
<source>Sort order of matches</source>
<target>Sortierung der Spiele</target>
</trans-unit>
<trans-unit id="plugin.competition.flexform.matchtable.orderby.typoscript" xml:space="preserve">
<source>As configured by typoscript</source>
<target>Per Typoscript konfiguriert</target>
</trans-unit>
<trans-unit id="plugin.competition.flexform.matchtable.orderby.date.asc" xml:space="preserve">
<source>Kickoff date ascending</source>
<target>Spielbeginn ansteigend</target>
</trans-unit>
<trans-unit id="plugin.competition.flexform.matchtable.orderby.date.desc" xml:space="preserve">
<source>Kickoff date descending</source>
<target>Spielbeginn absteigend</target>
</trans-unit>
<trans-unit id="plugin.competition.flexform.matchtable.orderby.number.desc" xml:space="preserve">
<source>Fixture number ascending</source>
<target>Spielnummer ansteigend</target>
</trans-unit>
<trans-unit id="plugin.competition.flexform.matchtable.report_page" xml:space="preserve">
<source>Page for report</source>
<target>Seite für Spielbericht</target>
Expand Down
15 changes: 15 additions & 0 deletions Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,21 @@
<trans-unit id="plugin.competition.flexform.matchtable.limit" xml:space="preserve">
<source>Max matches to show</source>
</trans-unit>
<trans-unit id="plugin.competition.flexform.matchtable.orderby" xml:space="preserve">
<source>Sort order of matches</source>
</trans-unit>
<trans-unit id="plugin.competition.flexform.matchtable.orderby.typoscript" xml:space="preserve">
<source>As configured by typoscript</source>
</trans-unit>
<trans-unit id="plugin.competition.flexform.matchtable.orderby.date.asc" xml:space="preserve">
<source>Kickoff date ascending</source>
</trans-unit>
<trans-unit id="plugin.competition.flexform.matchtable.orderby.date.desc" xml:space="preserve">
<source>Kickoff date descending</source>
</trans-unit>
<trans-unit id="plugin.competition.flexform.matchtable.orderby.number.desc" xml:space="preserve">
<source>Fixture number ascending</source>
</trans-unit>
<trans-unit id="plugin.competition.flexform.matchtable.report_page" xml:space="preserve">
<source>Page for report</source>
</trans-unit>
Expand Down

0 comments on commit c2f500e

Please sign in to comment.