Skip to content

Commit

Permalink
Add support for TYPO3 12 (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
digedag committed Nov 12, 2023
1 parent 4569c90 commit 4f5ae23
Show file tree
Hide file tree
Showing 46 changed files with 338 additions and 223 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
---------

v1.3.0 (??.11.2023)
* Update for support of TYPO3 12.4 LTS

v1.2.0 (10.11.2023)
* Update to support T3sports 1.11.x
* All classes moves to PSR-4 namespaces
Expand Down
4 changes: 4 additions & 0 deletions Classes/Frontend/Action/ScopeSelection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Sys25\T3sportsbet\Frontend\Action;

use Exception;
use Sys25\RnBase\Frontend\Request\RequestInterface;
use Sys25\T3sportsbet\Frontend\View\ScopeSelectionView;
use Sys25\T3sportsbet\Utility\ScopeController;
Expand Down Expand Up @@ -49,6 +50,9 @@ protected function handleRequest(RequestInterface $request)
$betgames = ScopeController::getBetgamesFromScope($scopeArr['BETGAME_UIDS']);
$rounds = ScopeController::getRoundsFromScope($scopeArr['BETSET_UIDS']);

if (empty($betgames)) {
throw new Exception('No betgame selected. Check your plugin configuration.');
}
$viewData = $request->getViewContext();
$viewData->offsetSet('betgame', $betgames[0]);
$viewData->offsetSet('rounds', $rounds);
Expand Down
2 changes: 0 additions & 2 deletions Classes/Frontend/Marker/MatchMarker.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class MatchMarker extends BaseMarker
{
public static $betMarker;

private $request;
private $matchMarker;
private $options;
private $feuserRepo;
Expand All @@ -55,7 +54,6 @@ class MatchMarker extends BaseMarker
public function __construct($options = [])
{
$this->options = $options;
$this->request = $options['request'];
$this->matchMarker = tx_rnbase::makeInstance(T3SMatchMarker::class);
$this->feuserRepo = new FeUserRepository();
$this->matchRepo = new MatchRepository();
Expand Down
2 changes: 1 addition & 1 deletion Classes/Frontend/Marker/TeamQuestionMarker.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private function addTrend($template, TeamQuestion $item, $feuser, $formatter, $c
}
if ($this->containsMarker($template, $markerPrefix.'_TEAM_')) {
$listBuilder = tx_rnbase::makeInstance(ListBuilder::class);
$template = $listBuilder->render($teams, false, $template, 'tx_cfcleaguefe_util_TeamMarker', $confId.'team.', $markerPrefix.'_TEAM', $formatter, $options);
$template = $listBuilder->render($teams, false, $template, TeamMarker::class, $confId.'team.', $markerPrefix.'_TEAM', $formatter);
}

if ($this->containsMarker($template, $markerPrefix.'_CHART')) {
Expand Down
5 changes: 3 additions & 2 deletions Classes/Frontend/View/BetListView.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function createOutput($template, RequestInterface $request, $formatter
}

// Wenn Selectbox für Tiprunde gezeigt werden soll, dann Abschnitt erstellen
$selectItems = $viewData->offsetGet('betset_select');
$selectItems = $viewData->offsetExists('betset_select') ? $viewData->offsetGet('betset_select') : [];
$selectItems = is_array($selectItems) ? $selectItems : [];
$template = $this->addScope($template, $viewData, $selectItems, 'betlist.betset.', 'BETSET', $formatter);

Expand All @@ -94,7 +94,7 @@ protected function createOutput($template, RequestInterface $request, $formatter
// $markerArray['###ACTION_URI###'] = $this->createPageUri($configurations);
$data['ACTION_URI'] = $this->createPageUri($request);
// Siehe \Sys25\T3sportsbet\Frontend\Marker\MatchMarker: Das ist nur ein Hack! Der Status sollte besser übergeben werden!
$matchState = $request->getConfigurations()->getViewData()->offsetGet('MATCH_STATE');
$matchState = $viewData->offsetExists('MATCH_STATE') ? $viewData->offsetGet('MATCH_STATE') : '';
if ('OPEN' == $matchState) {
$wrappedSubpartArray['###SAVEBUTTON###'] = [
'',
Expand Down Expand Up @@ -136,6 +136,7 @@ protected function createPageUri(RequestInterface $request, $params = [])

private function addScope($template, $viewData, $itemsArr, $confId, $markerName, $formatter)
{
$currItem = '';
if (!empty($itemsArr)) {
$betsets = $itemsArr[0];
$currItem = $betsets[$itemsArr[1]];
Expand Down
3 changes: 2 additions & 1 deletion Classes/Frontend/View/HighScoreView.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected function createOutput($template, RequestInterface $request, $formatter
$userSize = $viewData->offsetGet('userSize');

// Wenn Selectbox für Tiprunde gezeigt werden soll, dann Abschnitt erstellen
$selectItems = $viewData->offsetGet('betset_select');
$selectItems = $viewData->offsetExists('betset_select') ? $viewData->offsetGet('betset_select') : [];
$selectItems = is_array($selectItems) ? $selectItems : [];
$template = $this->addScope($template, $viewData, $selectItems, 'highscore.betset.', 'BETSET', $formatter);

Expand Down Expand Up @@ -144,6 +144,7 @@ protected function setAddUserData($feuser, $data)

private function addScope($template, $viewData, $itemsArr, $confId, $markerName, $formatter)
{
$currItem = '';
if (!empty($itemsArr)) {
$betsets = $itemsArr[0];
$currItem = $betsets[$itemsArr[1]];
Expand Down
3 changes: 2 additions & 1 deletion Classes/Frontend/View/ScopeSelectionView.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function createOutput($template, RequestInterface $request, $formatter
{
$viewData = $request->getViewContext();
// Wenn Selectbox für Tiprunde gezeigt werden soll, dann Abschnitt erstellen
$selectItems = $viewData->offsetGet('betset_select');
$selectItems = $viewData->offsetExists('betset_select') ? $viewData->offsetGet('betset_select') : [];
$selectItems = is_array($selectItems) ? $selectItems : [];
$template = $this->addScope($template, $viewData, $selectItems, 'scope.betset.', 'BETSET', $formatter);
$params = ['confid' => $request->getConfId()];
Expand All @@ -63,6 +63,7 @@ protected function createOutput($template, RequestInterface $request, $formatter

private function addScope($template, $viewData, $itemsArr, $confId, $markerName, $formatter)
{
$currItem = '';
if (!empty($itemsArr)) {
$betsets = $itemsArr[0];
$currItem = $betsets[$itemsArr[1]];
Expand Down
2 changes: 1 addition & 1 deletion Classes/Model/BetGame.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static function getBetgameInstance($uid)
if (!$uid) {
throw new Exception('Invalid uid for betgame');
}
if (!is_object(self::$instances[$uid])) {
if (!isset(self::$instances[$uid])) {
self::$instances[$uid] = new self($uid);
}

Expand Down
2 changes: 1 addition & 1 deletion Classes/Model/BetSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public static function getBetsetInstance($uid)
if (!$uid) {
throw new Exception('Invalid uid for betset');
}
if (!is_object(self::$instances[$uid])) {
if (!isset(self::$instances[$uid])) {
self::$instances[$uid] = new self($uid);
}

Expand Down
10 changes: 9 additions & 1 deletion Classes/Module/Controller/BetGame.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Sys25\RnBase\Frontend\Marker\FormatUtil;
use Sys25\RnBase\Frontend\Marker\Templates;
use Sys25\RnBase\Utility\Logger;
use Sys25\RnBase\Utility\TYPO3;
use Sys25\T3sportsbet\Model\BetSet;
use Sys25\T3sportsbet\Module\Handler\MatchMoveHandler;
use Sys25\T3sportsbet\Module\Utility\AddCompetitionWizard;
Expand Down Expand Up @@ -62,10 +63,17 @@ protected function getFuncId()
return 'funcbetgame';
}

public function getModuleIdentifier()
{
return 'cfc_league';
}

public function init(IModule $module, $conf)
{
parent::init($module, $conf);
$GLOBALS['LANG']->includeLLFile('EXT:t3sportsbet/Resources/Private/Language/locallang_mod.xlf');
if (!TYPO3::isTYPO121OrHigher()) {
$GLOBALS['LANG']->includeLLFile('EXT:t3sportsbet/Resources/Private/Language/locallang_mod.xlf');
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Classes/Module/Decorator/BetDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function setFormTool($formTool)
$this->formTool = $formTool;
}

public function format($value, $colName)
public function format($value, $colName, $record, $model)
{
$ret = $value;
if ('tstamp' == $colName) {
Expand All @@ -74,7 +74,7 @@ public function format($value, $colName)
$ret = $value.' '.$this->formTool->createEditLink('tx_t3sportsbet_bets', $value, '');
}
if ('bet' == $colName) {
$ret = (is_object($value)) ? $value->getProperty('goals_home').':'.$value->getProperty('goals_guest') : '-';
$ret = $model->getProperty('goals_home').':'.$model->getProperty('goals_guest');
}

return $ret;
Expand Down
128 changes: 0 additions & 128 deletions Classes/Module/Decorator/StaticBetDecorator.php

This file was deleted.

4 changes: 2 additions & 2 deletions Classes/Module/Handler/MatchMoveHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private function getCurrentMatch($mod)
$key => '',
], [], $mod->getName());

return $arr[$key];
return $arr[$key] ?? null;
}

/**
Expand Down Expand Up @@ -157,7 +157,7 @@ public function makePasteButton($item, $mod)
$options['hover'] = $matchInfo;
$label = '<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-paste-after"></span>';
$label .= $matchInfo.'<br />';
$ret .= $mod->getFormTool()->createLink('&doPasteMatch='.$item->getUid(), $mod->getPid(), $label, $options);
$ret .= $mod->getFormTool()->createModuleLink(['doPasteMatch' => $item->getUid()], $mod->getPid(), $label, $options);

return $ret;
}
Expand Down
8 changes: 4 additions & 4 deletions Classes/Module/Lister/MatchBetLister.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
use Sys25\RnBase\Backend\Utility\Tables;
use Sys25\RnBase\Utility\T3General;
use Sys25\T3sportsbet\Module\Decorator\BetDecorator;
use Sys25\T3sportsbet\Module\Decorator\StaticBetDecorator;
use Sys25\T3sportsbet\Utility\ServiceRegistry;
use tx_rnbase;
use tx_rnbase_mod_IModule;
Expand Down Expand Up @@ -139,7 +138,7 @@ public function getResultList()
$ret['table'] = $this->showBets($items);
$ret['totalsize'] = $cnt;
$pagerData = $pager->render();
$ret['pager'] .= '<div class="pager row"><span class="col-sm-2">'.$pagerData['limits'].'</span><span class="col-sm-2">'.$pagerData['pages'].'</span></div>';
$ret['pager'] = '<div class="pager row"><span class="col-sm-2">'.$pagerData['limits'].'</span><span class="col-sm-2">'.$pagerData['pages'].'</span></div>';

return $ret;
}
Expand Down Expand Up @@ -194,10 +193,11 @@ private function showBets($bets)
'title' => 'label_feuser',
],
];
$arr = StaticBetDecorator::prepareRecords($bets, $columns, $this->formTool, $this->options);

/** @var Tables $tables */
$tables = tx_rnbase::makeInstance(Tables::class);
$out = $tables->buildTable($arr[0]);
$rows = $tables->prepareTable($bets, $columns, $this->formTool, $this->options);
$out = $tables->buildTable($rows[0]);

return $out;
}
Expand Down
6 changes: 3 additions & 3 deletions Classes/Module/Lister/MatchLister.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private function init(IModule $mod, BetSet $currentRound, array $options)
$this->formTool = $this->mod->getFormTool();
$this->resultSize = 0;
$this->data = T3General::_GP('searchdata');
$this->competitions = $options['competitions'];
$this->competitions = $options['competitions'] ?? null;
$this->selector = tx_rnbase::makeInstance(Selector::class);
$this->selector->init($this->getModule()->getDoc(), $this->getModule());
// $this->selector->init($mod->doc, $mod->MCONF['name']);
Expand All @@ -116,7 +116,7 @@ public function getSearchForm($label = '')
global $LANG;
$out = '';
// Wir zeigen zwei Selectboxen an
$this->currComp = $this->selector->showLeagueSelector($out, $this->mod->id, $this->competitions);
$this->currComp = $this->selector->showLeagueSelector($out, $this->mod->getPid(), $this->competitions);
if (!$this->currComp) {
return $out.$this->mod->getDoc()->section('Info:', $LANG->getLL('msg_no_competition_in_betgame'), 0, 1, IModFunc::ICON_WARN);
}
Expand All @@ -129,7 +129,7 @@ public function getSearchForm($label = '')
return $out;
}
// Jetzt den Spieltag wählen lassen
$this->current_round = $this->selector->showRoundSelector($out, $this->mod->id, $this->currComp);
$this->current_round = $this->selector->showRoundSelector($out, $this->mod->getPid(), $this->currComp);

$out .= '<div style="clear:both" />';

Expand Down
2 changes: 1 addition & 1 deletion Classes/Module/Lister/TeamBetLister.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function getResultList()
$ret['table'] = $content;
$ret['totalsize'] = $cnt;
$pagerData = $pager->render();
$ret['pager'] .= '<div class="pager"><span class="col-md-2">'.$pagerData['limits'].'</span><span class="col-md-2">'.$pagerData['pages'].'</span></div>';
$ret['pager'] = '<div class="pager"><span class="col-md-2">'.$pagerData['limits'].'</span><span class="col-md-2">'.$pagerData['pages'].'</span></div>';

return $ret;
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Module/Lister/TeamQuestionLister.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function getResultList()
$ret['table'] = $content;
$ret['totalsize'] = $cnt;
$pagerData = $pager->render();
$ret['pager'] .= '<div class="pager row"><span class="col-sm-2">'.$pagerData['limits'].'</span><span class="col-sm-2">'.$pagerData['pages'].'</span></div>';
$ret['pager'] = '<div class="pager row"><span class="col-sm-2">'.$pagerData['limits'].'</span><span class="col-sm-2">'.$pagerData['pages'].'</span></div>';

return $ret;
}
Expand Down
Loading

0 comments on commit 4f5ae23

Please sign in to comment.