Explicit penalties for league teams (3): add moderator_user_id

This commit is contained in:
Wieland Hagen
2026-02-23 16:18:35 +01:00
parent 5bd0735708
commit 84d07aecb1
5 changed files with 14 additions and 6 deletions
@@ -8237,7 +8237,10 @@ function adminMannschaftStrafen()
if (!benutzerZugriff("mannschaftswettbewerb_aendern") && !benutzerVeranstaltungModerator($veranstaltungid))
keinZugriff();
$query = "SELECT zeitpunkt, strafe, beschreibung FROM #__sportsmanager_team_strafen WHERE team_id = $teamid";
$query = "SELECT strafen.zeitpunkt, strafen.strafe, strafen.beschreibung, users.name AS moderator_name"
. "\n FROM #__sportsmanager_team_strafen as strafen"
. "\n LEFT JOIN #__users as users ON users.id = strafen.moderator_user_id"
. "\n WHERE strafen.team_id = $teamid";
$rows = loadObjectList($db, $query);
HTML_sportsmanager_admin::adminMannschaftStrafen($teamid, $veranstaltungid, $teamname, $rows);
@@ -8257,9 +8260,10 @@ function adminMannschaftAddStrafe()
if ($jInput->get('cancel', false, 'BOOL')) {
redirectSportsManagerURL("&task=admin_team_edit&veranstaltungid=$veranstaltungid&id=$teamid");
} else if ($jInput->get('add', false, 'BOOL')) {
$user_id = Factory::getContainer()->get(SiteApplication::class)->getIdentity()->id;
$strafe = $jInput->get('strafe', 0, 'FLOAT');
$beschreibung = $jInput->get('beschreibung', 0, 'RAW');
neueTeamStrafe($teamid, $veranstaltungid, $strafe, $beschreibung);
neueTeamStrafe($teamid, $veranstaltungid, $strafe, $user_id, $beschreibung);
redirectSportsManagerURL('&task=admin_team_strafen&teamid=' . $teamid);
} else {
redirectSportsManagerURL('&task=admin_teams&veranstaltungid=' . $veranstaltungid);
@@ -5572,6 +5572,7 @@ function updateDatabase(): void
$query = "CREATE TABLE IF NOT EXISTS `#__sportsmanager_team_strafen` ("
. "\n `team_strafen_id` int(11) NOT NULL AUTO_INCREMENT,"
. "\n `zeitpunkt` datetime NOT NULL,"
. "\n `moderator_user_id` int(11) DEFAULT NULL,"
. "\n `team_id` int(11) NOT NULL DEFAULT '0',"
. "\n `strafe` float(6,2) NOT NULL DEFAULT '0',"
. "\n `beschreibung` text NOT NULL,"
@@ -4782,14 +4782,14 @@ function begegnungVerlegen(): void
}
}
function neueTeamStrafe($teamid, $veranstaltungid, $strafe, $beschreibung) {
function neueTeamStrafe($teamid, $veranstaltungid, $strafe, $moderator_user_id, $beschreibung) {
$app = Factory::getContainer()->get(SiteApplication::class);
$db = getDatabase();
$zeitpunkt = date('Y-m-d H:i:s');
$query = "INSERT INTO #__sportsmanager_team_strafen"
. "\n (team_id, zeitpunkt, strafe, beschreibung)"
. "\n VALUES ($teamid, '$zeitpunkt', $strafe, '$beschreibung')";
. "\n (team_id, zeitpunkt, moderator_user_id, strafe, beschreibung)"
. "\n VALUES ($teamid, '$zeitpunkt', $moderator_user_id, $strafe, '$beschreibung')";
$db->setQuery($query);
if (!$result = $db->execute()) { die($db->stderr(true)); }
@@ -9355,6 +9355,7 @@ class HTML_sportsmanager_admin
<table style="width: 100%" class="contentpaneopen<?php echo $params->get('pageclass_sfx'); ?>">
<tr class="sectiontableheader<?php echo $params->get('pageclass_sfx'); ?>">
<th nowrap><strong><?php echo JText::_('COM_SPORTSMANAGER_DATE'); ?></strong></th>
<th nowrap><strong><?php echo JText::_('COM_SPORTSMANAGER_MODERATOR'); ?></strong></th>
<th nowrap><strong><?php echo JText::_('COM_SPORTSMANAGER_PENALTY'); ?></strong></th>
<th nowrap><strong><?php echo JText::_('COM_SPORTSMANAGER_DESCRIPTION'); ?></strong></th>
</tr>
@@ -9365,8 +9366,9 @@ class HTML_sportsmanager_admin
?>
<tr class="sectiontableentry<?php echo $k + 1; $k = ($k + 1) % 2; echo $params->get('pageclass_sfx'); ?>">
<td nowrap style="text-align: center"> <?php echo $row->zeitpunkt ?> </td>
<td nowrap style="text-align: left"> <?php echo $row->moderator_name ? htmlentities_utf8($row->moderator_name) : "-" ?> </td>
<td nowrap style="text-align: center"> <?php echo $row->strafe ?> </td>
<td nowrap style="text-align: left"> <?php echo $row->beschreibung ?> </td>
<td nowrap style="text-align: left"> <?php echo htmlentities_utf8($row->beschreibung) ?> </td>
</tr>
<?php } ?>
+1
View File
@@ -725,6 +725,7 @@ return new class () implements InstallerScriptInterface
$query = "CREATE TABLE IF NOT EXISTS `#__sportsmanager_team_strafen` ("
. "\n `team_strafen_id` int(11) NOT NULL AUTO_INCREMENT,"
. "\n `zeitpunkt` datetime NOT NULL,"
. "\n `moderator_user_id` int(11) DEFAULT NULL,"
. "\n `team_id` int(11) NOT NULL DEFAULT '0',"
. "\n `strafe` float(6,2) NOT NULL DEFAULT '0',"
. "\n `beschreibung` text NOT NULL,"