mirror of
https://github.com/Deutscher-Tischfussballbund/com_sportsmanager.git
synced 2026-06-10 06:27:52 +00:00
Export Ordnungsstrafen. Unnötige Tags entfernt.
This commit is contained in:
@@ -6411,6 +6411,89 @@ function adminEditOrdnungsstrafe(): void
|
||||
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
|
||||
{
|
||||
$db = getDatabase();
|
||||
|
||||
@@ -377,6 +377,9 @@ if ($task == "spielerbild") {
|
||||
case 'admin_ordnungsstrafe_remove':
|
||||
adminRemoveOrdnungsstrafe();
|
||||
break;
|
||||
case 'admin_ordnungsstrafen_export':
|
||||
adminExportOrdnungsstrafen();
|
||||
break;
|
||||
case 'admin_verstoesse':
|
||||
adminVerstoesse();
|
||||
break;
|
||||
|
||||
@@ -6910,7 +6910,7 @@ class HTML_sportsmanager_admin
|
||||
<td>
|
||||
<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"
|
||||
onChange="document.adminForm.submit();" >
|
||||
onChange="document.adminForm.submit();" style='width: 60px;'>
|
||||
<?php
|
||||
foreach ($saisons as $saison)
|
||||
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>
|
||||
<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"
|
||||
onChange="document.adminForm.submit();" style='width: 200px;'>
|
||||
onChange="document.adminForm.submit();" style='width: 150px;'>
|
||||
<?php
|
||||
echo "<option value=\"0\" " . ($filter['aussteller'] == 0 ? "selected" : "") . ">Alle</option>";
|
||||
foreach ($ausstellerliste as $aussteller)
|
||||
echo "<option value=\"" . $aussteller->id . "\" " . ($filter['aussteller'] == $aussteller->id ? "selected" : "") . ">" . htmlentities_utf8($aussteller->name) . "</option>";
|
||||
?>
|
||||
</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>
|
||||
</tr>
|
||||
</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_DATE'); ?></strong></th>
|
||||
<th style='text-align: center;' nowrap><strong><?php echo Text::_('COM_SPORTSMANAGER_status'); ?></strong></th>
|
||||
<?php if (benutzerZugriff("benutzerVeranstalterModerator")){ ?>
|
||||
<th></th>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
@@ -7017,10 +7023,6 @@ class HTML_sportsmanager_admin
|
||||
|
||||
<form action="<?php echo SportsManagerURL(); ?>" method="post" name="adminForm" id="adminForm"
|
||||
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">
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
@@ -7141,10 +7143,6 @@ class HTML_sportsmanager_admin
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<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"/>
|
||||
@@ -7219,10 +7217,6 @@ class HTML_sportsmanager_admin
|
||||
|
||||
<form action="<?php echo SportsManagerURL(); ?>" method="post" name="adminForm" id="adminForm"
|
||||
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">
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
@@ -7244,11 +7238,6 @@ class HTML_sportsmanager_admin
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<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"/>
|
||||
@@ -7329,10 +7318,6 @@ class HTML_sportsmanager_admin
|
||||
|
||||
<form action="<?php echo SportsManagerURL(); ?>" method="post" name="adminForm" id="adminForm"
|
||||
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">
|
||||
<table style="width: 100%">
|
||||
</tr>
|
||||
@@ -7460,10 +7445,7 @@ class HTML_sportsmanager_admin
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<input type="submit" name="save" value="<?php echo Text::_('COM_SPORTSMANAGER_SAVE'); ?>" class="button"/>
|
||||
|
||||
Reference in New Issue
Block a user