diff --git a/Classes/Table/Factory.php b/Classes/Table/Factory.php index 52146ff..7c8a67e 100644 --- a/Classes/Table/Factory.php +++ b/Classes/Table/Factory.php @@ -6,6 +6,7 @@ use System25\T3sports\Table\Football\Table as FootballTable; use System25\T3sports\Table\Handball\Table as HandballTable; use System25\T3sports\Table\Icehockey\Table as IcehockeyTable; +use System25\T3sports\Table\Judo\Table as JudoTable; use System25\T3sports\Table\Volleyball\Table as VolleyballTable; use tx_rnbase; @@ -64,6 +65,7 @@ public static function createTableType($type) FootballTable::TABLE_TYPE => FootballTable::class, HandballTable::TABLE_TYPE => HandballTable::class, IcehockeyTable::TABLE_TYPE => IcehockeyTable::class, + JudoTable::TABLE_TYPE => JudoTable::class, VolleyballTable::TABLE_TYPE => VolleyballTable::class, ]; diff --git a/Classes/Table/Judo/Configurator.php b/Classes/Table/Judo/Configurator.php new file mode 100644 index 0000000..ee1c592 --- /dev/null +++ b/Classes/Table/Judo/Configurator.php @@ -0,0 +1,98 @@ +cfgPointSystem; + } + + /** + * @return IComparator + */ + public function getComparator(): IComparator + { + $compareClass = $this->cfgComparatorClass ? $this->cfgComparatorClass : Comparator::class; + $comparator = tx_rnbase::makeInstance($compareClass); + if (!is_object($comparator)) { + throw new Exception('Could not instanciate comparator: '.$compareClass); + } + if (!($comparator instanceof IComparator)) { + throw new Exception('Comparator is no instance of tx_cfcleaguefe_table_football_IComparator: '.get_class($comparator)); + } + + return $comparator; + } + + protected function init() + { + // Der TableScope wirkt sich auf die betrachteten Spiele (Hin-Rückrunde) aus + $parameters = $this->configurations->getParameters(); + $this->cfgTableScope = $this->getConfValue('tablescope'); + // Wir bleiben mit den alten falschen TS-Einstellungen kompatibel und fragen + // beide Einstellungen ab + if ($this->configurations->get('tabletypeSelectionInput') || $this->getConfValue('tablescopeSelectionInput')) { + $this->cfgTableScope = $parameters->offsetGet('tablescope') ? $parameters->offsetGet('tablescope') : $this->cfgTableScope; + } + + // tabletype means home or away matches only + $this->cfgTableType = $this->getConfValue('tabletype'); + if ($this->configurations->get('tabletypeSelectionInput') || $this->getConfValue('tabletypeSelectionInput')) { + $this->cfgTableType = $parameters->offsetGet('tabletype') ? $parameters->offsetGet('tabletype') : $this->cfgTableType; + } + + $this->cfgPointSystem = $this->getCompetition()->getProperty('point_system'); + if ($this->configurations->get('pointSystemSelectionInput') || $this->getConfValue('pointSystemSelectionInput')) { + $this->cfgPointSystem = is_string($parameters->offsetGet('pointsystem')) ? intval($parameters->offsetGet('pointsystem')) : $this->cfgPointSystem; + } + $this->cfgLiveTable = (int) $this->getConfValue('showLiveTable'); + $this->cfgComparatorClass = $this->getStrategyValue('comparator'); + } +} diff --git a/Classes/Table/Judo/Table.php b/Classes/Table/Judo/Table.php new file mode 100644 index 0000000..6817aa3 --- /dev/null +++ b/Classes/Table/Judo/Table.php @@ -0,0 +1,246 @@ +configurator)) { + $configuratorClass = $this->getConfValue('configuratorClass'); + $configuratorClass = $configuratorClass ? $configuratorClass : Configurator::class; + $this->configurator = tx_rnbase::makeInstance($configuratorClass, $this->getMatchProvider()->getBaseCompetition(), $this->configuration, $this->confId); + } + + return $this->configurator; + } + + /** + * Zählt die Punkte für eine normale Tabelle. + * + * @param Fixture $match + * @param int $toto + * @param IConfigurator $configurator + */ + protected function countStandard($match, $toto, IConfigurator $configurator) + { + // Anzahl Spiele aktualisieren + $home = $match->getHome(); + $guest = $match->getGuest(); + $this->addMatchCount($home); + $this->addMatchCount($guest); + + // Für H2H modus das Spielergebnis merken + $this->addResult($home, $guest, $match->getResult()); + + if (0 == $toto) { // Unentschieden + $this->addPoints($home, $configurator->getPointsDraw()); + $this->addPoints($guest, $configurator->getPointsDraw()); + if ($configurator->isCountLoosePoints()) { + $this->addPoints2($home, $configurator->getPointsDraw()); + $this->addPoints2($guest, $configurator->getPointsDraw()); + } + + $this->addDrawCount($home); + $this->addDrawCount($guest); + } elseif (1 == $toto) { // Heimsieg + // Für die + $this->addPoints($home, $configurator->getPointsWin($match->getGoalsHome(), $match->getGoalsGuest())); + $this->addPoints($guest, $configurator->getPointsLoose($match->getGoalsHome(), $match->getGoalsGuest())); + + if ($configurator->isCountLoosePoints()) { + $this->addPoints2($guest, $configurator->getPointsLoose($match->getGoalsHome(), $match->getGoalsGuest())); + } + + $this->addWinCount($home); + $this->addLoseCount($guest); + } else { // Auswärtssieg + $this->addPoints($home, $configurator->getPointsLoose($match->getGoalsHome(), $match->getGoalsGuest())); + $this->addPoints($guest, $configurator->getPointsWin($match->getGoalsHome(), $match->getGoalsGuest())); + + if ($configurator->isCountLoosePoints()) { + $this->addPoints2($home, $configurator->getPointsWin($match->getGoalsHome(), $match->getGoalsGuest())); + } + $this->addLoseCount($home); + $this->addWinCount($guest); + } + + // $ballsHome = MatchSets::countSetPointsHome($match); + // $ballsGuest = MatchSets::countSetPointsGuest($match); + // $this->addBalls($home, $ballsHome, $ballsGuest); + // $this->addBalls($guest, $ballsGuest, $ballsHome); + + // Jetzt die Tore summieren + $this->addSets($home, $match->getGoalsHome(), $match->getGoalsGuest()); + $this->addSets($guest, $match->getGoalsGuest(), $match->getGoalsHome()); + } + + protected function initTeam(ITeam $team) + { + $this->_teamData->setTeamData($team, 'balls1', 0); + $this->_teamData->setTeamData($team, 'balls2', 0); + $this->_teamData->setTeamData($team, 'balls_diff', 0); + $this->_teamData->setTeamData($team, 'sets1', 0); + $this->_teamData->setTeamData($team, 'sets2', 0); + $this->_teamData->setTeamData($team, 'sets_diff', 0); + } + + /** + * Addiert Sätze zu einem Team. + */ + protected function addSets(ITeam $team, $sets1, $sets2) + { + $data = $this->_teamData->getTeamData($team->getTeamId()); + $newSets1 = $data['sets1'] + $sets1; + $newSets2 = $data['sets2'] + $sets2; + $this->_teamData->setTeamData($team, 'sets1', $newSets1); + $this->_teamData->setTeamData($team, 'sets2', $newSets2); + $this->_teamData->setTeamData($team, 'sets_diff', $newSets1 - $newSets2); + // TODO: Muss hier ggf. gerundet werden?? + $this->_teamData->setTeamData($team, 'sets_quot', $newSets1 / ($newSets2 > 0 ? $newSets2 : 1)); + } + + /** + * Addiert Bälle zu einem Team. + */ + protected function addBalls(ITeam $team, $balls1, $balls2) + { + $data = $this->_teamData->getTeamData($team->getTeamId()); + $newBalls1 = $data['balls1'] + $balls1; + $newBalls2 = $data['balls2'] + $balls2; + $this->_teamData->setTeamData($team, 'balls1', $newBalls1); + $this->_teamData->setTeamData($team, 'balls2', $newBalls2); + $this->_teamData->setTeamData($team, 'balls_diff', $newBalls1 - $newBalls2); + $this->_teamData->setTeamData($team, 'balls_quot', $newBalls1 / ($newBalls2 > 0 ? $newBalls2 : 1)); + } + + /** + * Zählt die Punkte für eine Heimspieltabelle. Die Ergebnisse werden als nur für die + * Heimmannschaft gewertet. + * + * @param Fixture $match + * @param int $toto + * @param IConfigurator $configurator + */ + protected function countHome($match, $toto, IConfigurator $configurator) + { + $home = $match->getHome(); + $guest = $match->getGuest(); + + // Anzahl Spiele aktualisieren + $this->addMatchCount($home); + $this->addResult($home, $guest, $match->getGuest()); + + if (0 == $toto) { // Unentschieden + $this->addPoints($home, $configurator->getPointsDraw()); + if ($configurator->isCountLoosePoints()) { + $this->addPoints2($home, $configurator->getPointsDraw()); + } + $this->addDrawCount($home); + } elseif (1 == $toto) { // Heimsieg + $this->addPoints($home, $configurator->getPointsWin($match->isExtraTime(), $match->isPenalty())); + $this->addWinCount($home); + } else { // Auswärtssieg + $this->addPoints($home, $configurator->getPointsLoose($match->isExtraTime(), $match->isPenalty())); + if ($configurator->isCountLoosePoints()) { + $this->addPoints2($home, $configurator->getPointsWin($match->isExtraTime(), $match->isPenalty())); + } + $this->addLoseCount($home); + } + // $ballsHome = MatchSets::countSetPointsHome($match); + // $ballsGuest = MatchSets::countSetPointsGuest($match); + // $this->addBalls($home, $ballsHome, $ballsGuest); + + // Jetzt die Sätze summieren + $this->addSets($home, $match->getGoalsHome(), $match->getGoalsGuest()); + } + + /** + * Zählt die Punkte für eine Auswärtstabelle. Die Ergebnisse werden als nur für die + * Gastmannschaft gewertet. + * + * @param Fixture $match + * @param int $toto + * @param IConfigurator $configurator + */ + protected function countGuest($match, $toto, IConfigurator $configurator) + { + $home = $match->getHome(); + $guest = $match->getGuest(); + // Anzahl Spiele aktualisieren + $this->addMatchCount($guest); + $this->addResult($home, $guest, $match->getGuest()); + + if (0 == $toto) { // Unentschieden + $this->addPoints($guest, $configurator->getPointsDraw()); + if ($configurator->isCountLoosePoints()) { + $this->addPoints2($guest, $configurator->getPointsDraw()); + } + $this->addDrawCount($guest); + } elseif (1 == $toto) { // Heimsieg + $this->addPoints($guest, $configurator->getPointsLoose($match->isExtraTime(), $match->isPenalty())); + if ($configurator->isCountLoosePoints()) { + $this->addPoints2($guest, $configurator->getPointsWin($match->isExtraTime(), $match->isPenalty())); + } + $this->addLoseCount($guest); + } else { // Auswärtssieg + $this->addPoints($guest, $configurator->getPointsWin($match->isExtraTime(), $match->isPenalty())); + $this->addWinCount($guest); + } + + $ballsHome = MatchSets::countSetPointsHome($match); + $ballsGuest = MatchSets::countSetPointsGuest($match); + $this->addBalls($guest, $ballsGuest, $ballsHome); + + // Jetzt die Tore summieren + $this->addSets($guest, $match->getGoalsGuest(), $match->getGoalsHome()); + } + + public function getTypeID(): string + { + return self::TABLE_TYPE; + } +} diff --git a/Classes/Table/Volleyball/Comparator.php b/Classes/Table/Volleyball/Comparator.php index 084e613..29195bf 100644 --- a/Classes/Table/Volleyball/Comparator.php +++ b/Classes/Table/Volleyball/Comparator.php @@ -7,11 +7,7 @@ /*************************************************************** * Copyright notice * -<<<<<<< HEAD * (c) 2011-2024 Rene Nitzsche (rene@system25.de) -======= - * (c) 2011-2023 Rene Nitzsche (rene@system25.de) ->>>>>>> master * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is diff --git a/Classes/Table/Volleyball/Configurator.php b/Classes/Table/Volleyball/Configurator.php index c6ce069..859c1cf 100644 --- a/Classes/Table/Volleyball/Configurator.php +++ b/Classes/Table/Volleyball/Configurator.php @@ -103,13 +103,13 @@ public function getComparator() { $comparatorClass = $this->cfgComparatorClass; if (!$comparatorClass) { - $compareClass = self::POINT_SYSTEM_2POINT == $this->getPointSystem() ? + $comparatorClass = self::POINT_SYSTEM_2POINT == $this->getPointSystem() ? Comparator::class : Comparator3Point::class; } - $comparator = tx_rnbase::makeInstance($compareClass); + $comparator = tx_rnbase::makeInstance($comparatorClass); if (!is_object($comparator)) { - throw new Exception('Could not instanciate comparator: '.$compareClass); + throw new Exception('Could not instanciate comparator: '.$comparatorClass); } if (!($comparator instanceof IComparator)) { throw new Exception('Comparator is no instance of tx_cfcleaguefe_table_volleyball_IComparator: '.get_class($comparator)); diff --git a/Resources/Private/Templates/Html/leaguetable.html b/Resources/Private/Templates/Html/leaguetable.html index bcc3dcd..db92949 100644 --- a/Resources/Private/Templates/Html/leaguetable.html +++ b/Resources/Private/Templates/Html/leaguetable.html @@ -283,6 +283,81 @@
+###CONTROL_TABLETYPE_NORMAL_LINK### ###LABEL_TABLETYPE_NORMAL### ###CONTROL_TABLETYPE_NORMAL_LINK### +###CONTROL_TABLETYPE_HOME_LINK### ###LABEL_TABLETYPE_HOME### ###CONTROL_TABLETYPE_HOME_LINK### +###CONTROL_TABLETYPE_AWAY_LINK### ###LABEL_TABLETYPE_AWAY### ###CONTROL_TABLETYPE_AWAY_LINK### +
+###CONTROL_TABLETYPE### + +###CONTROL_TABLESCOPE### ++###CONTROL_TABLESCOPE_NORMAL_LINK### ###LABEL_TABLESCOPE_NORMAL### ###CONTROL_TABLESCOPE_NORMAL_LINK### +###CONTROL_TABLESCOPE_FIRST_LINK### ###LABEL_TABLESCOPE_FIRST### ###CONTROL_TABLESCOPE_FIRST_LINK### +###CONTROL_TABLESCOPE_SECOND_LINK### ###LABEL_TABLESCOPE_SECOND### ###CONTROL_TABLESCOPE_SECOND_LINK### +
+###CONTROL_TABLESCOPE### + +###CONTROL_POINTSYSTEM### ++###CONTROL_POINTSYSTEM_POINT3_LINK### ###LABEL_POINTSYSTEM_POINT3### ###CONTROL_POINTSYSTEM_POINT3_LINK### +###CONTROL_POINTSYSTEM_POINT2_LINK### ###LABEL_POINTSYSTEM_POINT2### ###CONTROL_POINTSYSTEM_POINT2_LINK### +
+###CONTROL_POINTSYSTEM### + +Pl. | ###LABEL_CLUB### | ###LABEL_MATCHES### | S | U | N | ###LABEL_BALLS### | ###LABEL_DIFF### | ###LABEL_SETS### | ###LABEL_DIFF### | ###LABEL_POINTS### | +
---|---|---|---|---|---|---|---|---|---|---|
###ROW_POSITION###. (###ROW_OLDPOSITION###) | +###ROW_LOGO### ###ROW_SHOWTEAMLINK######ROW_NAME######ROW_PENALTIES######ROW_SHOWTEAMLINK### (###ROW_SHOWMATCHTABLELINK######LABEL_MATCHTABLE######ROW_SHOWMATCHTABLELINK###) | +###ROW_MATCHCOUNT### | +###ROW_WINCOUNT### | +###ROW_DRAWCOUNT### | +###ROW_LOSECOUNT### | +###ROW_BALLS1###:###ROW_BALLS2### | +###ROW_BALLS_DIFF######ROW_BALLS_QUOT### | +###ROW_SETS1###:###ROW_SETS2### | +###ROW_SETS_DIFF######ROW_SETS_QUOT### | +###ROW_POINTS######ROW_POINTS2### | +
Hinweise
+ +* ###PENALTY_COMMENT### +
+ +