Skip to content

Commit

Permalink
Feature/#74 video assists (#97)
Browse files Browse the repository at this point in the history
* Add video referee and assists in fixtures #74
  • Loading branch information
digedag authored Dec 10, 2023
1 parent b20961b commit 79554d9
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Änderungen
==========

## v1.11.7 (??.12.2023)
* Add fields for video assists (#74)

## v1.11.6 (09.12.2023)
* Support for CSP-Headers in TYPO3 12

Expand Down
19 changes: 17 additions & 2 deletions Classes/Model/Fixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,24 @@ public function getStadium()
*/
public function getReferee()
{
if ($this->getProperty('referee')) {
return $this->getProfile('referee');
}

/**
* Liefert den Referee als Datenobjekt.
*
* @return Profile
*/
public function getVideoReferee()
{
return $this->getProfile('videoreferee');
}

private function getProfile(string $attr)
{
if ($this->getProperty($attr)) {
try {
$profile = Profile::getProfileInstance($this->getProperty('referee'));
$profile = Profile::getProfileInstance($this->getProperty($attr));

return $profile->isValid() ? $profile : null;
} catch (Exception $e) {
Expand Down
14 changes: 14 additions & 0 deletions Classes/Model/Repository/ProfileRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ public function getSearchClass()
return ProfileSearch::class;
}

/**
* @return Collection<Profile>
*/
public function findByFixtureRelation(int $fixtureUid, string $fieldName)
{
$fields = $options = [];
$fields['PROFILEMM.UID_FOREIGN'][OP_EQ_INT] = $fixtureUid;
$fields['PROFILEMM.TABLENAMES'][OP_EQ] = 'tx_cfcleague_games';
$fields['PROFILEMM.FIELDNAME'][OP_EQ] = $fieldName;
$options['orderby']['PROFILEMM.SORTING_FOREIGN'] = 'asc';

return $this->search($fields, $options);
}

/**
* @param string $uids
*
Expand Down
7 changes: 6 additions & 1 deletion Classes/Search/ProfileSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/***************************************************************
* Copyright notice
*
* (c) 2006-2021 Rene Nitzsche
* (c) 2006-2023 Rene Nitzsche
* Contact: rene@system25.de
* All rights reserved
*
Expand Down Expand Up @@ -40,6 +40,7 @@ protected function getTableMappings()
{
$tableMapping = [
'PROFILE' => 'tx_cfcleague_profiles',
'PROFILEMM' => 'tx_cfcleague_profiles_mm',
'TEAM' => 'tx_cfcleague_teams',
'TEAMNOTE' => 'tx_cfcleague_team_notes',
];
Expand Down Expand Up @@ -72,6 +73,10 @@ protected function getJoins($tableAliases)
if (isset($tableAliases['TEAM'])) {
$join[] = new Join('PROFILE', 'tx_cfcleague_teams', 'FIND_IN_SET(PROFILE.uid, TEAM.players)', 'TEAM');
}
if (isset($tableAliases['PROFILEMM'])) {
$join[] = new Join('PROFILE', 'tx_cfcleague_profiles_mm', 'PROFILE.uid = PROFILEMM.uid_local', 'PROFILEMM');
}

if (isset($tableAliases['TEAMNOTE'])) {
$join[] = new Join('PROFILE', 'tx_cfcleague_team_notes', 'PROFILE.uid = TEAMNOTE.player', 'TEAMNOTE');
}
Expand Down
45 changes: 42 additions & 3 deletions Configuration/TCA/tx_cfcleague_games.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@
'default' => 0,
'minitems' => 0,
'maxitems' => 1,
'wizards' => Tx_Rnbase_Utility_TcaTool::getWizards('tx_cfcleague_profiles', [
'wizards' => Sys25\RnBase\Backend\Utility\TcaTool::getWizards('tx_cfcleague_profiles', [
'suggest' => true,
]),
],
Expand All @@ -367,11 +367,48 @@
'size' => 3,
'minitems' => 0,
'maxitems' => 5,
'wizards' => Tx_Rnbase_Utility_TcaTool::getWizards('tx_cfcleague_profiles', [
'wizards' => Sys25\RnBase\Backend\Utility\TcaTool::getWizards('tx_cfcleague_profiles', [
'suggest' => true,
]),
],
],
'videoreferee' => [
'exclude' => 1,
'label' => 'LLL:EXT:cfc_league/Resources/Private/Language/locallang_db.xlf:tx_cfcleague_games.videoreferee',
'config' => [
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'tx_cfcleague_profiles',
'size' => 1,
'default' => 0,
'minitems' => 0,
'maxitems' => 1,
'wizards' => Sys25\RnBase\Backend\Utility\TcaTool::getWizards('tx_cfcleague_profiles', [
'suggest' => true,
]),
],
],
'videoassists' => [
'exclude' => 1,
'label' => 'LLL:EXT:cfc_league/Resources/Private/Language/locallang_db.xlf:tx_cfcleague_games.videoassists',
'config' => [
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'tx_cfcleague_profiles',
'size' => 5,
'selectedListStyle' => 'width: 450px;',
'autoSizeMax' => 10,
'minitems' => 0,
'maxitems' => 10,
'MM' => 'tx_cfcleague_profiles_mm',
'MM_foreign_select' => 1,
'MM_opposite_field' => 'relitems',
'MM_match_fields' => [
'tablenames' => 'tx_cfcleague_games',
'fieldname' => 'videoassists',
],
],
],

'goals_home_1' => [
'exclude' => 1,
Expand Down Expand Up @@ -674,7 +711,7 @@
// goals_home_1, goals_guest_1, goals_home_2, goals_guest_2,
'0' => [
'showitem' => 'hidden,match_no,competition,home,guest,round,round_name,date,addinfo,status,--palette--;;6,sets,arena,stadium,visitors,extid,
--div--;LLL:EXT:cfc_league/Resources/Private/Language/locallang_db.xlf:tx_cfcleague_games.tab_lineup,coach_home, players_home, substitutes_home, system_home, system_guest, coach_guest, players_guest, substitutes_guest, referee, assists,
--div--;LLL:EXT:cfc_league/Resources/Private/Language/locallang_db.xlf:tx_cfcleague_games.tab_lineup,coach_home, players_home, substitutes_home, system_home, system_guest, coach_guest, players_guest, substitutes_guest, referee, assists, videoreferee, videoassists,
--div--;LLL:EXT:cfc_league/Resources/Private/Language/locallang_db.xlf:tx_cfcleague_games.tab_lineup_stat,players_home_stat, substitutes_home_stat, players_guest_stat, substitutes_guest_stat, scorer_home_stat, scorer_guest_stat,
--div--;LLL:EXT:cfc_league/Resources/Private/Language/locallang_db.xlf:tx_cfcleague_games.tab_score, is_extratime,--palette--;;2, is_penalty,--palette--;;3,
--div--;LLL:EXT:cfc_league/Resources/Private/Language/locallang_db.xlf:tx_cfcleague_games.game_report, game_report,--palette--;;4, game_report_author,--palette--;;5, t3images, dam_media, dam_media2, video, videoimg',
Expand All @@ -698,6 +735,8 @@
'game_report' => ['RTE' => ['defaultExtras' => $rteConfig]],
'referee' => ['targettable' => 'tx_cfcleague_profiles', 'suggest' => true],
'assists' => ['targettable' => 'tx_cfcleague_profiles', 'suggest' => true],
'videoreferee' => ['targettable' => 'tx_cfcleague_profiles', 'suggest' => true],
'videoassists' => ['targettable' => 'tx_cfcleague_profiles', 'suggest' => true],
]);

$tx_cfcleague_games['columns']['t3images'] = \Sys25\RnBase\Utility\TSFAL::getMediaTCA('t3images', [
Expand Down
2 changes: 1 addition & 1 deletion Configuration/TCA/tx_cfcleague_profiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
'label' => 'LLL:EXT:cfc_league/Resources/Private/Language/locallang_db.xlf:tx_cfcleague_profiles.duration_of_contract',
'config' => [
'type' => 'input',
'renderType' => (\Sys25\RnBase\Utility\TYPO3::isTYPO86OrHigher() ? 'inputDateTime' : ''),
'renderType' => 'inputDateTime',
'size' => '8',
'eval' => 'date',
'checkbox' => '0',
Expand Down
8 changes: 8 additions & 0 deletions Resources/Private/Language/de.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,14 @@
<source>Assists</source>
<target>Linienrichter</target>
</trans-unit>
<trans-unit id="tx_cfcleague_games.videoreferee" xml:space="preserve">
<source>Video-Referee</source>
<target>Video-Schiedsrichter</target>
</trans-unit>
<trans-unit id="tx_cfcleague_games.videoassists" xml:space="preserve">
<source>Video-Assists</source>
<target>Video-Assists</target>
</trans-unit>
<trans-unit id="tx_cfcleague_games.parts_4_default" xml:space="preserve">
<source>Quarter</source>
<target>Viertel</target>
Expand Down
6 changes: 6 additions & 0 deletions Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@
<trans-unit id="tx_cfcleague_games.assists" xml:space="preserve">
<source>Assists</source>
</trans-unit>
<trans-unit id="tx_cfcleague_games.videoreferee" xml:space="preserve">
<source>Video-Referee</source>
</trans-unit>
<trans-unit id="tx_cfcleague_games.videoassists" xml:space="preserve">
<source>Video-Assists</source>
</trans-unit>
<trans-unit id="tx_cfcleague_games.parts_4_default" xml:space="preserve">
<source>Quarter</source>
</trans-unit>
Expand Down
20 changes: 19 additions & 1 deletion ext_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ CREATE TABLE tx_cfcleague_games (

referee int(11) DEFAULT '0' NOT NULL,
assists text,
videoreferee int(11) DEFAULT '0' NOT NULL,
videoassists int(11) DEFAULT '0' NOT NULL,
coach_home int(11) DEFAULT '0' NOT NULL,
coach_guest int(11) DEFAULT '0' NOT NULL,
players_home text,
Expand Down Expand Up @@ -309,7 +311,8 @@ CREATE TABLE tx_cfcleague_profiles (
description text,
types varchar(150) DEFAULT '' NOT NULL,
extid varchar(255) DEFAULT '' NOT NULL,

relitems int(11) DEFAULT '0' NOT NULL,

PRIMARY KEY (uid),
KEY parent (pid)
);
Expand All @@ -328,6 +331,21 @@ CREATE TABLE tx_cfcleague_profiletypes_mm (
KEY uid_foreign (uid_foreign)
);

#
# Table structure for table 'tx_cfcleague_profiletypes_mm'
# uid_local used for fixture
#
CREATE TABLE tx_cfcleague_profiles_mm (
uid_local int(11) unsigned DEFAULT '0' NOT NULL,
uid_foreign int(11) unsigned DEFAULT '0' NOT NULL,
tablenames varchar(50) DEFAULT '' NOT NULL,
fieldname varchar(50) DEFAULT '' NOT NULL,
sorting int(11) unsigned DEFAULT '0' NOT NULL,
sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL,
KEY uid_local (uid_local),
KEY uid_foreign (uid_foreign)
);

#
# Table structure for table 'tx_cfcleague_saison'
#
Expand Down

0 comments on commit 79554d9

Please sign in to comment.