Merge pull request #299 from Deutscher-Tischfussballbund/sportsmanager2-issue298

Zusätzliche Link-Parameter für Menüeinträge "Allgemeine Inhalte"
This commit is contained in:
svennickel
2026-08-30 13:43:04 +02:00
committed by GitHub
4 changed files with 29 additions and 1 deletions
@@ -30,6 +30,8 @@ COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_DESCRIPTION="Beschreibung"
COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_DESCRIPTION_DESC="Beschreibung, die unterhalb des Titels angezeigt wird (WICHTIG: Werden HTML-Tags verwendet, müssen auch Umlaute in HTML-Code angeben werden)" COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_DESCRIPTION_DESC="Beschreibung, die unterhalb des Titels angezeigt wird (WICHTIG: Werden HTML-Tags verwendet, müssen auch Umlaute in HTML-Code angeben werden)"
COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES="Kategorien" COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES="Kategorien"
COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES_DESC="Eine optionale Auswahl von Kategorienummern durch Kommata oder Spiegelstrich getrennt" COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES_DESC="Eine optionale Auswahl von Kategorienummern durch Kommata oder Spiegelstrich getrennt"
COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_EXTRA_PARAMS="Zusätzliche Parameter"
COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_EXTRA_PARAMS_DESC="Optionale zusätzliche Parameter für den Link in der Form Name1=Wert1&Name2=Wert2, die bei Aufruf dieses Menüpunkts wie GET-Parameter zur Verfügung stehen"
COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_TITLE="Layout: Elo-Rangliste" COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_TITLE="Layout: Elo-Rangliste"
COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_DESC="Auflistung der Spieler sortiert nach Elo-Wertung" COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_DESC="Auflistung der Spieler sortiert nach Elo-Wertung"
COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_ELO_RANKING="Elo-Rangliste" COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_ELO_RANKING="Elo-Rangliste"
@@ -30,6 +30,8 @@ COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_DESCRIPTION="Description"
COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_DESCRIPTION_DESC="Description that will be shows below the titel (IMPORTANT: if html tags are used, special characters must be maskeraded)" COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_DESCRIPTION_DESC="Description that will be shows below the titel (IMPORTANT: if html tags are used, special characters must be maskeraded)"
COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES="Categories" COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES="Categories"
COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES_DESC="An optional selection of category numbers seperated by commas or bullet point" COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES_DESC="An optional selection of category numbers seperated by commas or bullet point"
COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_EXTRA_PARAMS="Additional parameters"
COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_EXTRA_PARAMS_DESC="Optional additional parameters for the link in the form name1=value1&name2=value2, made available as GET parameters whenever this menu item is called"
COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_TITLE="Layout: elo ranking" COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_TITLE="Layout: elo ranking"
COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_DESC="Listing of players sorted by elo rating" COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_DESC="Listing of players sorted by elo rating"
COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_ELO_RANKING="Elo ranking" COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_ELO_RANKING="Elo ranking"
@@ -61,8 +61,27 @@ global $params;
$app = Factory::getContainer()->get(SiteApplication::class); $app = Factory::getContainer()->get(SiteApplication::class);
$jInput = $app->input; $jInput = $app->input;
$task = $jInput->getCmd('task');
$params = $app->getParams('com_sportsmanager'); $params = $app->getParams('com_sportsmanager');
// zusätzliche, im Menüpunkt hinterlegte Parameter (z.B. "test=test&foo=bar") wie GET-Parameter verfügbar machen;
// tatsächlich in der URL übergebene Werte haben weiterhin Vorrang (def() setzt nur, wenn noch nicht vorhanden);
// muss vor dem Auslesen von task/content erfolgen, damit diese die Zusatzparameter berücksichtigen
$zusatzparameter = trim((string) $params->get('zusatzparameter', ''));
if ($zusatzparameter !== '') {
// Namen, die den gesamten Seitenaufbau umstellen würden, nicht über einen Menüparameter
$gesperrteNamen = ['option', 'Itemid', 'format', 'tmpl', 'lang'];
parse_str($zusatzparameter, $zusatzparameterWerte);
foreach ($zusatzparameterWerte as $zusatzparameterName => $zusatzparameterWert) {
// Arrays (z.B. "task[]=x") würden weiter unten zu einem TypeError führen
if (!is_scalar($zusatzparameterWert)
|| in_array($zusatzparameterName, $gesperrteNamen, true)) {
continue;
}
$jInput->def($zusatzparameterName, $zusatzparameterWert);
}
}
$task = $jInput->getCmd('task');
$content = isJson() && $jInput->getCmd('content', NULL) != NULL ? $jInput->getCmd('content') : $params->get('content'); $content = isJson() && $jInput->getCmd('content', NULL) != NULL ? $jInput->getCmd('content') : $params->get('content');
if (berechnungen()) if (berechnungen())
@@ -45,6 +45,11 @@
default="" default=""
label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES" label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES"
description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES_DESC" /> description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES_DESC" />
<field name="zusatzparameter"
type="text"
default=""
label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_EXTRA_PARAMS"
description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_EXTRA_PARAMS_DESC" />
</fieldset> </fieldset>
</fields> </fields>
</metadata> </metadata>