mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-07 23:29:28 +00:00
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/* Copyright (C) 2008 Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at>,
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>,
|
||||
* Gerald Simane-Sequens <gerald.simane-sequens@technikum-wien.at>.
|
||||
*/
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
*
|
||||
* @classe kommune_wettbewerb
|
||||
*
|
||||
* @param connectSQL Datenbankverbindung
|
||||
* @param wbtyp_kurzbz Wettbewerbsgruppen Key
|
||||
* @param wettbewerb_kurzbz Wettbewerbssubgruppen Key
|
||||
*
|
||||
* @return - kein Retourn des Konstruktors
|
||||
*
|
||||
*/
|
||||
include_once(dirname(__FILE__)."/postgre_sql.class.php");
|
||||
class komune_wettbewerb extends postgre_sql
|
||||
{
|
||||
protected $wettbewerb;
|
||||
protected $wbtyp_kurzbz;
|
||||
protected $wettbewerb_kurzb;
|
||||
//-----Konstruktor
|
||||
function komune_wettbewerb($connectSQL,$wbtyp_kurzbz="",$wettbewerb_kurzbz="")
|
||||
{
|
||||
$this->InitWettbewerb();
|
||||
|
||||
$this->setConnectSQL($connectSQL);
|
||||
$this->setWbtyp_kurzbz($wbtyp_kurzbz);
|
||||
$this->setWettbewerb_kurzbz($wettbewerb_kurzbz);
|
||||
}
|
||||
//-----Initialisierung--------------------------------------------------------------------------------------------
|
||||
function InitWettbewerb()
|
||||
{
|
||||
$this->setError('');
|
||||
|
||||
$this->setWettbewerb('');
|
||||
$this->setWbtyp_kurzbz('');
|
||||
$this->setWettbewerb_kurzbz('');
|
||||
}
|
||||
//-----wbtyp_kurzbz--------------------------------------------------------------------------------------------
|
||||
function getWettbewerb()
|
||||
{
|
||||
return $this->wettbewerb;
|
||||
}
|
||||
function setWettbewerb($wettbewerb)
|
||||
{
|
||||
$this->wettbewerb=$wettbewerb;
|
||||
}
|
||||
//-----wbtyp_kurzbz--------------------------------------------------------------------------------------------
|
||||
function getWbtyp_kurzbz()
|
||||
{
|
||||
return $this->wbtyp_kurzbz;
|
||||
}
|
||||
function setWbtyp_kurzbz($wbtyp_kurzbz)
|
||||
{
|
||||
$this->wbtyp_kurzbz=$wbtyp_kurzbz;
|
||||
}
|
||||
//-----wettbewerb_kurzbz--------------------------------------------------------------------------------------------
|
||||
function getWettbewerb_kurzbz()
|
||||
{
|
||||
return $this->wettbewerb_kurzbz;
|
||||
}
|
||||
function setWettbewerb_kurzbz($wettbewerb_kurzbz="")
|
||||
{
|
||||
$this->wettbewerb_kurzbz=$wettbewerb_kurzbz;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function loadWettbewerbTyp()
|
||||
{
|
||||
|
||||
$cSchemaSQL=$this->getSchemaSQL();
|
||||
$tmpwbtyp_kurzbz=$this->getWbtyp_kurzbz();
|
||||
|
||||
$cTmpSQL="";
|
||||
$cTmpSQL.="SELECT * FROM ".$cSchemaSQL."tbl_wettbewerbtyp ";
|
||||
$cTmpSQL.=" WHERE ".$cSchemaSQL."tbl_wettbewerbtyp.wbtyp_kurzbz>'' ";
|
||||
|
||||
// Suche nach einem einzigen Wetttbewerbstypen wbtyp_kurzbz
|
||||
if (!is_array($tmpwbtyp_kurzbz) && !empty($tmpwbtyp_kurzbz) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(".$cSchemaSQL."tbl_wettbewerbtyp.wbtyp_kurzbz)=UPPER('".$tmpwbtyp_kurzbz."') ";
|
||||
}
|
||||
elseif (is_array($tmpwbtyp_kurzbz) && count($tmpwbtyp_kurzbz)>0 )
|
||||
{
|
||||
if (isset($tmpwbtyp_kurzbz[0]['wbtyp_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$tmpwbtyp_kurzbzE=array();
|
||||
for ($indZEILE=0;$indZEILE<count($tmpwbtyp_kurzbz);$indZEILE++)
|
||||
$tmpwbtyp_kurzbzE[]=trim($tmpwbtyp_kurzbz[$indZEILE]['wbtyp_kurzbz']);
|
||||
$tmpwbtyp_kurzbz=$tmpwbtyp_kurzbzE;
|
||||
}
|
||||
elseif (isset($tmpwbtyp_kurzbz['wbtyp_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$tmpwbtyp_kurzbzE=array();
|
||||
$tmpwbtyp_kurzbzE[]=trim($tmpwbtyp_kurzbz['wbtyp_kurzbz']);
|
||||
$tmpwbtyp_kurzbz=$tmpwbtyp_kurzbzE;
|
||||
}
|
||||
$cTmpSQL.=" AND UPPER(".$cSchemaSQL."tbl_wettbewerbtyp.wbtyp_kurzbz) in ('".strtoupper(implode("','",$tmpwbtyp_kurzbz))."') ";
|
||||
}
|
||||
$cTmpSQL.=" OFFSET 0 LIMIT ALL FOR SHARE;";
|
||||
|
||||
#exit($cTmpSQL);
|
||||
|
||||
// Entfernen der Temporaeren Variablen aus dem Speicher
|
||||
if (isset($cSchemaSQL)) unset($cSchemaSQL);
|
||||
if (isset($tmpwbtyp_kurzbz)) unset($tmpwbtyp_kurzbz);
|
||||
// Datenbankabfrage
|
||||
$this->setStringSQL($cTmpSQL);
|
||||
unset($cTmpSQL);
|
||||
|
||||
$this->setResultSQL(null);
|
||||
if (!$this->fetch_all())
|
||||
return false;
|
||||
$this->setWettbewerb($this->getResultSQL());
|
||||
$this->setResultSQL(null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function loadWettbewerb()
|
||||
{
|
||||
$cSchemaSQL=$this->getSchemaSQL();
|
||||
$tmpwbtyp_kurzbz=$this->getWbtyp_kurzbz();
|
||||
$cWettbewerb_kurzbz=$this->getWettbewerb_kurzbz();
|
||||
|
||||
$cTmpSQL="";
|
||||
$cTmpSQL.="SELECT *,tbl_wettbewerbtyp.wbtyp_kurzbz,case WHEN tbl_wettbewerb.teamgroesse >1 then 'Teambewerb' else 'Einzelbewerb' end as wettbewerbart FROM ".$cSchemaSQL."tbl_wettbewerbtyp ";
|
||||
$cTmpSQL.=" LEFT JOIN ".$cSchemaSQL."tbl_wettbewerb ON UPPER(".$cSchemaSQL."tbl_wettbewerb.wbtyp_kurzbz)=UPPER(".$cSchemaSQL."tbl_wettbewerbtyp.wbtyp_kurzbz) ";
|
||||
$cTmpSQL.=" WHERE ".$cSchemaSQL."tbl_wettbewerbtyp.wbtyp_kurzbz>'' ";
|
||||
|
||||
// Suche nach einem einzigen Wetttbewerbstypen wbtyp_kurzbz
|
||||
if (!is_array($tmpwbtyp_kurzbz) && !empty($tmpwbtyp_kurzbz) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(".$cSchemaSQL."tbl_wettbewerbtyp.wbtyp_kurzbz)=UPPER('".$tmpwbtyp_kurzbz."') ";
|
||||
}
|
||||
elseif (is_array($tmpwbtyp_kurzbz) && count($tmpwbtyp_kurzbz)>0 )
|
||||
{
|
||||
if (isset($tmpwbtyp_kurzbz[0]['wbtyp_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$tmpwbtyp_kurzbzE=array();
|
||||
for ($indZEILE=0;$indZEILE<count($tmpwbtyp_kurzbz);$indZEILE++)
|
||||
$tmpwbtyp_kurzbzE[]=trim($tmpwbtyp_kurzbz[$indZEILE]['wbtyp_kurzbz']);
|
||||
$tmpwbtyp_kurzbz=$tmpwbtyp_kurzbzE;
|
||||
}
|
||||
elseif (isset($tmpwbtyp_kurzbz['wbtyp_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$tmpwbtyp_kurzbzE=array();
|
||||
$tmpwbtyp_kurzbzE[]=trim($tmpwbtyp_kurzbz['wbtyp_kurzbz']);
|
||||
$tmpwbtyp_kurzbz=$tmpwbtyp_kurzbzE;
|
||||
}
|
||||
$cTmpSQL.=" AND UPPER(".$cSchemaSQL."tbl_wettbewerbtyp.wbtyp_kurzbz) in ('".strtoupper(implode("','",$tmpwbtyp_kurzbz))."') ";
|
||||
}
|
||||
|
||||
// Suche nach Wettbewerben wettbewerb_kurzbz
|
||||
if (!is_array($cWettbewerb_kurzbz) && !empty($cWettbewerb_kurzbz) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(".$cSchemaSQL."tbl_wettbewerb.wettbewerb_kurzbz)=UPPER('".$cWettbewerb_kurzbz."') ";
|
||||
}
|
||||
elseif (is_array($cWettbewerb_kurzbz) && count($cWettbewerb_kurzbz)>0 )
|
||||
{
|
||||
if (isset($cWettbewerb_kurzbz[0]['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$tmpwbtyp_kurzbzE=array();
|
||||
for ($indZEILE=0;$indZEILE<count($tmpwbtyp_kurzbz);$indZEILE++)
|
||||
$tmpwbtyp_kurzbzE[]=trim($tmpwbtyp_kurzbz[$indZEILE]['wettbewerb_kurzbz']);
|
||||
$cWettbewerb_kurzbz=$tmpwbtyp_kurzbzE;
|
||||
unset($tmpwbtyp_kurzbzE);
|
||||
}
|
||||
elseif (isset($cWettbewerb_kurzbz['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$tmpwbtyp_kurzbzE=array();
|
||||
$tmpwbtyp_kurzbzE[]=trim($tmpwbtyp_kurzbz['wettbewerb_kurzbz']);
|
||||
$cWettbewerb_kurzbz=$tmpwbtyp_kurzbzE;
|
||||
unset($tmpwbtyp_kurzbzE);
|
||||
}
|
||||
$cTmpSQL.=" AND UPPER(".$cSchemaSQL."tbl_wettbewerb.wettbewerb_kurzbz) in ('".strtoupper(implode("','",$tmpwbtyp_kurzbzE))."') ";
|
||||
}
|
||||
$cTmpSQL.=" OFFSET 0 LIMIT ALL FOR SHARE OF tbl_wettbewerbtyp;";
|
||||
|
||||
// Entfernen der Temporaeren Variablen aus dem Speicher
|
||||
if (isset($cSchemaSQL)) unset($cSchemaSQL);
|
||||
if (isset($tmpwbtyp_kurzbz)) unset($tmpwbtyp_kurzbz);
|
||||
if (isset($cWettbewerb_kurzbz)) unset($cWettbewerb_kurzbz);
|
||||
|
||||
// Datenbankabfrage
|
||||
$this->setStringSQL($cTmpSQL);
|
||||
unset($cTmpSQL);
|
||||
|
||||
$this->setResultSQL(null);
|
||||
if (!$this->fetch_all())
|
||||
return false;
|
||||
$this->setWettbewerb($this->getResultSQL());
|
||||
$this->setResultSQL(null);
|
||||
|
||||
return true;
|
||||
}
|
||||
} // Class komune_wettbewerb Ende
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,826 @@
|
||||
<?php
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/* Copyright (C) 2008 Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at>,
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>,
|
||||
* Gerald Simane-Sequens <gerald.simane-sequens@technikum-wien.at>.
|
||||
*/
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
*
|
||||
* @classe kommune_wettbewerbeinladungen
|
||||
*
|
||||
* @param connectSQL Datenbankverbindung
|
||||
* @param team_kurzbz Einladung zum Wettbewerb
|
||||
* @param team_gefordert Einladung zum Wettbewerb
|
||||
* @param wettbewerb_kurzbz Wettbewerbssubgruppen Key
|
||||
*
|
||||
* @return - kein Retourn des Konstruktors
|
||||
*
|
||||
*/
|
||||
include_once(dirname(__FILE__)."/postgre_sql.class.php");
|
||||
class komune_wettbewerbeinladungen extends postgre_sql
|
||||
{
|
||||
protected $wettbewerbeinladungen="";
|
||||
|
||||
protected $uid="";
|
||||
|
||||
protected $match_id="";
|
||||
protected $wettbewerb_kurzbz="";
|
||||
|
||||
protected $team_kurzbz="";
|
||||
protected $team_gefordert="";
|
||||
|
||||
protected $gefordertvon="";
|
||||
protected $gefordertamum="";
|
||||
|
||||
protected $matchdatumzeit="";
|
||||
protected $matchort="";
|
||||
|
||||
protected $bestaetigtvon="";
|
||||
protected $bestaetigtamum="";
|
||||
|
||||
protected $ergebniss="";
|
||||
protected $team_sieger="";
|
||||
|
||||
protected $matchbestaetigtamum="";
|
||||
protected $matchbestaetigtvon="";
|
||||
|
||||
protected $switchGewinner='';
|
||||
|
||||
//-----Konstruktor
|
||||
function komune_wettbewerbeinladungen($connectSQL,$match_id="",$team_forderer="",$team_gefordert="",$wettbewerb_kurzbz="",$uid="")
|
||||
{
|
||||
$this->InitWettbewerbeinladungen();
|
||||
|
||||
$this->setConnectSQL($connectSQL);
|
||||
$this->setMatch_id($match_id);
|
||||
$this->setTeam_forderer($team_forderer);
|
||||
$this->setTeam_gefordert($team_gefordert);
|
||||
$this->setWettbewerb_kurzbz($wettbewerb_kurzbz);
|
||||
$this->setGefordertvon($uid);
|
||||
}
|
||||
//-----Initialisierung--------------------------------------------------------------------------------------------
|
||||
function InitWettbewerbeinladungen()
|
||||
{
|
||||
$this->setError('');
|
||||
// Ergebniss-Liste der Spiele
|
||||
$this->setWettbewerbeinladung('');
|
||||
// Liste der Spiele mit Ergebniss "True" , oder Ohne "False"
|
||||
$this->setSwitchGewinner('');
|
||||
|
||||
// Step 1
|
||||
$this->setMatch_id('');
|
||||
$this->setWettbewerb_kurzbz('');
|
||||
|
||||
$this->setGefordertvon('');
|
||||
$this->setGefordertamum('');
|
||||
|
||||
$this->setTeam_kurzbz('');
|
||||
$this->setTeam_gefordert('');
|
||||
|
||||
$this->setMatchdatumzeit('');
|
||||
$this->setMatchort('');
|
||||
// Step 2
|
||||
$this->setBestaetigtvon('');
|
||||
$this->setBestaetigtamum(0);
|
||||
// Step 3
|
||||
$this->setErgebniss('');
|
||||
$this->setTeam_sieger('');
|
||||
// Step 4
|
||||
$this->setMatchbestaetigtamum('');
|
||||
$this->setMatchbestaetigtvon('');
|
||||
}
|
||||
//-----Wettbewerb Matchdaten--------------------------------------------------------------------------------------------
|
||||
function getWettbewerbeinladung()
|
||||
{
|
||||
return $this->wettbewerbeinladung;
|
||||
}
|
||||
function setWettbewerbeinladung($wettbewerbeinladung)
|
||||
{
|
||||
$this->wettbewerbeinladung=$wettbewerbeinladung;
|
||||
}
|
||||
//-----match_id--------------------------------------------------------------------------------------------
|
||||
function getMatch_id()
|
||||
{
|
||||
return $this->match_id;
|
||||
}
|
||||
function setMatch_id($match_id)
|
||||
{
|
||||
$this->match_id=$match_id;
|
||||
}
|
||||
//-----gefordertvon--------------------------------------------------------------------------------------------
|
||||
function getGefordertvon()
|
||||
{
|
||||
return $this->gefordertvon;
|
||||
}
|
||||
function setGefordertvon($gefordertvon)
|
||||
{
|
||||
$this->gefordertvon=$gefordertvon;
|
||||
}
|
||||
|
||||
//-----UID--------------------------------------------------------------------------------------------
|
||||
// Match - Wettbewerb uid = Moderator
|
||||
function getUid()
|
||||
{
|
||||
return $this->uid;
|
||||
}
|
||||
function setUid($uid)
|
||||
{
|
||||
$this->uid=$uid;
|
||||
}
|
||||
|
||||
//-----gefordertam--------------------------------------------------------------------------------------------
|
||||
function getGefordertamum()
|
||||
{
|
||||
return $this->gefordertamum;
|
||||
}
|
||||
function setGefordertamum($gefordertamum)
|
||||
{
|
||||
$this->gefordertamum=$gefordertamum;
|
||||
}
|
||||
//-----team_forderer--------------------------------------------------------------------------------------------
|
||||
function getTeam_forderer()
|
||||
{
|
||||
return $this->team_forderer;
|
||||
}
|
||||
function setTeam_forderer($team_forderer)
|
||||
{
|
||||
$this->team_forderer=$team_forderer;
|
||||
}
|
||||
//-----team_kurzbz--kompilitaet------------------------------------------------------------------------------------------
|
||||
function getTeam_kurzbz()
|
||||
{
|
||||
return $this->getTeam_forderer();
|
||||
}
|
||||
function setTeam_kurzbz($team_kurzbz)
|
||||
{
|
||||
$this->setTeam_forderer($team_kurzbz);
|
||||
}
|
||||
|
||||
//-----team_gefordert--------------------------------------------------------------------------------------------
|
||||
function getTeam_gefordert()
|
||||
{
|
||||
return $this->team_gefordert;
|
||||
}
|
||||
function setTeam_gefordert($team_gefordert)
|
||||
{
|
||||
$this->team_gefordert=$team_gefordert;
|
||||
}
|
||||
//-----team_sieger--------------------------------------------------------------------------------------------
|
||||
function getTeam_sieger()
|
||||
{
|
||||
return $this->team_sieger;
|
||||
}
|
||||
function setTeam_sieger($team_sieger)
|
||||
{
|
||||
$this->team_sieger=$team_sieger;
|
||||
}
|
||||
//-----wettbewerb_kurzbz--------------------------------------------------------------------------------------------
|
||||
function getWettbewerb_kurzbz()
|
||||
{
|
||||
return $this->wettbewerb_kurzbz;
|
||||
}
|
||||
function setWettbewerb_kurzbz($wettbewerb_kurzbz="")
|
||||
{
|
||||
$this->wettbewerb_kurzbz=$wettbewerb_kurzbz;
|
||||
}
|
||||
//-----matchdatumzeit--------------------------------------------------------------------------------------------
|
||||
function getMatchdatumzeit()
|
||||
{
|
||||
return $this->matchdatumzeit;
|
||||
}
|
||||
function setMatchdatumzeit($matchdatumzeit)
|
||||
{
|
||||
$this->matchdatumzeit=$matchdatumzeit;
|
||||
}
|
||||
//-----matchort--------------------------------------------------------------------------------------------
|
||||
function getMatchort()
|
||||
{
|
||||
return $this->matchort;
|
||||
}
|
||||
function setMatchort($matchort)
|
||||
{
|
||||
$this->matchort=$matchort;
|
||||
}
|
||||
//-----ergebniss--------------------------------------------------------------------------------------------
|
||||
function getErgebniss()
|
||||
{
|
||||
return $this->ergebniss;
|
||||
}
|
||||
function setErgebniss($ergebniss)
|
||||
{
|
||||
$this->ergebniss=$ergebniss;
|
||||
}
|
||||
//-----bestaetigtvon--------------------------------------------------------------------------------------------
|
||||
function getBestaetigtvon()
|
||||
{
|
||||
return $this->bestaetigtvon;
|
||||
}
|
||||
function setBestaetigtvon($bestaetigtvon)
|
||||
{
|
||||
$this->bestaetigtvon=$bestaetigtvon;
|
||||
}
|
||||
//-----bestaetigtamum--------------------------------------------------------------------------------------------
|
||||
function getBestaetigtamum()
|
||||
{
|
||||
return $this->bestaetigtamum;
|
||||
}
|
||||
function setBestaetigtamum($bestaetigtamum)
|
||||
{
|
||||
$this->bestaetigtamum=$bestaetigtamum;
|
||||
}
|
||||
//-----matchbestaetigtamum--------------------------------------------------------------------------------------------
|
||||
function getMatchbestaetigtamum()
|
||||
{
|
||||
return $this->matchbestaetigtamum;
|
||||
}
|
||||
function setMatchbestaetigtamum($matchbestaetigtamum)
|
||||
{
|
||||
$this->matchbestaetigtamum=$matchbestaetigtamum;
|
||||
}
|
||||
//-----matchbestaetigtvon--------------------------------------------------------------------------------------------
|
||||
function getMatchbestaetigtvon()
|
||||
{
|
||||
return $this->matchbestaetigtvon;
|
||||
}
|
||||
function setMatchbestaetigtvon($matchbestaetigtvon)
|
||||
{
|
||||
$this->matchbestaetigtvon=$matchbestaetigtvon;
|
||||
}
|
||||
//-----switchGewinner--------------------------------------------------------------------------------------------
|
||||
// Selektion des Datenlesen 0 nur nicht Gewonnene, 1 sind alle Gewonnene , leer alle
|
||||
function getSwitchGewinner()
|
||||
{
|
||||
return $this->switchGewinner;
|
||||
}
|
||||
function setSwitchGewinner($switchGewinner)
|
||||
{
|
||||
$this->switchGewinner=$switchGewinner;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function saveWettbewerbeinladung($team_forderer="",$team_gefordert="",$match_id="")
|
||||
{
|
||||
// Initialisieren
|
||||
$this->setError('');
|
||||
// Konstante
|
||||
$constTableMatch='tbl_match';
|
||||
|
||||
// Parameteruebernahme
|
||||
if (!empty($team_forderer))
|
||||
$this->setTeam_forderer($team_forderer);
|
||||
if (!empty($team_gefordert))
|
||||
$this->setTeam_gefordert($team_gefordert);
|
||||
if (!empty($match_id))
|
||||
$this->setMatch_id($match_id);
|
||||
|
||||
// Verarbeitungsvariablen
|
||||
$cSchemaSQL=$this->getschemaSQL();
|
||||
$cMatch_id=$this->getMatch_id();
|
||||
$cTeam_forderer=$this->getTeam_forderer();
|
||||
$cTeam_gefordert=$this->getTeam_gefordert();
|
||||
|
||||
// Plausib - Pruefen ob Eingeladente Team nicht als Array ubergeben wurde ( gebraucht wird nur die Kurzbezeichnung)
|
||||
if (is_array($cTeam_forderer) && isset($cTeam_forderer['team_forderer']))
|
||||
$cTeam_forderer=$cTeam_forderer['team_forderer'];
|
||||
elseif (is_array($cTeam_forderer) && isset($cTeam_forderer[0]['team_forderer']) )
|
||||
$cTeam_forderer=$cTeam_forderer[0]['team_forderer'];
|
||||
elseif (is_array($cTeam_forderer) && isset($cTeam_forderer['team_forderer']))
|
||||
$cTeam_forderer=$cTeam_forderer['team_kurzbz'];
|
||||
elseif (is_array($cTeam_forderer) && isset($cTeam_forderer[0]['team_forderer']) )
|
||||
$cTeam_forderer=$cTeam_forderer[0]['team_forderer'];
|
||||
|
||||
// Plausib - Pruefen ob Eingeladene Team nicht als Array ubergeben wurde ( gebraucht wird nur die Kurzbezeichnung)
|
||||
if (is_array($cTeam_gefordert) && isset($cTeam_gefordert['team_kurzbz']))
|
||||
$cTeam_gefordert=$cTeam_gefordert['team_kurzbz'];
|
||||
elseif (is_array($cTeam_gefordert) && isset($cTeam_gefordert[0]['team_kurbz']))
|
||||
$cTeam_gefordert=$cTeam_gefordert[0]['team_kurzbz'];
|
||||
|
||||
$cTeam_forderer=trim($cTeam_forderer);
|
||||
if (empty($cTeam_forderer) )
|
||||
{
|
||||
$this->setError('Kein Einladung (Einladenter fehlt) möglich !');
|
||||
return false;
|
||||
}
|
||||
$cTeam_gefordert=trim($cTeam_gefordert);
|
||||
if (empty($cTeam_gefordert) )
|
||||
{
|
||||
$this->setError('Kein Einladung (Eingeladener fehlt) möglich !');
|
||||
return false;
|
||||
}
|
||||
$cMatch_id=trim($cMatch_id);
|
||||
if (empty($cTeam_gefordert) && empty($cMatch_id) )
|
||||
{
|
||||
$this->setError('Kein Einladung (Bearbeitung) möglich !');
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->setTableStruckturSQL($constTableMatch);
|
||||
if (!$origWettbewerbeinladungen=$this->loadWettbewerbeinladungen())
|
||||
{
|
||||
if ($this->getError()) // Beim Lesen ist ein Fehler aufgetreten
|
||||
return false;
|
||||
$this->setNewRecord(true);
|
||||
}
|
||||
|
||||
$arrTmpTableStrucktur=$this->getTableStruckturSQL();
|
||||
if (!is_array($arrTmpTableStrucktur))
|
||||
{
|
||||
$this->setError('Kein Tabellenstrucktur ("'.$constTableMatch.'") gefunden !');
|
||||
return false;
|
||||
}
|
||||
|
||||
$cTmpSQL="BEGIN; ";
|
||||
if ($this->getNewRecord()) // Neuanlage - Insert
|
||||
{
|
||||
if (!$this->getGefordertamum())
|
||||
$this->setGefordertamum(time());
|
||||
|
||||
$fildsList="";
|
||||
$fildsValue="";
|
||||
for ($fildIND=0;$fildIND<count($arrTmpTableStrucktur);$fildIND++)
|
||||
{
|
||||
|
||||
$cTmpWert='';
|
||||
if (isset($this->$arrTmpTableStrucktur[$fildIND]['name']) && $this->$arrTmpTableStrucktur[$fildIND]['name']!='')
|
||||
$cTmpWert=$this->$arrTmpTableStrucktur[$fildIND]['name'];
|
||||
if ($cTmpWert!='')
|
||||
{
|
||||
switch ($arrTmpTableStrucktur[$fildIND]['type'])
|
||||
{
|
||||
case 'timestamp':
|
||||
$cTmpWert="to_timestamp('".$cTmpWert."')";
|
||||
break;
|
||||
case 'time':
|
||||
$cTmpWert="to_timestamp('".$cTmpWert."')";
|
||||
break;
|
||||
default:
|
||||
$cTmpWert="E'".addslashes(trim($cTmpWert))."'";
|
||||
break;
|
||||
}
|
||||
$fildsList.=(!empty($fildsList)?',':'').$arrTmpTableStrucktur[$fildIND]['name'];
|
||||
$fildsValue.=(!empty($fildsValue)?',':'').$cTmpWert;
|
||||
}
|
||||
}
|
||||
$cTmpSQL=" insert into ".$cSchemaSQL."tbl_match (".$fildsList.") values (".$fildsValue."); ";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$this->getMatch_id())
|
||||
$this->setMatch_id($origWettbewerbeinladungen[0]['match_id']);
|
||||
$cTmpSQL.=" update ".$cSchemaSQL."tbl_match set ";
|
||||
$fildsValue='';
|
||||
for ($fildIND=0;$fildIND<count($arrTmpTableStrucktur);$fildIND++)
|
||||
{
|
||||
$cTmpWert='';
|
||||
if (isset($this->$arrTmpTableStrucktur[$fildIND]['name'])
|
||||
&& $this->$arrTmpTableStrucktur[$fildIND]['name']!=''
|
||||
&& $arrTmpTableStrucktur[$fildIND]['name']!='match_id' )
|
||||
{
|
||||
$cTmpWert=$this->$arrTmpTableStrucktur[$fildIND]['name'];
|
||||
if ($cTmpWert!='')
|
||||
{
|
||||
switch ($arrTmpTableStrucktur[$fildIND]['type'])
|
||||
{
|
||||
case 'timestamp':
|
||||
$cTmpWert="to_timestamp('".$cTmpWert."')";
|
||||
break;
|
||||
case 'time':
|
||||
$cTmpWert="to_timestamp('".$cTmpWert."')";
|
||||
break;
|
||||
default:
|
||||
$cTmpWert="E'".addslashes(trim($cTmpWert))."'";
|
||||
break;
|
||||
}
|
||||
$fildsValue.= (!empty($fildsValue)?',':'').$arrTmpTableStrucktur[$fildIND]['name']."=".$cTmpWert;
|
||||
}
|
||||
}
|
||||
}
|
||||
$cTmpSQL.=$fildsValue." where tbl_match.match_id='".$this->getMatch_id()."'; ";
|
||||
$cWettbewerb_kurzbz=trim($origWettbewerbeinladungen[0]['wettbewerb_kurzbz']);
|
||||
$origWettbewerbeinladungen[0]['matchbestaetigtvon']=trim($origWettbewerbeinladungen[0]['matchbestaetigtvon']);
|
||||
$origWettbewerbeinladungen[0]['team_sieger']=trim($origWettbewerbeinladungen[0]['team_sieger']);
|
||||
|
||||
if ($this->getMatchbestaetigtvon() && empty($origWettbewerbeinladungen[0]['matchbestaetigtvon'])
|
||||
&& trim($origWettbewerbeinladungen[0]['team_sieger'])==trim($cTeam_forderer)) // Der Forderer ist der Siehter den Rangtauschen
|
||||
{
|
||||
// Rang des Geforderten ermitteln
|
||||
$cTmpSQL_tmp="select rang from ".$cSchemaSQL."tbl_wettbewerbteam where upper(team_kurzbz)=upper('".$cTeam_gefordert."') and upper(wettbewerb_kurzbz)=upper('".$cWettbewerb_kurzbz."') FOR UPDATE ;";
|
||||
$this->fetch_object($cTmpSQL_tmp);
|
||||
$iTmpRangGeforderter=$this->getResultSQL();
|
||||
if (isset($iTmpRangGeforderter->rang))
|
||||
$iTmpRangGeforderter=trim($iTmpRangGeforderter->rang);
|
||||
|
||||
// Rang des Geforderten ermitteln
|
||||
$cTmpSQL_tmp="select rang from ".$cSchemaSQL."tbl_wettbewerbteam where upper(team_kurzbz)=upper('".$cTeam_forderer."') and upper(wettbewerb_kurzbz)=upper('".$cWettbewerb_kurzbz."') FOR UPDATE ;";
|
||||
|
||||
$this->fetch_object($cTmpSQL_tmp);
|
||||
$iTmpRangFrorderer=$this->getResultSQL();
|
||||
if (isset($iTmpRangFrorderer->rang))
|
||||
$iTmpRangFrorderer=trim($iTmpRangFrorderer->rang);
|
||||
|
||||
$cTmpSQL.=" update ".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
$cTmpSQL.="set rang=0 ";
|
||||
$cTmpSQL.=" where upper(team_kurzbz)=upper('".$cTeam_gefordert."') and upper(wettbewerb_kurzbz)=upper('".$cWettbewerb_kurzbz."'); ";
|
||||
|
||||
$cTmpSQL.=" update ".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
$cTmpSQL.="set rang=".$iTmpRangGeforderter;
|
||||
$cTmpSQL.=" where upper(team_kurzbz)=upper('".$cTeam_forderer."') and upper(wettbewerb_kurzbz)=upper('".$cWettbewerb_kurzbz."'); ";
|
||||
|
||||
$cTmpSQL.=" update ".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
$cTmpSQL.="set rang=".$iTmpRangFrorderer;
|
||||
$cTmpSQL.=" where upper(team_kurzbz)=upper('".$cTeam_gefordert."') and upper(wettbewerb_kurzbz)=upper('".$cWettbewerb_kurzbz."'); ";
|
||||
|
||||
$cTmpSQL.=" update ".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
$cTmpSQL.="set punkte=3+punkte ";
|
||||
$cTmpSQL.="where upper(wettbewerb_kurzbz)=upper('".$cWettbewerb_kurzbz."') and upper(team_kurzbz)=upper('".$origWettbewerbeinladungen[0]['team_sieger']."'); ";
|
||||
|
||||
$cTmpSQL.=" update ".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
$cTmpSQL.="set punkte=1+punkte ";
|
||||
$cTmpSQL.="where upper(wettbewerb_kurzbz)=upper('".$cWettbewerb_kurzbz."') and upper(team_kurzbz)=upper('". ($origWettbewerbeinladungen[0]['team_sieger']==$cTeam_gefordert?$cTeam_forderer:$cTeam_gefordert)."'); ";
|
||||
}
|
||||
}
|
||||
$cTmpSQL.=" COMMIT; ";
|
||||
#exit($cTmpSQL);
|
||||
// Datenbankabfrage
|
||||
$this->setStringSQL($cTmpSQL);
|
||||
unset($cTmpSQL);
|
||||
|
||||
$this->setResultSQL(null);
|
||||
if (!$this->dbQuery())
|
||||
return false;
|
||||
if (!$origWettbewerbeinladungen=$this->loadWettbewerbeinladungen())
|
||||
{
|
||||
if ($this->getError()) // Beim Lesen ist ein Fehler aufgetreten
|
||||
return false;
|
||||
$this->setNewRecord(true);
|
||||
}
|
||||
$this->setResultSQL(null);
|
||||
return $origWettbewerbeinladungen;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function loadWettbewerbeinladungen()
|
||||
{
|
||||
$this->setError('');
|
||||
|
||||
$cSchemaSQL=$this->getschemaSQL();
|
||||
|
||||
$match_id=$this->getMatch_id();
|
||||
$cTeam_forderer=$this->getTeam_forderer();
|
||||
$cTeam_kurzbz_einladungen=$this->getTeam_gefordert();
|
||||
$cWettbewerb_kurzbz=$this->getWettbewerb_kurzbz();
|
||||
$cGefordertvon=$this->getGefordertvon();
|
||||
|
||||
$bSwitchGewinner=$this->getSwitchGewinner();
|
||||
|
||||
#SELECT TIMESTAMP WITHOUT TIME ZONE 'epoch' + 982384720 * INTERVAL '1 second';
|
||||
#select to_char(TIMESTAMP '2007-03-27 10:48:50.022', 'DD.MM.YYYY');
|
||||
#select to_char(TIMESTAMP '2007-03-27 10:48:50.022', 'HH24:MI:SS');
|
||||
$cTmpSQL="";
|
||||
$cTmpSQL.="SELECT * ";
|
||||
|
||||
$cTmpSQL.=", to_char(matchdatumzeit, 'DD.MM.YYYY') as \"matchdatum\" ";
|
||||
$cTmpSQL.=", to_char(matchdatumzeit, 'HH24:MI') as \"matchzeit\" ";
|
||||
|
||||
$cTmpSQL.=", to_char(gefordertamum, 'DD.MM.YYYY') as \"gefordertamumdatum\" ";
|
||||
$cTmpSQL.=", to_char(gefordertamum, 'HH24:MI') as \"gefordertamumzeit\" ";
|
||||
|
||||
$cTmpSQL.=", to_char(bestaetigtamum, 'DD.MM.YYYY') as \"bestaetigtdatum\" ";
|
||||
$cTmpSQL.=", to_char(bestaetigtamum, 'HH24:MI') as \"bestaetigtzeit\" ";
|
||||
|
||||
$cTmpSQL.=", to_char(matchbestaetigtamum, 'DD.MM.YYYY') as \"matchbestaetigtdatum\" ";
|
||||
$cTmpSQL.=", to_char(matchbestaetigtamum, 'HH24:MI') as \"matchbestaetigtzeit\" ";
|
||||
|
||||
$cTmpSQL.=" FROM ".$cSchemaSQL."tbl_match ";
|
||||
|
||||
if (empty($match_id))
|
||||
$cTmpSQL.=" WHERE tbl_match.match_id>0 ";
|
||||
else
|
||||
$cTmpSQL.=" WHERE tbl_match.match_id='".addslashes(trim($match_id))."' ";
|
||||
|
||||
# if (empty($cGefordertvon))
|
||||
# $cTmpSQL.=" and tbl_match.gefordertvon='".addslashes(trim($cGefordertvon))."' ";
|
||||
|
||||
// Forderer
|
||||
if (!is_array($cTeam_forderer) && !empty($cTeam_forderer) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.team_forderer)=UPPER('".addslashes(trim($cTeam_forderer))."') ";
|
||||
}
|
||||
elseif (is_array($cTeam_forderer) && count($cTeam_forderer)>0 )
|
||||
{
|
||||
if (isset($cTeam_forderer[0]['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
for ($indZEILE=0;$indZEILE<count($cTeam_forderer);$indZEILE++)
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_forderer[$indZEILE]['team_kurzbz']);
|
||||
$cTeam_forderer=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
elseif (isset($cTeam_forderer['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_forderer['team_kurzbz']);
|
||||
$cTeam_forderer=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.team_forderer) in ('".strtoupper(implode("','",$cTeam_forderer))."') ";
|
||||
}
|
||||
// Aaufforderungen - Einladung
|
||||
|
||||
if (!is_array($cTeam_kurzbz_einladungen) && !empty($cTeam_kurzbz_einladungen) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.team_gefordert)=UPPER('".addslashes(trim($cTeam_kurzbz_einladungen))."') ";
|
||||
}
|
||||
elseif (is_array($cTeam_kurzbz_einladungen) && count($cTeam_kurzbz_einladungen)>0 )
|
||||
{
|
||||
if (isset($cTeam_kurzbz_einladungen[0]['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
for ($indZEILE=0;$indZEILE<count($cTeam_kurzbz_einladungen);$indZEILE++)
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_kurzbz_einladungen[$indZEILE]['team_kurzbz']);
|
||||
$cTeam_kurzbz_einladungen=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
elseif (isset($cTeam_kurzbz_einladungen['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_kurzbz_einladungen['team_kurzbz']);
|
||||
$cTeam_kurzbz_einladungen=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.team_gefordert) in ('".strtoupper(implode("','",$cTeam_kurzbz_einladungen))."') ";
|
||||
}
|
||||
|
||||
// GEForderte
|
||||
|
||||
if (!is_array($cWettbewerb_kurzbz) && !empty($cWettbewerb_kurzbz) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.wettbewerb_kurzbz)=UPPER('".addslashes(trim($cWettbewerb_kurzbz))."') ";
|
||||
}
|
||||
elseif (is_array($cWettbewerb_kurzbz) && count($cWettbewerb_kurzbz)>0 )
|
||||
{
|
||||
if (isset($cWettbewerb_kurzbz[0]['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrWettbewerb_kurzbz=array();
|
||||
for ($indZEILE=0;$indZEILE<count($cWettbewerb_kurzbz);$indZEILE++)
|
||||
$arrWettbewerb_kurzbz[]=trim($cTeam_kurzbz_einladungen[$indZEILE]['wettbewerb_kurzbz']);
|
||||
$cWettbewerb_kurzbz=$arrWettbewerb_kurzbz;
|
||||
unset($arrWettbewerb_kurzbz);
|
||||
}
|
||||
elseif (isset($cWettbewerb_kurzbz['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrWettbewerb_kurzbz=array();
|
||||
$arrWettbewerb_kurzbz[]=trim($cTeam_kurzbz_einladungen['wettbewerb_kurzbz']);
|
||||
$cWettbewerb_kurzbz=$arrWettbewerb_kurzbz;
|
||||
unset($arrWettbewerb_kurzbz);
|
||||
}
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.wettbewerb_kurzbz) in ('".strtoupper(implode("','",$cWettbewerb_kurzbz))."') ";
|
||||
}
|
||||
|
||||
// Listenformen bestimmen
|
||||
if ($bSwitchGewinner=='0')
|
||||
$cTmpSQL.=" AND ( tbl_match.matchbestaetigtvon <='' or (tbl_match.matchbestaetigtvon IS NULL) ) ";
|
||||
elseif ($bSwitchGewinner=='1')
|
||||
$cTmpSQL.=" AND tbl_match.matchbestaetigtvon > '' ";
|
||||
|
||||
$cTmpSQL.=" OFFSET 0 LIMIT ALL FOR SHARE ;";
|
||||
|
||||
// Entfernen der Temporaeren Variablen aus dem Speicher
|
||||
unset($cSchemaSQL);
|
||||
unset($cTeam_kurzbz);
|
||||
unset($cTeam_kurzbz_einladungen);
|
||||
unset($cWettbewerb_kurzbz);
|
||||
unset($cGefordertvond);
|
||||
// Datenbankabfrage
|
||||
$this->setStringSQL($cTmpSQL);
|
||||
unset($cTmpSQL);
|
||||
|
||||
$this->setResultSQL(null);
|
||||
$this->setWettbewerbeinladung(null);
|
||||
|
||||
if (!$this->fetch_all())
|
||||
return false;
|
||||
$this->setWettbewerbeinladung($this->getResultSQL());
|
||||
$this->setResultSQL(null);
|
||||
|
||||
return $this->getWettbewerbeinladung();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function loadWettbewerbeinladungenForderungstage()
|
||||
{
|
||||
$this->setError('');
|
||||
$cSchemaSQL=$this->getschemaSQL();
|
||||
|
||||
$match_id=$this->getMatch_id();
|
||||
$cTeam_forderer=$this->getTeam_forderer();
|
||||
$cTeam_kurzbz_einladungen=$this->getTeam_gefordert();
|
||||
$cWettbewerb_kurzbz=$this->getWettbewerb_kurzbz();
|
||||
|
||||
$cUid=$this->getGefordertvon();
|
||||
|
||||
$cTmpSQL="";
|
||||
$cTmpSQL.="SELECT * ";
|
||||
|
||||
$cTmpSQL.=", to_char(matchdatumzeit, 'DD.MM.YYYY') as \"matchdatum\" ";
|
||||
$cTmpSQL.=", to_char(matchdatumzeit, 'HH24:MI') as \"matchzeit\" ";
|
||||
|
||||
$cTmpSQL.=", to_char(gefordertamum, 'DD.MM.YYYY') as \"gefordertamumdatum\" ";
|
||||
$cTmpSQL.=", to_char(gefordertamum, 'HH24:MI') as \"gefordertamumzeit\" ";
|
||||
|
||||
$cTmpSQL.=", to_char(bestaetigtamum, 'DD.MM.YYYY') as \"bestaetigtdatum\" ";
|
||||
$cTmpSQL.=", to_char(bestaetigtamum, 'HH24:MI') as \"bestaetigtzeit\" ";
|
||||
|
||||
$cTmpSQL.=", to_char(matchbestaetigtamum, 'DD.MM.YYYY') as \"matchbestaetigtdatum\" ";
|
||||
$cTmpSQL.=", to_char(matchbestaetigtamum, 'HH24:MI') as \"matchbestaetigtzeit\" ";
|
||||
|
||||
|
||||
$cTmpSQL.="
|
||||
,1+extract('day' from (age(".$cSchemaSQL."tbl_match.gefordertamum))) as gefordertamum_diff
|
||||
,1+extract('day' from (age(".$cSchemaSQL."tbl_match.bestaetigtamum,".$cSchemaSQL."tbl_match.gefordertamum))) as bestaetigtamum_diff
|
||||
,1+extract('day' from (age(".$cSchemaSQL."tbl_match.matchdatumzeit,".$cSchemaSQL."tbl_match.bestaetigtamum))) as matchdatumzeit_diff
|
||||
,1+extract('day' from (age(".$cSchemaSQL."tbl_match.matchbestaetigtamum,".$cSchemaSQL."tbl_match.matchdatumzeit))) as matchbestaetigtamum_diff
|
||||
|
||||
,1+extract('day' from (age(".$cSchemaSQL."tbl_match.gefordertamum))) as gefordertamum_tag_diff
|
||||
,1+extract('day' from (age(".$cSchemaSQL."tbl_match.bestaetigtamum))) as bestaetigtamum_tag_diff
|
||||
,1+extract('day' from (age(".$cSchemaSQL."tbl_match.matchdatumzeit))) as matchdatumzeit_tag_diff
|
||||
,1+extract('day' from (age(".$cSchemaSQL."tbl_match.matchbestaetigtamum))) as matchbestaetigtamum_tag_diff
|
||||
|
||||
|
||||
";
|
||||
|
||||
|
||||
$cTmpSQL.=" from ".$cSchemaSQL."tbl_wettbewerbtyp,".$cSchemaSQL."tbl_wettbewerb,".$cSchemaSQL."tbl_match
|
||||
|
||||
where ".$cSchemaSQL."tbl_wettbewerbtyp.wbtyp_kurzbz=".$cSchemaSQL."tbl_wettbewerb.wbtyp_kurzbz
|
||||
and ".$cSchemaSQL."tbl_match.wettbewerb_kurzbz=".$cSchemaSQL."tbl_wettbewerb.wettbewerb_kurzbz
|
||||
and (".$cSchemaSQL."tbl_match.matchbestaetigtvon IS NULL or ".$cSchemaSQL."tbl_match.matchbestaetigtvon<='')
|
||||
|
||||
";
|
||||
# and ( extract('day' from (age(".$cSchemaSQL."tbl_match.gefordertamum))) >=".$cSchemaSQL."tbl_wettbewerb.forderungstage
|
||||
# or extract('day' from (age(".$cSchemaSQL."tbl_match.bestaetigtamum,".$cSchemaSQL."tbl_match.gefordertamum)))>=".$cSchemaSQL."tbl_wettbewerb.forderungstage
|
||||
# or extract('day' from (age(".$cSchemaSQL."tbl_match.matchdatumzeit,".$cSchemaSQL."tbl_match.bestaetigtamum)))>=".$cSchemaSQL."tbl_wettbewerb.forderungstage
|
||||
# or extract('day' from (age(".$cSchemaSQL."tbl_match.matchbestaetigtamum,".$cSchemaSQL."tbl_match.matchdatumzeit)))>=".$cSchemaSQL."tbl_wettbewerb.forderungstage
|
||||
# )
|
||||
|
||||
|
||||
if (!empty($match_id))
|
||||
$cTmpSQL.=" and tbl_match.match_id='".addslashes(trim($match_id))."' ";
|
||||
|
||||
if (!empty($cUid))
|
||||
$cTmpSQL.=" and tbl_wettbewerb.uid='".addslashes(trim($cUid))."' ";
|
||||
|
||||
|
||||
// Forderer
|
||||
if (!is_array($cTeam_forderer) && !empty($cTeam_forderer) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.team_forderer)=UPPER('".addslashes(trim($cTeam_forderer))."') ";
|
||||
}
|
||||
elseif (is_array($cTeam_forderer) && count($cTeam_forderer)>0 )
|
||||
{
|
||||
if (isset($cTeam_forderer[0]['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
for ($indZEILE=0;$indZEILE<count($cTeam_forderer);$indZEILE++)
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_forderer[$indZEILE]['team_kurzbz']);
|
||||
$cTeam_forderer=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
elseif (isset($cTeam_forderer['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_forderer['team_kurzbz']);
|
||||
$cTeam_forderer=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.team_forderer) in ('".strtoupper(implode("','",$cTeam_forderer))."') ";
|
||||
}
|
||||
// Aaufforderungen - Einladung
|
||||
|
||||
if (!is_array($cTeam_kurzbz_einladungen) && !empty($cTeam_kurzbz_einladungen) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.team_gefordert)=UPPER('".addslashes(trim($cTeam_kurzbz_einladungen))."') ";
|
||||
}
|
||||
elseif (is_array($cTeam_kurzbz_einladungen) && count($cTeam_kurzbz_einladungen)>0 )
|
||||
{
|
||||
if (isset($cTeam_kurzbz_einladungen[0]['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
for ($indZEILE=0;$indZEILE<count($cTeam_kurzbz_einladungen);$indZEILE++)
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_kurzbz_einladungen[$indZEILE]['team_kurzbz']);
|
||||
$cTeam_kurzbz_einladungen=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
elseif (isset($cTeam_kurzbz_einladungen['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_kurzbz_einladungen['team_kurzbz']);
|
||||
$cTeam_kurzbz_einladungen=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.team_gefordert) in ('".strtoupper(implode("','",$cTeam_kurzbz_einladungen))."') ";
|
||||
}
|
||||
|
||||
// GEForderte
|
||||
|
||||
if (!is_array($cWettbewerb_kurzbz) && !empty($cWettbewerb_kurzbz) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.wettbewerb_kurzbz)=UPPER('".addslashes(trim($cWettbewerb_kurzbz))."') ";
|
||||
}
|
||||
elseif (is_array($cWettbewerb_kurzbz) && count($cWettbewerb_kurzbz)>0 )
|
||||
{
|
||||
if (isset($cWettbewerb_kurzbz[0]['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrWettbewerb_kurzbz=array();
|
||||
for ($indZEILE=0;$indZEILE<count($cWettbewerb_kurzbz);$indZEILE++)
|
||||
$arrWettbewerb_kurzbz[]=trim($cTeam_kurzbz_einladungen[$indZEILE]['wettbewerb_kurzbz']);
|
||||
$cWettbewerb_kurzbz=$arrWettbewerb_kurzbz;
|
||||
unset($arrWettbewerb_kurzbz);
|
||||
}
|
||||
elseif (isset($cWettbewerb_kurzbz['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrWettbewerb_kurzbz=array();
|
||||
$arrWettbewerb_kurzbz[]=trim($cTeam_kurzbz_einladungen['wettbewerb_kurzbz']);
|
||||
$cWettbewerb_kurzbz=$arrWettbewerb_kurzbz;
|
||||
unset($arrWettbewerb_kurzbz);
|
||||
}
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.wettbewerb_kurzbz) in ('".strtoupper(implode("','",$cWettbewerb_kurzbz))."') ";
|
||||
}
|
||||
|
||||
$cTmpSQL.=" OFFSET 0 LIMIT ALL FOR SHARE OF tbl_match ;";
|
||||
#exit($cTmpSQL.Test($cTeam_kurzbz_einladungen).implode("','",$cTeam_kurzbz_einladungen));
|
||||
|
||||
// Entfernen der Temporaeren Variablen aus dem Speicher
|
||||
unset($cSchemaSQL);
|
||||
unset($cTeam_kurzbz);
|
||||
unset($cTeam_kurzbz_einladungen);
|
||||
unset($cWettbewerb_kurzbz);
|
||||
unset($cUid);
|
||||
// Datenbankabfrage
|
||||
$this->setStringSQL($cTmpSQL);
|
||||
unset($cTmpSQL);
|
||||
|
||||
$this->setResultSQL(null);
|
||||
$this->setWettbewerbeinladung(null);
|
||||
|
||||
if (!$this->fetch_all())
|
||||
return false;
|
||||
$this->setWettbewerbeinladung($this->getResultSQL());
|
||||
$this->setResultSQL(null);
|
||||
return $this->getWettbewerbeinladung();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function unloadWettbewerbeinladungen()
|
||||
{
|
||||
$this->setError('');
|
||||
$cSchemaSQL=$this->getschemaSQL();
|
||||
|
||||
$match_id=$this->getMatch_id();
|
||||
if (empty($match_id))
|
||||
{
|
||||
$this->setError('Keine Match ID gefunden!');
|
||||
return false;
|
||||
}
|
||||
$cTmpSQL="";
|
||||
$cTmpSQL.="delete from ".$cSchemaSQL."tbl_match ";
|
||||
$cTmpSQL.=" * ";
|
||||
$cTmpSQL.=" where tbl_match.match_id='".addslashes(trim($match_id))."' ";
|
||||
|
||||
// Entfernen der Temporaeren Variablen aus dem Speicher
|
||||
unset($cSchemaSQL);
|
||||
unset($match_id);
|
||||
// Datenbankabfrage
|
||||
$this->setStringSQL($cTmpSQL);
|
||||
unset($cTmpSQL);
|
||||
|
||||
$this->setResultSQL(null);
|
||||
$this->setWettbewerbeinladung(null);
|
||||
if (!$this->fetch_object())
|
||||
return false;
|
||||
$this->setResultSQL(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // Class komune_wettbewerb Ende
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,396 @@
|
||||
<?php
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/* Copyright (C) 2008 Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at>,
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>,
|
||||
* Gerald Simane-Sequens <gerald.simane-sequens@technikum-wien.at>.
|
||||
*/
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
*
|
||||
* @classe komune_wettbewerbteam
|
||||
*
|
||||
* @param connectSQL Datenbankverbindung
|
||||
* @param uid Angemeleter Anwender
|
||||
* @param team_kurzbz Team des Angemeleter Anwenders zum Wettbewerb
|
||||
* @param wettbewerb_kurzbz Wettbewerbssubgruppen Key
|
||||
*
|
||||
* @return - kein Retourn des Konstruktors
|
||||
*
|
||||
*/
|
||||
include_once(dirname(__FILE__)."/postgre_sql.class.php");
|
||||
class komune_wettbewerbteam extends postgre_sql
|
||||
{
|
||||
protected $newWettbewerbteam;
|
||||
protected $wettbewerbteam;
|
||||
|
||||
protected $uid;
|
||||
protected $team_kurzbz;
|
||||
protected $team_kurzbz_old;
|
||||
protected $wettbewerb_kurzbz;
|
||||
|
||||
//-----Konstruktor
|
||||
function komune_wettbewerbteam($connectSQL,$uid="",$team_kurzbz="",$wettbewerb_kurzbz="")
|
||||
{
|
||||
$this->InitWettbewerbteam();
|
||||
|
||||
$this->setConnectSQL($connectSQL);
|
||||
$this->setSchemaSQL('kommune');
|
||||
// Parameter DB Schema
|
||||
|
||||
$this->setuid($uid);
|
||||
$this->setTeam_kurzbz($team_kurzbz);
|
||||
$this->setWettbewerb_kurzbz($wettbewerb_kurzbz);
|
||||
}
|
||||
|
||||
//-----Initialisierung--------------------------------------------------------------------------------------------
|
||||
function InitWettbewerbteam()
|
||||
{
|
||||
$this->setError('');
|
||||
|
||||
$this->setNewWettbewerbteam('');
|
||||
$this->setWettbewerbteam('');
|
||||
|
||||
$this->setuid('');
|
||||
$this->setTeam_kurzbz('');
|
||||
$this->setTeam_kurzbz_old('');
|
||||
$this->setWettbewerb_kurzbz('');
|
||||
}
|
||||
|
||||
//-----Neuer Datensatz--------------------------------------------------------------------------------------------
|
||||
function getNewWettbewerbteam()
|
||||
{
|
||||
return $this->newWettbewerbteam;
|
||||
}
|
||||
function setNewWettbewerbteam($newWettbewerbteam)
|
||||
{
|
||||
$this->newWettbewerbteam=$newWettbewerbteam;
|
||||
}
|
||||
//-----Aenderung Datensatz wird wie Neuanlage gehandhabt -------------------------------------------------------------
|
||||
function getUpdWettbewerbteam()
|
||||
{
|
||||
return $this->newWettbewerbteam;
|
||||
}
|
||||
function setUpdWettbewerbteam($newWettbewerbteam)
|
||||
{
|
||||
$this->newWettbewerbteam=trim($newWettbewerbteam);
|
||||
}
|
||||
//-----Aktueller Datensatz--------------------------------------------------------------------------------------------
|
||||
function getWettbewerbteam()
|
||||
{
|
||||
return $this->wettbewerbteam;
|
||||
}
|
||||
function setWettbewerbteam($wettbewerbteam)
|
||||
{
|
||||
$this->wettbewerbteam=$wettbewerbteam;
|
||||
}
|
||||
//-----team_kurzbz--------------------------------------------------------------------------------------------
|
||||
function getTeam_kurzbz()
|
||||
{
|
||||
return $this->team_kurzbz;
|
||||
}
|
||||
function setTeam_kurzbz($team_kurzbz)
|
||||
{
|
||||
$this->team_kurzbz=trim($team_kurzbz);
|
||||
}
|
||||
//-----team_kurzbz--------------------------------------------------------------------------------------------
|
||||
function getTeam_kurzbz_old()
|
||||
{
|
||||
return $this->team_kurzbz_old;
|
||||
}
|
||||
function setTeam_kurzbz_old($team_kurzbz_old)
|
||||
{
|
||||
$this->team_kurzbz_old=trim($team_kurzbz_old);
|
||||
}
|
||||
//-----uid--------------------------------------------------------------------------------------------
|
||||
function getUid()
|
||||
{
|
||||
return $this->uid;
|
||||
}
|
||||
function setUid($uid)
|
||||
{
|
||||
$this->uid=trim($uid);
|
||||
}
|
||||
//-----wettbewerb_kurzbz--------------------------------------------------------------------------------------------
|
||||
function getWettbewerb_kurzbz()
|
||||
{
|
||||
return $this->wettbewerb_kurzbz;
|
||||
}
|
||||
function setWettbewerb_kurzbz($wettbewerb_kurzbz="")
|
||||
{
|
||||
$this->wettbewerb_kurzbz=trim($wettbewerb_kurzbz);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function saveWettbewerbteam($newWettbewerbteam="")
|
||||
{
|
||||
// Initialisierung
|
||||
$this->setError('');
|
||||
|
||||
// Plausib
|
||||
if (!empty($newWettbewerbteam))
|
||||
$this->setNewWettbewerbteam($newWettbewerbteam);
|
||||
|
||||
if (!is_array($this->getNewWettbewerbteam()))
|
||||
{
|
||||
$this->setError('Kein Wettbewerbsteam übergeben');
|
||||
return false;
|
||||
}
|
||||
$newWettbewerbteam=$this->getNewWettbewerbteam();
|
||||
|
||||
// Daten uebernahme
|
||||
$cSchemaSQL=$this->getSchemaSQL();
|
||||
$cTeam_kurzbz=$this->getTeam_kurzbz();
|
||||
|
||||
// Aenderungen muessen mit dem Team_kurzbz_old gekennzeichnet werden. Ansonst koennten falsche Daten geaendert werden
|
||||
$cTeam_kurzbz_old=$this->getTeam_kurzbz_old();
|
||||
|
||||
$cUserUID=$this->getUid(); // Vor der Verarbeitung sicherstellen das Alle Anwender gelesen werden
|
||||
$this->setUid('');
|
||||
|
||||
$this->setNewRecord(false);
|
||||
if (!$origWettbewerbteam=$this->loadWettbewerbteam())
|
||||
{
|
||||
if ($this->getError()) // Beim Lesen ist ein Fehler aufgetreten
|
||||
return false;
|
||||
$this->setNewRecord(true);
|
||||
}
|
||||
$this->setUid($cUserUID);
|
||||
unset($cUserUID);
|
||||
|
||||
if ($origWettbewerbteam && empty($cTeam_kurzbz_old)) // Datenrec bereits vorhanden
|
||||
{
|
||||
$this->setError('Das Team '.$cTeam_kurzbz.' ist bereits angelegt!');
|
||||
return false;
|
||||
}
|
||||
$bTmpNewRecord=$this->getNewRecord(); // Neuanlage Switch sichern
|
||||
|
||||
|
||||
// Aus dem Array newWettbewerbteam die Teaminformationen heraus holen
|
||||
$cWettbewerb_kurzbz=(isset($newWettbewerbteam['wettbewerb_kurzbz']) ? $newWettbewerbteam['wettbewerb_kurzbz'] : '');
|
||||
if (empty($cWettbewerb_kurzbz))
|
||||
$cWettbewerb_kurzbz=(isset($newWettbewerbteam[0]['wettbewerb_kurzbz']) ? $newWettbewerbteam[0]['wettbewerb_kurzbz'] : '');
|
||||
$team_bezeichnung=(isset($newWettbewerbteam['bezeichnung']) ? $newWettbewerbteam['bezeichnung'] : '');
|
||||
$team_beschreibung=(isset($newWettbewerbteam['beschreibung']) ? $newWettbewerbteam['beschreibung'] : '');
|
||||
|
||||
$team_logo=(isset($newWettbewerbteam['logo']) ? $newWettbewerbteam['logo'] : null);
|
||||
$team_rang=(isset($newWettbewerbteam['rang']) ? $newWettbewerbteam['rang'] : null);
|
||||
|
||||
// Ermitteln der Tabelle der Teamspieler
|
||||
if (isset($newWettbewerbteam['array_userUID']))
|
||||
$array_userUID=$newWettbewerbteam['array_userUID'];
|
||||
else
|
||||
{
|
||||
$this->setError('Die Spieler / Team wurde nicht gefunden! ');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$cTmpSQL="select * from ".$cSchemaSQL."tbl_teambenutzer , ".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
$cTmpSQL.=" where tbl_wettbewerbteam.team_kurzbz =tbl_teambenutzer.team_kurzbz ";
|
||||
$cTmpSQL.=" and not ( UPPER(tbl_teambenutzer.team_kurzbz)=E'".addslashes(trim(strtoupper($cTeam_kurzbz_old)))."' and UPPER(tbl_teambenutzer.team_kurzbz)=E'".addslashes(trim(strtoupper($cTeam_kurzbz)))."' ) ";
|
||||
$cTmpSQL.=" and UPPER(tbl_teambenutzer.uid) in ('".strtoupper(implode("','",$array_userUID))."') ";
|
||||
$cTmpSQL.=" and UPPER(tbl_wettbewerbteam.wettbewerb_kurzbz)=E'".addslashes(trim(strtoupper($cWettbewerb_kurzbz)))."' ; ";
|
||||
// Datenbankabfrage
|
||||
$this->setStringSQL($cTmpSQL);
|
||||
unset($cTmpSQL);
|
||||
$this->setResultSQL(null);
|
||||
if ($this->fetch_all())
|
||||
{
|
||||
$cTmpSQL=$this->getResultSQL();
|
||||
$this->setResultSQL(null);
|
||||
# exit(kommune_Test($cTmpSQL));
|
||||
if (is_array($cTmpSQL))
|
||||
{
|
||||
for ($zeileIND=0;$zeileIND<count($cTmpSQL);$zeileIND++)
|
||||
$this->setError(sprintf('Der Spieler %s wurde bereits im Team %s im Wettbewerb %s gefunden ! ',$cTmpSQL[$zeileIND]['uid'],$cTmpSQL[$zeileIND]['team_kurzbz'],$cTmpSQL[$zeileIND]['wettbewerb_kurzbz']));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$arrTmpCheckUID=array(); // Aus dem Array nur die Belegten UIDs suchen
|
||||
for ($zeileIND=0;$zeileIND<count($array_userUID);$zeileIND++)
|
||||
{
|
||||
if (!empty($array_userUID[$zeileIND])) // Leere Daten entfernen (Inputmasken befuellung kann Wahllos erfolgen)
|
||||
{
|
||||
$array_userUID[$zeileIND]=trim($array_userUID[$zeileIND]);
|
||||
$arrTmpCheckUID[]=$array_userUID[$zeileIND];
|
||||
}
|
||||
}
|
||||
$array_userUID=$arrTmpCheckUID;
|
||||
if (isset($arrTmpCheckUID)) unset($arrTmpCheckUID);
|
||||
|
||||
$this->setNewRecord($bTmpNewRecord);
|
||||
|
||||
$cTmpSQL="BEGIN; ";
|
||||
// Neuanlage - Insert
|
||||
if ($this->getNewRecord())
|
||||
{
|
||||
$cTmpSQL.=" INSERT into ".$cSchemaSQL."tbl_team (team_kurzbz,bezeichnung,beschreibung,logo) VALUES (E'".addslashes(trim($cTeam_kurzbz))."',E'".addslashes(trim($team_bezeichnung))."',E'".addslashes(trim($team_beschreibung))."',E'".addslashes(trim($team_logo))."'); ";
|
||||
for ($zeileIND=0;$zeileIND<count($array_userUID);$zeileIND++)
|
||||
{
|
||||
if (!empty($array_userUID[$zeileIND]))
|
||||
$cTmpSQL.=" INSERT into ".$cSchemaSQL."tbl_teambenutzer (uid, team_kurzbz) VALUES (E'".addslashes(trim($array_userUID[$zeileIND]))."',E'".addslashes(trim($cTeam_kurzbz))."'); ";
|
||||
}
|
||||
$cTmpSQL.=" INSERT into ".$cSchemaSQL."tbl_wettbewerbteam (team_kurzbz, wettbewerb_kurzbz,rang,punkte) VALUES (E'".$cTeam_kurzbz."',E'".addslashes(trim($cWettbewerb_kurzbz))."',(select 1+count(wettbewerb_kurzbz) from ".$cSchemaSQL."tbl_wettbewerbteam where rang<9999 and upper(wettbewerb_kurzbz)=upper(E'".addslashes(trim($cWettbewerb_kurzbz))."')),0); ";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update Logo nur wenn Daten uebergeben wurden, sonst Logo auslassen
|
||||
# if ($team_logo==null) $team_logo=(isset($origWettbewerbteam[0]['logo']) ? $origWettbewerbteam[0]['logo'] : null);
|
||||
# if ($team_rang==null) $team_rang=(isset($origWettbewerbteam[0]['rang']) ? $origWettbewerbteam[0]['rang'] : null);
|
||||
|
||||
$cTmpSQL.=" UPDATE ".$cSchemaSQL."tbl_team ";
|
||||
$cTmpSQL.=" set team_kurzbz=E'".addslashes(trim($cTeam_kurzbz))."',bezeichnung=E'".addslashes(trim($team_bezeichnung))."',beschreibung=E'".addslashes(trim($team_beschreibung))."'".($team_logo!=null?",logo=E'".addslashes(trim($team_logo))."'":"");
|
||||
$cTmpSQL.=" WHERE upper(team_kurzbz)=upper(E'".$cTeam_kurzbz_old."'); ";
|
||||
|
||||
$cTmpSQL.=" UPDATE ".$cSchemaSQL."tbl_wettbewerbteam set team_kurzbz=E'".addslashes(trim($cTeam_kurzbz))."'".($team_rang!=null?",rang=".$team_rang:"")." WHERE upper(team_kurzbz)=upper(E'".$cTeam_kurzbz_old."'); ";
|
||||
|
||||
// Alle bisher bestehenden DB-Eintraege in Array lesen fuer spaeteren vergleich ob Update/Delete
|
||||
reset($origWettbewerbteam);
|
||||
|
||||
$arrTmpCheckUID=new stdClass;;
|
||||
for ($zeileIND=0;$zeileIND<count($origWettbewerbteam);$zeileIND++)
|
||||
{
|
||||
$cTmpUID=trim($origWettbewerbteam[$zeileIND]['uid']);
|
||||
$arrTmpCheckUID->$cTmpUID=$cTmpUID;
|
||||
}
|
||||
|
||||
|
||||
// Suchen Neuanlage - Update (nach Update den Array Eintrag entleeren sonst wird er nachher geloescht)
|
||||
for ($zeileIND=0;$zeileIND<count($array_userUID);$zeileIND++)
|
||||
{
|
||||
$cTmpUID=trim($array_userUID[$zeileIND]);
|
||||
if (isset($arrTmpCheckUID->$cTmpUID))
|
||||
{
|
||||
$cTmpSQL.=" UPDATE ".$cSchemaSQL."tbl_teambenutzer set team_kurzbz=E'".addslashes(trim($cTeam_kurzbz))."' WHERE UPPER(uid)=UPPER(E'".addslashes($cTmpUID)."') AND upper(team_kurzbz)=upper(E'".$cTeam_kurzbz_old."'); ";
|
||||
unset($arrTmpCheckUID->$cTmpUID);
|
||||
}
|
||||
elseif (!isset($arrTmpCheckUID->$cTmpUID))
|
||||
{
|
||||
$cTmpSQL.=" INSERT into ".$cSchemaSQL."tbl_teambenutzer (uid, team_kurzbz) VALUES (E'".addslashes(trim($cTmpUID))."',E'".addslashes(trim($cTeam_kurzbz))."'); ";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($zeileIND)) unset($zeileIND);
|
||||
if (isset($array_userUID)) unset($array_userUID);
|
||||
// Alle die noch in der DB-Alt Array sind muessen geloeschte sein
|
||||
while (list( $key, $value ) = each($arrTmpCheckUID) )
|
||||
$cTmpSQL.=" DELETE from ".$cSchemaSQL."tbl_teambenutzer WHERE UPPER(uid)=UPPER(E'".addslashes($value)."') AND upper(team_kurzbz)=upper(E'".$cTeam_kurzbz_old."'); ";
|
||||
|
||||
if (isset($key)) unset($key);
|
||||
if (isset($value)) unset($value);
|
||||
if (isset($arrTmpCheckUID)) unset($arrTmpCheckUID);
|
||||
}
|
||||
$cTmpSQL.=" COMMIT; ";
|
||||
# exit("<br />".$cTmpSQL);
|
||||
|
||||
// Datenbankabfrage
|
||||
$this->setStringSQL($cTmpSQL);
|
||||
unset($cTmpSQL);
|
||||
|
||||
$this->setResultSQL(null);
|
||||
if (!$this->dbQuery())
|
||||
return false;
|
||||
if (!$this->loadWettbewerbteam())
|
||||
{
|
||||
if ($this->getError()) // Beim Lesen ist ein Fehler aufgetreten
|
||||
return false;
|
||||
$this->setNewRecord(true);
|
||||
}
|
||||
|
||||
$this->setResultSQL(null);
|
||||
return $this->getWettbewerbteam();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function loadWettbewerbteam()
|
||||
{
|
||||
$this->setError('');
|
||||
|
||||
$cSchemaSQL=$this->getSchemaSQL();
|
||||
$tmpUid=$this->getUid();
|
||||
|
||||
$cTeam_kurzbz=$this->getTeam_kurzbz_old();
|
||||
if (empty($cTeam_kurzbz))
|
||||
$cTeam_kurzbz=$this->getTeam_kurzbz();
|
||||
|
||||
$cWettbewerb_kurzbz=$this->getWettbewerb_kurzbz();
|
||||
|
||||
$cTmpSQL="";
|
||||
$cTmpSQL.="SELECT * FROM ".$cSchemaSQL."tbl_teambenutzer,".$cSchemaSQL."tbl_team,".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
|
||||
$cTmpSQL.=" WHERE UPPER(tbl_team.team_kurzbz)=UPPER(tbl_teambenutzer.team_kurzbz) ";
|
||||
$cTmpSQL.=" AND UPPER(tbl_wettbewerbteam.team_kurzbz)=UPPER(tbl_team.team_kurzbz) ";
|
||||
|
||||
// Check wie Postgre darauf reagiert Performenc
|
||||
$cTmpSQL.=" AND UPPER(tbl_wettbewerbteam.team_kurzbz)=UPPER(tbl_teambenutzer.team_kurzbz) ";
|
||||
|
||||
if (!empty($cTeam_kurzbz))
|
||||
$cTmpSQL.=" AND UPPER(tbl_teambenutzer.team_kurzbz)=UPPER(E'".$cTeam_kurzbz."') ";
|
||||
|
||||
if (!empty($tmpUid))
|
||||
$cTmpSQL.=" AND UPPER(tbl_teambenutzer.uid)=UPPER(E'".addslashes($tmpUid)."') ";
|
||||
|
||||
// Suche nach einem einzigen Wettbewerb
|
||||
if (!is_array($cWettbewerb_kurzbz) && !empty($cWettbewerb_kurzbz) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(tbl_wettbewerbteam.wettbewerb_kurzbz)=UPPER(E'".$cWettbewerb_kurzbz."') ";
|
||||
}
|
||||
elseif (is_array($cWettbewerb_kurzbz) && count($cWettbewerb_kurzbz)>0 )
|
||||
{
|
||||
if (isset($cWettbewerb_kurzbz[0]['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$tmpWETTBEWERB=array();
|
||||
for ($indZEILE=0;$indZEILE<count($selectWETTBEWERB);$indZEILE++)
|
||||
$tmpWETTBEWERB[]=trim($selectWETTBEWERB[$indZEILE]['wettbewerb_kurzbz']);
|
||||
$cWettbewerb_kurzbz=$tmpWETTBEWERB;
|
||||
unset($tmpWETTBEWERB);
|
||||
}
|
||||
elseif (isset($cWettbewerb_kurzbz['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$tmpWETTBEWERB=array();
|
||||
$tmpWETTBEWERB[]=trim($selectWETTBEWERB['wettbewerb_kurzbz']);
|
||||
$cWettbewerb_kurzbz=$tmpWETTBEWERB;
|
||||
unset($tmpWETTBEWERB);
|
||||
}
|
||||
$cTmpSQL.=" AND UPPER(tbl_wettbewerbteam.wettbewerb_kurzbz) in (E'".strtoupper(implode("','",$cWettbewerb_kurzbz))."') ";
|
||||
}
|
||||
$cTmpSQL.="ORDER BY tbl_wettbewerbteam.rang OFFSET 0 LIMIT ALL FOR SHARE ;";
|
||||
|
||||
// Entfernen der Temporaeren Variablen aus dem Speicher
|
||||
unset($cSchemaSQL);
|
||||
unset($cTeam_kurzbz);
|
||||
unset($cWettbewerb_kurzbz);
|
||||
|
||||
// Datenbankabfrage
|
||||
$this->setStringSQL($cTmpSQL);
|
||||
unset($cTmpSQL);
|
||||
|
||||
$this->setResultSQL(null);
|
||||
$this->setWettbewerbteam(null);
|
||||
if (!$this->fetch_all())
|
||||
return false;
|
||||
$this->setWettbewerbteam($this->getResultSQL());
|
||||
$this->setResultSQL(null);
|
||||
return $this->getWettbewerbteam();
|
||||
}
|
||||
} // Class komune_wettbewerbteam Ende
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user