Skip to content

Commit

Permalink
#99 Add judo as sports
Browse files Browse the repository at this point in the history
  • Loading branch information
digedag committed Mar 10, 2024
1 parent 212e894 commit 861a357
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 51 deletions.
8 changes: 4 additions & 4 deletions Classes/Controller/Competition/MatchEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ private function getHeadline($parts, $competition)
$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(sprintf('tx_cfcleague_games_%s_points_home', $sports->getIdentifier()));
$arr[] = $LANG->getLL(sprintf('tx_cfcleague_games_%s_points_guest', $sports->getIdentifier()));
}

$arr[] = $LANG->getLL('tx_cfcleague_games.visitors');
Expand Down Expand Up @@ -358,8 +358,8 @@ private function createTableArray($matches, $competition)
$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->createTxtInput('data[tx_cfcleague_games]['.$matchUid.'][points_home]', $match->getProperty('points_home'), 6);
$row[] = $this->formTool->createTxtInput('data[tx_cfcleague_games]['.$matchUid.'][points_guest]', $match->getProperty('points_guest'), 6);
}

$row[] = $this->formTool->createIntInput('data[tx_cfcleague_games]['.$matchUid.'][visitors]', $match->getProperty('visitors'), 6);
Expand Down
42 changes: 0 additions & 42 deletions Classes/Utility/Misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,48 +88,6 @@ public static function removeMatchNote($typeId)
}
}

/**
* Register a new kind of sports.
*
* @param string $typeId
* @param string $class
*/
public static function registerSports($typeId, $class)
{
if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cfc_league']['sports'])) {
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cfc_league']['sports'] = [];
}
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cfc_league']['sports'][$typeId] = [
'class' => $class,
];
}

/**
* @return array
*/
public static function lookupSports(): array
{
$ret = [];
if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cfc_league']['sports'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cfc_league']['sports'] as $type => $data) {
$ret[] = ['type' => $type, 'sports' => tx_rnbase::makeInstance($data['class'])];
}
}

return $ret;
}

public static function getSports($sportsId): ?ISports
{
if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cfc_league']['sports'][$sportsId])) {
$data = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cfc_league']['sports'][$sportsId];

return tx_rnbase::makeInstance($data['class']);
}

return null;
}

/**
* Register a new table strategy.
*
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 @@ -596,6 +596,14 @@
<source>Sub-Score Guest</source>
<target>Unterbewertung Gast</target>
</trans-unit>
<trans-unit id="tx_cfcleague_games_judo_points_home" xml:space="preserve">
<source>Sub-Score Home</source>
<target>Unterbewertung Heim</target>
</trans-unit>
<trans-unit id="tx_cfcleague_games_judo_points_guest" xml:space="preserve">
<source>Sub-Score Guest</source>
<target>Unterbewertung Gast</target>
</trans-unit>

<trans-unit id="tx_cfcleague_games.date" xml:space="preserve">
<source>Date</source>
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 @@ -448,6 +448,12 @@
<trans-unit id="tx_cfcleague_games.points_guest" xml:space="preserve">
<source>Sub-Score Guest</source>
</trans-unit>
<trans-unit id="tx_cfcleague_games_judo_points_home" xml:space="preserve">
<source>Sub-Score Home</source>
</trans-unit>
<trans-unit id="tx_cfcleague_games_judo_points_guest" xml:space="preserve">
<source>Sub-Score Guest</source>
</trans-unit>

<trans-unit id="tx_cfcleague_games.date" xml:space="preserve">
<source>Date</source>
Expand Down
5 changes: 0 additions & 5 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,3 @@
$provider->addSports(new System25\T3sports\Sports\Volleyball());
$provider->addSports(new System25\T3sports\Sports\Judo());
}

// System25\T3sports\Utility\Misc::registerSports('football', System25\T3sports\Sports\Football::class);
// System25\T3sports\Utility\Misc::registerSports('handball', System25\T3sports\Sports\Handball::class);
// System25\T3sports\Utility\Misc::registerSports('icehockey', System25\T3sports\Sports\IceHockey::class);
// System25\T3sports\Utility\Misc::registerSports('volleyball', System25\T3sports\Sports\Volleyball::class);

0 comments on commit 861a357

Please sign in to comment.