-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
353 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
|
||
use Sys25\RnBase\Backend\Form\ToolBox; | ||
use Sys25\RnBase\Backend\Module\BaseModFunc; | ||
use Sys25\RnBase\Configuration\ConfigurationInterface; | ||
use Sys25\RnBase\Frontend\Marker\FormatUtil; | ||
use Sys25\RnBase\Frontend\Marker\Templates; | ||
use System25\T3sports\Controller\Competition\DfbSync; | ||
|
@@ -17,7 +16,7 @@ | |
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2008-2023 Rene Nitzsche ([email protected]) | ||
* (c) 2008-2024 Rene Nitzsche ([email protected]) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
|
@@ -53,6 +52,10 @@ class Competition extends BaseModFunc | |
* @var DfbSync | ||
*/ | ||
private $dfbSync; | ||
/** | ||
* @var MatchEdit | ||
*/ | ||
private $matchEdit; | ||
|
||
public $MCONF; | ||
|
||
|
@@ -71,9 +74,10 @@ public function getModuleIdentifier() | |
return 'cfc_league'; | ||
} | ||
|
||
public function __construct(?DfbSync $dfbSync = null) | ||
public function __construct(?MatchEdit $matchEdit = null, ?DfbSync $dfbSync = null) | ||
{ | ||
$this->dfbSync = $dfbSync ?: tx_rnbase::makeInstance(DfbSync::class); | ||
$this->matchEdit = $matchEdit ?: tx_rnbase::makeInstance(MatchEdit::class); | ||
} | ||
|
||
/** | ||
|
@@ -168,9 +172,7 @@ protected function getContent($template, &$configurations, &$formatter, $formToo | |
|
||
private function showEditMatches($current_league, $module) | ||
{ | ||
/** @var MatchEdit $subMod */ | ||
$subMod = tx_rnbase::makeInstance(MatchEdit::class); | ||
$content = $subMod->main($module, $current_league); | ||
$content = $this->matchEdit->main($module, $current_league); | ||
|
||
return $content; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2007-2023 Rene Nitzsche ([email protected]) | ||
* (c) 2007-2024 Rene Nitzsche ([email protected]) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
|
@@ -65,9 +65,9 @@ class MatchEdit | |
*/ | ||
private $module; | ||
|
||
public function __construct() | ||
public function __construct(?ServiceLocator $serviceLocator = null) | ||
{ | ||
$this->sportsServiceLocator = new ServiceLocator(); | ||
$this->sportsServiceLocator = $serviceLocator ?? ServiceLocator::getInstance(); | ||
} | ||
|
||
/** | ||
|
@@ -277,10 +277,14 @@ private function getHeadline($parts, $competition) | |
$arr[] = $label ? $label : $i.'. part'; | ||
} | ||
} | ||
$sports = $this->sportsServiceLocator->getSportsService($competition->getSports()); | ||
$sports = $this->sportsServiceLocator->getSportsByIdentifier($competition->getSports()); | ||
if ($sports->isSetBased()) { | ||
$arr[] = $LANG->getLL('tx_cfcleague_games_sets'); | ||
} | ||
if ($sports->hasPoints()) { | ||
$arr[] = $LANG->getLL('tx_cfcleague_games_points_home'); | ||
$arr[] = $LANG->getLL('tx_cfcleague_games_points_guest'); | ||
} | ||
|
||
$arr[] = $LANG->getLL('tx_cfcleague_games.visitors'); | ||
|
||
|
@@ -349,10 +353,14 @@ private function createTableArray($matches, $competition) | |
$row[] = $this->formTool->createIntInput('data[tx_cfcleague_games]['.$matchUid.'][goals_home_'.$i.']', $match->getProperty('goals_home_'.$i), 3).' : '.$this->formTool->createIntInput('data[tx_cfcleague_games]['.$matchUid.'][goals_guest_'.$i.']', $match->getProperty('goals_guest_'.$i), 3); | ||
} | ||
|
||
$sports = $this->sportsServiceLocator->getSportsService($competition->getSports()); | ||
$sports = $this->sportsServiceLocator->getSportsByIdentifier($competition->getSports()); | ||
if ($sports->isSetBased()) { | ||
$row[] = $this->formTool->createTxtInput('data[tx_cfcleague_games]['.$matchUid.'][sets]', $match->getProperty('sets'), 12); | ||
} | ||
if ($sports->hasPoints()) { | ||
$row[] = $this->formTool->createTxtInput('data[tx_cfcleague_games]['.$matchUid.'][points_home]', $match->getProperty('points_home'), 12); | ||
$row[] = $this->formTool->createTxtInput('data[tx_cfcleague_games]['.$matchUid.'][points_guest]', $match->getProperty('points_guest'), 12); | ||
} | ||
|
||
$row[] = $this->formTool->createIntInput('data[tx_cfcleague_games]['.$matchUid.'][visitors]', $match->getProperty('visitors'), 6); | ||
$arr[0][] = $row; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\DependencyInjection; | ||
|
||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
use System25\T3sports\Sports\ServiceLocator; | ||
|
||
class SportsCompilerPass implements CompilerPassInterface | ||
{ | ||
public function process(ContainerBuilder $container): void | ||
{ | ||
// always first check if the primary service is defined | ||
if (!$container->has(ServiceLocator::class)) { | ||
return; | ||
} | ||
|
||
$definition = $container->findDefinition(ServiceLocator::class); | ||
|
||
// find all service IDs with the t3sports.sports tag | ||
$taggedServices = $container->findTaggedServiceIds('t3sports.sports'); | ||
|
||
foreach ($taggedServices as $id => $tags) { | ||
// add the indexer to the IndexerProvider service | ||
$definition->addMethodCall('addSports', [new Reference($id)]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,13 @@ | |
|
||
namespace System25\T3sports\Sports; | ||
|
||
use Sys25\RnBase\Typo3Wrapper\Service\AbstractService; | ||
use Sys25\RnBase\Utility\Misc; | ||
use tx_rnbase; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2008-2021 Rene Nitzsche ([email protected]) | ||
* (c) 2008-2024 Rene Nitzsche ([email protected]) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
|
@@ -29,7 +28,7 @@ | |
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
class Football extends AbstractService implements ISports | ||
class Football implements ISports | ||
{ | ||
/** | ||
* @return array | ||
|
@@ -47,7 +46,12 @@ public function getTCALabel() | |
return 'Football'; | ||
} | ||
|
||
public function isSetBased() | ||
public function isSetBased(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function hasPoints(): bool | ||
{ | ||
return false; | ||
} | ||
|
@@ -69,4 +73,9 @@ public function getMatchInfo() | |
|
||
return $this->matchInfo; | ||
} | ||
|
||
public function getIdentifier(): string | ||
{ | ||
return 'football'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,13 @@ | |
|
||
namespace System25\T3sports\Sports; | ||
|
||
use Sys25\RnBase\Typo3Wrapper\Service\AbstractService; | ||
use Sys25\RnBase\Utility\Misc; | ||
use tx_rnbase; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2017-2020 Rene Nitzsche ([email protected]) | ||
* (c) 2017-2024 Rene Nitzsche ([email protected]) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
|
@@ -29,7 +28,7 @@ | |
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
class Handball extends AbstractService implements ISports | ||
class Handball implements ISports | ||
{ | ||
/** | ||
* @return array | ||
|
@@ -49,7 +48,12 @@ public function getTCALabel() | |
return 'Handball'; | ||
} | ||
|
||
public function isSetBased() | ||
public function isSetBased(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function hasPoints(): bool | ||
{ | ||
return false; | ||
} | ||
|
@@ -72,4 +76,9 @@ public function getMatchInfo() | |
|
||
return $this->matchInfo; | ||
} | ||
|
||
public function getIdentifier(): string | ||
{ | ||
return 'handball'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,13 @@ | |
|
||
namespace System25\T3sports\Sports; | ||
|
||
use Sys25\RnBase\Typo3Wrapper\Service\AbstractService; | ||
use Sys25\RnBase\Utility\Misc; | ||
use tx_rnbase; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2008-2020 Rene Nitzsche ([email protected]) | ||
* (c) 2008-2024 Rene Nitzsche ([email protected]) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
|
@@ -29,7 +28,7 @@ | |
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
class IceHockey extends AbstractService implements ISports | ||
class IceHockey implements ISports | ||
{ | ||
/** | ||
* @return array | ||
|
@@ -47,7 +46,12 @@ public function getTCALabel() | |
return 'Icehockey'; | ||
} | ||
|
||
public function isSetBased() | ||
public function isSetBased(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function hasPoints(): bool | ||
{ | ||
return false; | ||
} | ||
|
@@ -70,4 +74,9 @@ public function getMatchInfo() | |
|
||
return $this->matchInfo; | ||
} | ||
|
||
public function getIdentifier(): string | ||
{ | ||
return 'icehockey'; | ||
} | ||
} |
Oops, something went wrong.