mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
This commit is contained in:
+379
-154
@@ -34,187 +34,412 @@
|
||||
* @return - kein Retourn des Konstruktors
|
||||
*
|
||||
*/
|
||||
include_once(dirname(__FILE__)."/postgre_sql.class.php");
|
||||
class komune_wettbewerb extends postgre_sql
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
class komune_wettbewerb extends basis_db
|
||||
{
|
||||
protected $wettbewerb;
|
||||
protected $wbtyp_kurzbz;
|
||||
protected $wettbewerb_kurzb;
|
||||
public $result;
|
||||
public $new=false; // boolean
|
||||
|
||||
public $wbtyp_kurzbz;
|
||||
public $wettbewerb_kurzbz;
|
||||
|
||||
public $schemaSQL="kommune"; // string Datenbankschema
|
||||
|
||||
//-----Konstruktor
|
||||
function komune_wettbewerb($connectSQL,$wbtyp_kurzbz="",$wettbewerb_kurzbz="")
|
||||
function __construct($wbtyp_kurzbz="",$wettbewerb_kurzbz="",$uid="",$team_kurzbz="")
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->InitWettbewerb();
|
||||
|
||||
$this->setConnectSQL($connectSQL);
|
||||
$this->setWbtyp_kurzbz($wbtyp_kurzbz);
|
||||
$this->setWettbewerb_kurzbz($wettbewerb_kurzbz);
|
||||
$this->wbtyp_kurzbz=$wbtyp_kurzbz;
|
||||
$this->wettbewerb_kurzbz=$wettbewerb_kurzbz;
|
||||
}
|
||||
//-----Initialisierung--------------------------------------------------------------------------------------------
|
||||
function InitWettbewerb()
|
||||
{
|
||||
$this->setError('');
|
||||
$this->new=false;
|
||||
$this->errormsg='';
|
||||
$this->result=array();
|
||||
|
||||
$this->setWettbewerb('');
|
||||
$this->setWbtyp_kurzbz('');
|
||||
$this->setWettbewerb_kurzbz('');
|
||||
$this->wbtyp_kurzbz='';
|
||||
$this->wettbewerb_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))."') ";
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// ------------------------ Wettbewerbstypen
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Speichert bzw. Aendert eine Veranstaltungskategorie
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function saveWettbewerbTyp()
|
||||
{
|
||||
// Initialisieren
|
||||
$this->errormsg='';
|
||||
$qry="";
|
||||
|
||||
$fildsList='';
|
||||
$fildsValue='';
|
||||
|
||||
|
||||
if (empty($this->wbtyp_kurzbz) || $this->wbtyp_kurzbz==null )
|
||||
{
|
||||
$this->errormsg='Wettbewerb - Typ fehlt!';
|
||||
return false;
|
||||
}
|
||||
$cTmpSQL.=" OFFSET 0 LIMIT ALL FOR SHARE;";
|
||||
|
||||
#exit($cTmpSQL);
|
||||
if (empty($this->bezeichnung))
|
||||
{
|
||||
$this->errormsg='Wettbewerbstyp - Bezeichnung fehlt!';
|
||||
return false;
|
||||
}
|
||||
|
||||
if($this->new)
|
||||
{
|
||||
|
||||
// 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);
|
||||
$fildsList.='wbtyp_kurzbz,';
|
||||
$fildsList.='bezeichnung,';
|
||||
$fildsList.='farbe';
|
||||
|
||||
$this->setResultSQL(null);
|
||||
if (!$this->fetch_all())
|
||||
return false;
|
||||
$this->setWettbewerb($this->getResultSQL());
|
||||
$this->setResultSQL(null);
|
||||
|
||||
return true;
|
||||
}
|
||||
$fildsValue.="'".addslashes($this->wbtyp_kurzbz)."',";
|
||||
$fildsValue.="'".addslashes($this->bezeichnung)."',";
|
||||
$fildsValue.="'".addslashes($this->farbe)."'";
|
||||
|
||||
$qry=" insert into ".$this->schemaSQL.".tbl_wettbewerbtyp (".$fildsList.") values (".$fildsValue."); ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$fildsValue.=(!empty($fildsValue)?',':'')."bezeichnung='".addslashes($this->bezeichnung)."'";
|
||||
$fildsValue.=(!empty($fildsValue)?',':'')."farbe='".addslashes($this->farbe)."'";
|
||||
|
||||
function loadWettbewerb()
|
||||
$qry.=" update ".$this->schemaSQL.".tbl_wettbewerbtyp set ";
|
||||
$qry.=$fildsValue;
|
||||
$qry.=" where wbtyp_kurzbz='".addslashes($this->wbtyp_kurzbz)."' ";
|
||||
}
|
||||
if($resurce=$this->db_query($qry))
|
||||
return $resurce;
|
||||
else
|
||||
{
|
||||
if (empty($this->errormsg))
|
||||
$this->errormsg = 'Fehler beim speichern des Datensatzes ';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Loescht eine Veranstaltungskategorie
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function deleteWettbewerbTyp($wbtyp_kurzbz="")
|
||||
{
|
||||
$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>'' ";
|
||||
|
||||
// Initialisieren
|
||||
$qry="";
|
||||
$this->errormsg='';
|
||||
|
||||
// Parameter
|
||||
if (!empty($wbtyp_kurzbz))
|
||||
$this->wbtyp_kurzbz=$wbtyp_kurzbz;
|
||||
|
||||
// Plausib
|
||||
if (empty($this->wbtyp_kurzbz) || $this->wbtyp_kurzbz==null )
|
||||
{
|
||||
$this->errormsg='Wettbewerb - Typ fehlt!';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Abfrage
|
||||
$qry.=" BEGIN; ";
|
||||
$qry.=" delete from ".$this->schemaSQL.".tbl_wettbewerb ";
|
||||
if (is_array($this->wbtyp_kurzbz))
|
||||
$qry.=" where wbtyp_kurzbz in ('".implode("','",$this->wbtyp_kurzbz)."') ";
|
||||
else
|
||||
$qry.=" where wbtyp_kurzbz='".addslashes($this->wbtyp_kurzbz)."' ";
|
||||
$qry.="; ";
|
||||
|
||||
$qry.=" delete from ".$this->schemaSQL.".tbl_wettbewerbtyp ";
|
||||
if (is_array($this->wbtyp_kurzbz))
|
||||
$qry.=" where wbtyp_kurzbz in ('".implode("','",$this->wbtyp_kurzbz)."') ";
|
||||
else
|
||||
$qry.=" where wbtyp_kurzbz='".addslashes($this->wbtyp_kurzbz)."' ";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($this->db_query('COMMIT;'))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db_query('ROLLBACK;');
|
||||
if (empty($this->errormsg))
|
||||
$this->errormsg = 'Fehler beim Veranstaltungskategorie löschen';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function loadWettbewerbTyp($wbtyp_kurzbz=null)
|
||||
{
|
||||
// Init
|
||||
$this->result=array();
|
||||
$this->errormsg='';
|
||||
if (!is_null($wbtyp_kurzbz))
|
||||
$this->wbtyp_kurzbz=$wbtyp_kurzbz;
|
||||
|
||||
$qry="";
|
||||
$qry.="SELECT * FROM ".$this->schemaSQL.".tbl_wettbewerbtyp ";
|
||||
$qry.=" WHERE ".$this->schemaSQL.".tbl_wettbewerbtyp.wbtyp_kurzbz>'' ";
|
||||
|
||||
// Suche nach einem einzigen Wetttbewerbstypen wbtyp_kurzbz
|
||||
if (!is_array($tmpwbtyp_kurzbz) && !empty($tmpwbtyp_kurzbz) )
|
||||
if ( !empty($this->wettbewerb_kurzbz) && !is_array($this->wettbewerb_kurzbz) )
|
||||
{
|
||||
$qry.=" AND UPPER(".$this->schemaSQL.".tbl_wettbewerbtyp.wbtyp_kurzbz)=UPPER('".addslashes($this->wettbewerb_kurzbz)."') ";
|
||||
}
|
||||
elseif (is_array($this->wettbewerb_kurzbz) && count($this->wettbewerb_kurzbz)>0 )
|
||||
{
|
||||
$qry.=" AND UPPER(".$this->schemaSQL.".tbl_wettbewerbtyp.wbtyp_kurzbz) in ('".strtoupper(implode("','",$this->wettbewerb_kurzbz))."') ";
|
||||
}
|
||||
$qry.=" order by wbtyp_kurzbz ";
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->result[]=$row;
|
||||
}
|
||||
return $this->result;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($this->errormsg))
|
||||
$this->errormsg = 'Fehler beim lesen der Wettbewerbstypen';
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// ------------------------ Wettbewerbe
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Speichert bzw. Aendert eine Veranstaltungskategorie
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function saveWettbewerb()
|
||||
{
|
||||
// Initialisieren
|
||||
$this->errormsg='';
|
||||
$qry="";
|
||||
|
||||
$fildsList='';
|
||||
$fildsValue='';
|
||||
|
||||
|
||||
// Plausib
|
||||
if (empty($this->wbtyp_kurzbz) || $this->wbtyp_kurzbz==null )
|
||||
{
|
||||
$this->errormsg='Wettbewerb - Type fehlt!';
|
||||
return false;
|
||||
}
|
||||
if (empty($this->wettbewerb_kurzbz) || $this->wettbewerb_kurzbz==null )
|
||||
{
|
||||
$this->errormsg='Wettbewerb - Kurzbz. fehlt!';
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($this->regeln))
|
||||
{
|
||||
$this->errormsg='Wettbewerb - Regeln fehlen!';
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($this->forderungstage) || is_null($this->forderungstage) )
|
||||
$this->forderungstage=7;
|
||||
|
||||
if (!is_numeric($this->forderungstage) )
|
||||
{
|
||||
$this->errormsg='Forderungstage nur Nummerisch';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (empty($this->teamgroesse) || is_null($this->teamgroesse))
|
||||
$this->teamgroesse=1;
|
||||
|
||||
if (!is_numeric($this->teamgroesse) )
|
||||
{
|
||||
$this->errormsg='Forderungstage nur Nummerisch';
|
||||
return false;
|
||||
}
|
||||
|
||||
if($this->new)
|
||||
{
|
||||
|
||||
$fildsList.='wbtyp_kurzbz,';
|
||||
$fildsList.='wettbewerb_kurzbz,';
|
||||
$fildsList.='regeln,';
|
||||
$fildsList.='forderungstage,';
|
||||
|
||||
$fildsList.='teamgroesse,';
|
||||
$fildsList.='uid,';
|
||||
$fildsList.='icon';
|
||||
|
||||
$fildsValue.="'".addslashes($this->wbtyp_kurzbz)."',";
|
||||
$fildsValue.="'".addslashes($this->wettbewerb_kurzbz)."',";
|
||||
|
||||
$fildsValue.="'".addslashes($this->regeln)."',";
|
||||
$fildsValue.="".addslashes($this->forderungstage).",";
|
||||
|
||||
$fildsValue.="".addslashes($this->teamgroesse).",";
|
||||
$fildsValue.="'".addslashes($this->uid)."',";
|
||||
|
||||
$fildsValue.="'".addslashes($this->icon)."'";
|
||||
|
||||
$qry=" insert into ".$this->schemaSQL.".tbl_wettbewerb (".$fildsList.") values (".$fildsValue."); ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$fildsValue.=(!empty($fildsValue)?',':'')."regeln='".addslashes($this->regeln)."'";
|
||||
$fildsValue.=(!empty($fildsValue)?',':'')."forderungstage=".addslashes($this->forderungstage)."";
|
||||
|
||||
|
||||
$fildsValue.=(!empty($fildsValue)?',':'')."teamgroesse=".addslashes($this->teamgroesse)."";
|
||||
|
||||
$fildsValue.=(!empty($fildsValue)?',':'')."uid='".addslashes($this->uid)."'";
|
||||
|
||||
$fildsValue.=(!empty($fildsValue)?',':'')."icon='".addslashes($this->icon)."'";
|
||||
|
||||
$qry.=" update ".$this->schemaSQL.".tbl_wettbewerb set ";
|
||||
$qry.=$fildsValue;
|
||||
$qry.=" where wbtyp_kurzbz='".addslashes($this->wbtyp_kurzbz)."' and wettbewerb_kurzbz='".addslashes($this->wettbewerb_kurzbz)."' ";
|
||||
}
|
||||
if($this->db_query($qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
if (empty($qry))
|
||||
$this->errormsg = 'Fehler beim speichern des Datensatzes ';
|
||||
$this->errormsg .=' '.$qry;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Loescht eine Veranstaltungskategorie
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function deleteWettbewerb($wbtyp_kurzbz="",$wettbewerb_kurzbz=null)
|
||||
{
|
||||
|
||||
// Initialisieren
|
||||
$qry="";
|
||||
|
||||
$this->result=array();
|
||||
$this->errormsg='';
|
||||
|
||||
// Parameter
|
||||
if (!is_null($wbtyp_kurzbz))
|
||||
$this->wbtyp_kurzbz=$wbtyp_kurzbz;
|
||||
if (!is_null($wettbewerb_kurzbz))
|
||||
$this->wettbewerb_kurzbz=$wettbewerb_kurzbz;
|
||||
|
||||
// Plausib
|
||||
if (empty($this->wbtyp_kurzbz) || $this->wbtyp_kurzbz==null )
|
||||
{
|
||||
$this->errormsg='Wettbewerb - Typ fehlt!';
|
||||
return false;
|
||||
}
|
||||
if (empty($this->wettbewerb_kurzbz) || $this->wettbewerb_kurzbz==null )
|
||||
{
|
||||
$this->errormsg='Wettbewerb - Kurzbz. fehlt!';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Abfrage
|
||||
$qry.=" delete from ".$this->schemaSQL.".tbl_wettbewerb ";
|
||||
if (is_array($this->wbtyp_kurzbz))
|
||||
$qry.=" where wbtyp_kurzbz in ('".implode("','",$this->wbtyp_kurzbz)."') ";
|
||||
else
|
||||
$qry.=" where wbtyp_kurzbz='".addslashes($this->wbtyp_kurzbz)."' ";
|
||||
|
||||
if (is_array($this->wettbewerb_kurzbz))
|
||||
$qry.=" and wettbewerb_kurzbz in ('".implode("','",$this->wettbewerb_kurzbz)."') ";
|
||||
else
|
||||
$qry.=" and wettbewerb_kurzbz='".addslashes($this->wettbewerb_kurzbz)."' ";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($this->errormsg))
|
||||
$this->errormsg = 'Fehler beim Veranstaltungskategorie löschen';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function loadWettbewerb($wbtyp_kurzbz=null,$wettbewerb_kurzbz=null)
|
||||
{
|
||||
// Init
|
||||
$this->result=array();
|
||||
$this->errormsg='';
|
||||
|
||||
if (!is_null($wbtyp_kurzbz))
|
||||
$this->wbtyp_kurzbz=$wbtyp_kurzbz;
|
||||
if (!is_null($wettbewerb_kurzbz))
|
||||
$this->wettbewerb_kurzbz=$wettbewerb_kurzbz;
|
||||
|
||||
|
||||
$qry="";
|
||||
$qry.="SELECT *,tbl_wettbewerbtyp.wbtyp_kurzbz,case WHEN tbl_wettbewerb.teamgroesse >1 then 'Teambewerb' else 'Einzelbewerb' end as wettbewerbart FROM ".$this->schemaSQL.".tbl_wettbewerbtyp ";
|
||||
$qry.=" LEFT JOIN ".$this->schemaSQL.".tbl_wettbewerb ON UPPER(".$this->schemaSQL.".tbl_wettbewerb.wbtyp_kurzbz)=UPPER(".$this->schemaSQL.".tbl_wettbewerbtyp.wbtyp_kurzbz) ";
|
||||
$qry.=" WHERE ".$this->schemaSQL.".tbl_wettbewerbtyp.wbtyp_kurzbz>'' ";
|
||||
|
||||
// Suche nach einem einzigen Wetttbewerbstypen wbtyp_kurzbz
|
||||
if (!is_array($this->wbtyp_kurzbz) && !empty($this->wbtyp_kurzbz) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(".$cSchemaSQL."tbl_wettbewerbtyp.wbtyp_kurzbz)=UPPER('".$tmpwbtyp_kurzbz."') ";
|
||||
$qry.=" AND UPPER(".$this->schemaSQL.".tbl_wettbewerbtyp.wbtyp_kurzbz)=UPPER('".$this->wbtyp_kurzbz."') ";
|
||||
}
|
||||
elseif (is_array($tmpwbtyp_kurzbz) && count($tmpwbtyp_kurzbz)>0 )
|
||||
elseif (is_array($this->wettbewerb_kurzbz) && count($this->wettbewerb_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))."') ";
|
||||
$qry.=" AND UPPER(".$this->schemaSQL.".tbl_wettbewerbtyp.wbtyp_kurzbz) in ('".strtoupper(implode("','",$this->wbtyp_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 (!is_array($this->wettbewerb_kurzbz) && !empty($this->wettbewerb_kurzbz) )
|
||||
{
|
||||
$qry.=" AND UPPER(".$this->schemaSQL.".tbl_wettbewerb.wettbewerb_kurzbz)=UPPER('".$this->wettbewerb_kurzbz."') ";
|
||||
}
|
||||
elseif (is_array($this->wettbewerb_kurzbz) && count($this->wettbewerb_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))."') ";
|
||||
$qry.=" AND UPPER(".$this->schemaSQL.".tbl_wettbewerb.wettbewerb_kurzbz) in ('".strtoupper(implode("','",$this->wettbewerb_kurzbz))."') ";
|
||||
}
|
||||
$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;
|
||||
}
|
||||
$qry.=" order by tbl_wettbewerbtyp.wbtyp_kurzbz,wettbewerb_kurzbz ";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->result[]=$row;
|
||||
}
|
||||
return $this->result;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($this->errormsg))
|
||||
$this->errormsg = 'Fehler beim lesen der Wettbewerbstypen';
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // Class komune_wettbewerb Ende
|
||||
|
||||
?>
|
||||
@@ -34,247 +34,92 @@
|
||||
* @return - kein Retourn des Konstruktors
|
||||
*
|
||||
*/
|
||||
include_once(dirname(__FILE__)."/postgre_sql.class.php");
|
||||
class komune_wettbewerbeinladungen extends postgre_sql
|
||||
|
||||
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
class komune_wettbewerbeinladungen extends basis_db
|
||||
{
|
||||
protected $wettbewerbeinladungen="";
|
||||
public $result;
|
||||
public $new=false; // boolean
|
||||
|
||||
public $wbtyp_kurzbz;
|
||||
public $wettbewerb_kurzb;
|
||||
|
||||
public $uid;
|
||||
public $team_kurzbz;
|
||||
|
||||
public $team_forderer="";
|
||||
public $team_gefordert="";
|
||||
public $match_id="";
|
||||
|
||||
public $gefordertvon="";
|
||||
public $gefordertamum="";
|
||||
|
||||
public $matchdatumzeit="";
|
||||
public $matchort="";
|
||||
|
||||
public $bestaetigtvon="";
|
||||
public $bestaetigtamum="";
|
||||
|
||||
public $ergebniss="";
|
||||
public $team_sieger="";
|
||||
|
||||
public $matchbestaetigtamum="";
|
||||
public $matchbestaetigtvon="";
|
||||
|
||||
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='';
|
||||
|
||||
public $switchGewinner='';
|
||||
|
||||
public $schemaSQL="kommune"; // string Datenbankschema
|
||||
//-----Konstruktor
|
||||
function komune_wettbewerbeinladungen($connectSQL,$match_id="",$team_forderer="",$team_gefordert="",$wettbewerb_kurzbz="",$uid="")
|
||||
function __construct($match_id="",$team_forderer="",$team_gefordert="",$wettbewerb_kurzbz="",$uid="",$wbtyp_kurzbz="")
|
||||
{
|
||||
$this->InitWettbewerbeinladungen();
|
||||
parent::__construct();
|
||||
|
||||
$this->InitWettbewerbeinladungen();
|
||||
|
||||
$this->match_id=$match_id;
|
||||
$this->team_forderer=$team_forderer;
|
||||
$this->team_gefordert=$team_gefordert;
|
||||
|
||||
$this->wbtyp_kurzbz=$wbtyp_kurzbz;
|
||||
$this->wettbewerb_kurzbz=$wettbewerb_kurzbz;
|
||||
|
||||
$this->gefordertvon=$uid;
|
||||
|
||||
$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->new=false;
|
||||
$this->errormsg='';
|
||||
|
||||
$this->result=array();
|
||||
|
||||
$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('');
|
||||
$this->wbtyp_kurzbz='';
|
||||
$this->wettbewerb_kurzbz='';
|
||||
|
||||
$this->match_id="";
|
||||
$this->team_forderer="";
|
||||
$this->team_gefordert="";
|
||||
|
||||
$this->gefordertvon="";
|
||||
$this->gefordertamum="";
|
||||
|
||||
$this->matchdatumzeit="";
|
||||
$this->matchort="";
|
||||
|
||||
$this->bestaetigtvon="";
|
||||
$this->bestaetigtamum="";
|
||||
|
||||
$this->ergebniss="";
|
||||
$this->team_sieger="";
|
||||
|
||||
$this->matchbestaetigtamum="";
|
||||
$this->matchbestaetigtvon="";
|
||||
|
||||
$this->switchGewinner='';
|
||||
|
||||
}
|
||||
//-----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="")
|
||||
{
|
||||
@@ -294,18 +139,18 @@ class komune_wettbewerbeinladungen extends postgre_sql
|
||||
// Verarbeitungsvariablen
|
||||
$cSchemaSQL=$this->getschemaSQL();
|
||||
$cMatch_id=$this->getMatch_id();
|
||||
$cTeam_forderer=$this->getTeam_forderer();
|
||||
$this->team_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'];
|
||||
if (is_array($this->team_forderer) && isset($this->team_forderer['team_forderer']))
|
||||
$this->team_forderer=$this->team_forderer['team_forderer'];
|
||||
elseif (is_array($this->team_forderer) && isset($this->team_forderer[0]['team_forderer']) )
|
||||
$this->team_forderer=$this->team_forderer[0]['team_forderer'];
|
||||
elseif (is_array($this->team_forderer) && isset($this->team_forderer['team_forderer']))
|
||||
$this->team_forderer=$this->team_forderer['team_kurzbz'];
|
||||
elseif (is_array($this->team_forderer) && isset($this->team_forderer[0]['team_forderer']) )
|
||||
$this->team_forderer=$this->team_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']))
|
||||
@@ -313,8 +158,8 @@ class komune_wettbewerbeinladungen extends postgre_sql
|
||||
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->team_forderer=trim($this->team_forderer);
|
||||
if (empty($this->team_forderer) )
|
||||
{
|
||||
$this->setError('Kein Einladung (Einladenter fehlt) möglich !');
|
||||
return false;
|
||||
@@ -347,7 +192,7 @@ class komune_wettbewerbeinladungen extends postgre_sql
|
||||
return false;
|
||||
}
|
||||
|
||||
$cTmpSQL="BEGIN; ";
|
||||
$qry="BEGIN; ";
|
||||
if ($this->getNewRecord()) // Neuanlage - Insert
|
||||
{
|
||||
if (!$this->getGefordertamum())
|
||||
@@ -379,13 +224,13 @@ class komune_wettbewerbeinladungen extends postgre_sql
|
||||
$fildsValue.=(!empty($fildsValue)?',':'').$cTmpWert;
|
||||
}
|
||||
}
|
||||
$cTmpSQL=" insert into ".$cSchemaSQL."tbl_match (".$fildsList.") values (".$fildsValue."); ";
|
||||
$qry=" insert into ".$this->schemaSQL.".tbl_match (".$fildsList.") values (".$fildsValue."); ";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$this->getMatch_id())
|
||||
$this->setMatch_id($origWettbewerbeinladungen[0]['match_id']);
|
||||
$cTmpSQL.=" update ".$cSchemaSQL."tbl_match set ";
|
||||
$qry.=" update ".$this->schemaSQL.".tbl_match set ";
|
||||
$fildsValue='';
|
||||
for ($fildIND=0;$fildIND<count($arrTmpTableStrucktur);$fildIND++)
|
||||
{
|
||||
@@ -413,55 +258,55 @@ class komune_wettbewerbeinladungen extends postgre_sql
|
||||
}
|
||||
}
|
||||
}
|
||||
$cTmpSQL.=$fildsValue." where tbl_match.match_id='".$this->getMatch_id()."'; ";
|
||||
$cWettbewerb_kurzbz=trim($origWettbewerbeinladungen[0]['wettbewerb_kurzbz']);
|
||||
$qry.=$fildsValue." where tbl_match.match_id='".$this->getMatch_id()."'; ";
|
||||
$this->wettbewerb_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
|
||||
&& trim($origWettbewerbeinladungen[0]['team_sieger'])==trim($this->team_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);
|
||||
$qry_tmp="select rang from ".$this->schemaSQL.".tbl_wettbewerbteam where upper(team_kurzbz)=upper('".$cTeam_gefordert."') and upper(wettbewerb_kurzbz)=upper('".$this->wettbewerb_kurzbz."') FOR UPDATE ;";
|
||||
$this->fetch_object($qry_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 ;";
|
||||
$qry_tmp="select rang from ".$this->schemaSQL.".tbl_wettbewerbteam where upper(team_kurzbz)=upper('".$this->team_forderer."') and upper(wettbewerb_kurzbz)=upper('".$this->wettbewerb_kurzbz."') FOR UPDATE ;";
|
||||
|
||||
$this->fetch_object($cTmpSQL_tmp);
|
||||
$this->fetch_object($qry_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."'); ";
|
||||
$qry.=" update ".$this->schemaSQL.".tbl_wettbewerbteam ";
|
||||
$qry.="set rang=0 ";
|
||||
$qry.=" where upper(team_kurzbz)=upper('".$cTeam_gefordert."') and upper(wettbewerb_kurzbz)=upper('".$this->wettbewerb_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."'); ";
|
||||
$qry.=" update ".$this->schemaSQL.".tbl_wettbewerbteam ";
|
||||
$qry.="set rang=".$iTmpRangGeforderter;
|
||||
$qry.=" where upper(team_kurzbz)=upper('".$this->team_forderer."') and upper(wettbewerb_kurzbz)=upper('".$this->wettbewerb_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."'); ";
|
||||
$qry.=" update ".$this->schemaSQL.".tbl_wettbewerbteam ";
|
||||
$qry.="set rang=".$iTmpRangFrorderer;
|
||||
$qry.=" where upper(team_kurzbz)=upper('".$cTeam_gefordert."') and upper(wettbewerb_kurzbz)=upper('".$this->wettbewerb_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']."'); ";
|
||||
$qry.=" update ".$this->schemaSQL.".tbl_wettbewerbteam ";
|
||||
$qry.="set punkte=3+punkte ";
|
||||
$qry.="where upper(wettbewerb_kurzbz)=upper('".$this->wettbewerb_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)."'); ";
|
||||
$qry.=" update ".$this->schemaSQL.".tbl_wettbewerbteam ";
|
||||
$qry.="set punkte=1+punkte ";
|
||||
$qry.="where upper(wettbewerb_kurzbz)=upper('".$this->wettbewerb_kurzbz."') and upper(team_kurzbz)=upper('". ($origWettbewerbeinladungen[0]['team_sieger']==$cTeam_gefordert?$this->team_forderer:$cTeam_gefordert)."'); ";
|
||||
}
|
||||
}
|
||||
$cTmpSQL.=" COMMIT; ";
|
||||
#exit($cTmpSQL);
|
||||
$qry.=" COMMIT; ";
|
||||
#exit($qry);
|
||||
// Datenbankabfrage
|
||||
$this->setStringSQL($cTmpSQL);
|
||||
unset($cTmpSQL);
|
||||
$this->setStringSQL($qry);
|
||||
unset($qry);
|
||||
|
||||
$this->setResultSQL(null);
|
||||
if (!$this->dbQuery())
|
||||
@@ -477,347 +322,247 @@ class komune_wettbewerbeinladungen extends postgre_sql
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function loadWettbewerbeinladungen()
|
||||
|
||||
function loadWettbewerbeinladungen($match_id=null,$gefordertvon=null,$team_forderer=null,$team_einladungen=null,$wettbewerb_kurzbz=null,$switchGewinner=null)
|
||||
{
|
||||
$this->setError('');
|
||||
|
||||
// Initialisierung
|
||||
|
||||
$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();
|
||||
$this->result=array();
|
||||
$this->errormsg='';
|
||||
|
||||
#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 * ";
|
||||
if (!is_null($match_id))
|
||||
$this->match_id=$match_id;
|
||||
|
||||
if (!is_null($gefordertvon))
|
||||
$this->gefordertvon=$gefordertvon;
|
||||
|
||||
if (!is_null($team_forderer))
|
||||
$this->team_forderer=$team_forderer;
|
||||
|
||||
if (!is_null($team_einladungen))
|
||||
$this->team_einladungen=$team_einladungen;
|
||||
|
||||
if (!is_null($wettbewerb_kurzbz))
|
||||
$this->wettbewerb_kurzbz=$wettbewerb_kurzbz;
|
||||
|
||||
$cTmpSQL.=", to_char(matchdatumzeit, 'DD.MM.YYYY') as \"matchdatum\" ";
|
||||
$cTmpSQL.=", to_char(matchdatumzeit, 'HH24:MI') as \"matchzeit\" ";
|
||||
if (!is_null($switchGewinner))
|
||||
$this->switchGewinner=$switchGewinner;
|
||||
|
||||
$qry="";
|
||||
$qry.="SELECT * ";
|
||||
|
||||
$cTmpSQL.=", to_char(gefordertamum, 'DD.MM.YYYY') as \"gefordertamumdatum\" ";
|
||||
$cTmpSQL.=", to_char(gefordertamum, 'HH24:MI') as \"gefordertamumzeit\" ";
|
||||
$qry.=", to_char(matchdatumzeit, 'DD.MM.YYYY') as \"matchdatum\" ";
|
||||
$qry.=", to_char(matchdatumzeit, 'HH24:MI') as \"matchzeit\" ";
|
||||
|
||||
$cTmpSQL.=", to_char(bestaetigtamum, 'DD.MM.YYYY') as \"bestaetigtdatum\" ";
|
||||
$cTmpSQL.=", to_char(bestaetigtamum, 'HH24:MI') as \"bestaetigtzeit\" ";
|
||||
$qry.=", to_char(gefordertamum, 'DD.MM.YYYY') as \"gefordertamumdatum\" ";
|
||||
$qry.=", to_char(gefordertamum, 'HH24:MI') as \"gefordertamumzeit\" ";
|
||||
|
||||
$cTmpSQL.=", to_char(matchbestaetigtamum, 'DD.MM.YYYY') as \"matchbestaetigtdatum\" ";
|
||||
$cTmpSQL.=", to_char(matchbestaetigtamum, 'HH24:MI') as \"matchbestaetigtzeit\" ";
|
||||
$qry.=", to_char(bestaetigtamum, 'DD.MM.YYYY') as \"bestaetigtdatum\" ";
|
||||
$qry.=", to_char(bestaetigtamum, 'HH24:MI') as \"bestaetigtzeit\" ";
|
||||
|
||||
$cTmpSQL.=" FROM ".$cSchemaSQL."tbl_match ";
|
||||
$qry.=", to_char(matchbestaetigtamum, 'DD.MM.YYYY') as \"matchbestaetigtdatum\" ";
|
||||
$qry.=", to_char(matchbestaetigtamum, 'HH24:MI') as \"matchbestaetigtzeit\" ";
|
||||
|
||||
if (empty($match_id))
|
||||
$cTmpSQL.=" WHERE tbl_match.match_id>0 ";
|
||||
$qry.=" FROM ".$this->schemaSQL.".tbl_match ";
|
||||
|
||||
if (empty($this->match_id))
|
||||
$qry.=" 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))."' ";
|
||||
$qry.=" WHERE tbl_match.match_id='".addslashes(trim($this->match_id))."' ";
|
||||
|
||||
// Forderer
|
||||
if (!is_array($cTeam_forderer) && !empty($cTeam_forderer) )
|
||||
if (!is_array($this->team_forderer) && !empty($this->team_forderer) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.team_forderer)=UPPER('".addslashes(trim($cTeam_forderer))."') ";
|
||||
$qry.=" AND UPPER(tbl_match.team_forderer)=UPPER('".addslashes(trim($this->team_forderer))."') ";
|
||||
}
|
||||
elseif (is_array($cTeam_forderer) && count($cTeam_forderer)>0 )
|
||||
elseif (is_array($this->team_forderer) && count($this->team_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))."') ";
|
||||
$qry.=" AND UPPER(tbl_match.team_forderer) in ('".strtoupper(implode("','",$this->team_forderer))."') ";
|
||||
}
|
||||
// Aaufforderungen - Einladung
|
||||
|
||||
if (!is_array($cTeam_kurzbz_einladungen) && !empty($cTeam_kurzbz_einladungen) )
|
||||
if (!is_array($this->team_einladungen) && !empty($this->team_einladungen) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.team_gefordert)=UPPER('".addslashes(trim($cTeam_kurzbz_einladungen))."') ";
|
||||
$qry.=" AND UPPER(tbl_match.team_gefordert)=UPPER('".addslashes(trim($this->team_einladungen))."') ";
|
||||
}
|
||||
elseif (is_array($cTeam_kurzbz_einladungen) && count($cTeam_kurzbz_einladungen)>0 )
|
||||
elseif (is_array($this->team_einladungen) && count($this->team_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))."') ";
|
||||
$qry.=" AND UPPER(tbl_match.team_gefordert) in ('".strtoupper(implode("','",$this->team_einladungen))."') ";
|
||||
}
|
||||
|
||||
// GEForderte
|
||||
|
||||
if (!is_array($cWettbewerb_kurzbz) && !empty($cWettbewerb_kurzbz) )
|
||||
if (!is_array($this->wettbewerb_kurzbz) && !empty($this->wettbewerb_kurzbz) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.wettbewerb_kurzbz)=UPPER('".addslashes(trim($cWettbewerb_kurzbz))."') ";
|
||||
$qry.=" AND UPPER(tbl_match.wettbewerb_kurzbz)=UPPER('".addslashes(trim($this->wettbewerb_kurzbz))."') ";
|
||||
}
|
||||
elseif (is_array($cWettbewerb_kurzbz) && count($cWettbewerb_kurzbz)>0 )
|
||||
elseif (is_array($this->wettbewerb_kurzbz) && count($this->wettbewerb_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))."') ";
|
||||
$qry.=" AND UPPER(tbl_match.wettbewerb_kurzbz) in ('".strtoupper(implode("','",$this->wettbewerb_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 > '' ";
|
||||
if ($this->switchGewinner=='0')
|
||||
$qry.=" AND ( tbl_match.matchbestaetigtvon <='' or (tbl_match.matchbestaetigtvon IS NULL) ) ";
|
||||
elseif ($this->switchGewinner=='1')
|
||||
$qry.=" 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();
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->result[]=$row;
|
||||
}
|
||||
return $this->result;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($this->errormsg))
|
||||
$this->errormsg = 'Fehler beim lesen der Wettbewerbstypen';
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function loadWettbewerbeinladungenForderungstage()
|
||||
function loadWettbewerbeinladungenForderungstage($match_id=null,$gefordertvon=null,$team_forderer=null,$team_einladungen=null,$wettbewerb_kurzbz=null)
|
||||
{
|
||||
$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();
|
||||
$this->result=array();
|
||||
$this->errormsg='';
|
||||
|
||||
$cUid=$this->getGefordertvon();
|
||||
|
||||
$cTmpSQL="";
|
||||
$cTmpSQL.="SELECT * ";
|
||||
if (!is_null($match_id))
|
||||
$this->match_id=$match_id;
|
||||
|
||||
if (!is_null($gefordertvon))
|
||||
$this->gefordertvon=$gefordertvon;
|
||||
|
||||
if (!is_null($team_forderer))
|
||||
$this->team_forderer=$team_forderer;
|
||||
|
||||
if (!is_null($team_einladungen))
|
||||
$this->team_einladungen=$team_einladungen;
|
||||
|
||||
if (!is_null($wettbewerb_kurzbz))
|
||||
$this->wettbewerb_kurzbz=$wettbewerb_kurzbz;
|
||||
|
||||
$qry="";
|
||||
$qry.="SELECT * ";
|
||||
$qry.=", to_char(matchdatumzeit, 'DD.MM.YYYY') as \"matchdatum\" ";
|
||||
$qry.=", to_char(matchdatumzeit, 'HH24:MI') as \"matchzeit\" ";
|
||||
|
||||
$cTmpSQL.=", to_char(matchdatumzeit, 'DD.MM.YYYY') as \"matchdatum\" ";
|
||||
$cTmpSQL.=", to_char(matchdatumzeit, 'HH24:MI') as \"matchzeit\" ";
|
||||
$qry.=", to_char(gefordertamum, 'DD.MM.YYYY') as \"gefordertamumdatum\" ";
|
||||
$qry.=", to_char(gefordertamum, 'HH24:MI') as \"gefordertamumzeit\" ";
|
||||
|
||||
$cTmpSQL.=", to_char(gefordertamum, 'DD.MM.YYYY') as \"gefordertamumdatum\" ";
|
||||
$cTmpSQL.=", to_char(gefordertamum, 'HH24:MI') as \"gefordertamumzeit\" ";
|
||||
$qry.=", to_char(bestaetigtamum, 'DD.MM.YYYY') as \"bestaetigtdatum\" ";
|
||||
$qry.=", to_char(bestaetigtamum, 'HH24:MI') as \"bestaetigtzeit\" ";
|
||||
|
||||
$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\" ";
|
||||
$qry.=", to_char(matchbestaetigtamum, 'DD.MM.YYYY') as \"matchbestaetigtdatum\" ";
|
||||
$qry.=", 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
|
||||
$qry.="
|
||||
,1+extract('day' from (age(".$this->schemaSQL.".tbl_match.gefordertamum))) as gefordertamum_diff
|
||||
,1+extract('day' from (age(".$this->schemaSQL.".tbl_match.bestaetigtamum,".$this->schemaSQL.".tbl_match.gefordertamum))) as bestaetigtamum_diff
|
||||
,1+extract('day' from (age(".$this->schemaSQL.".tbl_match.matchdatumzeit,".$this->schemaSQL.".tbl_match.bestaetigtamum))) as matchdatumzeit_diff
|
||||
,1+extract('day' from (age(".$this->schemaSQL.".tbl_match.matchbestaetigtamum,".$this->schemaSQL.".tbl_match.matchdatumzeit))) as matchbestaetigtamum_diff
|
||||
|
||||
,1+extract('day' from (age(".$this->schemaSQL.".tbl_match.gefordertamum))) as gefordertamum_tag_diff
|
||||
,1+extract('day' from (age(".$this->schemaSQL.".tbl_match.bestaetigtamum))) as bestaetigtamum_tag_diff
|
||||
,1+extract('day' from (age(".$this->schemaSQL.".tbl_match.matchdatumzeit))) as matchdatumzeit_tag_diff
|
||||
,1+extract('day' from (age(".$this->schemaSQL.".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<='')
|
||||
$qry.=" from ".$this->schemaSQL.".tbl_wettbewerbtyp,".$this->schemaSQL.".tbl_wettbewerb,".$this->schemaSQL.".tbl_match
|
||||
|
||||
where ".$this->schemaSQL.".tbl_wettbewerbtyp.wbtyp_kurzbz=".$this->schemaSQL.".tbl_wettbewerb.wbtyp_kurzbz
|
||||
and ".$this->schemaSQL.".tbl_match.wettbewerb_kurzbz=".$this->schemaSQL.".tbl_wettbewerb.wettbewerb_kurzbz
|
||||
and (".$this->schemaSQL.".tbl_match.matchbestaetigtvon IS NULL or ".$this->schemaSQL.".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($this->match_id))
|
||||
$qry.=" and tbl_match.match_id='".addslashes(trim($this->match_id))."' ";
|
||||
|
||||
if (!empty($cUid))
|
||||
$cTmpSQL.=" and tbl_wettbewerb.uid='".addslashes(trim($cUid))."' ";
|
||||
if (!empty($this->gefordertvon))
|
||||
$qry.=" and tbl_wettbewerb.uid='".addslashes(trim($this->gefordertvon))."' ";
|
||||
|
||||
|
||||
// Forderer
|
||||
if (!is_array($cTeam_forderer) && !empty($cTeam_forderer) )
|
||||
if (!is_array($this->team_forderer) && !empty($this->team_forderer) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.team_forderer)=UPPER('".addslashes(trim($cTeam_forderer))."') ";
|
||||
$qry.=" AND UPPER(tbl_match.team_forderer)=UPPER('".addslashes(trim($this->team_forderer))."') ";
|
||||
}
|
||||
elseif (is_array($cTeam_forderer) && count($cTeam_forderer)>0 )
|
||||
elseif (is_array($this->team_forderer) && count($this->team_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))."') ";
|
||||
$qry.=" AND UPPER(tbl_match.team_forderer) in ('".strtoupper(implode("','",$this->team_forderer))."') ";
|
||||
}
|
||||
|
||||
// Aaufforderungen - Einladung
|
||||
|
||||
if (!is_array($cTeam_kurzbz_einladungen) && !empty($cTeam_kurzbz_einladungen) )
|
||||
if (!is_array($this->team_einladungen) && !empty($this->team_einladungen) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.team_gefordert)=UPPER('".addslashes(trim($cTeam_kurzbz_einladungen))."') ";
|
||||
$qry.=" AND UPPER(tbl_match.team_gefordert)=UPPER('".addslashes(trim($this->team_einladungen))."') ";
|
||||
}
|
||||
elseif (is_array($cTeam_kurzbz_einladungen) && count($cTeam_kurzbz_einladungen)>0 )
|
||||
elseif (is_array($this->team_einladungen) && count($this->team_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))."') ";
|
||||
$qry.=" AND UPPER(tbl_match.team_gefordert) in ('".strtoupper(implode("','",$this->team_einladungen))."') ";
|
||||
}
|
||||
|
||||
// GEForderte
|
||||
|
||||
if (!is_array($cWettbewerb_kurzbz) && !empty($cWettbewerb_kurzbz) )
|
||||
// Wettbewerb
|
||||
if (!is_array($this->wettbewerb_kurzbz) && !empty($this->wettbewerb_kurzbz) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(tbl_match.wettbewerb_kurzbz)=UPPER('".addslashes(trim($cWettbewerb_kurzbz))."') ";
|
||||
$qry.=" AND UPPER(tbl_match.wettbewerb_kurzbz)=UPPER('".addslashes(trim($this->wettbewerb_kurzbz))."') ";
|
||||
}
|
||||
elseif (is_array($cWettbewerb_kurzbz) && count($cWettbewerb_kurzbz)>0 )
|
||||
elseif (is_array($this->wettbewerb_kurzbz) && count($this->wettbewerb_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))."') ";
|
||||
$qry.=" AND UPPER(tbl_match.wettbewerb_kurzbz) in ('".strtoupper(implode("','",$this->wettbewerb_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();
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->result[]=$row;
|
||||
}
|
||||
return $this->result;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($this->errormsg))
|
||||
$this->errormsg = 'Fehler beim lesen der Wettbewerbstypen';
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function unloadWettbewerbeinladungen()
|
||||
function unloadWettbewerbeinladungen($match_id=null)
|
||||
{
|
||||
$this->setError('');
|
||||
$cSchemaSQL=$this->getschemaSQL();
|
||||
|
||||
$match_id=$this->getMatch_id();
|
||||
if (empty($match_id))
|
||||
$this->result=array();
|
||||
$this->errormsg='';
|
||||
|
||||
if (!is_null($match_id))
|
||||
$this->match_id=$match_id;
|
||||
|
||||
if (empty($this->match_id) || is_null($this->match_id))
|
||||
{
|
||||
$this->setError('Keine Match ID gefunden!');
|
||||
$this->errormsg = '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;
|
||||
|
||||
$qry="";
|
||||
$qry.="delete from ".$this->schemaSQL.".tbl_match ";
|
||||
$qry.=" * ";
|
||||
$qry.=" where tbl_match.match_id='".addslashes(trim($this->match_id))."' ";
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($this->errormsg))
|
||||
$this->errormsg = 'Fehler beim lesen der Wettbewerbstypen';
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,134 +35,157 @@
|
||||
* @return - kein Retourn des Konstruktors
|
||||
*
|
||||
*/
|
||||
include_once(dirname(__FILE__)."/postgre_sql.class.php");
|
||||
class komune_wettbewerbteam extends postgre_sql
|
||||
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
class komune_wettbewerbteam extends basis_db
|
||||
{
|
||||
protected $newWettbewerbteam;
|
||||
protected $wettbewerbteam;
|
||||
public $result;
|
||||
public $new=false; // boolean
|
||||
|
||||
|
||||
protected $uid;
|
||||
protected $team_kurzbz;
|
||||
protected $team_kurzbz_old;
|
||||
protected $wettbewerb_kurzbz;
|
||||
public $wbtyp_kurzbz;
|
||||
|
||||
// tbl_team
|
||||
public $team_kurzbz; //character varying(16)
|
||||
public $bezeichnung; //character varying(128)
|
||||
public $beschreibung; //text
|
||||
public $logo; //text
|
||||
|
||||
//-----Konstruktor
|
||||
function komune_wettbewerbteam($connectSQL,$uid="",$team_kurzbz="",$wettbewerb_kurzbz="")
|
||||
// tbl_teambenutzer
|
||||
public $uid; // varying(16)
|
||||
// im tbl_team public $team_kurzbz //character
|
||||
|
||||
//tbl_wettbewerbteam
|
||||
// im tbl_team public $team_kurzbz; // character varying(16)
|
||||
public $rang; // smallint Alter Drop
|
||||
public $punkte; // numeric(8,2) Alter Drop
|
||||
public $wettbewerb_kurzb; // character varying(16)
|
||||
|
||||
public $schemaSQL="kommune"; // string Datenbankschema
|
||||
|
||||
//-----Konstruktor
|
||||
function __construct($wbtyp_kurzbz="",$wettbewerb_kurzbz="",$uid="",$team_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);
|
||||
parent::__construct();
|
||||
|
||||
$this->InitWettbewerb();
|
||||
|
||||
$this->wbtyp_kurzbz=$wbtyp_kurzbz;
|
||||
$this->wettbewerb_kurzbz=$wettbewerb_kurzbz;
|
||||
$this->uid=$uid;
|
||||
$this->team_kurzbz=$team_kurzbz;
|
||||
}
|
||||
|
||||
//-----Initialisierung--------------------------------------------------------------------------------------------
|
||||
function InitWettbewerbteam()
|
||||
function InitWettbewerb()
|
||||
{
|
||||
$this->setError('');
|
||||
$this->new=false;
|
||||
$this->errormsg='';
|
||||
$this->result=array();
|
||||
|
||||
$this->setNewWettbewerbteam('');
|
||||
$this->setWettbewerbteam('');
|
||||
|
||||
$this->setuid('');
|
||||
$this->setTeam_kurzbz('');
|
||||
$this->setTeam_kurzbz_old('');
|
||||
$this->setWettbewerb_kurzbz('');
|
||||
}
|
||||
$this->wbtyp_kurzbz='';
|
||||
$this->wettbewerb_kurzbz='';
|
||||
$this->uid='';
|
||||
|
||||
|
||||
$this->team_kurzbz='';
|
||||
$this->bezeichnung='';
|
||||
$this->beschreibung='';
|
||||
$this->logo='';
|
||||
|
||||
//-----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);
|
||||
$this->rang='1';
|
||||
$this->punkte='0';
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function saveWettbewerbteam($newWettbewerbteam="")
|
||||
// ------------------------ Wettbewerbteam
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function saveWettbewerbteam()
|
||||
{
|
||||
// Initialisierung
|
||||
$this->setError('');
|
||||
// Initialisieren
|
||||
$this->errormsg='';
|
||||
$qry="";
|
||||
|
||||
$fildsList='';
|
||||
$fildsValue='';
|
||||
|
||||
/*
|
||||
tbl_wettbewerbteam
|
||||
public $team_kurzbz; // character varying(16)
|
||||
public $wettbewerb_kurzb; // character varying(16)
|
||||
public $rang; // smallint Alter Drop
|
||||
public $punkte; // numeric(8,2) Alter Drop
|
||||
*/
|
||||
|
||||
if (empty($this->wettbewerb_kurzb) || $this->wettbewerb_kurzb==null )
|
||||
{
|
||||
$this->errormsg='Wettbewerb fehlt!';
|
||||
return false;
|
||||
}
|
||||
if (empty($this->team_kurzbz) || $this->team_kurzbz==null )
|
||||
{
|
||||
$this->errormsg='Teambezeichnung fehlt!';
|
||||
return false;
|
||||
}
|
||||
if (!is_numeric($this->rang))
|
||||
$this->rang=
|
||||
if (!is_numeric($this->punkte))
|
||||
$this->punkte=0;
|
||||
|
||||
if($this->new)
|
||||
{
|
||||
|
||||
// Plausib
|
||||
if (!empty($newWettbewerbteam))
|
||||
$this->setNewWettbewerbteam($newWettbewerbteam);
|
||||
$fildsList.='team_kurzbz,';
|
||||
$fildsList.='wettbewerb_kurzb,';
|
||||
$fildsList.='rang,';
|
||||
$fildsList.='punkte';
|
||||
|
||||
$fildsValue.="'".addslashes($this->team_kurzbz)."',";
|
||||
$fildsValue.="'".addslashes($this->wettbewerb_kurzb)."',";
|
||||
$fildsValue.="".addslashes($this->rang).",";
|
||||
$fildsValue.="".addslashes($this->punkte)."";
|
||||
|
||||
$qry=" insert into ".$this->schemaSQL.".tbl_wettbewerbtyp (".$fildsList.") values (".$fildsValue."); ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$fildsValue.=(!empty($fildsValue)?',':'')."bezeichnung='".addslashes($this->bezeichnung)."'";
|
||||
$fildsValue.=(!empty($fildsValue)?',':'')."farbe='".addslashes($this->farbe)."'";
|
||||
|
||||
$qry.=" update ".$this->schemaSQL.".tbl_wettbewerbtyp set ";
|
||||
$qry.=$fildsValue;
|
||||
$qry.=" where wbtyp_kurzbz='".addslashes($this->wbtyp_kurzbz)."' ";
|
||||
}
|
||||
if($resurce=$this->db_query($qry))
|
||||
return $resurce;
|
||||
else
|
||||
{
|
||||
if (empty($this->errormsg))
|
||||
$this->errormsg = 'Fehler beim speichern des Datensatzes ';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
if (!is_array($this->getNewWettbewerbteam()))
|
||||
{
|
||||
$this->setError('Kein Wettbewerbsteam übergeben');
|
||||
$this->errormsg='Kein Wettbewerbsteam übergeben';
|
||||
return false;
|
||||
}
|
||||
$newWettbewerbteam=$this->getNewWettbewerbteam();
|
||||
|
||||
// Daten uebernahme
|
||||
$cSchemaSQL=$this->getSchemaSQL();
|
||||
$cTeam_kurzbz=$this->getTeam_kurzbz();
|
||||
$this->team_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();
|
||||
$this->team_kurzbz_old=$this->getTeam_kurzbz_old();
|
||||
|
||||
$cUserUID=$this->getUid(); // Vor der Verarbeitung sicherstellen das Alle Anwender gelesen werden
|
||||
$this->setUid('');
|
||||
$cUserUID=$this->uid; // Vor der Verarbeitung sicherstellen das Alle Anwender gelesen werden
|
||||
$this->uid='';
|
||||
|
||||
$this->setNewRecord(false);
|
||||
if (!$origWettbewerbteam=$this->loadWettbewerbteam())
|
||||
@@ -174,18 +197,18 @@ class komune_wettbewerbteam extends postgre_sql
|
||||
$this->setUid($cUserUID);
|
||||
unset($cUserUID);
|
||||
|
||||
if ($origWettbewerbteam && empty($cTeam_kurzbz_old)) // Datenrec bereits vorhanden
|
||||
if ($origWettbewerbteam && empty($this->team_kurzbz_old)) // Datenrec bereits vorhanden
|
||||
{
|
||||
$this->setError('Das Team '.$cTeam_kurzbz.' ist bereits angelegt!');
|
||||
$this->setError('Das Team '.$this->team_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'] : '');
|
||||
$this->wettbewerb_kurzbz=(isset($newWettbewerbteam['wettbewerb_kurzbz']) ? $newWettbewerbteam['wettbewerb_kurzbz'] : '');
|
||||
if (empty($this->wettbewerb_kurzbz))
|
||||
$this->wettbewerb_kurzbz=(isset($newWettbewerbteam[0]['wettbewerb_kurzbz']) ? $newWettbewerbteam[0]['wettbewerb_kurzbz'] : '');
|
||||
$team_bezeichnung=(isset($newWettbewerbteam['bezeichnung']) ? $newWettbewerbteam['bezeichnung'] : '');
|
||||
$team_beschreibung=(isset($newWettbewerbteam['beschreibung']) ? $newWettbewerbteam['beschreibung'] : '');
|
||||
|
||||
@@ -202,24 +225,24 @@ class komune_wettbewerbteam extends postgre_sql
|
||||
}
|
||||
|
||||
|
||||
$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)))."' ; ";
|
||||
$qry="select * from ".$this->schemaSQL.".tbl_teambenutzer , ".$this->schemaSQL.".tbl_wettbewerbteam ";
|
||||
$qry.=" where tbl_wettbewerbteam.team_kurzbz =tbl_teambenutzer.team_kurzbz ";
|
||||
$qry.=" and not ( UPPER(tbl_teambenutzer.team_kurzbz)=E'".addslashes(trim(strtoupper($this->team_kurzbz_old)))."' and UPPER(tbl_teambenutzer.team_kurzbz)=E'".addslashes(trim(strtoupper($this->team_kurzbz)))."' ) ";
|
||||
$qry.=" and UPPER(tbl_teambenutzer.uid) in ('".strtoupper(implode("','",$array_userUID))."') ";
|
||||
$qry.=" and UPPER(tbl_wettbewerbteam.wettbewerb_kurzbz)=E'".addslashes(trim(strtoupper($this->wettbewerb_kurzbz)))."' ; ";
|
||||
// Datenbankabfrage
|
||||
$this->setStringSQL($cTmpSQL);
|
||||
unset($cTmpSQL);
|
||||
$this->setStringSQL($qry);
|
||||
unset($qry);
|
||||
$this->setResultSQL(null);
|
||||
if ($this->fetch_all())
|
||||
{
|
||||
$cTmpSQL=$this->getResultSQL();
|
||||
$qry=$this->getResultSQL();
|
||||
$this->setResultSQL(null);
|
||||
# exit(kommune_Test($cTmpSQL));
|
||||
if (is_array($cTmpSQL))
|
||||
# exit(kommune_Test($qry));
|
||||
if (is_array($qry))
|
||||
{
|
||||
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']));
|
||||
for ($zeileIND=0;$zeileIND<count($qry);$zeileIND++)
|
||||
$this->setError(sprintf('Der Spieler %s wurde bereits im Team %s im Wettbewerb %s gefunden ! ',$qry[$zeileIND]['uid'],$qry[$zeileIND]['team_kurzbz'],$qry[$zeileIND]['wettbewerb_kurzbz']));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -238,17 +261,17 @@ class komune_wettbewerbteam extends postgre_sql
|
||||
|
||||
$this->setNewRecord($bTmpNewRecord);
|
||||
|
||||
$cTmpSQL="BEGIN; ";
|
||||
$qry="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))."'); ";
|
||||
$qry.=" INSERT into ".$this->schemaSQL.".tbl_team (team_kurzbz,bezeichnung,beschreibung,logo) VALUES (E'".addslashes(trim($this->team_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))."'); ";
|
||||
$qry.=" INSERT into ".$this->schemaSQL.".tbl_teambenutzer (uid, team_kurzbz) VALUES (E'".addslashes(trim($array_userUID[$zeileIND]))."',E'".addslashes(trim($this->team_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); ";
|
||||
$qry.=" INSERT into ".$this->schemaSQL.".tbl_wettbewerbteam (team_kurzbz, wettbewerb_kurzbz,rang,punkte) VALUES (E'".$this->team_kurzbz."',E'".addslashes(trim($this->wettbewerb_kurzbz))."',(select 1+count(wettbewerb_kurzbz) from ".$this->schemaSQL.".tbl_wettbewerbteam where rang<9999 and upper(wettbewerb_kurzbz)=upper(E'".addslashes(trim($this->wettbewerb_kurzbz))."')),0); ";
|
||||
|
||||
}
|
||||
else
|
||||
@@ -257,11 +280,11 @@ class komune_wettbewerbteam extends postgre_sql
|
||||
# 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."'); ";
|
||||
$qry.=" UPDATE ".$this->schemaSQL.".tbl_team ";
|
||||
$qry.=" set team_kurzbz=E'".addslashes(trim($this->team_kurzbz))."',bezeichnung=E'".addslashes(trim($team_bezeichnung))."',beschreibung=E'".addslashes(trim($team_beschreibung))."'".($team_logo!=null?",logo=E'".addslashes(trim($team_logo))."'":"");
|
||||
$qry.=" WHERE upper(team_kurzbz)=upper(E'".$this->team_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."'); ";
|
||||
$qry.=" UPDATE ".$this->schemaSQL.".tbl_wettbewerbteam set team_kurzbz=E'".addslashes(trim($this->team_kurzbz))."'".($team_rang!=null?",rang=".$team_rang:"")." WHERE upper(team_kurzbz)=upper(E'".$this->team_kurzbz_old."'); ";
|
||||
|
||||
// Alle bisher bestehenden DB-Eintraege in Array lesen fuer spaeteren vergleich ob Update/Delete
|
||||
reset($origWettbewerbteam);
|
||||
@@ -280,12 +303,12 @@ class komune_wettbewerbteam extends postgre_sql
|
||||
$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."'); ";
|
||||
$qry.=" UPDATE ".$this->schemaSQL.".tbl_teambenutzer set team_kurzbz=E'".addslashes(trim($this->team_kurzbz))."' WHERE UPPER(uid)=UPPER(E'".addslashes($cTmpUID)."') AND upper(team_kurzbz)=upper(E'".$this->team_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))."'); ";
|
||||
$qry.=" INSERT into ".$this->schemaSQL.".tbl_teambenutzer (uid, team_kurzbz) VALUES (E'".addslashes(trim($cTmpUID))."',E'".addslashes(trim($this->team_kurzbz))."'); ";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,18 +316,18 @@ class komune_wettbewerbteam extends postgre_sql
|
||||
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."'); ";
|
||||
$qry.=" DELETE from ".$this->schemaSQL.".tbl_teambenutzer WHERE UPPER(uid)=UPPER(E'".addslashes($value)."') AND upper(team_kurzbz)=upper(E'".$this->team_kurzbz_old."'); ";
|
||||
|
||||
if (isset($key)) unset($key);
|
||||
if (isset($value)) unset($value);
|
||||
if (isset($arrTmpCheckUID)) unset($arrTmpCheckUID);
|
||||
}
|
||||
$cTmpSQL.=" COMMIT; ";
|
||||
# exit("<br />".$cTmpSQL);
|
||||
$qry.=" COMMIT; ";
|
||||
# exit("<br />".$qry);
|
||||
|
||||
// Datenbankabfrage
|
||||
$this->setStringSQL($cTmpSQL);
|
||||
unset($cTmpSQL);
|
||||
$this->setStringSQL($qry);
|
||||
unset($qry);
|
||||
|
||||
$this->setResultSQL(null);
|
||||
if (!$this->dbQuery())
|
||||
@@ -320,77 +343,112 @@ class komune_wettbewerbteam extends postgre_sql
|
||||
return $this->getWettbewerbteam();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function loadWettbewerbteam()
|
||||
function loadWettbewerbteam($wbtyp_kurzbz=null,$wettbewerb_kurzbz=null,$uid=null,$team_kurzbz=null)
|
||||
{
|
||||
$this->setError('');
|
||||
// Initialisierung
|
||||
$this->result=array();
|
||||
$this->errormsg='';
|
||||
|
||||
$cSchemaSQL=$this->getSchemaSQL();
|
||||
$tmpUid=$this->getUid();
|
||||
if (!is_null($wbtyp_kurzbz))
|
||||
$this->wbtyp_kurzbz=$wbtyp_kurzbz;
|
||||
|
||||
$cTeam_kurzbz=$this->getTeam_kurzbz_old();
|
||||
if (empty($cTeam_kurzbz))
|
||||
$cTeam_kurzbz=$this->getTeam_kurzbz();
|
||||
if (!is_null($wettbewerb_kurzbz))
|
||||
$this->wettbewerb_kurzbz=$wettbewerb_kurzbz;
|
||||
|
||||
if (!is_null($uid))
|
||||
$this->uid=$uid;
|
||||
|
||||
$cWettbewerb_kurzbz=$this->getWettbewerb_kurzbz();
|
||||
if (!is_null($team_kurzbz))
|
||||
$this->team_kurzbz=$team_kurzbz;
|
||||
|
||||
$cTmpSQL="";
|
||||
$cTmpSQL.="SELECT * FROM ".$cSchemaSQL."tbl_teambenutzer,".$cSchemaSQL."tbl_team,".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
$qry="";
|
||||
$qry.="SELECT * FROM ".$this->schemaSQL.".tbl_teambenutzer,".$this->schemaSQL.".tbl_team,".$this->schemaSQL.".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) ";
|
||||
|
||||
$qry.=" WHERE UPPER(tbl_team.team_kurzbz)=UPPER(tbl_teambenutzer.team_kurzbz) ";
|
||||
$qry.=" 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) ";
|
||||
$qry.=" 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)."') ";
|
||||
if (!empty($this->team_kurzbz))
|
||||
$qry.=" AND UPPER(tbl_teambenutzer.team_kurzbz)=UPPER(E'".$this->team_kurzbz."') ";
|
||||
|
||||
if (!empty($this->uid))
|
||||
$qry.=" AND UPPER(tbl_teambenutzer.uid)=UPPER(E'".addslashes($this->uid)."') ";
|
||||
|
||||
// Suche nach einem einzigen Wettbewerb
|
||||
if (!is_array($cWettbewerb_kurzbz) && !empty($cWettbewerb_kurzbz) )
|
||||
if (!is_array($this->wettbewerb_kurzbz) && !empty($this->wettbewerb_kurzbz) )
|
||||
{
|
||||
$cTmpSQL.=" AND UPPER(tbl_wettbewerbteam.wettbewerb_kurzbz)=UPPER(E'".$cWettbewerb_kurzbz."') ";
|
||||
$qry.=" AND UPPER(tbl_wettbewerbteam.wettbewerb_kurzbz)=UPPER(E'".$this->wettbewerb_kurzbz."') ";
|
||||
}
|
||||
elseif (is_array($cWettbewerb_kurzbz) && count($cWettbewerb_kurzbz)>0 )
|
||||
elseif (is_array($this->wettbewerb_kurzbz) && count($this->wettbewerb_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))."') ";
|
||||
$qry.=" AND UPPER(tbl_wettbewerbteam.wettbewerb_kurzbz) in (E'".strtoupper(implode("','",$this->wettbewerb_kurzbz))."') ";
|
||||
}
|
||||
$cTmpSQL.="ORDER BY tbl_wettbewerbteam.rang OFFSET 0 LIMIT ALL FOR SHARE ;";
|
||||
$qry.="ORDER BY tbl_wettbewerbteam.rang;";
|
||||
|
||||
// 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();
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->result[]=$row;
|
||||
}
|
||||
return $this->result;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($this->errormsg))
|
||||
$this->errormsg = 'Fehler beim lesen der Wettbewerbstypen';
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // Class komune_wettbewerbteam Ende
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function loadMaxRang($wettbewerb_kurzbz=null)
|
||||
{
|
||||
// Initialisierung
|
||||
$this->result=array();
|
||||
$this->errormsg='';
|
||||
|
||||
|
||||
if (!is_null($wettbewerb_kurzbz))
|
||||
$this->wettbewerb_kurzbz=$wettbewerb_kurzbz;
|
||||
|
||||
$qry="";
|
||||
$qry.="SELECT max(rang) as max FROM ".$this->schemaSQL.".tbl_teambenutzer ";
|
||||
$qry.=" WHERE rang > 0 ";
|
||||
// Suche nach einem einzigen Wettbewerb
|
||||
if (!is_array($this->wettbewerb_kurzbz) && !empty($this->wettbewerb_kurzbz) )
|
||||
{
|
||||
$qry.=" AND UPPER(tbl_wettbewerbteam.wettbewerb_kurzbz)=UPPER(E'".$this->wettbewerb_kurzbz."') ";
|
||||
}
|
||||
elseif (is_array($this->wettbewerb_kurzbz) && count($this->wettbewerb_kurzbz)>0 )
|
||||
{
|
||||
$qry.=" AND UPPER(tbl_wettbewerbteam.wettbewerb_kurzbz) in (E'".strtoupper(implode("','",$this->wettbewerb_kurzbz))."') ";
|
||||
}
|
||||
|
||||
exit($qry);
|
||||
|
||||
// Entfernen der Temporaeren Variablen aus dem Speicher
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->result=$row->max;
|
||||
}
|
||||
return $this->result;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($this->errormsg))
|
||||
$this->errormsg = 'Fehler beim lesen des letzten Range im Wettbewerb ';
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
+848
-848
File diff suppressed because it is too large
Load Diff
@@ -1,448 +0,0 @@
|
||||
<?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 postgre_sql
|
||||
*
|
||||
* @param connectSQL Datenbankverbindung
|
||||
*
|
||||
* @return - kein Retourn des Konstruktors
|
||||
*
|
||||
*/
|
||||
class postgre_sql
|
||||
{
|
||||
protected $error=""; // Letzter aufgetretene Fehler
|
||||
|
||||
protected $connectSQL; // Verbindungsobjekt zur Datenbank
|
||||
|
||||
protected $connectstringSQL=""; // Datenbankverbindungsstring
|
||||
|
||||
protected $stringSQL; // Letzte Datenbankverarbeitungsstring
|
||||
protected $resourceSQL; // Letzter Datenbankzugriff
|
||||
protected $resultSQL; // Datenabfrageergebnis
|
||||
|
||||
protected $tableSQL; // Tabelle auf die zugegriffen wird
|
||||
protected $tableStruckturSQL; // Tabellenstucktur
|
||||
|
||||
protected $encodingSQL=null; // Datenencoding Clint
|
||||
|
||||
protected $newRecord; // Switch Datengefunde
|
||||
|
||||
protected $schemaSQL="public"; // Datenbankschema
|
||||
//---Konstruktor----------------------------------------------------------------------------------------------
|
||||
function postgre_sql($connectSQL) // Konstruktor
|
||||
{
|
||||
$this->setConnectSQL($connectSQL);
|
||||
}
|
||||
//---ERROR----------------------------------------------------------------------------------------------
|
||||
function getError()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
function setError($error)
|
||||
{
|
||||
$this->error=$error;
|
||||
}
|
||||
//---// Verbindungsobjekt zur Datenbank----------------------------------------------------------------------------------------------
|
||||
function getConnectSQL()
|
||||
{
|
||||
return $this->connectSQL;
|
||||
}
|
||||
function setConnectSQL($connectSQL)
|
||||
{
|
||||
$this->connectSQL=$connectSQL;
|
||||
}
|
||||
//-----schemaSQL--------------------------------------------------------------------------------------------
|
||||
function getSchemaSQL()
|
||||
{
|
||||
return (!empty($this->schemaSQL)?$this->schemaSQL.'.':'');
|
||||
}
|
||||
function setSchemaSQL($schemaSQL)
|
||||
{
|
||||
$this->schemaSQL=$schemaSQL;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function getResourceSQL()
|
||||
{
|
||||
return $this->resourceSQL;
|
||||
}
|
||||
function setResourceSQL($resourceSQL)
|
||||
{
|
||||
$this->resourceSQL=$resourceSQL;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function getEncodingSQL()
|
||||
{
|
||||
return $this->encodingSQL;
|
||||
}
|
||||
function setEncodingSQL($encodingSQL)
|
||||
{
|
||||
$this->encodingSQL=$encodingSQL;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function getStringSQL()
|
||||
{
|
||||
return $this->stringSQL;
|
||||
}
|
||||
function setStringSQL($stringSQL)
|
||||
{
|
||||
$this->stringSQL=$stringSQL;
|
||||
}
|
||||
//---SQL Verbindungsstring -------------------------------------------------------------------------
|
||||
function getConnectstringSQL()
|
||||
{
|
||||
return $this->connectstringSQL;
|
||||
}
|
||||
function setConnectstringSQL($connectstringSQL)
|
||||
{
|
||||
$this->connectstringSQL=$connectstringSQL;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function getNewRecord()
|
||||
{
|
||||
return $this->newRecord;
|
||||
}
|
||||
function setNewRecord($newRecord)
|
||||
{
|
||||
$this->newRecord=$newRecord;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function getResultSQL()
|
||||
{
|
||||
return $this->resultSQL;
|
||||
}
|
||||
function setResultSQL($resultSQL)
|
||||
{
|
||||
$this->free_result(); // Vorherige Ergebnisse entfernen
|
||||
$this->resultSQL=$resultSQL;
|
||||
if ($this->resultSQL!=null)
|
||||
{
|
||||
if ($this->resultSQL)
|
||||
$this->setNewRecord(false);
|
||||
else
|
||||
$this->setNewRecord(true);
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function getTableSQL()
|
||||
{
|
||||
return $this->tableSQL;
|
||||
}
|
||||
function setTableSQL($tableSQL)
|
||||
{
|
||||
$this->tableSQL=$tableSQL;
|
||||
}
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
*
|
||||
* @dbFehler Setzt den Fehlertext fuer einen Resourcenfehler, oder der letzte Fehler der aufgetreten ist
|
||||
*
|
||||
* @param - keine Parameter
|
||||
*
|
||||
* @return Retour wird der ermittelte Fehlertext, bzw false wenn kein Fehler gefunden wurde
|
||||
*
|
||||
*/
|
||||
function dbFehler()
|
||||
{
|
||||
|
||||
$this->setResultSQL(null);
|
||||
|
||||
if ($this->getResourceSQL())
|
||||
{
|
||||
$this->setError(@pg_result_error($this->getResourceSQL()));
|
||||
if ($this->getError()) return $this->getError();
|
||||
}
|
||||
|
||||
if ($this->getConnectSQL())
|
||||
{
|
||||
$this->setError(@pg_last_error($this->getConnectSQL()));
|
||||
if ($this->getError()) return $this->getError();
|
||||
}
|
||||
|
||||
if ($this->getError()) return $this->getError();
|
||||
return '';
|
||||
}
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
*
|
||||
* @dbConnect Setzt eine SQL Abfrage in der DB ab, und liefert den Result der Abfrage als Objekt retour
|
||||
*
|
||||
* @param connectstringSQL Verbindung zur Datenbank moegliche uebergabe eines Datenbankstring
|
||||
*
|
||||
* @return Verbindungs Objekt zur Datenbank
|
||||
*
|
||||
*/
|
||||
function dbConnect($connectstringSQL="")
|
||||
{
|
||||
|
||||
$this->setConnectSQL(null);
|
||||
if (!empty($connectstringSQL))
|
||||
$this->setConnectstringSQL($connectstringSQL);
|
||||
if ($connectSQL=@pg_pconnect($this->getConnectstringSQL()))
|
||||
{
|
||||
$this->setConnectSQL($connectSQL);
|
||||
return $this->getConnectSQL();
|
||||
}
|
||||
return $this->dbFehler();
|
||||
}
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
*
|
||||
* @dbQuery Setzt eine SQL Abfrage in der DB ab, und liefert den Result der Abfrage als Objekt retour
|
||||
*
|
||||
* @param stringSQL Datenbankabfrage bzw. SQL-Abfrage wenn nicht vorher mittels setStringSQL gesetzt wurde
|
||||
*
|
||||
* @return Resource der SQL Anfrage / Abfrage
|
||||
*
|
||||
*/
|
||||
function dbQuery($stringSQL="")
|
||||
{
|
||||
// Initialisieren DB Resource
|
||||
$this->setNewRecord(true);
|
||||
$this->setResourceSQL(null);
|
||||
|
||||
// SQL Befehl aus Parameter oder aus der ClassenVariable entnehmen
|
||||
if (empty($stringSQL))
|
||||
$stringSQL=$this->getStringSQL();
|
||||
// Letzten SQL Befehl merken
|
||||
$this->setStringSQL($stringSQL);
|
||||
// Encoding
|
||||
if($this->getEncodingSQL()!="" && $this->getEncodingSQL()!=null)
|
||||
$stringSQL="SET CLIENT_ENCODING TO '".$this->getEncodingSQL()."'; ".$stringSQL;
|
||||
|
||||
if (!$resourceSQL=@pg_query($this->getConnectSQL(),$stringSQL))
|
||||
{
|
||||
$this->dbFehler();
|
||||
return false;
|
||||
}
|
||||
$this->setResourceSQL($resourceSQL);
|
||||
return $this->getResourceSQL();
|
||||
}
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
*
|
||||
* @fetch_object Setzt den Select in der DB ab, und liefert den Result der Abfrage in Objektform retour
|
||||
* Die Funktion wird fuer Insert,Delete,Update, Transaktionen benoetigt
|
||||
*
|
||||
* @param stringSQL Datenbankabfrage bzw. SQL-Abfrage wenn nicht vorher mittels setStringSQL gesetzt wurde
|
||||
*
|
||||
* @return Ergebniss der Datenabfrage, oder Fehlerinformation
|
||||
*
|
||||
*/
|
||||
function free_result()
|
||||
{
|
||||
if ($this->getResultSQL() && $this->getResourceSQL())
|
||||
{
|
||||
return @pg_free_result($this->getResourceSQL());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
*
|
||||
* @fetch_object Setzt den Select in der DB ab, und liefert den Result der Abfrage in Objektform retour
|
||||
* Die Funktion wird fuer Insert,Delete,Update, Transaktionen benoetigt
|
||||
*
|
||||
* @param stringSQL Datenbankabfrage bzw. SQL-Abfrage wenn nicht vorher mittels setStringSQL gesetzt wurde
|
||||
*
|
||||
* @return Ergebniss der Datenabfrage, oder Fehlerinformation
|
||||
*
|
||||
*/
|
||||
function fetch_array($stringSQL="")
|
||||
{
|
||||
if (!$this->dbQuery($stringSQL))
|
||||
return false;
|
||||
if(!$resultSQL=@pg_fetch_array($this->getResourceSQL(),null,PGSQL_ASSOC))
|
||||
{
|
||||
$this->dbFehler();
|
||||
return false;
|
||||
}
|
||||
$this->setResultSQL($resultSQL);
|
||||
return true;
|
||||
}
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
*
|
||||
* @fetch_object Setzt den Select in der DB ab, und liefert den Result der Abfrage in Objektform retour
|
||||
* Die Funktion wird fuer Insert,Delete,Update, Transaktionen benoetigt
|
||||
*
|
||||
* @param stringSQL Datenbankabfrage bzw. SQL-Abfrage wenn nicht vorher mittels setStringSQL gesetzt wurde
|
||||
*
|
||||
* @return Ergebniss der Datenabfrage, oder Fehlerinformation
|
||||
*
|
||||
*/
|
||||
function fetch_object($stringSQL="")
|
||||
{
|
||||
if (!$this->dbQuery($stringSQL))
|
||||
return false;
|
||||
if(!$resultSQL=@pg_fetch_object($this->getResourceSQL()))
|
||||
{
|
||||
$this->dbFehler();
|
||||
return false;
|
||||
}
|
||||
$this->setResultSQL($resultSQL);
|
||||
return true;
|
||||
}
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
*
|
||||
* @fetch_all Liefert zu einem SQL Select alle gefundenen Daten in einem Array
|
||||
*
|
||||
* @param stringSQL Datenbankabfrage bzw. SQL-Abfrage wenn nicht vorher mittels setStringSQL gesetzt wurde
|
||||
*
|
||||
* @return Array der gefunden Daten bzw. Leer oder eine DB Fehlernachricht
|
||||
*
|
||||
*/
|
||||
function fetch_all($stringSQL="")
|
||||
{
|
||||
if (!$this->dbQuery($stringSQL))
|
||||
return false;
|
||||
if(!$resultSQL=@pg_fetch_all($this->getResourceSQL()))
|
||||
{
|
||||
$this->dbFehler();
|
||||
return false;
|
||||
}
|
||||
$this->setResultSQL($resultSQL);
|
||||
return true;
|
||||
}
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
*
|
||||
* @fetch_object_all Liefert zu einem SQL Select alle gefundenen Daten in einem Array
|
||||
*
|
||||
* @param stringSQL Datenbankabfrage bzw. SQL-Abfrage wenn nicht vorher mittels setStringSQL gesetzt wurde
|
||||
*
|
||||
* @return Array der gefunden Daten bzw. Leer oder eine DB Fehlernachricht
|
||||
*
|
||||
*/
|
||||
function fetch_all_object($stringSQL="")
|
||||
{
|
||||
if (!$this->dbQuery($stringSQL))
|
||||
return false;
|
||||
$resultSQL=array();
|
||||
if(!$resultSQL[]=@pg_fetch_object($this->getResourceSQL()))
|
||||
{
|
||||
$this->dbFehler();
|
||||
return false;
|
||||
}
|
||||
|
||||
while ($res=@pg_fetch_object($this->getResourceSQL()))
|
||||
if ($res) $resultSQL[]=$res;
|
||||
|
||||
$this->setResultSQL($resultSQL);
|
||||
return true;
|
||||
}
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
/*
|
||||
*
|
||||
* @setTableStruckturSQL Liefert zu einer Tabelle die Strucktur und Feldinformationen
|
||||
*
|
||||
* @param tableSQL Tabelle zu der die Informationen geliefert werden sollen
|
||||
*
|
||||
* @return Array der gefunden Tabellenstrucktur
|
||||
*
|
||||
*/
|
||||
function getTableStruckturSQL()
|
||||
{
|
||||
return $this->tableStruckturSQL;
|
||||
}
|
||||
function setTableStruckturSQL($tableSQL="")
|
||||
{
|
||||
if (!empty($tableSQL))
|
||||
$this->setTableSQL($tableSQL);
|
||||
$tableSQL=$this->getTableSQL();
|
||||
|
||||
# listet die Datenbanken-Tabellenfelder auf
|
||||
$this->tableStruckturSQL=array();
|
||||
$cTmpSQL="
|
||||
SELECT
|
||||
a.attnum,
|
||||
a.attname AS field,
|
||||
a.attname AS fildname,
|
||||
t.typname AS type,
|
||||
a.attlen AS length,
|
||||
a.atttypmod AS lengthvar,
|
||||
a.attnotnull AS notnull
|
||||
FROM
|
||||
pg_class c,
|
||||
pg_attribute a,
|
||||
pg_type t
|
||||
WHERE
|
||||
c.relname = '".$tableSQL."'
|
||||
AND a.attnum > 0
|
||||
AND a.attrelid = c.oid
|
||||
AND a.atttypid = t.oid
|
||||
ORDER BY a.attnum;
|
||||
";
|
||||
// Datenbankabfrage
|
||||
$this->setStringSQL($cTmpSQL);
|
||||
unset($cTmpSQL);
|
||||
$this->setResultSQL(null);
|
||||
if (!$this->fetch_all())
|
||||
return false;
|
||||
|
||||
$arrTmpResultSQL=$this->getResultSQL();
|
||||
$this->setResultSQL(null);
|
||||
# listet die Anzahl der Felder auf
|
||||
for ($i=0;$i<count($arrTmpResultSQL);$i++)
|
||||
{
|
||||
if (isset($feldname) && $feldname==$arrTmpResultSQL[$i]['fildname'])
|
||||
continue;
|
||||
$feldname= $arrTmpResultSQL[$i]['fildname'];#gibt den Feldnamen an
|
||||
$type=$arrTmpResultSQL[$i]['type'];#gibt den Feldtyp zurück
|
||||
$laenge=($arrTmpResultSQL[$i]['length']==-1?$arrTmpResultSQL[$i]['lengthvar']:$arrTmpResultSQL[$i]['length']) ; #gibt die Länge des Feldes zurück
|
||||
$flags=($arrTmpResultSQL[$i]['notnull']=='t'?' not null ':' null ');
|
||||
|
||||
$cTmpSQL="
|
||||
SELECT
|
||||
pg_attribute.attname::text as PK
|
||||
FROM
|
||||
pg_attribute
|
||||
JOIN
|
||||
pg_class ON pg_attribute.attrelid = pg_class.oid
|
||||
JOIN
|
||||
pg_namespace ON pg_namespace.oid = pg_class.relnamespace
|
||||
LEFT JOIN
|
||||
pg_constraint ON conrelid = pg_class.oid AND pg_constraint.contype = 'p'
|
||||
WHERE
|
||||
pg_attribute.attname = '".$feldname."' AND
|
||||
pg_class.relname = '".$tableSQL."' AND
|
||||
pg_attribute.attnum = ANY (pg_constraint.conkey)
|
||||
ORDER BY
|
||||
pg_attribute.attnum;
|
||||
";
|
||||
|
||||
$this->setStringSQL($cTmpSQL);
|
||||
unset($cTmpSQL);
|
||||
$this->setResultSQL(null);
|
||||
if ($this->fetch_array())
|
||||
$flags.=($this->resultSQL['pk']=="$feldname"?', primary_key ':' ');
|
||||
|
||||
$this->tableStruckturSQL[]=array("name"=>$feldname,"flag"=>$flags,"type"=>$type,"laenge"=>$laenge);
|
||||
}
|
||||
return $this->getTableStruckturSQL();
|
||||
}
|
||||
} // Ende Class kommune
|
||||
Reference in New Issue
Block a user