mirror of
https://github.com/Deutscher-Tischfussballbund/com_sportsmanager.git
synced 2026-06-10 14:37:52 +00:00
Exportfunktion und ein paar Korrekturen
This commit is contained in:
@@ -7295,41 +7295,8 @@ function adminEditOrdnungsstrafe(): void
|
||||
$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);
|
||||
|
||||
exportCSV($rows, "Ordnungsstrafen.csv");
|
||||
|
||||
die();
|
||||
}
|
||||
@@ -7454,6 +7421,27 @@ function adminEditVerbandsorgan(): void
|
||||
redirectSportsManagerURL('&task=admin_verbandsorgane');
|
||||
}
|
||||
|
||||
#[NoReturn] function adminExportVerbandsorgane(): void
|
||||
{
|
||||
$db = getDatabase();
|
||||
$jInput = Factory::getContainer()->get(SiteApplication::class)->input;
|
||||
|
||||
if (!benutzerZugriff("organisationen_aendern"))
|
||||
keinZugriff(true);
|
||||
|
||||
$query = "SELECT t1.verbandsorgan AS Verbandsorgan, t2.funktion As Funktion, t2.zusatzinfo As Zusatzinfo, t3.spielernr AS Passnummer,"
|
||||
. "\n t2.nachname AS Nachname, t2.Vorname AS Vorname, t2.email AS 'E-Mail', t2.telefon AS Telefon, t2.mobil AS Mobil"
|
||||
. "\n FROM #__sportsmanager_verbandsorgane t1"
|
||||
. "\n LEFT JOIN #__sportsmanager_mitglied_von_verbandsorgan t2 ON t2.verbandsorgane_id = t1.verbandsorgane_id"
|
||||
. "\n LEFT JOIN #__sportsmanager_spieler t3 ON t3.spieler_id = t2.spieler_id"
|
||||
. "\n ORDER BY t1.reihenfolge, t2.reihenfolge, t2.nachname, t2.vorname;";
|
||||
$rows = loadObjectList($db, $query);
|
||||
|
||||
exportCSV($rows, "Verbandsorgane.csv");
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
function adminVerbandsorganMitglieder(): void
|
||||
{
|
||||
$db = getDatabase();
|
||||
@@ -7465,10 +7453,10 @@ function adminVerbandsorganMitglieder(): void
|
||||
$id = $jInput->get('id', 0, 'INT');
|
||||
|
||||
$query = "SELECT t2.*, t1.verbandsorgan"
|
||||
. "\n FROM #__sportsmanager_verbandsorgane t1"
|
||||
. "\n LEFT JOIN #__sportsmanager_mitglied_von_verbandsorgan t2 ON t2.verbandsorgane_id = t1.verbandsorgane_id"
|
||||
. "\n WHERE t2.verbandsorgane_id = $id"
|
||||
. "\n ORDER BY t2.reihenfolge, t2.nachname, t2.vorname;";
|
||||
. "\n FROM #__sportsmanager_verbandsorgane t1"
|
||||
. "\n LEFT JOIN #__sportsmanager_mitglied_von_verbandsorgan t2 ON t2.verbandsorgane_id = t1.verbandsorgane_id"
|
||||
. "\n WHERE t2.verbandsorgane_id = $id"
|
||||
. "\n ORDER BY t2.reihenfolge, t2.nachname, t2.vorname;";
|
||||
$rows = loadObjectList($db, $query);
|
||||
|
||||
$query = "SELECT * FROM #__sportsmanager_verbandsorgane WHERE verbandsorgane_id = $id";
|
||||
@@ -12370,30 +12358,42 @@ function adminBegegnungenExportForm(): void
|
||||
$Bestaetigt = [];
|
||||
$Bestaetigt = [];
|
||||
$Moderator = [];
|
||||
$value->vorgeschlagen_um = "";
|
||||
$value->vorgeschlagen_von = "";
|
||||
$value->bestaetigt_um = "";
|
||||
$value->bestaetigt_von = "";
|
||||
$value->moderator_um = "";
|
||||
$value->moderator_von = "";
|
||||
|
||||
// Endergebnis vorgeschlagen
|
||||
$query = "
|
||||
SELECT t1.eingetragen AS gespeichert_um, t2.name AS gespeichert_von
|
||||
SELECT t1.eingetragen AS gespeichert_um,
|
||||
t2.name AS gespeichert_von_user,
|
||||
t3.teamname AS gespeichert_von_team
|
||||
FROM #__sportsmanager_begegnung_historie AS t1
|
||||
LEFT JOIN #__users AS t2 ON t1.user_id = t2.id
|
||||
LEFT JOIN #__sportsmanager_team AS t3 ON t1.team_id = t3.team_id
|
||||
WHERE begegnung_id = " . $value->ID . "
|
||||
AND aktion IN (6)
|
||||
ORDER BY eingetragen DESC LIMIT 1;
|
||||
";
|
||||
$Bestaetigt = loadObjectList($db, $query);
|
||||
if (!empty($Bestaetigt)) {
|
||||
$value->vorgeschlagen_um = $Bestaetigt[0]->gespeichert_um;
|
||||
$value->vorgeschlagen_von = $Bestaetigt[0]->gespeichert_von;
|
||||
} else {
|
||||
$value->vorgeschlagen_um = $Bestaetigt[0]->gespeichert_um;
|
||||
$value->vorgeschlagen_von = $Bestaetigt[0]->gespeichert_von;
|
||||
$Vorgeschlagen = loadObjectList($db, $query);
|
||||
if (!empty($Vorgeschlagen)) {
|
||||
$value->vorgeschlagen_um = $Vorgeschlagen[0]->gespeichert_um;
|
||||
if (!empty($Vorgeschlagen[0]->gespeichert_von_user))
|
||||
$value->vorgeschlagen_von = $Vorgeschlagen[0]->gespeichert_von_user;
|
||||
if (!empty($Vorgeschlagen[0]->gespeichert_von_team))
|
||||
$value->vorgeschlagen_von = $Vorgeschlagen[0]->gespeichert_von_team;
|
||||
}
|
||||
|
||||
// Endergebnis bestätigen Gegner
|
||||
$query = "
|
||||
SELECT t1.eingetragen AS gespeichert_um, t2.name AS gespeichert_von
|
||||
SELECT t1.eingetragen AS gespeichert_um,
|
||||
t2.name AS gespeichert_von_user,
|
||||
t3.teamname AS gespeichert_von_team
|
||||
FROM #__sportsmanager_begegnung_historie AS t1
|
||||
LEFT JOIN #__users AS t2 ON t1.user_id = t2.id
|
||||
LEFT JOIN #__sportsmanager_team AS t3 ON t1.team_id = t3.team_id
|
||||
WHERE begegnung_id = " . $value->ID . "
|
||||
AND aktion IN (7)
|
||||
ORDER BY eingetragen DESC LIMIT 1;
|
||||
@@ -12401,28 +12401,32 @@ function adminBegegnungenExportForm(): void
|
||||
$Bestaetigt = loadObjectList($db, $query);
|
||||
if (!empty($Bestaetigt)) {
|
||||
$value->bestaetigt_um = $Bestaetigt[0]->gespeichert_um;
|
||||
$value->bestaetigt_von = $Bestaetigt[0]->gespeichert_von;
|
||||
} else {
|
||||
$value->bestaetigt_um = $Bestaetigt[0]->gespeichert_um;
|
||||
$value->bestaetigt_von = $Bestaetigt[0]->gespeichert_von;
|
||||
if (!empty($Bestaetigt[0]->gespeichert_von_user))
|
||||
$value->bestaetigt_von = $Bestaetigt[0]->gespeichert_von_user;
|
||||
if (!empty($Bestaetigt[0]->gespeichert_von_team))
|
||||
$value->bestaetigt_von = $Bestaetigt[0]->gespeichert_von_team;
|
||||
}
|
||||
|
||||
|
||||
// Endergebnis bestätigen Moderator
|
||||
$query = "
|
||||
SELECT t1.eingetragen AS gespeichert_um, t2.name AS gespeichert_von
|
||||
SELECT t1.eingetragen AS gespeichert_um,
|
||||
t2.name AS gespeichert_von_user,
|
||||
t3.teamname AS gespeichert_von_team
|
||||
FROM #__sportsmanager_begegnung_historie AS t1
|
||||
LEFT JOIN #__users AS t2 ON t1.user_id = t2.id
|
||||
LEFT JOIN #__sportsmanager_team AS t3 ON t1.team_id = t3.team_id
|
||||
WHERE begegnung_id = " . $value->ID . "
|
||||
AND aktion IN (8)
|
||||
ORDER BY eingetragen DESC LIMIT 1;
|
||||
";
|
||||
$Moderator = loadObjectList($db, $query);
|
||||
$Bestaetigt = loadObjectList($db, $query);
|
||||
if (!empty($Moderator)) {
|
||||
$value->moderator_um = $Moderator[0]->gespeichert_um;
|
||||
$value->moderator_von = $Moderator[0]->gespeichert_von;
|
||||
} else {
|
||||
$value->moderator_um = $Moderator[0]->gespeichert_um;
|
||||
$value->moderator_von = $Moderator[0]->gespeichert_von;
|
||||
if (!empty($Moderator[0]->gespeichert_von_user))
|
||||
$value->moderator_von = $Moderator[0]->gespeichert_von_user;
|
||||
if (!empty($Moderator[0]->gespeichert_von_team))
|
||||
$value->moderator_von = $Moderator[0]->gespeichert_von_team;
|
||||
}
|
||||
|
||||
// Spielbericht
|
||||
|
||||
@@ -383,6 +383,9 @@ if ($task == "spielerbild") {
|
||||
case 'admin_verbandsorgan_remove':
|
||||
adminRemoveVerbandsorgan();
|
||||
break;
|
||||
case 'admin_verbandsorgane_export':
|
||||
adminExportVerbandsorgane();
|
||||
break;
|
||||
case 'admin_verbandsorgan_mitglieder':
|
||||
adminVerbandsorganMitglieder();
|
||||
break;
|
||||
@@ -4290,9 +4293,18 @@ function verbandsorgane(): void
|
||||
function verbandsorganeDetails($uebergabe_id = 0): void
|
||||
{
|
||||
$db = getDatabase();
|
||||
$app = Factory::getContainer()->get(SiteApplication::class);
|
||||
$jInput = $app->input;
|
||||
|
||||
global $params;
|
||||
$jInput = Factory::getContainer()->get(SiteApplication::class)->input;
|
||||
|
||||
$user_id = isExternalDatabase() ? 0 : (isJson() ? getUserID() : $app->getIdentity()->id);
|
||||
if ($user_id > 0)
|
||||
$erweiterte_anzeige = true;
|
||||
else
|
||||
$erweiterte_anzeige = false;
|
||||
|
||||
if ($uebergabe_id == 0)
|
||||
$id = $jInput->get('id', 0, 'INT');
|
||||
else
|
||||
@@ -4306,10 +4318,20 @@ function verbandsorganeDetails($uebergabe_id = 0): void
|
||||
. "\n ORDER BY reihenfolge, nachname, vorname";
|
||||
$mitglieder = loadObjectList($db, $query);
|
||||
|
||||
$query = "SELECT zusatzinfo FROM #__sportsmanager_mitglied_von_verbandsorgan"
|
||||
. "\n WHERE verbandsorgane_id = $id"
|
||||
. "\n AND zusatzinfo IS NOT NULL AND TRIM(zusatzinfo) <> ''"
|
||||
. "\n ORDER BY reihenfolge, nachname, vorname";
|
||||
$zusatzinfos = loadObjectList($db, $query);
|
||||
if (count($zusatzinfos) > 0)
|
||||
$zusatzinfos_vorhanden = true;
|
||||
else
|
||||
$zusatzinfos_vorhanden = false;
|
||||
|
||||
if (isJson()) {
|
||||
echo json_encode($mitglieder);
|
||||
} else {
|
||||
HTML_sportsmanager::verbandsorganeDetails($params->get('titel'), $params->get('beschreibung'), $verbandsorgane[0], $mitglieder);
|
||||
HTML_sportsmanager::verbandsorganeDetails($params->get('titel'), $params->get('beschreibung'), $verbandsorgane[0], $mitglieder, $erweiterte_anzeige, $zusatzinfos_vorhanden);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4069,7 +4069,7 @@ static function verbandsorgane($titel, $beschreibung, $rows, $organisation_zeige
|
||||
<?php
|
||||
}
|
||||
|
||||
static function verbandsorganeDetails($titel, $beschreibung, $verbandsorgan, $rows): void
|
||||
static function verbandsorganeDetails($titel, $beschreibung, $verbandsorgan, $rows, $erweiterte_anzeige, $zusatzinfos_vorhanden): void
|
||||
{
|
||||
global $params;
|
||||
if (!empty($titel)) { ?>
|
||||
@@ -4095,7 +4095,7 @@ static function verbandsorganeDetails($titel, $beschreibung, $verbandsorgan, $ro
|
||||
if (count($rows) > 0) {
|
||||
?>
|
||||
<H2>Mitglieder</H2>
|
||||
<table style='width: 100%; border-collapse: collapse;'
|
||||
<table style='border-collapse: collapse;'
|
||||
class="uk-table-hover uk-table-divider uk-table-middle dtfl-table-medium contentpaneopen<?php echo $params->get('pageclass_sfx'); ?>">
|
||||
<?php
|
||||
|
||||
@@ -4104,18 +4104,25 @@ static function verbandsorganeDetails($titel, $beschreibung, $verbandsorgan, $ro
|
||||
?>
|
||||
<tr class="sectiontableentry<?php echo $k + 1;
|
||||
$k = ($k + 1) % 2; ?><?php echo $params->get('pageclass_sfx'); ?>">
|
||||
<td nowrap>
|
||||
<td style='width: 80px;' nowrap>
|
||||
<?PHP echo bildHTML("spieler", $row->spieler_id, 45, 60, 0, 0, 'border="1"'); ?>
|
||||
</td>
|
||||
<td nowrap>
|
||||
<td style='width: 200px;' nowrap>
|
||||
<?php echo htmlentities_utf8($row->nachname . ", " . $row->vorname); ?>
|
||||
</td>
|
||||
<td nowrap>
|
||||
<?PHP if ($erweiterte_anzeige){ ?>
|
||||
<td style='width: 300px;' nowrap>
|
||||
<?php echo htmlentities_utf8($row->email); ?>
|
||||
</td>
|
||||
<?PHP } ?>
|
||||
<td style='width: 200px;' nowrap>
|
||||
<?php echo htmlentities_utf8($row->funktion); ?>
|
||||
</td>
|
||||
<td nowrap>
|
||||
<?PHP if ($zusatzinfos_vorhanden){ ?>
|
||||
<td style='width: 200px;' nowrap>
|
||||
<?php echo htmlentities_utf8($row->zusatzinfo); ?>
|
||||
</td>
|
||||
<?PHP } ?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -7035,9 +7035,7 @@ class HTML_sportsmanager_admin
|
||||
<input type="hidden" name="task" value="admin_ordnungsstrafen"/>
|
||||
</form>
|
||||
<?php
|
||||
} ?>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
if (count($rows) > 0) {
|
||||
?>
|
||||
@@ -7506,6 +7504,7 @@ class HTML_sportsmanager_admin
|
||||
|
||||
if (count($rows) > 0) {
|
||||
?>
|
||||
|
||||
<table style='width: 400px;' class="contentpaneopen<?php echo $params->get('pageclass_sfx'); ?>">
|
||||
<tr class="sectiontableheader<?php echo $params->get('pageclass_sfx'); ?>">
|
||||
<th style='text-align: left; width: 250px;' nowrap><strong><?php echo Text::_('COM_SPORTSMANAGER_ASSOCIATION_BODIES'); ?></strong></th>
|
||||
@@ -7538,6 +7537,15 @@ class HTML_sportsmanager_admin
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<form action="<?php echo SportsManagerURL(); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<input type="submit" value="<?php echo Text::_('COM_SPORTSMANAGER_EXPORT'); ?>" class="button"
|
||||
onclick="const t = this.form.task;
|
||||
t.value = 'admin_verbandsorgane_export';
|
||||
setTimeout(() => { t.value = 'admin_verbandsorgane'; }, 100);"/>
|
||||
<input type="hidden" name="task" value="admin_verbandsorgane"/>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user