Export Ordnungsstrafen. Unnötige Tags entfernt.

This commit is contained in:
Jürgen Meyer
2025-12-12 12:11:24 +01:00
parent e7dbfa6402
commit 49c8037dbf
3 changed files with 375 additions and 307 deletions
@@ -6411,6 +6411,89 @@ function adminEditOrdnungsstrafe(): void
redirectSportsManagerURL('&task=admin_ordnungsstrafen'); redirectSportsManagerURL('&task=admin_ordnungsstrafen');
} }
#[NoReturn] function adminExportOrdnungsstrafen(): void
{
$db = getDatabase();
$jInput = Factory::getContainer()->get(SiteApplication::class)->input;
$filter['saison'] = $jInput->get('filter_saison_id', 0, 'INT');
$filter['verein'] = $jInput->get('filter_verein_id', 0, 'INT');
$filter['veranstaltung'] = $jInput->get('filter_veranstaltung_id', 0, 'INT');
$filter['aussteller'] = $jInput->get('filter_aussteller_id', 0, 'INT');
if (!benutzerZugriff("benutzerVeranstalterModerator"))
keinZugriff(true);
if (empty($filter['saison']))
$filter['saison'] = $saisons[0]->saison_id;
if (!isset($filter['verein']))
$filter['verein'] = 0;
if (!isset($filter['veranstaltung']))
$filter['veranstaltung'] = 0;
if (!isset($filter['aussteller']))
$filter['aussteller'] = 0;
$query = "SELECT t1.ordnungsstrafen_id AS ID, t3.begegnung_id AS Spiel_ID, t7.bezeichnung AS Liga,"
. "\n t3.spieltag AS Spieltag, t9.vereinsname AS Verein, t2.verstoss AS Verstoss, t8.name AS Aussteller,"
. "\n (t1.multiplikator * t2.gebuehr + t2.zusatzgebuehr) AS Gebuehr,"
. "\n t1.ausstelldatum AS Ausstelldatum, t1.status AS Status"
. "\n FROM #__sportsmanager_ordnungsstrafen AS t1"
. "\n LEFT JOIN #__sportsmanager_verstoesse AS t2 ON t1.verstoesse_id = t2.verstoesse_id"
. "\n LEFT JOIN #__sportsmanager_begegnung AS t3 ON t1.begegnung_id = t3.begegnung_id"
. "\n LEFT JOIN #__sportsmanager_team AS t4 ON t1.team_id = t4.team_id"
. "\n LEFT JOIN #__sportsmanager_verein AS t9 ON t4.verein_id = t9.verein_id"
. "\n LEFT JOIN #__sportsmanager_team AS t5 ON t3.heim_team_id = t5.team_id"
. "\n LEFT JOIN #__sportsmanager_team AS t6 ON t3.gast_team_id = t6.team_id"
. "\n LEFT JOIN #__sportsmanager_veranstaltung AS t7 ON t4.veranstaltung_id = t7.veranstaltung_id"
. "\n LEFT JOIN #__users AS t8 ON t1.aussteller_id = t8.id"
. "\n WHERE t7.saison_id = '" . $filter['saison'] . "'";
if (!empty($filter['verein']))
$query .= "\n AND t9.verein_id = '" . $filter['verein'] . "'";
if (!empty($filter['veranstaltung']))
$query .= "\n AND t7.veranstaltung_id = '" . $filter['veranstaltung'] . "'";
if (!empty($filter['aussteller']))
$query .= "\n AND t8.id = '" . $filter['aussteller'] . "'";
$query .= "\n ORDER BY ordnungsstrafen_id";
$rows = loadObjectList($db, $query);
$dateiname .= "Ordnungsstrafen.csv";
$dateiname = bereinigterDateiname($dateiname);
ob_end_clean(); // Wegen UTF-8-Zeichen, die in der ausgabe vorhanden sind
Header("Content-Type: text/x-csv");
Header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
Header('Content-Disposition: attachment; filename="' . $dateiname . '"');
Header("Pragma: no-cache");
$data = "";
$trennzeichen = ";";
$spalte = 0;
$header = "";
foreach ($rows[0] as $field => $value) {
if ($spalte != 0) {
$header .= $trennzeichen;
}
$header .= $field;
$spalte++;
}
foreach ($rows as $row) {
$line = '';
$spalte = 0;
foreach ($row as $value) {
if ($spalte != 0) {
$line .= $trennzeichen;
}
$line .= $value;
$spalte++;
}
$data .= trim($line) . "\n";
}
echo $header . "\n" . utf8_decode($data);
die();
}
function adminRegelwerke(): void function adminRegelwerke(): void
{ {
$db = getDatabase(); $db = getDatabase();
@@ -377,6 +377,9 @@ if ($task == "spielerbild") {
case 'admin_ordnungsstrafe_remove': case 'admin_ordnungsstrafe_remove':
adminRemoveOrdnungsstrafe(); adminRemoveOrdnungsstrafe();
break; break;
case 'admin_ordnungsstrafen_export':
adminExportOrdnungsstrafen();
break;
case 'admin_verstoesse': case 'admin_verstoesse':
adminVerstoesse(); adminVerstoesse();
break; break;
@@ -6910,7 +6910,7 @@ class HTML_sportsmanager_admin
<td> <td>
<label for="filter_saison_id"><?php echo Text::_('COM_SPORTSMANAGER_SEASON'); ?>:</label> <label for="filter_saison_id"><?php echo Text::_('COM_SPORTSMANAGER_SEASON'); ?>:</label>
<select class="uk-form-width-small" name="filter_saison_id" id="filter_saison_id" size="1" <select class="uk-form-width-small" name="filter_saison_id" id="filter_saison_id" size="1"
onChange="document.adminForm.submit();" > onChange="document.adminForm.submit();" style='width: 60px;'>
<?php <?php
foreach ($saisons as $saison) foreach ($saisons as $saison)
echo "<option value=\"" . $saison->saison_id . "\" " . ($filter['saison'] == $saison->saison_id ? "selected" : "") . ">" . htmlentities_utf8($saison->saisonbezeichnung) . "</option>"; echo "<option value=\"" . $saison->saison_id . "\" " . ($filter['saison'] == $saison->saison_id ? "selected" : "") . ">" . htmlentities_utf8($saison->saisonbezeichnung) . "</option>";
@@ -6936,13 +6936,17 @@ class HTML_sportsmanager_admin
</select>&nbsp; </select>&nbsp;
<label for="filter_aussteller_id"><?php echo Text::_('COM_SPORTSMANAGER_ISSUER'); ?>:</label> <label for="filter_aussteller_id"><?php echo Text::_('COM_SPORTSMANAGER_ISSUER'); ?>:</label>
<select class="uk-form-width-small" name="filter_aussteller_id" id="filter_aussteller_id" size="1" <select class="uk-form-width-small" name="filter_aussteller_id" id="filter_aussteller_id" size="1"
onChange="document.adminForm.submit();" style='width: 200px;'> onChange="document.adminForm.submit();" style='width: 150px;'>
<?php <?php
echo "<option value=\"0\" " . ($filter['aussteller'] == 0 ? "selected" : "") . ">Alle</option>"; echo "<option value=\"0\" " . ($filter['aussteller'] == 0 ? "selected" : "") . ">Alle</option>";
foreach ($ausstellerliste as $aussteller) foreach ($ausstellerliste as $aussteller)
echo "<option value=\"" . $aussteller->id . "\" " . ($filter['aussteller'] == $aussteller->id ? "selected" : "") . ">" . htmlentities_utf8($aussteller->name) . "</option>"; echo "<option value=\"" . $aussteller->id . "\" " . ($filter['aussteller'] == $aussteller->id ? "selected" : "") . ">" . htmlentities_utf8($aussteller->name) . "</option>";
?> ?>
</select> </select>
<?php if (benutzerZugriff("benutzerVeranstalterModerator")){ ?>
<input type="submit" name="exportieren" value="<?php echo Text::_('COM_SPORTSMANAGER_EXPORT'); ?>"
class="button" onclick="this.form.task.value='admin_ordnungsstrafen_export';" />
<?php } ?>
</td> </td>
</tr> </tr>
</table> </table>
@@ -6965,7 +6969,9 @@ class HTML_sportsmanager_admin
<th style='text-align: center;' nowrap><strong><?php echo Text::_('COM_SPORTSMANAGER_FEE'); ?></strong></th> <th style='text-align: center;' nowrap><strong><?php echo Text::_('COM_SPORTSMANAGER_FEE'); ?></strong></th>
<th style='text-align: center;' nowrap><strong><?php echo Text::_('COM_SPORTSMANAGER_DATE'); ?></strong></th> <th style='text-align: center;' nowrap><strong><?php echo Text::_('COM_SPORTSMANAGER_DATE'); ?></strong></th>
<th style='text-align: center;' nowrap><strong><?php echo Text::_('COM_SPORTSMANAGER_status'); ?></strong></th> <th style='text-align: center;' nowrap><strong><?php echo Text::_('COM_SPORTSMANAGER_status'); ?></strong></th>
<?php if (benutzerZugriff("benutzerVeranstalterModerator")){ ?>
<th></th> <th></th>
<?php } ?>
</tr> </tr>
<?php <?php
@@ -7017,10 +7023,6 @@ class HTML_sportsmanager_admin
<form action="<?php echo SportsManagerURL(); ?>" method="post" name="adminForm" id="adminForm" <form action="<?php echo SportsManagerURL(); ?>" method="post" name="adminForm" id="adminForm"
enctype="multipart/form-data"> enctype="multipart/form-data">
<div class="uk-overflow-auto">
<table style="width: 100%">
<tr>
<td nowrap style="width: 60%; vertical-align: top">
<div class="uk-overflow-auto"> <div class="uk-overflow-auto">
<table style="width: 100%"> <table style="width: 100%">
<tr> <tr>
@@ -7141,10 +7143,6 @@ class HTML_sportsmanager_admin
</tr> </tr>
</table> </table>
</div> </div>
</td>
</tr>
</table>
</div>
<input type="submit" name="save" value="<?php echo Text::_('COM_SPORTSMANAGER_SAVE'); ?>" class="button"/> <input type="submit" name="save" value="<?php echo Text::_('COM_SPORTSMANAGER_SAVE'); ?>" class="button"/>
<input type="submit" name="cancel" value="<?php echo Text::_('COM_SPORTSMANAGER_CANCEL'); ?>" class="button"/> <input type="submit" name="cancel" value="<?php echo Text::_('COM_SPORTSMANAGER_CANCEL'); ?>" class="button"/>
@@ -7219,10 +7217,6 @@ class HTML_sportsmanager_admin
<form action="<?php echo SportsManagerURL(); ?>" method="post" name="adminForm" id="adminForm" <form action="<?php echo SportsManagerURL(); ?>" method="post" name="adminForm" id="adminForm"
enctype="multipart/form-data"> enctype="multipart/form-data">
<div class="uk-overflow-auto">
<table style="width: 100%">
<tr>
<td nowrap style="width: 60%; vertical-align: top">
<div class="uk-overflow-auto"> <div class="uk-overflow-auto">
<table style="width: 100%"> <table style="width: 100%">
<tr> <tr>
@@ -7244,11 +7238,6 @@ class HTML_sportsmanager_admin
</tr> </tr>
</table> </table>
</div> </div>
</td>
</tr>
</table>
</div>
<input type="submit" name="save" value="<?php echo Text::_('COM_SPORTSMANAGER_SAVE'); ?>" class="button"/> <input type="submit" name="save" value="<?php echo Text::_('COM_SPORTSMANAGER_SAVE'); ?>" class="button"/>
<input type="submit" name="cancel" value="<?php echo Text::_('COM_SPORTSMANAGER_CANCEL'); ?>" <input type="submit" name="cancel" value="<?php echo Text::_('COM_SPORTSMANAGER_CANCEL'); ?>"
class="button"/> class="button"/>
@@ -7329,10 +7318,6 @@ class HTML_sportsmanager_admin
<form action="<?php echo SportsManagerURL(); ?>" method="post" name="adminForm" id="adminForm" <form action="<?php echo SportsManagerURL(); ?>" method="post" name="adminForm" id="adminForm"
enctype="multipart/form-data"> enctype="multipart/form-data">
<div class="uk-overflow-auto">
<table style="width: 100%">
<tr>
<td nowrap style="width: 60%; vertical-align: top">
<div class="uk-overflow-auto"> <div class="uk-overflow-auto">
<table style="width: 100%"> <table style="width: 100%">
</tr> </tr>
@@ -7460,10 +7445,7 @@ class HTML_sportsmanager_admin
</td> </td>
</tr> </tr>
</table> </table>
</div>
</td>
</tr>
</table>
</div> </div>
<br> <br>
<input type="submit" name="save" value="<?php echo Text::_('COM_SPORTSMANAGER_SAVE'); ?>" class="button"/> <input type="submit" name="save" value="<?php echo Text::_('COM_SPORTSMANAGER_SAVE'); ?>" class="button"/>