diff --git a/Classes/Action/CoachStats.php b/Classes/Frontend/Action/CoachStats.php similarity index 97% rename from Classes/Action/CoachStats.php rename to Classes/Frontend/Action/CoachStats.php index a554050..89b68d3 100644 --- a/Classes/Action/CoachStats.php +++ b/Classes/Frontend/Action/CoachStats.php @@ -1,6 +1,6 @@ seriesRepo = $seriesRepo ?: tx_rnbase::makeInstance(SeriesRepository::class); + } + + /** + * @param RequestInterface $request + * + * @return string error msg or null + */ + protected function handleRequest(RequestInterface $request) + { + $viewData = $request->getViewContext(); + + $filter = BaseFilter::createFilter($request, $this->getConfId().'filter.'); + $fields = []; + $options = []; + $filter->init($fields, $options); + + $items = $this->seriesRepo->search($fields, $options); + + $viewData->offsetSet('items', $items); + + return null; + } + + protected function getTemplateName() + { + return 'serieslist'; + } + + protected function getViewClassName() + { + return ListView::class; + } +} diff --git a/Classes/Marker/CoachStatsMarker.php b/Classes/Frontend/Marker/CoachStatsMarker.php similarity index 94% rename from Classes/Marker/CoachStatsMarker.php rename to Classes/Frontend/Marker/CoachStatsMarker.php index 952716c..e86ad79 100644 --- a/Classes/Marker/CoachStatsMarker.php +++ b/Classes/Frontend/Marker/CoachStatsMarker.php @@ -1,20 +1,21 @@ getProperties(), $template, $marker); + $ignore = MarkerUtility::findUnusedAttributes($item, $template, $marker); $markerArray = $formatter->getItemMarkerArrayWrapped($item->getProperties(), $confId, $ignore, $marker.'_'); $wrappedSubpartArray = []; $subpartArray = []; @@ -92,7 +93,7 @@ public function parseTemplate($template, $item, &$formatter, $confId, $marker = * * @param string $template * @param CoachStat $item - * @param tx_rnbase_util_FormatUtil $formatter + * @param FormatUtil $formatter * @param string $confId * @param string $markerPrefix * @@ -144,7 +145,7 @@ private function prepareFields($item, $template, $markerPrefix) * @param array $markerArray * @param array $wrappedSubpartArray * @param string $confId - * @param tx_rnbase_util_FormatUtil $formatter + * @param FormatUtil $formatter */ private function prepareLinks($item, $marker, &$markerArray, &$subpartArray, &$wrappedSubpartArray, $confId, &$formatter, $template) { diff --git a/Classes/Marker/PlayerStatsMarker.php b/Classes/Frontend/Marker/PlayerStatsMarker.php similarity index 94% rename from Classes/Marker/PlayerStatsMarker.php rename to Classes/Frontend/Marker/PlayerStatsMarker.php index da541d2..7b73207 100644 --- a/Classes/Marker/PlayerStatsMarker.php +++ b/Classes/Frontend/Marker/PlayerStatsMarker.php @@ -1,8 +1,10 @@ getProperties(), $template, $marker); + $ignore = MarkerUtility::findUnusedAttributes($item, $template, $marker); $markerArray = $formatter->getItemMarkerArrayWrapped($item->getProperties(), $confId, $ignore, $marker.'_'); $wrappedSubpartArray = []; $subpartArray = []; @@ -101,7 +102,7 @@ public function parseTemplate($template, $item, &$formatter, $confId, $marker = * * @param string $template * @param PlayerStat $item - * @param tx_rnbase_util_FormatUtil $formatter + * @param FormatUtil $formatter * @param string $confId * @param string $markerPrefix * @@ -127,7 +128,7 @@ protected function addPlayer($template, $item, $formatter, $confId, $markerPrefi * * @param string $template * @param PlayerStat $item - * @param tx_rnbase_util_FormatUtil $formatter + * @param FormatUtil $formatter * @param string $confId * @param string $markerPrefix * @@ -153,7 +154,7 @@ protected function addCompetition($template, $item, $formatter, $confId, $marker * * @param string $template * @param PlayerStat $item - * @param tx_rnbase_util_FormatUtil $formatter + * @param FormatUtil $formatter * @param string $confId * @param string $markerPrefix * @@ -205,7 +206,7 @@ private function prepareFields($item, $template, $markerPrefix) * @param array $markerArray * @param array $wrappedSubpartArray * @param string $confId - * @param tx_rnbase_util_FormatUtil $formatter + * @param FormatUtil $formatter */ private function prepareLinks($item, $marker, &$markerArray, &$subpartArray, &$wrappedSubpartArray, $confId, &$formatter, $template) { diff --git a/Classes/Marker/RefereeStatsMarker.php b/Classes/Frontend/Marker/RefereeStatsMarker.php similarity index 94% rename from Classes/Marker/RefereeStatsMarker.php rename to Classes/Frontend/Marker/RefereeStatsMarker.php index 93d3a35..a2199da 100644 --- a/Classes/Marker/RefereeStatsMarker.php +++ b/Classes/Frontend/Marker/RefereeStatsMarker.php @@ -1,20 +1,21 @@ getProperty(), $template, $marker); + $ignore = MarkerUtility::findUnusedAttributes($item, $template, $marker); $markerArray = $formatter->getItemMarkerArrayWrapped($item->getProperty(), $confId, $ignore, $marker.'_'); $wrappedSubpartArray = []; $subpartArray = []; @@ -92,7 +93,7 @@ public function parseTemplate($template, $item, &$formatter, $confId, $marker = * * @param string $template * @param RefereeStat $item - * @param tx_rnbase_util_FormatUtil $formatter + * @param FormatUtil $formatter * @param string $confId * @param string $markerPrefix * @@ -144,7 +145,7 @@ private function prepareFields($item, $template, $markerPrefix) * @param array $markerArray * @param array $wrappedSubpartArray * @param string $confId - * @param tx_rnbase_util_FormatUtil $formatter + * @param FormatUtil $formatter */ private function prepareLinks($item, $marker, &$markerArray, &$subpartArray, &$wrappedSubpartArray, $confId, &$formatter, $template) { diff --git a/Classes/Frontend/Marker/SeriesMarker.php b/Classes/Frontend/Marker/SeriesMarker.php new file mode 100644 index 0000000..5198e9c --- /dev/null +++ b/Classes/Frontend/Marker/SeriesMarker.php @@ -0,0 +1,91 @@ +setClassname(Series::class); + parent::__construct($options); + } + + protected function prepareTemplate($template, $item, $formatter, $confId, $marker) + { + if (self::containsMarker($template, $marker . '_RESULTS')) { + $template = $this->addResults($template, $item, $formatter, $confId . 'category.', $marker . '_CATEGORY'); + } + return $template; + } + + + /** + * Bindet den gefundenen Ergebnisse ein. + * + * @param string $template + * @param Series $item + * @param FormatUtil $formatter + * @param string $confId + * @param string $markerPrefix + * + * @return string + */ + private function addResults($template, $item, $formatter, $confId, $markerPrefix) + { + $repo = RepositoryRegistry::getRepositoryForClass(SeriesResult::class); + $options = $fields = []; + $fields['SERIESRESULT.PARENTID'][OP_EQ_INT] = $item->getUid(); + $fields['SERIESRESULT.RESULTTYPE'][OP_EQ] = SeriesResult::TYPE_BEST; + SearchBase::setConfigFields($fields, $formatter->getConfigurations(), $confId . 'fields.'); + SearchBase::setConfigOptions($options, $formatter->getConfigurations(), $confId . 'options.'); + $children = $repo->search($fields, $options); + + $listBuilder = tx_rnbase::makeInstance(ListBuilder::class); + $out = $listBuilder->render($children, false, $template, SeriesResultMarker::class, $confId, $markerPrefix, $formatter); + return $out; + + return $template; + } +} diff --git a/Classes/Frontend/Marker/SeriesResultMarker.php b/Classes/Frontend/Marker/SeriesResultMarker.php new file mode 100644 index 0000000..452f8f8 --- /dev/null +++ b/Classes/Frontend/Marker/SeriesResultMarker.php @@ -0,0 +1,63 @@ +setClassname(SeriesResult::class); + parent::__construct($options); + } + + protected function prepareTemplate($template, $item, $formatter, $confId, $marker) + { + // if (self::containsMarker($template, $marker . '_RESULTS')) { + // $template = $this->addResults($template, $item, $formatter, $confId . 'category.', $marker . '_CATEGORY'); + // } + return $template; + } + +} diff --git a/Classes/View/CoachStats.php b/Classes/Frontend/View/CoachStats.php similarity index 93% rename from Classes/View/CoachStats.php rename to Classes/Frontend/View/CoachStats.php index 876ef09..6eca437 100644 --- a/Classes/View/CoachStats.php +++ b/Classes/Frontend/View/CoachStats.php @@ -1,19 +1,19 @@ seriesRepo = $seriesRepo ?: tx_rnbase::makeInstance(SeriesRepository::class); + } + + public function lookupSeries($config) + { + $seriesList = $this->seriesRepo->findAll(); + foreach ($seriesList as $series) { + $config['items'][] = [$series->getName(), $series->getUid()]; + } + + return $config; + } + /** * Returns all configured statistics type for flexform. * @@ -55,7 +72,7 @@ public static function lookupPlayerStatsReport($config) public static function lookupCoachStatsReport($config) { if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3sportstats']['coachStats']['reports'])) { - $types = Tx_Rnbase_Utility_Strings::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3sportstats']['coachStats']['reports']); + $types = Strings::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3sportstats']['coachStats']['reports']); foreach ($types as $type) { $config['items'][] = [$type, $type]; } @@ -72,7 +89,7 @@ public static function lookupCoachStatsReport($config) public static function lookupRefereeStatsReport($config) { if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3sportstats']['refereeStats']['reports'])) { - $types = Tx_Rnbase_Utility_Strings::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3sportstats']['refereeStats']['reports']); + $types = Strings::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3sportstats']['refereeStats']['reports']); foreach ($types as $type) { $config['items'][] = [$type, $type]; } @@ -100,7 +117,7 @@ private static function registerStatsReport($baseType, $statsType) { $current = []; if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3sportstats'][$baseType]['reports'])) { - $current = array_flip(Tx_Rnbase_Utility_Strings::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3sportstats'][$baseType]['reports'])); + $current = array_flip(Strings::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3sportstats'][$baseType]['reports'])); } if (!array_key_exists($statsType, $current)) { $current = array_flip($current); diff --git a/Configuration/Flexform/plugin_series.xml b/Configuration/Flexform/plugin_series.xml new file mode 100644 index 0000000..9225cde --- /dev/null +++ b/Configuration/Flexform/plugin_series.xml @@ -0,0 +1,130 @@ + + + + + + + + LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:plugin.t3sportstats.flexform.tab.common + + + array + + + + 1 + + + select + selectMultipleSideBySide + + + LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:plugin.t3sportstats.flexform.action.serieslist + tx_t3sportstats_actions_SeriesList + + + + 0 + 10 + 6 + + + + + + + + + + LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:plugin.t3sportstats.flexform.action.serieslist + + + array + + + + 1 + + + select + selectMultipleSideBySide + + + System25\T3sports\Utility\StatsConfig->lookupSeries + 0 + 10 + 5 + + + + + + + 1 + + + check + + + + + + + 1 + + + input + 24 + 256 + trim + + <_PADDING>2 + + popup + Link + link_popup.gif + + wizard_element_browser + + wizard + file + + + + page,url,mail,spec + htm,html,tmpl,tpl + + height=300,width=500,status=0,menubar=0,scrollbars=1 + + + + + + + + + + + + + LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:plugin.t3sportstats.flexform.tab.TSSetup + + array + + + + 1 + + + text + 80 + 10 + + + + + + + + + \ No newline at end of file diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index a700950..ddb6078 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -8,24 +8,50 @@ $extKey = 't3sportstats'; //////////////////////////////// - // Plugin Competition anmelden + // Plugin Statistik anmelden //////////////////////////////// + $pluginKey = 'tx_t3sportstats'; // Einige Felder ausblenden - $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['tx_t3sportstats'] = 'layout,select_key,pages,recursive'; + $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginKey] = 'layout,select_key,pages,recursive'; // Das tt_content-Feld pi_flexform einblenden - $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['tx_t3sportstats'] = 'pi_flexform'; + $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginKey] = 'pi_flexform'; Sys25\RnBase\Utility\Extensions::addPiFlexFormValue( - 'tx_t3sportstats', + $pluginKey, 'FILE:EXT:'.$extKey.'/Configuration/Flexform/plugin_main.xml' ); Sys25\RnBase\Utility\Extensions::addPlugin( [ 'LLL:EXT:'.$extKey.'/Resources/Private/Language/locallang_db.xlf:plugin.t3sportstats.label', - 'tx_t3sportstats', + $pluginKey, + ], + 'list_type', + $extKey + ); + //////////////////////////////// + + // Plugin Serien anmelden + //////////////////////////////// + + $pluginKey = 'tx_t3sportstats_series'; + // Einige Felder ausblenden + $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginKey] = 'layout,select_key,pages,recursive'; + + // Das tt_content-Feld pi_flexform einblenden + $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginKey] = 'pi_flexform'; + + Sys25\RnBase\Utility\Extensions::addPiFlexFormValue( + $pluginKey, + 'FILE:EXT:'.$extKey.'/Configuration/Flexform/plugin_series.xml' + ); + + Sys25\RnBase\Utility\Extensions::addPlugin( + [ + 'LLL:EXT:'.$extKey.'/Resources/Private/Language/locallang_db.xlf:plugin.t3sportstatsseries.label', + $pluginKey, ], 'list_type', $extKey diff --git a/Configuration/TypoScript/Plugin/setup.txt b/Configuration/TypoScript/Plugin/setup.txt index b95c7d4..a6153fc 100755 --- a/Configuration/TypoScript/Plugin/setup.txt +++ b/Configuration/TypoScript/Plugin/setup.txt @@ -8,7 +8,7 @@ plugin.tx_t3sportstats.toUserInt = 1 plugin.tx_t3sportstats.userFunc = tx_rnbase_controller->main plugin.tx_t3sportstats.defaultAction = System25\T3sports\Action\PlayerStats plugin.tx_t3sportstats.qualifier = cfc_league_fe -plugin.tx_t3sportstats.templatePath = EXT:t3sportstats/templates +plugin.tx_t3sportstats.templatePath = EXT:t3sportstats/Resources/Private/Templates plugin.tx_t3sportstats.locallangFilename = EXT:t3sportstats/Resources/Private/Language/locallang.xlf @@ -184,3 +184,18 @@ plugin.tx_cfcleaguefe_competition { defaultRef =< lib.t3sports.statsRefereeFilter } } + +plugin.tx_t3sportstats_series = USER +plugin.tx_t3sportstats_series.flexform = flexform_series.xml +plugin.tx_t3sportstats_series.toUserInt = 1 +plugin.tx_t3sportstats_series.userFunc = tx_rnbase_controller->main +plugin.tx_t3sportstats_series.defaultAction = System25\T3sports\Action\SeriesList +plugin.tx_t3sportstats_series.qualifier = t3sports +plugin.tx_t3sportstats_series.templatePath = EXT:t3sportstats/Resources/Private/Templates +plugin.tx_t3sportstats_series.locallangFilename = EXT:t3sportstats/Resources/Private/Language/locallang.xlf + + +tt_content.list.20.tx_t3sportstats_series =< plugin.tx_t3sportstats_series + +plugin.tx_t3sportstats_series { +} diff --git a/Deprecations/classes.php b/Deprecations/classes.php deleted file mode 100644 index 99fa152..0000000 --- a/Deprecations/classes.php +++ /dev/null @@ -1,17 +0,0 @@ - System25\T3sports\Frontend\Action\SeriesList::class, + 'tx_t3sportstats_actions_PlayerStats' => System25\T3sports\Frontend\Action\PlayerStats::class, + 'tx_t3sportstats_actions_CoachStats' => System25\T3sports\Frontend\Action\CoachStats::class, + 'tx_t3sportstats_actions_RefereeStats' => System25\T3sports\Frontend\Action\RefereeStats::class, + 'tx_t3sportstats_actions_DBStats' => System25\T3sports\Frontend\Action\DBStats::class, + 'tx_t3sportstats_util_Config' => System25\T3sports\Utility\StatsConfig::class, +]; diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index 64c7896..4d429c6 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -9,6 +9,12 @@ Shows extensive statistics of players, trainers and referees + + T3sports: Series + + + Shows series of fixtures + Common @@ -27,6 +33,9 @@ Highlight team players + + Series + Player statistics @@ -39,6 +48,9 @@ Database statistics + + List of series + Statistics service diff --git a/Resources/Private/Templates/serieslist.html b/Resources/Private/Templates/serieslist.html new file mode 100755 index 0000000..03fce23 --- /dev/null +++ b/Resources/Private/Templates/serieslist.html @@ -0,0 +1,23 @@ + + + + +Insert title here + + + +###SERIESLIST### + +

Die besten Serien

+###ITEMS### + +###ITEM### +###LABEL_SERIES### (Serie): ###ITEM_LABEL###
+###ITEM### + +###ITEMS### + +###SERIESLIST### + + + \ No newline at end of file diff --git a/composer.json b/composer.json index 33f0786..9638336 100644 --- a/composer.json +++ b/composer.json @@ -40,10 +40,7 @@ "autoload" : { "psr-4": { "System25\\T3sports\\" : "Classes" - }, - "classmap" : [ - "Deprecations/" - ] + } }, "autoload-dev": { "psr-4": {