mirror of
https://github.com/Deutscher-Tischfussballbund/com_sportsmanager.git
synced 2026-06-10 06:27:52 +00:00
Export Funktion für Spielberichte, Spieler in Teams und Spielplan
This commit is contained in:
@@ -11436,7 +11436,6 @@ function adminBegegnungenImportieren() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function adminBegegnungenRundeErzeugenForm() {
|
function adminBegegnungenRundeErzeugenForm() {
|
||||||
$db = getDatabase();
|
$db = getDatabase();
|
||||||
$jinput = JFactory::getApplication()->input;
|
$jinput = JFactory::getApplication()->input;
|
||||||
@@ -11668,6 +11667,222 @@ function adminBegegnungenAlleEntfernen() {
|
|||||||
redirectSportsManagerURL('&task=admin_begegnungen&veranstaltungid=' . $veranstaltungid);
|
redirectSportsManagerURL('&task=admin_begegnungen&veranstaltungid=' . $veranstaltungid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function adminBegegnungenExportForm() {
|
||||||
|
$db = getDatabase();
|
||||||
|
$jinput = JFactory::getApplication()->input;
|
||||||
|
|
||||||
|
$veranstaltungid = $jinput->get('veranstaltungid', 0, 'INT');
|
||||||
|
if ($veranstaltungid == 0) die("Missing id!");
|
||||||
|
|
||||||
|
if (!benutzerZugriff("mannschaftswettbewerb_aendern") && !benutzerVeranstaltungModerator($veranstaltungid))
|
||||||
|
keinZugriff();
|
||||||
|
|
||||||
|
// Veranstaltung ermitteln
|
||||||
|
$query = "SELECT * FROM #__sportsmanager_veranstaltung WHERE veranstaltung_id = $veranstaltungid";
|
||||||
|
$db->setQuery($query);
|
||||||
|
if (!$result = $db->execute()) {
|
||||||
|
die($db->stderr(true));
|
||||||
|
}
|
||||||
|
$rows = $db->loadObjectList();
|
||||||
|
if (count($rows) < 1) die("Wrong id!");
|
||||||
|
$veranstaltung = $rows[0];
|
||||||
|
|
||||||
|
HTML_sportsmanager_admin::adminBegegnungenExport($veranstaltung);
|
||||||
|
}
|
||||||
|
|
||||||
|
function adminBegegnungenExport() {
|
||||||
|
$db = getDatabase();
|
||||||
|
$jinput = JFactory::getApplication()->input;
|
||||||
|
|
||||||
|
$veranstaltungid = $jinput->get('veranstaltungid', 0, 'INT');
|
||||||
|
$export = $jinput->get('export', '', 'RAW');
|
||||||
|
$exportformat = $jinput->get('exportformat', '', 'RAW');
|
||||||
|
|
||||||
|
if ($veranstaltungid == 0) die("Missing id!");
|
||||||
|
|
||||||
|
if (!benutzerZugriff("mannschaftswettbewerb_aendern") && !benutzerVeranstaltungModerator($veranstaltungid))
|
||||||
|
keinZugriff();
|
||||||
|
|
||||||
|
// Veranstaltung ermitteln
|
||||||
|
$query = "SELECT * FROM #__sportsmanager_veranstaltung WHERE veranstaltung_id = $veranstaltungid";
|
||||||
|
$db->setQuery($query);
|
||||||
|
if (!$result = $db->execute()) {
|
||||||
|
die($db->stderr(true));
|
||||||
|
}
|
||||||
|
$rows = $db->loadObjectList();
|
||||||
|
if (count($rows) < 1) die("Wrong id!");
|
||||||
|
$veranstaltung = $rows[0];
|
||||||
|
|
||||||
|
if ($jinput->get('cancel', false, 'BOOL')) {
|
||||||
|
redirectSportsManagerURL('&task=admin_begegnungen&veranstaltungid=' . $veranstaltungid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($rows);
|
||||||
|
|
||||||
|
if ($export == "spieler")
|
||||||
|
{
|
||||||
|
$query = "
|
||||||
|
SELECT t5.bezeichnung AS Veranstaltung, t2.vereinsname AS Verein, t1.teamname AS Team,
|
||||||
|
t4.spielernr AS Passnummer, t4.nachname AS Nachname, t4.vorname AS Vorname, t4.geburtsjahr AS Geburtsjahr,
|
||||||
|
t3.erster_spieltag AS Spielberechtigt_von, t3.letzter_spieltag AS Spielberechtigt_bis
|
||||||
|
FROM #__sportsmanager_team AS t1
|
||||||
|
LEFT JOIN #__sportsmanager_veranstaltung AS t5 ON t1.veranstaltung_id = t5.veranstaltung_id
|
||||||
|
LEFT JOIN #__sportsmanager_verein AS t2 ON t1.verein_id = t2.verein_id
|
||||||
|
LEFT JOIN #__sportsmanager_mitglied_von_team AS t3 ON t1.team_id = t3.team_id
|
||||||
|
LEFT JOIN #__sportsmanager_spieler AS t4 ON t3.spieler_id = t4.spieler_id
|
||||||
|
WHERE t1.veranstaltung_id = ".$veranstaltungid.";
|
||||||
|
";
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
if (!$result = $db->execute()) {
|
||||||
|
die($db->stderr(true));
|
||||||
|
}
|
||||||
|
$rows = $db->loadObjectList();
|
||||||
|
|
||||||
|
$dateiname = "Spieler ".$veranstaltung->bezeichnung;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($export == "spielplan" or $export == "spielberichte")
|
||||||
|
{
|
||||||
|
$query = "
|
||||||
|
SELECT t1.begegnung_id, t4.bezeichnung AS Liga, t1.zeitpunkt AS Spielstart, t2.teamname AS Heim, t3.teamname AS Gast,
|
||||||
|
t1.spieltag AS Spieltag_Nr, t1.heim_punkte AS Heim_Tore, t1.gast_punkte AS Gast_Tore,
|
||||||
|
t1.heim_spielpunkte AS Heim_Satzpunkte, t1.gast_spielpunkte AS Gast_Satzpunkte
|
||||||
|
FROM #__sportsmanager_begegnung AS t1
|
||||||
|
LEFT JOIN #__sportsmanager_team AS t2 ON t1.heim_team_id = t2.team_id
|
||||||
|
LEFT JOIN #__sportsmanager_team AS t3 ON t1.gast_team_id = t3.team_id
|
||||||
|
LEFT JOIN #__sportsmanager_veranstaltung AS t4 ON t2.veranstaltung_id = t4.veranstaltung_id
|
||||||
|
WHERE t4.veranstaltung_id = ".$veranstaltungid."
|
||||||
|
ORDER BY t4.veranstaltung_id, t1.spieltag;
|
||||||
|
";
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
if (!$result = $db->execute()) {
|
||||||
|
die($db->stderr(true));
|
||||||
|
}
|
||||||
|
$rows = $db->loadObjectList();
|
||||||
|
|
||||||
|
$dateiname = "Spielplan ".$veranstaltung->bezeichnung;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($rows) or count($rows) == 0)
|
||||||
|
{
|
||||||
|
redirectSportsManagerURL('&task=admin_begegnungen&veranstaltungid=1', "Zu dieser Auswahl sind keine Daten vorhanden!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($export == "spielberichte")
|
||||||
|
{
|
||||||
|
// Modus ermitteln
|
||||||
|
$query = "
|
||||||
|
SELECT t2.* FROM stfv_sportsmanager_veranstaltung AS t1
|
||||||
|
LEFT JOIN stfv_sportsmanager_teamspiel_modus AS t2 ON t1.modus_id = t2.teamspiel_modus_id
|
||||||
|
WHERE t1.veranstaltung_id = ".$veranstaltungid."
|
||||||
|
";
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
if (!$result = $db->execute()) {
|
||||||
|
die($db->stderr(true));
|
||||||
|
}
|
||||||
|
$spielmodus = $db->loadObjectList();
|
||||||
|
$Anzahl_Saetze = count(explode(",",$spielmodus[0]->modus));
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($rows as $row => $value)
|
||||||
|
{
|
||||||
|
$query = "
|
||||||
|
SELECT
|
||||||
|
t1.teamspiel_nummer AS Satz_Nr,
|
||||||
|
t3.spielernr AS Pass_Heim1, t4.spielernr AS Pass_Heim2,
|
||||||
|
t5.spielernr AS Pass_Gast1, t6.spielernr AS Pass_Gast2,
|
||||||
|
t1.teamspiel_heim_punkte AS Heim_Tore, t1.teamspiel_gast_punkte AS Gast_Tore,
|
||||||
|
t1.teamspiel_heim_spielpunkte AS Heim_Punkte, t1.teamspiel_gast_spielpunkte AS Gast_Punkte
|
||||||
|
FROM stfv_sportsmanager_teamspiel AS t1
|
||||||
|
LEFT JOIN stfv_sportsmanager_begegnung AS t2 ON t1.begegnung_id = t2.begegnung_id
|
||||||
|
LEFT JOIN stfv_sportsmanager_spieler AS t3 ON t1.heim_spieler_1_id = t3.spieler_id
|
||||||
|
LEFT JOIN stfv_sportsmanager_spieler AS t4 ON t1.heim_spieler_2_id = t4.spieler_id
|
||||||
|
LEFT JOIN stfv_sportsmanager_spieler AS t5 ON t1.gast_spieler_1_id = t5.spieler_id
|
||||||
|
LEFT JOIN stfv_sportsmanager_spieler AS t6 ON t1.gast_spieler_2_id = t6.spieler_id
|
||||||
|
WHERE t1.begegnung_id = ".$value->begegnung_id."
|
||||||
|
ORDER BY t1.teamspiel_nummer;
|
||||||
|
";
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
if ($result = $db->execute())
|
||||||
|
{
|
||||||
|
$spielbericht = $db->loadObjectList();
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i = 1; $i <= $Anzahl_Saetze; $i++)
|
||||||
|
{
|
||||||
|
$variable = "S".$i."_Pass_Heim1";
|
||||||
|
$rows[$row]->$variable = $spielbericht[$i-1]->Pass_Heim1;
|
||||||
|
$variable = "S".$i."_Pass_Heim2";
|
||||||
|
$rows[$row]->$variable = $spielbericht[$i-1]->Pass_Heim2;
|
||||||
|
$variable = "S".$i."_Pass_Gast1";
|
||||||
|
$rows[$row]->$variable = $spielbericht[$i-1]->Pass_Gast1;
|
||||||
|
$variable = "S".$i."_Pass_Gast2";
|
||||||
|
$rows[$row]->$variable = $spielbericht[$i-1]->Pass_Gast2;
|
||||||
|
$variable = "S".$i."_Heim_Tore";
|
||||||
|
$rows[$row]->$variable = $spielbericht[$i-1]->Heim_Tore;
|
||||||
|
$variable = "S".$i."_Gast_Tore";
|
||||||
|
$rows[$row]->$variable = $spielbericht[$i-1]->Gast_Tore;
|
||||||
|
$variable = "S".$i."_Heim_Punkte";
|
||||||
|
$rows[$row]->$variable = $spielbericht[$i-1]->Heim_Punkte;
|
||||||
|
$variable = "S".$i."_Gast_Punkte";
|
||||||
|
$rows[$row]->$variable = $spielbericht[$i-1]->Gast_Punkte;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$dateiname = "Spielberichte ".$veranstaltung->bezeichnung;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//echo "<pre>";
|
||||||
|
//print_r($rows);
|
||||||
|
//echo "</pre>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$dateiname .= " " . date('Y-m-d') . ".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";
|
||||||
|
}
|
||||||
|
//$data = str_replace("\r", "", $data);
|
||||||
|
|
||||||
|
echo $header . "\n" . utf8_decode($data);
|
||||||
|
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
function adminEditTurnier() {
|
function adminEditTurnier() {
|
||||||
$db = getDatabase();
|
$db = getDatabase();
|
||||||
$jinput = JFactory::getApplication()->input;
|
$jinput = JFactory::getApplication()->input;
|
||||||
|
|||||||
@@ -488,6 +488,12 @@ if ($task == "spielerbild") {
|
|||||||
case 'admin_begegnungen_alle_entfernen':
|
case 'admin_begegnungen_alle_entfernen':
|
||||||
adminBegegnungenAlleEntfernen();
|
adminBegegnungenAlleEntfernen();
|
||||||
break;
|
break;
|
||||||
|
case 'admin_begegnungen_export_form':
|
||||||
|
adminBegegnungenExportForm();
|
||||||
|
break;
|
||||||
|
case 'admin_begegnungen_export':
|
||||||
|
adminBegegnungenExport();
|
||||||
|
break;
|
||||||
case 'admin_individualwettbewerb_edit':
|
case 'admin_individualwettbewerb_edit':
|
||||||
adminEditIndividualwettbewerb();
|
adminEditIndividualwettbewerb();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -8277,27 +8277,30 @@ class HTML_sportsmanager_admin
|
|||||||
': <?php echo JText::_('COM_SPORTSMANAGER_JOOMLA_MANAGEMENT'); ?></div>
|
': <?php echo JText::_('COM_SPORTSMANAGER_JOOMLA_MANAGEMENT'); ?></div>
|
||||||
<table cellspacing="10">
|
<table cellspacing="10">
|
||||||
<tr>
|
<tr>
|
||||||
<td nowrap><a
|
<td nowrap>
|
||||||
href="<?php echo SportsManagerURL('&task=admin_uebersicht'); ?>"><?php echo JText::_('COM_SPORTSMANAGER_BACK'); ?></a>
|
<a href="<?php echo SportsManagerURL('&task=admin_uebersicht'); ?>"><?php echo JText::_('COM_SPORTSMANAGER_BACK'); ?></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td nowrap><a
|
<td nowrap>
|
||||||
href="<?php echo SportsManagerURL('&task=admin_begegnung_edit&veranstaltungid=' . $veranstaltung->veranstaltung_id); ?>"><?php echo JText::_('COM_SPORTSMANAGER_ADD_MEETING'); ?></a>
|
<a href="<?php echo SportsManagerURL('&task=admin_begegnung_edit&veranstaltungid=' . $veranstaltung->veranstaltung_id); ?>"><?php echo JText::_('COM_SPORTSMANAGER_ADD_MEETING'); ?></a>
|
||||||
</td>
|
</td>
|
||||||
<td nowrap><a
|
<td nowrap>
|
||||||
href="<?php echo SportsManagerURL('&task=admin_begegnungen_runde_erzeugen_form&veranstaltungid=' . $veranstaltung->veranstaltung_id); ?>"><?php echo $veranstaltung->unterteilung == 0 ? JText::_('COM_SPORTSMANAGER_GAMEDAY') : JText::_('COM_SPORTSMANAGER_ROUND_GENERATION'); ?></a>
|
<a href="<?php echo SportsManagerURL('&task=admin_begegnungen_runde_erzeugen_form&veranstaltungid=' . $veranstaltung->veranstaltung_id); ?>"><?php echo $veranstaltung->unterteilung == 0 ? JText::_('COM_SPORTSMANAGER_GAMEDAY') : JText::_('COM_SPORTSMANAGER_ROUND_GENERATION'); ?></a>
|
||||||
</td>
|
</td>
|
||||||
<td nowrap><a
|
<td nowrap>
|
||||||
href="<?php echo SportsManagerURL('&task=admin_begegnungen_generieren_form&veranstaltungid=' . $veranstaltung->veranstaltung_id); ?>"><?php echo JText::_('COM_SPORTSMANAGER_GENERATE_GROUP_GAME'); ?></a>
|
<a href="<?php echo SportsManagerURL('&task=admin_begegnungen_generieren_form&veranstaltungid=' . $veranstaltung->veranstaltung_id); ?>"><?php echo JText::_('COM_SPORTSMANAGER_GENERATE_GROUP_GAME'); ?></a>
|
||||||
</td>
|
</td>
|
||||||
<td nowrap><a
|
<td nowrap>
|
||||||
href="<?php echo SportsManagerURL('&task=admin_begegnungen_importieren_form&veranstaltungid=' . $veranstaltung->veranstaltung_id); ?>"><?php echo JText::_('COM_SPORTSMANAGER_IMPORT_GROUP_GAME'); ?></a>
|
<a href="<?php echo SportsManagerURL('&task=admin_begegnungen_importieren_form&veranstaltungid=' . $veranstaltung->veranstaltung_id); ?>"><?php echo JText::_('COM_SPORTSMANAGER_IMPORT_GROUP_GAME'); ?></a>
|
||||||
</td>
|
</td>
|
||||||
<td nowrap><a
|
<td nowrap>
|
||||||
href="<?php echo SportsManagerURL('&task=admin_begegnungen_alle_entfernen&veranstaltungid=' . $veranstaltung->veranstaltung_id); ?>"
|
<a href="<?php echo SportsManagerURL('&task=admin_begegnungen_alle_entfernen&veranstaltungid=' . $veranstaltung->veranstaltung_id); ?>"
|
||||||
onclick="return confirm('<?php echo JText::_('COM_SPORTSMANAGER_REMOVE_ALL_ENCOUNTERS'); ?>');"><?php echo JText::_('COM_SPORTSMANAGER_REMOVE_ALL_MATCHES'); ?></a>
|
onclick="return confirm('<?php echo JText::_('COM_SPORTSMANAGER_REMOVE_ALL_ENCOUNTERS'); ?>');"><?php echo JText::_('COM_SPORTSMANAGER_REMOVE_ALL_MATCHES'); ?></a>
|
||||||
</td>
|
</td>
|
||||||
|
<td nowrap>
|
||||||
|
<a href="<?php echo SportsManagerURL('&task=admin_begegnungen_export_form&veranstaltungid=' . $veranstaltung->veranstaltung_id); ?>"><?php echo JText::_('COM_SPORTSMANAGER_EXPORT'); ?></a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<?php
|
<?php
|
||||||
@@ -9769,6 +9772,63 @@ class HTML_sportsmanager_admin
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function adminBegegnungenExport($veranstaltung)
|
||||||
|
{
|
||||||
|
global $params;
|
||||||
|
?>
|
||||||
|
<div class="componentheading<?php echo $params->get('pageclass_sfx'); ?>"><?php echo JText::_('COM_SPORTSMANAGER_EXPORT'); ?></div>
|
||||||
|
|
||||||
|
<form action="<?php echo SportsManagerURL(); ?>" method="post" name="adminForm" id="adminForm">
|
||||||
|
<div class="uk-overflow-auto"><table class="" width="100%">
|
||||||
|
<tr>
|
||||||
|
<td nowrap width="60%" valign="top">
|
||||||
|
<div class="uk-overflow-auto"><table class="" width="100%">
|
||||||
|
<tr>
|
||||||
|
<td nowrap width="20%" align="right">
|
||||||
|
Veranstaltung
|
||||||
|
</td>
|
||||||
|
<td nowrap>
|
||||||
|
<select class="uk-select uk-form-width-medium" name="veranstaltungid" size="1">
|
||||||
|
<option value='<?PHP echo $veranstaltung->veranstaltung_id; ?>'><?PHP echo $veranstaltung->bezeichnung; ?></option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td nowrap width="20%" align="right">
|
||||||
|
Exportieren
|
||||||
|
</td>
|
||||||
|
<td nowrap>
|
||||||
|
<select class="uk-select uk-form-width-medium" name="export" size="1">
|
||||||
|
<option value='spieler'>Spieler</option>
|
||||||
|
<option value='spielplan'>Spielplan</option>
|
||||||
|
<option value='spielberichte'>Spielberichte</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td nowrap width="20%" align="right">
|
||||||
|
Exportformat
|
||||||
|
</td>
|
||||||
|
<td nowrap>
|
||||||
|
<select class="uk-select uk-form-width-medium" name="exportformat" size="1">
|
||||||
|
<option value='csvdatei'>CSV-Datei</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table></div>
|
||||||
|
|
||||||
|
<input type="submit" name="save" value="<?php echo JText::_('COM_SPORTSMANAGER_EXPORT'); ?>"
|
||||||
|
class="button"/>
|
||||||
|
<input type="submit" name="cancel" value="<?php echo JText::_('COM_SPORTSMANAGER_CANCEL'); ?>"
|
||||||
|
class="button"/>
|
||||||
|
<input type="hidden" name="task" value="admin_begegnungen_export"/>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
static function adminEditIndividualwettbewerb($row, $veranstalter, $kategorien, $saisons, $users, $berechtigt_fuer_individualwettbewerb, $vorlage)
|
static function adminEditIndividualwettbewerb($row, $veranstalter, $kategorien, $saisons, $users, $berechtigt_fuer_individualwettbewerb, $vorlage)
|
||||||
{
|
{
|
||||||
global $params;
|
global $params;
|
||||||
|
|||||||
Reference in New Issue
Block a user