mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 09:52:22 +00:00
Veraltete Files entfernt
This commit is contained in:
@@ -1,570 +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 kommune_wettbewerb
|
||||
*
|
||||
* @param connectSQL Datenbankverbindung
|
||||
* @param wbtyp_kurzbz Wettbewerbsgruppen Key
|
||||
* @param wettbewerb_kurzbz Wettbewerbssubgruppen Key
|
||||
*
|
||||
* @return - kein Retourn des Konstruktors
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
class komune_wettbewerb extends basis_db
|
||||
{
|
||||
|
||||
|
||||
public $wettbewerb;
|
||||
public $wbtyp_kurzbz;
|
||||
public $wettbewerb_kurzb;
|
||||
|
||||
public $result;
|
||||
public $new=false; // boolean
|
||||
|
||||
public $regeln;
|
||||
public $forderungstage;
|
||||
|
||||
public $teamgroesse;
|
||||
public $uid;
|
||||
public $icon;
|
||||
|
||||
|
||||
public $schemaSQL="kommune."; // string Datenbankschema
|
||||
|
||||
//-----Konstruktor
|
||||
function __construct($wbtyp_kurzbz="",$wettbewerb_kurzbz="")
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->InitWettbewerb();
|
||||
|
||||
$this->setWbtyp_kurzbz($wbtyp_kurzbz);
|
||||
$this->setWettbewerb_kurzbz($wettbewerb_kurzbz);
|
||||
}
|
||||
//-----Initialisierung--------------------------------------------------------------------------------------------
|
||||
function InitWettbewerb()
|
||||
{
|
||||
$this->setError('');
|
||||
|
||||
$this->setWettbewerb('');
|
||||
$this->setWbtyp_kurzbz('');
|
||||
$this->setWettbewerb_kurzbz('');
|
||||
|
||||
|
||||
|
||||
$this->new=false;
|
||||
|
||||
$this->result=array();
|
||||
|
||||
$this->wbtyp_kurzbz='';
|
||||
$this->wettbewerb_kurzbz='';
|
||||
|
||||
$this->regeln='';
|
||||
$this->forderungstage=1;
|
||||
|
||||
$this->teamgroesse=1;
|
||||
$this->uid='';
|
||||
$this->icon='';
|
||||
|
||||
}
|
||||
//-----NewRecord--------------------------------------------------------------------------------------------
|
||||
function getNewRecord()
|
||||
{
|
||||
return $this->new;
|
||||
}
|
||||
function setNewRecord($switch)
|
||||
{
|
||||
$this->new=$switch;
|
||||
}
|
||||
//-----Error--------------------------------------------------------------------------------------------
|
||||
function getError()
|
||||
{
|
||||
return $this->errormsg;
|
||||
}
|
||||
function setError($err)
|
||||
{
|
||||
$this->errormsg=$err;
|
||||
}
|
||||
//-----schemaSQL--------------------------------------------------------------------------------------------
|
||||
function getSchemaSQL()
|
||||
{
|
||||
return $this->schemaSQL;
|
||||
}
|
||||
function setSchemaSQL($schemaSQL)
|
||||
{
|
||||
$this->schemaSQL=$schemaSQL;
|
||||
}
|
||||
//-----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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// ------------------------ 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;
|
||||
}
|
||||
|
||||
if (empty($this->bezeichnung))
|
||||
{
|
||||
$this->errormsg='Wettbewerbstyp - Bezeichnung fehlt!';
|
||||
return false;
|
||||
}
|
||||
|
||||
if($this->new)
|
||||
{
|
||||
|
||||
$fildsList.='wbtyp_kurzbz,';
|
||||
$fildsList.='bezeichnung,';
|
||||
$fildsList.='farbe';
|
||||
|
||||
$fildsValue.="'".addslashes($this->wbtyp_kurzbz)."',";
|
||||
$fildsValue.="'".addslashes($this->bezeichnung)."',";
|
||||
$fildsValue.="'".addslashes($this->farbe)."'";
|
||||
|
||||
$qry=" insert into ".$this->schemaSQL."tbl_wettbewerbtyp (".$fildsList.") values (".$fildsValue."); ";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->bezeichnung)
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Loescht eine Veranstaltungskategorie
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function deleteWettbewerbTyp($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()
|
||||
{
|
||||
|
||||
$cSchemaSQL=$this->getSchemaSQL();
|
||||
$tmpwbtyp_kurzbz=$this->getWbtyp_kurzbz();
|
||||
|
||||
$qry="";
|
||||
$qry.="SELECT * FROM ".$cSchemaSQL."tbl_wettbewerbtyp ";
|
||||
$qry.=" WHERE ".$cSchemaSQL."tbl_wettbewerbtyp.wbtyp_kurzbz>'' ";
|
||||
|
||||
// Suche nach einem einzigen Wetttbewerbstypen wbtyp_kurzbz
|
||||
if (!is_array($tmpwbtyp_kurzbz) && !empty($tmpwbtyp_kurzbz) )
|
||||
{
|
||||
$qry.=" 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;
|
||||
}
|
||||
$qry.=" AND UPPER(".$cSchemaSQL."tbl_wettbewerbtyp.wbtyp_kurzbz) in ('".strtoupper(implode("','",$tmpwbtyp_kurzbz))."') ";
|
||||
}
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
$rows=array();
|
||||
while($row = $this->db_fetch_array())
|
||||
{
|
||||
$rows[]=$row;
|
||||
}
|
||||
$this->setWettbewerb($rows);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($this->db_last_error());
|
||||
|
||||
return false;
|
||||
}
|
||||
return $this->getWettbewerb();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// ------------------------ 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
|
||||
{
|
||||
if (!is_null($this->regeln) && $this->regeln)
|
||||
$fildsValue.=(!empty($fildsValue)?',':'')."regeln='".addslashes($this->regeln)."'";
|
||||
|
||||
if (!is_null($this->forderungstage) && $this->forderungstage)
|
||||
$fildsValue.=(!empty($fildsValue)?',':'')."forderungstage=".addslashes($this->forderungstage)."";
|
||||
if (!is_null($this->teamgroesse) && $this->teamgroesse)
|
||||
$fildsValue.=(!empty($fildsValue)?',':'')."teamgroesse=".addslashes($this->teamgroesse)."";
|
||||
if (!is_null($this->icon) && $this->icon)
|
||||
$fildsValue.=(!empty($fildsValue)?',':'')."icon='".addslashes($this->icon)."'";
|
||||
|
||||
$fildsValue.=(!empty($fildsValue)?',':'')."uid='".addslashes($this->uid)."'";
|
||||
|
||||
$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()
|
||||
{
|
||||
$cSchemaSQL=$this->getSchemaSQL();
|
||||
$tmpwbtyp_kurzbz=$this->getWbtyp_kurzbz();
|
||||
$cWettbewerb_kurzbz=$this->getWettbewerb_kurzbz();
|
||||
|
||||
$qry="";
|
||||
$qry.="SELECT *,tbl_wettbewerbtyp.wbtyp_kurzbz,case WHEN tbl_wettbewerb.teamgroesse >1 then 'Teambewerb' else 'Einzelbewerb' end as wettbewerbart FROM ".$cSchemaSQL."tbl_wettbewerbtyp ";
|
||||
$qry.=" LEFT JOIN ".$cSchemaSQL."tbl_wettbewerb ON UPPER(".$cSchemaSQL."tbl_wettbewerb.wbtyp_kurzbz)=UPPER(".$cSchemaSQL."tbl_wettbewerbtyp.wbtyp_kurzbz) ";
|
||||
$qry.=" WHERE ".$cSchemaSQL."tbl_wettbewerbtyp.wbtyp_kurzbz>'' ";
|
||||
|
||||
// Suche nach einem einzigen Wetttbewerbstypen wbtyp_kurzbz
|
||||
if (!is_array($tmpwbtyp_kurzbz) && !empty($tmpwbtyp_kurzbz) )
|
||||
{
|
||||
$qry.=" 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;
|
||||
}
|
||||
$qry.=" AND UPPER(".$cSchemaSQL."tbl_wettbewerbtyp.wbtyp_kurzbz) in ('".strtoupper(implode("','",$tmpwbtyp_kurzbz))."') ";
|
||||
}
|
||||
|
||||
// Suche nach Wettbewerben wettbewerb_kurzbz
|
||||
if (!is_array($cWettbewerb_kurzbz) && !empty($cWettbewerb_kurzbz) )
|
||||
{
|
||||
$qry.=" AND UPPER(".$cSchemaSQL."tbl_wettbewerb.wettbewerb_kurzbz)=UPPER('".$cWettbewerb_kurzbz."') ";
|
||||
}
|
||||
elseif (is_array($cWettbewerb_kurzbz) && count($cWettbewerb_kurzbz)>0 )
|
||||
{
|
||||
if (isset($cWettbewerb_kurzbz[0]['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$tmpwbtyp_kurzbzE=array();
|
||||
for ($indZEILE=0;$indZEILE<count($tmpwbtyp_kurzbz);$indZEILE++)
|
||||
$tmpwbtyp_kurzbzE[]=trim($tmpwbtyp_kurzbz[$indZEILE]['wettbewerb_kurzbz']);
|
||||
$cWettbewerb_kurzbz=$tmpwbtyp_kurzbzE;
|
||||
unset($tmpwbtyp_kurzbzE);
|
||||
}
|
||||
elseif (isset($cWettbewerb_kurzbz['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$tmpwbtyp_kurzbzE=array();
|
||||
$tmpwbtyp_kurzbzE[]=trim($tmpwbtyp_kurzbz['wettbewerb_kurzbz']);
|
||||
$cWettbewerb_kurzbz=$tmpwbtyp_kurzbzE;
|
||||
unset($tmpwbtyp_kurzbzE);
|
||||
}
|
||||
$qry.=" AND UPPER(".$cSchemaSQL."tbl_wettbewerb.wettbewerb_kurzbz) in ('".strtoupper(implode("','",$tmpwbtyp_kurzbzE))."') ";
|
||||
}
|
||||
// Datenbankabfrage
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
$rows=array();
|
||||
while($row = $this->db_fetch_array())
|
||||
{
|
||||
$rows[]=$row;
|
||||
}
|
||||
$this->setWettbewerb($rows);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($this->db_last_error());
|
||||
|
||||
return false;
|
||||
}
|
||||
return $this->getWettbewerb();
|
||||
}
|
||||
} // Class komune_wettbewerb Ende
|
||||
|
||||
?>
|
||||
@@ -1,881 +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 kommune_wettbewerbeinladungen
|
||||
*
|
||||
* @param connectSQL Datenbankverbindung
|
||||
* @param team_kurzbz Einladung zum Wettbewerb
|
||||
* @param team_gefordert Einladung zum Wettbewerb
|
||||
* @param wettbewerb_kurzbz Wettbewerbssubgruppen Key
|
||||
*
|
||||
* @return - kein Retourn des Konstruktors
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
class komune_wettbewerbeinladungen extends basis_db
|
||||
{
|
||||
public $new;
|
||||
protected $wettbewerbeinladungen="";
|
||||
|
||||
protected $uid="";
|
||||
|
||||
protected $match_id="";
|
||||
protected $wettbewerb_kurzbz="";
|
||||
|
||||
protected $team_kurzbz="";
|
||||
protected $team_gefordert="";
|
||||
|
||||
protected $gefordertvon="";
|
||||
protected $gefordertamum="";
|
||||
|
||||
protected $matchdatumzeit="";
|
||||
protected $matchort="";
|
||||
|
||||
protected $bestaetigtvon="";
|
||||
protected $bestaetigtamum="";
|
||||
|
||||
protected $ergebniss="";
|
||||
protected $team_sieger="";
|
||||
|
||||
protected $matchbestaetigtamum="";
|
||||
protected $matchbestaetigtvon="";
|
||||
|
||||
protected $switchGewinner='';
|
||||
|
||||
public $schemaSQL="kommune."; // string Datenbankschema
|
||||
//-----Konstruktor
|
||||
function __construct($match_id="",$team_forderer="",$team_gefordert="",$wettbewerb_kurzbz="",$uid="")
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->InitWettbewerbeinladungen();
|
||||
|
||||
$this->setMatch_id($match_id);
|
||||
$this->setTeam_forderer($team_forderer);
|
||||
$this->setTeam_gefordert($team_gefordert);
|
||||
$this->setWettbewerb_kurzbz($wettbewerb_kurzbz);
|
||||
$this->setGefordertvon($uid);
|
||||
}
|
||||
//-----Initialisierung--------------------------------------------------------------------------------------------
|
||||
function InitWettbewerbeinladungen()
|
||||
{
|
||||
$this->setError('');
|
||||
// Ergebniss-Liste der Spiele
|
||||
$this->setWettbewerbeinladung('');
|
||||
// Liste der Spiele mit Ergebniss "True" , oder Ohne "False"
|
||||
$this->setSwitchGewinner('');
|
||||
|
||||
// Step 1
|
||||
$this->setMatch_id('');
|
||||
$this->setWettbewerb_kurzbz('');
|
||||
|
||||
$this->setGefordertvon('');
|
||||
$this->setGefordertamum('');
|
||||
|
||||
$this->setTeam_kurzbz('');
|
||||
$this->setTeam_gefordert('');
|
||||
|
||||
$this->setMatchdatumzeit('');
|
||||
$this->setMatchort('');
|
||||
// Step 2
|
||||
$this->setBestaetigtvon('');
|
||||
$this->setBestaetigtamum(0);
|
||||
// Step 3
|
||||
$this->setErgebniss('');
|
||||
$this->setTeam_sieger('');
|
||||
// Step 4
|
||||
$this->setMatchbestaetigtamum('');
|
||||
$this->setMatchbestaetigtvon('');
|
||||
}
|
||||
//-----NewRecord--------------------------------------------------------------------------------------------
|
||||
function getNewRecord()
|
||||
{
|
||||
return $this->new;
|
||||
}
|
||||
function setNewRecord($switch)
|
||||
{
|
||||
$this->new=$switch;
|
||||
}
|
||||
//-----Error--------------------------------------------------------------------------------------------
|
||||
function getError()
|
||||
{
|
||||
return $this->errormsg;
|
||||
}
|
||||
function setError($err)
|
||||
{
|
||||
$this->errormsg=$err;
|
||||
}
|
||||
//-----schemaSQL--------------------------------------------------------------------------------------------
|
||||
function getSchemaSQL()
|
||||
{
|
||||
return $this->schemaSQL;
|
||||
}
|
||||
function setSchemaSQL($schemaSQL)
|
||||
{
|
||||
$this->schemaSQL=$schemaSQL;
|
||||
}
|
||||
//-----Wettbewerb Matchdaten--------------------------------------------------------------------------------------------
|
||||
function getWettbewerbeinladung()
|
||||
{
|
||||
return $this->wettbewerbeinladung;
|
||||
}
|
||||
function setWettbewerbeinladung($wettbewerbeinladung)
|
||||
{
|
||||
$this->wettbewerbeinladung=$wettbewerbeinladung;
|
||||
}
|
||||
//-----match_id--------------------------------------------------------------------------------------------
|
||||
function getMatch_id()
|
||||
{
|
||||
return $this->match_id;
|
||||
}
|
||||
function setMatch_id($match_id)
|
||||
{
|
||||
$this->match_id=$match_id;
|
||||
}
|
||||
//-----gefordertvon--------------------------------------------------------------------------------------------
|
||||
function getGefordertvon()
|
||||
{
|
||||
return $this->gefordertvon;
|
||||
}
|
||||
function setGefordertvon($gefordertvon)
|
||||
{
|
||||
$this->gefordertvon=$gefordertvon;
|
||||
}
|
||||
|
||||
//-----UID--------------------------------------------------------------------------------------------
|
||||
// Match - Wettbewerb uid = Moderator
|
||||
function getUid()
|
||||
{
|
||||
return $this->uid;
|
||||
}
|
||||
function setUid($uid)
|
||||
{
|
||||
$this->uid=$uid;
|
||||
}
|
||||
|
||||
//-----gefordertam--------------------------------------------------------------------------------------------
|
||||
function getGefordertamum()
|
||||
{
|
||||
return $this->gefordertamum;
|
||||
}
|
||||
function setGefordertamum($gefordertamum)
|
||||
{
|
||||
$this->gefordertamum=$gefordertamum;
|
||||
}
|
||||
//-----team_forderer--------------------------------------------------------------------------------------------
|
||||
function getTeam_forderer()
|
||||
{
|
||||
return $this->team_forderer;
|
||||
}
|
||||
function setTeam_forderer($team_forderer)
|
||||
{
|
||||
$this->team_forderer=$team_forderer;
|
||||
}
|
||||
//-----team_kurzbz--kompilitaet------------------------------------------------------------------------------------------
|
||||
function getTeam_kurzbz()
|
||||
{
|
||||
return $this->getTeam_forderer();
|
||||
}
|
||||
function setTeam_kurzbz($team_kurzbz)
|
||||
{
|
||||
$this->setTeam_forderer($team_kurzbz);
|
||||
}
|
||||
|
||||
//-----team_gefordert--------------------------------------------------------------------------------------------
|
||||
function getTeam_gefordert()
|
||||
{
|
||||
return $this->team_gefordert;
|
||||
}
|
||||
function setTeam_gefordert($team_gefordert)
|
||||
{
|
||||
$this->team_gefordert=$team_gefordert;
|
||||
}
|
||||
//-----team_sieger--------------------------------------------------------------------------------------------
|
||||
function getTeam_sieger()
|
||||
{
|
||||
return $this->team_sieger;
|
||||
}
|
||||
function setTeam_sieger($team_sieger)
|
||||
{
|
||||
$this->team_sieger=$team_sieger;
|
||||
}
|
||||
//-----wettbewerb_kurzbz--------------------------------------------------------------------------------------------
|
||||
function getWettbewerb_kurzbz()
|
||||
{
|
||||
return $this->wettbewerb_kurzbz;
|
||||
}
|
||||
function setWettbewerb_kurzbz($wettbewerb_kurzbz="")
|
||||
{
|
||||
$this->wettbewerb_kurzbz=$wettbewerb_kurzbz;
|
||||
}
|
||||
//-----matchdatumzeit--------------------------------------------------------------------------------------------
|
||||
function getMatchdatumzeit()
|
||||
{
|
||||
return $this->matchdatumzeit;
|
||||
}
|
||||
function setMatchdatumzeit($matchdatumzeit)
|
||||
{
|
||||
$this->matchdatumzeit=$matchdatumzeit;
|
||||
}
|
||||
//-----matchort--------------------------------------------------------------------------------------------
|
||||
function getMatchort()
|
||||
{
|
||||
return $this->matchort;
|
||||
}
|
||||
function setMatchort($matchort)
|
||||
{
|
||||
$this->matchort=$matchort;
|
||||
}
|
||||
//-----ergebniss--------------------------------------------------------------------------------------------
|
||||
function getErgebniss()
|
||||
{
|
||||
return $this->ergebniss;
|
||||
}
|
||||
function setErgebniss($ergebniss)
|
||||
{
|
||||
$this->ergebniss=$ergebniss;
|
||||
}
|
||||
//-----bestaetigtvon--------------------------------------------------------------------------------------------
|
||||
function getBestaetigtvon()
|
||||
{
|
||||
return $this->bestaetigtvon;
|
||||
}
|
||||
function setBestaetigtvon($bestaetigtvon)
|
||||
{
|
||||
$this->bestaetigtvon=$bestaetigtvon;
|
||||
}
|
||||
//-----bestaetigtamum--------------------------------------------------------------------------------------------
|
||||
function getBestaetigtamum()
|
||||
{
|
||||
return $this->bestaetigtamum;
|
||||
}
|
||||
function setBestaetigtamum($bestaetigtamum)
|
||||
{
|
||||
$this->bestaetigtamum=$bestaetigtamum;
|
||||
}
|
||||
//-----matchbestaetigtamum--------------------------------------------------------------------------------------------
|
||||
function getMatchbestaetigtamum()
|
||||
{
|
||||
return $this->matchbestaetigtamum;
|
||||
}
|
||||
function setMatchbestaetigtamum($matchbestaetigtamum)
|
||||
{
|
||||
$this->matchbestaetigtamum=$matchbestaetigtamum;
|
||||
}
|
||||
//-----matchbestaetigtvon--------------------------------------------------------------------------------------------
|
||||
function getMatchbestaetigtvon()
|
||||
{
|
||||
return $this->matchbestaetigtvon;
|
||||
}
|
||||
function setMatchbestaetigtvon($matchbestaetigtvon)
|
||||
{
|
||||
$this->matchbestaetigtvon=$matchbestaetigtvon;
|
||||
}
|
||||
//-----switchGewinner--------------------------------------------------------------------------------------------
|
||||
// Selektion des Datenlesen 0 nur nicht Gewonnene, 1 sind alle Gewonnene , leer alle
|
||||
function getSwitchGewinner()
|
||||
{
|
||||
return $this->switchGewinner;
|
||||
}
|
||||
function setSwitchGewinner($switchGewinner)
|
||||
{
|
||||
$this->switchGewinner=$switchGewinner;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function saveWettbewerbeinladung($team_forderer="",$team_gefordert="",$match_id="")
|
||||
{
|
||||
// Initialisieren
|
||||
$this->setError('');
|
||||
// Konstante
|
||||
$constTableMatch='tbl_match';
|
||||
|
||||
// Parameteruebernahme
|
||||
if (!empty($team_forderer))
|
||||
$this->setTeam_forderer($team_forderer);
|
||||
if (!empty($team_gefordert))
|
||||
$this->setTeam_gefordert($team_gefordert);
|
||||
if (!empty($match_id))
|
||||
$this->setMatch_id($match_id);
|
||||
|
||||
// Verarbeitungsvariablen
|
||||
$cSchemaSQL=$this->getschemaSQL();
|
||||
$cMatch_id=$this->getMatch_id();
|
||||
$cTeam_forderer=$this->getTeam_forderer();
|
||||
$cTeam_gefordert=$this->getTeam_gefordert();
|
||||
|
||||
// Plausib - Pruefen ob Eingeladente Team nicht als Array ubergeben wurde ( gebraucht wird nur die Kurzbezeichnung)
|
||||
if (is_array($cTeam_forderer) && isset($cTeam_forderer['team_forderer']))
|
||||
$cTeam_forderer=$cTeam_forderer['team_forderer'];
|
||||
elseif (is_array($cTeam_forderer) && isset($cTeam_forderer[0]['team_forderer']) )
|
||||
$cTeam_forderer=$cTeam_forderer[0]['team_forderer'];
|
||||
elseif (is_array($cTeam_forderer) && isset($cTeam_forderer['team_forderer']))
|
||||
$cTeam_forderer=$cTeam_forderer['team_kurzbz'];
|
||||
elseif (is_array($cTeam_forderer) && isset($cTeam_forderer[0]['team_forderer']) )
|
||||
$cTeam_forderer=$cTeam_forderer[0]['team_forderer'];
|
||||
|
||||
// Plausib - Pruefen ob Eingeladene Team nicht als Array ubergeben wurde ( gebraucht wird nur die Kurzbezeichnung)
|
||||
if (is_array($cTeam_gefordert) && isset($cTeam_gefordert['team_kurzbz']))
|
||||
$cTeam_gefordert=$cTeam_gefordert['team_kurzbz'];
|
||||
elseif (is_array($cTeam_gefordert) && isset($cTeam_gefordert[0]['team_kurbz']))
|
||||
$cTeam_gefordert=$cTeam_gefordert[0]['team_kurzbz'];
|
||||
|
||||
$cTeam_forderer=trim($cTeam_forderer);
|
||||
if (empty($cTeam_forderer) )
|
||||
{
|
||||
$this->setError('Kein Einladung (Einladenter fehlt) möglich !');
|
||||
return false;
|
||||
}
|
||||
$cTeam_gefordert=trim($cTeam_gefordert);
|
||||
if (empty($cTeam_gefordert) )
|
||||
{
|
||||
$this->setError('Kein Einladung (Eingeladener fehlt) möglich !');
|
||||
return false;
|
||||
}
|
||||
$cMatch_id=trim($cMatch_id);
|
||||
if (empty($cTeam_gefordert) && empty($cMatch_id) )
|
||||
{
|
||||
$this->setError('Kein Einladung (Bearbeitung) möglich !');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$origWettbewerbeinladungen=$this->loadWettbewerbeinladungen())
|
||||
{
|
||||
if ($this->getError()) // Beim Lesen ist ein Fehler aufgetreten
|
||||
return false;
|
||||
$this->setNewRecord(true);
|
||||
}
|
||||
|
||||
$this->db_query(" BEGIN; ");
|
||||
$qry="";
|
||||
|
||||
if ($this->getNewRecord()) // Neuanlage - Insert
|
||||
{
|
||||
/*
|
||||
team_sieger character varying(16) Durchsuchen Ändern Löschen
|
||||
wettbewerb_kurzbz character varying(16) NOT NULL Durchsuchen Ändern Löschen
|
||||
team_gefordert character varying(16) NOT NULL Durchsuchen Ändern Löschen
|
||||
team_forderer character varying(16) NOT NULL Durchsuchen Ändern Löschen
|
||||
gefordertvon character varying(16) NOT NULL Durchsuchen Ändern Löschen
|
||||
matchdatumzeit timestamp without time zone Durchsuchen Ändern Löschen
|
||||
matchort character varying(32) Durchsuchen Ändern Löschen
|
||||
ergebniss character varying(16) Durchsuchen Ändern Löschen
|
||||
bestaetigtvon character varying(16) Durchsuchen Ändern Löschen
|
||||
bestaetigtamum timestamp without time zone Durchsuchen Ändern Löschen
|
||||
match_id integer NOT NULL nextval('tbl_match_match_id_seq'::regclass) Durchsuchen Ändern Löschen
|
||||
matchbestaetigtvon character varying(16) Durchsuchen Ändern Löschen
|
||||
matchbestaetigtamum timestamp without time zone Durchsuchen Ändern Löschen
|
||||
gefordertamum timestamp without time zone
|
||||
*/
|
||||
$fildsList="";
|
||||
$fildsValue="";
|
||||
|
||||
$fildsList.='team_sieger,';
|
||||
$fildsList.='wettbewerb_kurzbz,';
|
||||
$fildsList.='team_gefordert,';
|
||||
$fildsList.='team_forderer,';
|
||||
$fildsList.='gefordertvon,';
|
||||
$fildsList.='matchdatumzeit,';
|
||||
$fildsList.='matchort,';
|
||||
$fildsList.='ergebniss,';
|
||||
$fildsList.='bestaetigtvon,';
|
||||
$fildsList.='bestaetigtamum,';
|
||||
# $fildsList.='match_id,';
|
||||
$fildsList.='matchbestaetigtvon,';
|
||||
$fildsList.='matchbestaetigtamum,';
|
||||
$fildsList.='gefordertamum';
|
||||
|
||||
if (!$this->getGefordertamum())
|
||||
$this->setGefordertamum(time());
|
||||
|
||||
$fildsValue.=($this->team_sieger?"'".addslashes($this->team_sieger)."'":'null').",";
|
||||
|
||||
$fildsValue.="'".addslashes($this->wettbewerb_kurzbz)."',";
|
||||
$fildsValue.="'".addslashes($this->team_gefordert)."',";
|
||||
$fildsValue.="'".addslashes($this->team_forderer)."',";
|
||||
$fildsValue.="'".addslashes($this->gefordertvon)."',";
|
||||
|
||||
$fildsValue.=(empty($this->matchdatumzeit)?'null,':"'".addslashes(date('Y-m-d H:i:s',$this->matchdatumzeit))."',");
|
||||
|
||||
$fildsValue.="'".addslashes($this->matchort)."',";
|
||||
$fildsValue.="'".addslashes($this->ergebniss)."',";
|
||||
|
||||
$fildsValue.=($this->bestaetigtvon?"'".addslashes($this->bestaetigtvon)."'":'null').",";
|
||||
$fildsValue.=(empty($this->bestaetigtamum)?'null,':"'".addslashes(date('Y-m-d H:i:s',$this->bestaetigtamum))."',");
|
||||
# $fildsValue.="".addslashes($this->match_id).",";
|
||||
$fildsValue.=($this->matchbestaetigtvon?"'".addslashes($this->matchbestaetigtvon)."'":'null').",";
|
||||
|
||||
$fildsValue.=(empty($this->matchbestaetigtamum)?'null,':"'".addslashes(date('Y-m-d H:i:s',$this->matchbestaetigtamum))."',");
|
||||
$fildsValue.=(empty($this->gefordertamum)?'null':"'".addslashes(date('Y-m-d H:i:s',$this->gefordertamum))."'");
|
||||
|
||||
$qry=" insert into ".$this->schemaSQL."tbl_match (".$fildsList.") values (".$fildsValue."); ";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$this->getMatch_id())
|
||||
$this->setMatch_id($origWettbewerbeinladungen[0]['match_id']);
|
||||
$qry.=" update ".$cSchemaSQL."tbl_match set ";
|
||||
$fildsValue='';
|
||||
|
||||
if ($this->team_sieger)
|
||||
$fildsValue.="team_sieger=".($this->team_sieger?"'".addslashes($this->team_sieger)."'":'null').",";
|
||||
|
||||
|
||||
$fildsValue.="wettbewerb_kurzbz='".addslashes($this->wettbewerb_kurzbz)."',";
|
||||
$fildsValue.="team_gefordert='".addslashes($this->team_gefordert)."',";
|
||||
$fildsValue.="team_forderer='".addslashes($this->team_forderer)."',";
|
||||
|
||||
if (!is_null($this->gefordertvon) && $this->gefordertvon)
|
||||
$fildsValue.="gefordertvon=".($this->gefordertvon?"'".addslashes($this->gefordertvon)."'":'null').",";
|
||||
|
||||
if (!is_null($this->matchdatumzeit) && $this->matchdatumzeit)
|
||||
$fildsValue.="matchdatumzeit=".($this->matchdatumzeit?"'".addslashes(date('Y-m-d H:i:s',$this->matchdatumzeit))."'":'null').",";
|
||||
|
||||
if (!is_null($this->matchort) && $this->matchort)
|
||||
$fildsValue.="matchort='".addslashes($this->matchort)."',";
|
||||
if (!is_null($this->ergebniss) && $this->ergebniss)
|
||||
$fildsValue.="ergebniss='".addslashes($this->ergebniss)."',";
|
||||
|
||||
if (!is_null($this->ergebniss) && $this->bestaetigtvon)
|
||||
$fildsValue.="bestaetigtvon=".($this->bestaetigtvon?"'".addslashes($this->bestaetigtvon)."'":'null').",";
|
||||
if (!is_null($this->ergebniss) && $this->bestaetigtamum)
|
||||
$fildsValue.="bestaetigtamum=".($this->bestaetigtamum?"'".addslashes(date('Y-m-d H:i:s',$this->bestaetigtamum))."'":'null').",";
|
||||
|
||||
if (!is_null($this->ergebniss) && $this->matchbestaetigtvon)
|
||||
$fildsValue.="matchbestaetigtvon=".($this->matchbestaetigtvon?"'".addslashes($this->matchbestaetigtvon)."'":'null').",";
|
||||
if (!is_null($this->matchbestaetigtamum) && $this->matchbestaetigtamum)
|
||||
$fildsValue.="matchbestaetigtamum=".($this->matchbestaetigtamum?"'".addslashes(date('Y-m-d H:i:s',$this->matchbestaetigtamum))."'":'null').",";
|
||||
if (!is_null($this->gefordertamum) && $this->gefordertamum)
|
||||
$fildsValue.="gefordertamum=".($this->gefordertamum?"'".addslashes(date('Y-m-d H:i:s',$this->gefordertamum))."'":'null').",";
|
||||
|
||||
$fildsValue.="match_id=".addslashes($this->match_id)."";
|
||||
|
||||
$qry.=$fildsValue." where tbl_match.match_id='".$this->getMatch_id()."'; ";
|
||||
|
||||
$cWettbewerb_kurzbz=trim($origWettbewerbeinladungen[0]['wettbewerb_kurzbz']);
|
||||
$origWettbewerbeinladungen[0]['matchbestaetigtvon']=trim($origWettbewerbeinladungen[0]['matchbestaetigtvon']);
|
||||
$origWettbewerbeinladungen[0]['team_sieger']=trim($origWettbewerbeinladungen[0]['team_sieger']);
|
||||
|
||||
if ($this->getMatchbestaetigtvon() && empty($origWettbewerbeinladungen[0]['matchbestaetigtvon'])
|
||||
&& trim($origWettbewerbeinladungen[0]['team_sieger'])==trim($this->team_forderer)) // Der Forderer ist der Siehter den Rangtauschen
|
||||
{
|
||||
// Rang des Geforderten ermitteln
|
||||
$iTmpRangGeforderter=0;
|
||||
$qry_tmp="select rang from ".$cSchemaSQL."tbl_wettbewerbteam where upper(team_kurzbz)=upper('".addslashes($this->team_gefordert)."') and upper(wettbewerb_kurzbz)=upper('".addslashes($this->wettbewerb_kurzbz)."') ;";
|
||||
if($res=$this->db_query($qry_tmp))
|
||||
{
|
||||
$iTmpRangGeforderter=$this->db_result($res,0,'rang');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = $this->db_last_error();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$iTmpRangFrorderer=0;
|
||||
// Rang des Geforderten ermitteln
|
||||
$qry_tmp="select rang from ".$cSchemaSQL."tbl_wettbewerbteam where upper(team_kurzbz)=upper('".$this->team_forderer."') and upper(wettbewerb_kurzbz)=upper('".addslashes($this->wettbewerb_kurzbz)."') ;";
|
||||
if($res=$this->db_query($qry_tmp))
|
||||
{
|
||||
$iTmpRangFrorderer=$this->db_result($res,0,'rang');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = $this->db_last_error();
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry.=" update ".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
$qry.="set rang=0 ";
|
||||
$qry.=" where upper(team_kurzbz)=upper('".addslashes($this->team_gefordert)."') and upper(wettbewerb_kurzbz)=upper('".addslashes($this->wettbewerb_kurzbz)."'); ";
|
||||
|
||||
$qry.=" update ".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
$qry.="set rang=".$iTmpRangGeforderter;
|
||||
$qry.=" where upper(team_kurzbz)=upper('".addslashes($this->team_forderer)."') and upper(wettbewerb_kurzbz)=upper('".addslashes($this->wettbewerb_kurzbz)."'); ";
|
||||
|
||||
$qry.=" update ".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
$qry.="set rang=".$iTmpRangFrorderer;
|
||||
$qry.=" where upper(team_kurzbz)=upper('".addslashes($this->team_gefordert)."') and upper(wettbewerb_kurzbz)=upper('".addslashes($this->wettbewerb_kurzbz)."'); ";
|
||||
|
||||
$qry.=" update ".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
$qry.="set punkte=3+punkte ";
|
||||
$qry.="where upper(wettbewerb_kurzbz)=upper('".addslashes($this->wettbewerb_kurzbz)."') and upper(team_kurzbz)=upper('".addslashes($origWettbewerbeinladungen[0]['team_sieger'])."'); ";
|
||||
|
||||
$qry.=" update ".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
$qry.="set punkte=1+punkte ";
|
||||
$qry.="where upper(wettbewerb_kurzbz)=upper('".addslashes($this->wettbewerb_kurzbz)."') and upper(team_kurzbz)=upper('". addslashes(($origWettbewerbeinladungen[0]['team_sieger']==$this->team_gefordert?$this->team_forderer:$this->team_gefordert))."'); ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
$this->db_query(" COMMIT; ");
|
||||
return $this->loadWettbewerbeinladungen();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($qry.' '.$this->db_last_error());
|
||||
$this->db_query(" ROLLBACK; ");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function loadWettbewerbeinladungen()
|
||||
{
|
||||
$this->setError('');
|
||||
|
||||
$cSchemaSQL=$this->getschemaSQL();
|
||||
|
||||
$match_id=$this->getMatch_id();
|
||||
$cTeam_forderer=$this->getTeam_forderer();
|
||||
$cTeam_kurzbz_einladungen=$this->getTeam_gefordert();
|
||||
$cWettbewerb_kurzbz=$this->getWettbewerb_kurzbz();
|
||||
$cGefordertvon=$this->getGefordertvon();
|
||||
|
||||
$bSwitchGewinner=$this->getSwitchGewinner();
|
||||
|
||||
#SELECT TIMESTAMP WITHOUT TIME ZONE 'epoch' + 982384720 * INTERVAL '1 second';
|
||||
#select to_char(TIMESTAMP '2007-03-27 10:48:50.022', 'DD.MM.YYYY');
|
||||
#select to_char(TIMESTAMP '2007-03-27 10:48:50.022', 'HH24:MI:SS');
|
||||
$qry="";
|
||||
$qry.="SELECT * ";
|
||||
|
||||
$qry.=", to_char(matchdatumzeit, 'DD.MM.YYYY') as \"matchdatum\" ";
|
||||
$qry.=", to_char(matchdatumzeit, 'HH24:MI') as \"matchzeit\" ";
|
||||
|
||||
$qry.=", to_char(gefordertamum, 'DD.MM.YYYY') as \"gefordertamumdatum\" ";
|
||||
$qry.=", to_char(gefordertamum, 'HH24:MI') as \"gefordertamumzeit\" ";
|
||||
|
||||
$qry.=", to_char(bestaetigtamum, 'DD.MM.YYYY') as \"bestaetigtdatum\" ";
|
||||
$qry.=", to_char(bestaetigtamum, 'HH24:MI') as \"bestaetigtzeit\" ";
|
||||
|
||||
$qry.=", to_char(matchbestaetigtamum, 'DD.MM.YYYY') as \"matchbestaetigtdatum\" ";
|
||||
$qry.=", to_char(matchbestaetigtamum, 'HH24:MI') as \"matchbestaetigtzeit\" ";
|
||||
|
||||
$qry.=" FROM ".$cSchemaSQL."tbl_match ";
|
||||
|
||||
if (empty($match_id))
|
||||
$qry.=" WHERE tbl_match.match_id>0 ";
|
||||
else
|
||||
$qry.=" WHERE tbl_match.match_id='".addslashes(trim($match_id))."' ";
|
||||
|
||||
# if (!empty($cGefordertvon))
|
||||
# $qry.=" and tbl_match.gefordertvon='".addslashes(trim($cGefordertvon))."' ";
|
||||
|
||||
// Forderer
|
||||
if (!is_array($cTeam_forderer) && !empty($cTeam_forderer) )
|
||||
{
|
||||
$qry.=" AND UPPER(tbl_match.team_forderer)=UPPER('".addslashes(trim($cTeam_forderer))."') ";
|
||||
}
|
||||
elseif (is_array($cTeam_forderer) && count($cTeam_forderer)>0 )
|
||||
{
|
||||
if (isset($cTeam_forderer[0]['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
for ($indZEILE=0;$indZEILE<count($cTeam_forderer);$indZEILE++)
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_forderer[$indZEILE]['team_kurzbz']);
|
||||
$cTeam_forderer=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
elseif (isset($cTeam_forderer['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_forderer['team_kurzbz']);
|
||||
$cTeam_forderer=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
$qry.=" AND UPPER(tbl_match.team_forderer) in ('".strtoupper(implode("','",$cTeam_forderer))."') ";
|
||||
}
|
||||
// Aaufforderungen - Einladung
|
||||
|
||||
if (!is_array($cTeam_kurzbz_einladungen) && !empty($cTeam_kurzbz_einladungen) )
|
||||
{
|
||||
$qry.=" AND UPPER(tbl_match.team_gefordert)=UPPER('".addslashes(trim($cTeam_kurzbz_einladungen))."') ";
|
||||
}
|
||||
elseif (is_array($cTeam_kurzbz_einladungen) && count($cTeam_kurzbz_einladungen)>0 )
|
||||
{
|
||||
if (isset($cTeam_kurzbz_einladungen[0]['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
for ($indZEILE=0;$indZEILE<count($cTeam_kurzbz_einladungen);$indZEILE++)
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_kurzbz_einladungen[$indZEILE]['team_kurzbz']);
|
||||
$cTeam_kurzbz_einladungen=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
elseif (isset($cTeam_kurzbz_einladungen['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_kurzbz_einladungen['team_kurzbz']);
|
||||
$cTeam_kurzbz_einladungen=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
$qry.=" AND UPPER(tbl_match.team_gefordert) in ('".strtoupper(implode("','",$cTeam_kurzbz_einladungen))."') ";
|
||||
}
|
||||
|
||||
// GEForderte
|
||||
|
||||
if (!is_array($cWettbewerb_kurzbz) && !empty($cWettbewerb_kurzbz) )
|
||||
{
|
||||
$qry.=" AND UPPER(tbl_match.wettbewerb_kurzbz)=UPPER('".addslashes(trim($cWettbewerb_kurzbz))."') ";
|
||||
}
|
||||
elseif (is_array($cWettbewerb_kurzbz) && count($cWettbewerb_kurzbz)>0 )
|
||||
{
|
||||
if (isset($cWettbewerb_kurzbz[0]['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrWettbewerb_kurzbz=array();
|
||||
for ($indZEILE=0;$indZEILE<count($cWettbewerb_kurzbz);$indZEILE++)
|
||||
$arrWettbewerb_kurzbz[]=trim($cTeam_kurzbz_einladungen[$indZEILE]['wettbewerb_kurzbz']);
|
||||
$cWettbewerb_kurzbz=$arrWettbewerb_kurzbz;
|
||||
unset($arrWettbewerb_kurzbz);
|
||||
}
|
||||
elseif (isset($cWettbewerb_kurzbz['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrWettbewerb_kurzbz=array();
|
||||
$arrWettbewerb_kurzbz[]=trim($cTeam_kurzbz_einladungen['wettbewerb_kurzbz']);
|
||||
$cWettbewerb_kurzbz=$arrWettbewerb_kurzbz;
|
||||
unset($arrWettbewerb_kurzbz);
|
||||
}
|
||||
$qry.=" AND UPPER(tbl_match.wettbewerb_kurzbz) in ('".strtoupper(implode("','",$cWettbewerb_kurzbz))."') ";
|
||||
}
|
||||
|
||||
// Listenformen bestimmen
|
||||
if ($bSwitchGewinner=='0')
|
||||
$qry.=" AND ( tbl_match.matchbestaetigtvon <='' or (tbl_match.matchbestaetigtvon IS NULL) ) ";
|
||||
elseif ($bSwitchGewinner=='1')
|
||||
$qry.=" AND tbl_match.matchbestaetigtvon > '' ";
|
||||
|
||||
#echo $qry;
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
$rows=array();
|
||||
while($row = $this->db_fetch_array())
|
||||
{
|
||||
$rows[]=$row;
|
||||
}
|
||||
$this->setWettbewerbeinladung($rows);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($this->db_last_error());
|
||||
return false;
|
||||
}
|
||||
return $this->getWettbewerbeinladung();
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function loadWettbewerbeinladungenForderungstage()
|
||||
{
|
||||
$this->setError('');
|
||||
$cSchemaSQL=$this->getschemaSQL();
|
||||
|
||||
$match_id=$this->getMatch_id();
|
||||
$cTeam_forderer=$this->getTeam_forderer();
|
||||
$cTeam_kurzbz_einladungen=$this->getTeam_gefordert();
|
||||
$cWettbewerb_kurzbz=$this->getWettbewerb_kurzbz();
|
||||
|
||||
$cUid=$this->getGefordertvon();
|
||||
|
||||
$qry="";
|
||||
$qry.="SELECT * ";
|
||||
|
||||
$qry.=", to_char(matchdatumzeit, 'DD.MM.YYYY') as \"matchdatum\" ";
|
||||
$qry.=", to_char(matchdatumzeit, 'HH24:MI') as \"matchzeit\" ";
|
||||
|
||||
$qry.=", to_char(gefordertamum, 'DD.MM.YYYY') as \"gefordertamumdatum\" ";
|
||||
$qry.=", to_char(gefordertamum, 'HH24:MI') as \"gefordertamumzeit\" ";
|
||||
|
||||
$qry.=", to_char(bestaetigtamum, 'DD.MM.YYYY') as \"bestaetigtdatum\" ";
|
||||
$qry.=", to_char(bestaetigtamum, 'HH24:MI') as \"bestaetigtzeit\" ";
|
||||
|
||||
$qry.=", to_char(matchbestaetigtamum, 'DD.MM.YYYY') as \"matchbestaetigtdatum\" ";
|
||||
$qry.=", to_char(matchbestaetigtamum, 'HH24:MI') as \"matchbestaetigtzeit\" ";
|
||||
|
||||
|
||||
$qry.="
|
||||
,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.=" 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<='')
|
||||
|
||||
";
|
||||
|
||||
if (!empty($match_id))
|
||||
$qry.=" and tbl_match.match_id='".addslashes(trim($match_id))."' ";
|
||||
|
||||
if (!empty($cUid))
|
||||
$qry.=" and tbl_wettbewerb.uid='".addslashes(trim($cUid))."' ";
|
||||
|
||||
|
||||
// Forderer
|
||||
if (!is_array($cTeam_forderer) && !empty($cTeam_forderer) )
|
||||
{
|
||||
$qry.=" AND UPPER(tbl_match.team_forderer)=UPPER('".addslashes(trim($cTeam_forderer))."') ";
|
||||
}
|
||||
elseif (is_array($cTeam_forderer) && count($cTeam_forderer)>0 )
|
||||
{
|
||||
if (isset($cTeam_forderer[0]['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
for ($indZEILE=0;$indZEILE<count($cTeam_forderer);$indZEILE++)
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_forderer[$indZEILE]['team_kurzbz']);
|
||||
$cTeam_forderer=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
elseif (isset($cTeam_forderer['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_forderer['team_kurzbz']);
|
||||
$cTeam_forderer=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
|
||||
$qry.=" AND UPPER(tbl_match.team_forderer) in ('".strtoupper(implode("','",$cTeam_forderer))."') ";
|
||||
}
|
||||
// Aaufforderungen - Einladung
|
||||
|
||||
if (!is_array($cTeam_kurzbz_einladungen) && !empty($cTeam_kurzbz_einladungen) )
|
||||
{
|
||||
$qry.=" AND UPPER(tbl_match.team_gefordert)=UPPER('".addslashes(trim($cTeam_kurzbz_einladungen))."') ";
|
||||
}
|
||||
elseif (is_array($cTeam_kurzbz_einladungen) && count($cTeam_kurzbz_einladungen)>0 )
|
||||
{
|
||||
if (isset($cTeam_kurzbz_einladungen[0]['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
for ($indZEILE=0;$indZEILE<count($cTeam_kurzbz_einladungen);$indZEILE++)
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_kurzbz_einladungen[$indZEILE]['team_kurzbz']);
|
||||
$cTeam_kurzbz_einladungen=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
elseif (isset($cTeam_kurzbz_einladungen['team_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrTmpTeam_kurzbz=array();
|
||||
$arrTmpTeam_kurzbz[]=trim($cTeam_kurzbz_einladungen['team_kurzbz']);
|
||||
$cTeam_kurzbz_einladungen=$arrTmpTeam_kurzbz;
|
||||
unset($arrTmpTeam_kurzbz);
|
||||
}
|
||||
$qry.=" AND UPPER(tbl_match.team_gefordert) in ('".strtoupper(implode("','",$cTeam_kurzbz_einladungen))."') ";
|
||||
}
|
||||
|
||||
// GEForderte
|
||||
|
||||
if (!is_array($cWettbewerb_kurzbz) && !empty($cWettbewerb_kurzbz) )
|
||||
{
|
||||
$qry.=" AND UPPER(tbl_match.wettbewerb_kurzbz)=UPPER('".addslashes(trim($cWettbewerb_kurzbz))."') ";
|
||||
}
|
||||
elseif (is_array($cWettbewerb_kurzbz) && count($cWettbewerb_kurzbz)>0 )
|
||||
{
|
||||
if (isset($cWettbewerb_kurzbz[0]['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrWettbewerb_kurzbz=array();
|
||||
for ($indZEILE=0;$indZEILE<count($cWettbewerb_kurzbz);$indZEILE++)
|
||||
$arrWettbewerb_kurzbz[]=trim($cTeam_kurzbz_einladungen[$indZEILE]['wettbewerb_kurzbz']);
|
||||
$cWettbewerb_kurzbz=$arrWettbewerb_kurzbz;
|
||||
unset($arrWettbewerb_kurzbz);
|
||||
}
|
||||
elseif (isset($cWettbewerb_kurzbz['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$arrWettbewerb_kurzbz=array();
|
||||
$arrWettbewerb_kurzbz[]=trim($cTeam_kurzbz_einladungen['wettbewerb_kurzbz']);
|
||||
$cWettbewerb_kurzbz=$arrWettbewerb_kurzbz;
|
||||
unset($arrWettbewerb_kurzbz);
|
||||
}
|
||||
$qry.=" AND UPPER(tbl_match.wettbewerb_kurzbz) in ('".strtoupper(implode("','",$cWettbewerb_kurzbz))."') ";
|
||||
}
|
||||
|
||||
# $qry.=" OFFSET 0 LIMIT ALL FOR SHARE OF tbl_match ;";
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
$rows=array();
|
||||
while($row = $this->db_fetch_array())
|
||||
{
|
||||
$rows[]=$row;
|
||||
}
|
||||
$this->setWettbewerbeinladung($rows);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($this->db_last_error());
|
||||
|
||||
return false;
|
||||
}
|
||||
return $this->getWettbewerbeinladung();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function unloadWettbewerbeinladungen()
|
||||
{
|
||||
$this->setError('');
|
||||
$cSchemaSQL=$this->getschemaSQL();
|
||||
|
||||
$match_id=$this->getMatch_id();
|
||||
if (empty($match_id))
|
||||
{
|
||||
$this->setError('Keine Match ID gefunden!');
|
||||
return false;
|
||||
}
|
||||
$qry="";
|
||||
$qry.="delete from ".$cSchemaSQL."tbl_match ";
|
||||
$qry.=" * ";
|
||||
$qry.=" where tbl_match.match_id='".addslashes(trim($match_id))."' ";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
$this->setWettbewerbeinladung(null);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($this->db_last_error());
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // Class komune_wettbewerb Ende
|
||||
|
||||
?>
|
||||
@@ -1,418 +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 komune_wettbewerbteam
|
||||
*
|
||||
* @param connectSQL Datenbankverbindung
|
||||
* @param uid Angemeleter Anwender
|
||||
* @param team_kurzbz Team des Angemeleter Anwenders zum Wettbewerb
|
||||
* @param wettbewerb_kurzbz Wettbewerbssubgruppen Key
|
||||
*
|
||||
* @return - kein Retourn des Konstruktors
|
||||
*
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
class komune_wettbewerbteam extends basis_db
|
||||
{
|
||||
public $new;
|
||||
public $newWettbewerbteam;
|
||||
public $wettbewerbteam;
|
||||
|
||||
public $uid;
|
||||
public $team_kurzbz;
|
||||
public $team_kurzbz_old;
|
||||
public $wettbewerb_kurzbz;
|
||||
|
||||
public $schemaSQL="kommune."; // string Datenbankschema
|
||||
//-----Konstruktor
|
||||
function __construct($uid="",$team_kurzbz="",$wettbewerb_kurzbz="")
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->InitWettbewerbteam();
|
||||
|
||||
$this->setuid($uid);
|
||||
$this->setTeam_kurzbz($team_kurzbz);
|
||||
$this->setWettbewerb_kurzbz($wettbewerb_kurzbz);
|
||||
}
|
||||
|
||||
//-----Initialisierung--------------------------------------------------------------------------------------------
|
||||
function InitWettbewerbteam()
|
||||
{
|
||||
$this->setError('');
|
||||
|
||||
$this->setNewWettbewerbteam('');
|
||||
$this->setWettbewerbteam('');
|
||||
|
||||
$this->setuid('');
|
||||
$this->setTeam_kurzbz('');
|
||||
$this->setTeam_kurzbz_old('');
|
||||
$this->setWettbewerb_kurzbz('');
|
||||
}
|
||||
|
||||
|
||||
//-----NewRecord--------------------------------------------------------------------------------------------
|
||||
function getNewRecord()
|
||||
{
|
||||
return $this->new;
|
||||
}
|
||||
function setNewRecord($switch)
|
||||
{
|
||||
$this->new=$switch;
|
||||
}
|
||||
|
||||
//-----Error--------------------------------------------------------------------------------------------
|
||||
function getError()
|
||||
{
|
||||
return $this->errormsg;
|
||||
}
|
||||
function setError($err)
|
||||
{
|
||||
$this->errormsg=$err;
|
||||
}
|
||||
//-----schemaSQL--------------------------------------------------------------------------------------------
|
||||
function getSchemaSQL()
|
||||
{
|
||||
return $this->schemaSQL;
|
||||
}
|
||||
function setSchemaSQL($schemaSQL)
|
||||
{
|
||||
$this->schemaSQL=$schemaSQL;
|
||||
}
|
||||
//-----Neuer Datensatz--------------------------------------------------------------------------------------------
|
||||
function getNewWettbewerbteam()
|
||||
{
|
||||
return $this->newWettbewerbteam;
|
||||
}
|
||||
function setNewWettbewerbteam($newWettbewerbteam)
|
||||
{
|
||||
$this->newWettbewerbteam=$newWettbewerbteam;
|
||||
}
|
||||
//-----Aenderung Datensatz wird wie Neuanlage gehandhabt -------------------------------------------------------------
|
||||
function getUpdWettbewerbteam()
|
||||
{
|
||||
return $this->newWettbewerbteam;
|
||||
}
|
||||
function setUpdWettbewerbteam($newWettbewerbteam)
|
||||
{
|
||||
$this->newWettbewerbteam=trim($newWettbewerbteam);
|
||||
}
|
||||
//-----Aktueller Datensatz--------------------------------------------------------------------------------------------
|
||||
function getWettbewerbteam()
|
||||
{
|
||||
return $this->wettbewerbteam;
|
||||
}
|
||||
function setWettbewerbteam($wettbewerbteam)
|
||||
{
|
||||
$this->wettbewerbteam=$wettbewerbteam;
|
||||
}
|
||||
//-----team_kurzbz--------------------------------------------------------------------------------------------
|
||||
function getTeam_kurzbz()
|
||||
{
|
||||
return $this->team_kurzbz;
|
||||
}
|
||||
function setTeam_kurzbz($team_kurzbz)
|
||||
{
|
||||
$this->team_kurzbz=trim($team_kurzbz);
|
||||
}
|
||||
//-----team_kurzbz--------------------------------------------------------------------------------------------
|
||||
function getTeam_kurzbz_old()
|
||||
{
|
||||
return $this->team_kurzbz_old;
|
||||
}
|
||||
function setTeam_kurzbz_old($team_kurzbz_old)
|
||||
{
|
||||
$this->team_kurzbz_old=trim($team_kurzbz_old);
|
||||
}
|
||||
//-----uid--------------------------------------------------------------------------------------------
|
||||
function getUid()
|
||||
{
|
||||
return $this->uid;
|
||||
}
|
||||
function setUid($uid)
|
||||
{
|
||||
$this->uid=trim($uid);
|
||||
}
|
||||
//-----wettbewerb_kurzbz--------------------------------------------------------------------------------------------
|
||||
function getWettbewerb_kurzbz()
|
||||
{
|
||||
return $this->wettbewerb_kurzbz;
|
||||
}
|
||||
function setWettbewerb_kurzbz($wettbewerb_kurzbz="")
|
||||
{
|
||||
$this->wettbewerb_kurzbz=trim($wettbewerb_kurzbz);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function saveWettbewerbteam($newWettbewerbteam="")
|
||||
{
|
||||
// Initialisierung
|
||||
$this->setError('');
|
||||
|
||||
// Plausib
|
||||
if (!empty($newWettbewerbteam))
|
||||
$this->setNewWettbewerbteam($newWettbewerbteam);
|
||||
|
||||
if (!is_array($this->getNewWettbewerbteam()))
|
||||
{
|
||||
$this->setError('Kein Wettbewerbsteam übergeben');
|
||||
return false;
|
||||
}
|
||||
$newWettbewerbteam=$this->getNewWettbewerbteam();
|
||||
|
||||
// Daten uebernahme
|
||||
$cSchemaSQL=$this->getSchemaSQL();
|
||||
$cTeam_kurzbz=$this->getTeam_kurzbz();
|
||||
|
||||
// Aenderungen muessen mit dem Team_kurzbz_old gekennzeichnet werden. Ansonst koennten falsche Daten geaendert werden
|
||||
$cTeam_kurzbz_old=$this->getTeam_kurzbz_old();
|
||||
|
||||
$cUserUID=$this->getUid(); // Vor der Verarbeitung sicherstellen das Alle Anwender gelesen werden
|
||||
$this->setUid('');
|
||||
|
||||
$this->setNewRecord(false);
|
||||
if (!$origWettbewerbteam=$this->loadWettbewerbteam())
|
||||
{
|
||||
if ($this->getError()) // Beim Lesen ist ein Fehler aufgetreten
|
||||
return false;
|
||||
$this->setNewRecord(true);
|
||||
}
|
||||
$this->setUid($cUserUID);
|
||||
unset($cUserUID);
|
||||
|
||||
if ($origWettbewerbteam && empty($cTeam_kurzbz_old)) // Datenrec bereits vorhanden
|
||||
{
|
||||
$this->setError('Das Team '.$cTeam_kurzbz.' ist bereits angelegt!');
|
||||
return false;
|
||||
}
|
||||
$bTmpNewRecord=$this->getNewRecord(); // Neuanlage Switch sichern
|
||||
|
||||
|
||||
// Aus dem Array newWettbewerbteam die Teaminformationen heraus holen
|
||||
$cWettbewerb_kurzbz=(isset($newWettbewerbteam['wettbewerb_kurzbz']) ? $newWettbewerbteam['wettbewerb_kurzbz'] : '');
|
||||
if (empty($cWettbewerb_kurzbz))
|
||||
$cWettbewerb_kurzbz=(isset($newWettbewerbteam[0]['wettbewerb_kurzbz']) ? $newWettbewerbteam[0]['wettbewerb_kurzbz'] : '');
|
||||
$team_bezeichnung=(isset($newWettbewerbteam['bezeichnung']) ? $newWettbewerbteam['bezeichnung'] : '');
|
||||
$team_beschreibung=(isset($newWettbewerbteam['beschreibung']) ? $newWettbewerbteam['beschreibung'] : '');
|
||||
|
||||
$team_logo=(isset($newWettbewerbteam['logo']) ? $newWettbewerbteam['logo'] : null);
|
||||
$team_rang=(isset($newWettbewerbteam['rang']) ? $newWettbewerbteam['rang'] : null);
|
||||
|
||||
// Ermitteln der Tabelle der Teamspieler
|
||||
if (isset($newWettbewerbteam['array_user']))
|
||||
$array_userUID=$newWettbewerbteam['array_user'];
|
||||
else
|
||||
{
|
||||
$this->setError('Die Spieler / Team wurde nicht gefunden! ');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$qry="select * from ".$cSchemaSQL."tbl_teambenutzer , ".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
$qry.=" where tbl_wettbewerbteam.team_kurzbz =tbl_teambenutzer.team_kurzbz ";
|
||||
$qry.=" and not ( UPPER(tbl_teambenutzer.team_kurzbz)='".addslashes(trim(strtoupper($cTeam_kurzbz_old)))."' and UPPER(tbl_teambenutzer.team_kurzbz)='".addslashes(trim(strtoupper($cTeam_kurzbz)))."' ) ";
|
||||
$qry.=" and UPPER(tbl_teambenutzer.uid) in ('".strtoupper(implode("','",$array_userUID))."') ";
|
||||
$qry.=" and UPPER(tbl_wettbewerbteam.wettbewerb_kurzbz)='".addslashes(trim(strtoupper($cWettbewerb_kurzbz)))."' ; ";
|
||||
// Datenbankabfrage
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
$rows=array();
|
||||
while($row = $this->db_fetch_array())
|
||||
{
|
||||
$this->setError(sprintf('Der Spieler %s wurde bereits im Team %s im Wettbewerb %s gefunden ! ',$row['uid'],$row['team_kurzbz'],$row['wettbewerb_kurzbz']));
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$arrTmpCheckUID=array(); // Aus dem Array nur die Belegten UIDs suchen
|
||||
for ($zeileIND=0;$zeileIND<count($array_userUID);$zeileIND++)
|
||||
{
|
||||
if (!empty($array_userUID[$zeileIND])) // Leere Daten entfernen (Inputmasken befuellung kann Wahllos erfolgen)
|
||||
{
|
||||
$array_userUID[$zeileIND]=trim($array_userUID[$zeileIND]);
|
||||
$arrTmpCheckUID[]=$array_userUID[$zeileIND];
|
||||
}
|
||||
}
|
||||
$array_userUID=$arrTmpCheckUID;
|
||||
if (isset($arrTmpCheckUID)) unset($arrTmpCheckUID);
|
||||
|
||||
$this->setNewRecord($bTmpNewRecord);
|
||||
|
||||
|
||||
$this->db_query(" BEGIN; ");
|
||||
|
||||
$qry="";
|
||||
// Neuanlage - Insert
|
||||
if ($this->getNewRecord())
|
||||
{
|
||||
$qry.=" INSERT into ".$cSchemaSQL."tbl_team (team_kurzbz,bezeichnung,beschreibung,logo) VALUES ('".addslashes(trim($cTeam_kurzbz))."','".addslashes(trim($team_bezeichnung))."','".addslashes(trim($team_beschreibung))."','".addslashes(trim($team_logo))."'); ";
|
||||
for ($zeileIND=0;$zeileIND<count($array_userUID);$zeileIND++)
|
||||
{
|
||||
if (!empty($array_userUID[$zeileIND]))
|
||||
$qry.=" INSERT into ".$cSchemaSQL."tbl_teambenutzer (uid, team_kurzbz) VALUES ('".addslashes(trim($array_userUID[$zeileIND]))."','".addslashes(trim($cTeam_kurzbz))."'); ";
|
||||
}
|
||||
$qry.=" INSERT into ".$cSchemaSQL."tbl_wettbewerbteam (team_kurzbz, wettbewerb_kurzbz,rang,punkte) VALUES ('".$cTeam_kurzbz."','".addslashes(trim($cWettbewerb_kurzbz))."',(select 1+count(wettbewerb_kurzbz) from ".$cSchemaSQL."tbl_wettbewerbteam where rang<9999 and upper(wettbewerb_kurzbz)=upper('".addslashes(trim($cWettbewerb_kurzbz))."')),0); ";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update Logo nur wenn Daten uebergeben wurden, sonst Logo auslassen
|
||||
# if ($team_logo==null) $team_logo=(isset($origWettbewerbteam[0]['logo']) ? $origWettbewerbteam[0]['logo'] : null);
|
||||
# if ($team_rang==null) $team_rang=(isset($origWettbewerbteam[0]['rang']) ? $origWettbewerbteam[0]['rang'] : null);
|
||||
|
||||
$qry.=" UPDATE ".$cSchemaSQL."tbl_team ";
|
||||
$qry.=" set team_kurzbz='".addslashes(trim($cTeam_kurzbz))."',bezeichnung='".addslashes(trim($team_bezeichnung))."',beschreibung='".addslashes(trim($team_beschreibung))."'".($team_logo!=null?",logo='".addslashes($team_logo)."'":"");
|
||||
$qry.=" WHERE upper(team_kurzbz)=upper('".$cTeam_kurzbz_old."'); ";
|
||||
|
||||
$qry.=" UPDATE ".$cSchemaSQL."tbl_wettbewerbteam set team_kurzbz='".addslashes(trim($cTeam_kurzbz))."'".($team_rang!=null?",rang=".$team_rang:"")." WHERE upper(team_kurzbz)=upper('".$cTeam_kurzbz_old."'); ";
|
||||
|
||||
// Alle bisher bestehenden DB-Eintraege in Array lesen fuer spaeteren vergleich ob Update/Delete
|
||||
reset($origWettbewerbteam);
|
||||
|
||||
$arrTmpCheckUID=new stdClass;;
|
||||
for ($zeileIND=0;$zeileIND<count($origWettbewerbteam);$zeileIND++)
|
||||
{
|
||||
$cTmpUID=trim($origWettbewerbteam[$zeileIND]['uid']);
|
||||
$arrTmpCheckUID->$cTmpUID=$cTmpUID;
|
||||
}
|
||||
|
||||
|
||||
// Suchen Neuanlage - Update (nach Update den Array Eintrag entleeren sonst wird er nachher geloescht)
|
||||
for ($zeileIND=0;$zeileIND<count($array_userUID);$zeileIND++)
|
||||
{
|
||||
$cTmpUID=trim($array_userUID[$zeileIND]);
|
||||
if (isset($arrTmpCheckUID->$cTmpUID))
|
||||
{
|
||||
$qry.=" UPDATE ".$cSchemaSQL."tbl_teambenutzer set team_kurzbz='".addslashes(trim($cTeam_kurzbz))."' WHERE UPPER(uid)=UPPER('".addslashes($cTmpUID)."') AND upper(team_kurzbz)=upper('".$cTeam_kurzbz_old."'); ";
|
||||
unset($arrTmpCheckUID->$cTmpUID);
|
||||
}
|
||||
elseif (!isset($arrTmpCheckUID->$cTmpUID))
|
||||
{
|
||||
$qry.=" INSERT into ".$cSchemaSQL."tbl_teambenutzer (uid, team_kurzbz) VALUES ('".addslashes(trim($cTmpUID))."','".addslashes(trim($cTeam_kurzbz))."'); ";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($zeileIND)) unset($zeileIND);
|
||||
if (isset($array_userUID)) unset($array_userUID);
|
||||
// Alle die noch in der DB-Alt Array sind muessen geloeschte sein
|
||||
while (list( $key, $value ) = each($arrTmpCheckUID) )
|
||||
$qry.=" DELETE from ".$cSchemaSQL."tbl_teambenutzer WHERE UPPER(uid)=UPPER('".addslashes($value)."') AND upper(team_kurzbz)=upper('".$cTeam_kurzbz_old."'); ";
|
||||
|
||||
if (isset($key)) unset($key);
|
||||
if (isset($value)) unset($value);
|
||||
if (isset($arrTmpCheckUID)) unset($arrTmpCheckUID);
|
||||
}
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
$this->db_query(" COMMIT; ");
|
||||
if (!$this->loadWettbewerbteam())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db_query(" ROLLBACK; ");
|
||||
$this->setError($this->db_last_error());
|
||||
return false;
|
||||
}
|
||||
return $this->getWettbewerbteam();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
function loadWettbewerbteam()
|
||||
{
|
||||
$this->setError('');
|
||||
|
||||
$cSchemaSQL=$this->getSchemaSQL();
|
||||
$tmpUid=$this->getUid();
|
||||
|
||||
$cTeam_kurzbz=$this->getTeam_kurzbz_old();
|
||||
if (empty($cTeam_kurzbz))
|
||||
$cTeam_kurzbz=$this->getTeam_kurzbz();
|
||||
|
||||
$cWettbewerb_kurzbz=$this->getWettbewerb_kurzbz();
|
||||
|
||||
$qry="";
|
||||
$qry.="SELECT * FROM ".$cSchemaSQL."tbl_teambenutzer,".$cSchemaSQL."tbl_team,".$cSchemaSQL."tbl_wettbewerbteam ";
|
||||
|
||||
$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
|
||||
$qry.=" AND UPPER(tbl_wettbewerbteam.team_kurzbz)=UPPER(tbl_teambenutzer.team_kurzbz) ";
|
||||
|
||||
if (!empty($cTeam_kurzbz))
|
||||
$qry.=" AND UPPER(tbl_teambenutzer.team_kurzbz)=UPPER('".$cTeam_kurzbz."') ";
|
||||
|
||||
if (!empty($tmpUid))
|
||||
$qry.=" AND UPPER(tbl_teambenutzer.uid)=UPPER('".addslashes($tmpUid)."') ";
|
||||
|
||||
// Suche nach einem einzigen Wettbewerb
|
||||
if (!is_array($cWettbewerb_kurzbz) && !empty($cWettbewerb_kurzbz) )
|
||||
{
|
||||
$qry.=" AND UPPER(tbl_wettbewerbteam.wettbewerb_kurzbz)=UPPER('".$cWettbewerb_kurzbz."') ";
|
||||
}
|
||||
elseif (is_array($cWettbewerb_kurzbz) && count($cWettbewerb_kurzbz)>0 )
|
||||
{
|
||||
if (isset($cWettbewerb_kurzbz[0]['wettbewerb_kurzbz'])) // Check ob nicht kpl. Tablestruck in Array
|
||||
{
|
||||
$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);
|
||||
}
|
||||
$qry.=" AND UPPER(tbl_wettbewerbteam.wettbewerb_kurzbz) in ('".strtoupper(implode("','",$cWettbewerb_kurzbz))."') ";
|
||||
}
|
||||
$qry.="ORDER BY tbl_wettbewerbteam.rang ;";
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
$rows=array();
|
||||
while($row = $this->db_fetch_array())
|
||||
{
|
||||
$rows[]=$row;
|
||||
}
|
||||
$this->setWettbewerbteam($rows);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($this->db_last_error());
|
||||
|
||||
return false;
|
||||
}
|
||||
return $this->getWettbewerbteam();
|
||||
}
|
||||
} // Class komune_wettbewerbteam Ende
|
||||
|
||||
?>
|
||||
@@ -1,93 +0,0 @@
|
||||
<?PHP /*
|
||||
xslfo2pdf
|
||||
Copyright (C) 2005 Tegonal GmbH
|
||||
|
||||
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.
|
||||
|
||||
Contact:
|
||||
mike.toggweiler@tegonal.com
|
||||
http://xslf2pdf.tegonal.com
|
||||
*/ ?>
|
||||
<?PHP
|
||||
if ($_GET["file"] ) {
|
||||
require_once("xslfo2pdf.php");
|
||||
$buffer = file_get_contents($_GET["file"]);
|
||||
$fo2pdf = new XslFo2Pdf();
|
||||
if (!$fo2pdf->generatePdf($buffer, $_GET["file"], "D")) {
|
||||
echo "Failed parsing file:".$_GET["file"]."<br>";
|
||||
}
|
||||
}
|
||||
else if ($_FILES["file"]) {
|
||||
$buffer = file_get_contents($_FILES['file']['tmp_name']);
|
||||
require_once("xslfo2pdf.php");
|
||||
$fo2pdf = new XslFo2Pdf();
|
||||
if (!$fo2pdf->generatePdf($buffer, $_FILES['file']['name'], "D")) {
|
||||
echo "Failed parsing file:".$_FILES['file']['name']."<br>";
|
||||
//store file in specific directory that failed document may be checked by the developer team
|
||||
file_put_contents("failed/".basename($_FILES['file']['name']));
|
||||
echo "Stored file for inspection";
|
||||
}
|
||||
}
|
||||
else {
|
||||
?>
|
||||
<div >
|
||||
<a target="_new" href="http://www.tegonal.com/en"><img src="http://www.tegonal.com/images/tegonal_logo.png" border="0"></img></a>
|
||||
<p>
|
||||
Browse a local file to process:
|
||||
<form name="extfile" action="index.php" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
|
||||
<input name="file" type="file" size="50" maxlength="100000" accept="text/*.xml">
|
||||
<input type="submit" value="Process" />
|
||||
</form>
|
||||
</p>
|
||||
<p>
|
||||
Or choose one of the predefined examples<br />
|
||||
<?PHP
|
||||
|
||||
$files = addDir("examples");
|
||||
foreach ($files as $file) {
|
||||
echo('<a href="index.php?file='.$file.'">'.$file.'</a>(<a href="'.$file.'">.xml</a>)<br>');
|
||||
}
|
||||
}
|
||||
|
||||
function addDir($dirname) {
|
||||
$dir = dir($dirname);
|
||||
$files = array();
|
||||
while ($file = $dir->read()) {
|
||||
if($file != "." && $file != "..") {
|
||||
if (!is_dir($dirname."/".$file)) {
|
||||
$path_parts = pathinfo($file);
|
||||
|
||||
if ($path_parts['extension'] == "xml" ||
|
||||
$path_parts['extension'] == "fo") {
|
||||
$files[$file] = $dirname . "/" . $file;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$files += addDir($dirname."/".$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
$dir->close();
|
||||
asort($files);
|
||||
return $files;
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<p>XPMT is kindly hosted on <br/><a class="normallink" href="http://sourceforge.net" target="_new">
|
||||
<img src="http://sourceforge.net/sflogo.php?group_id=132608&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,61 +0,0 @@
|
||||
<?PHP /*
|
||||
xslfo2pdf
|
||||
Copyright (C) 2005 Tegonal GmbH
|
||||
|
||||
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.
|
||||
|
||||
Contact:
|
||||
mike.toggweiler@tegonal.com
|
||||
http://xslf2pdf.tegonal.com
|
||||
*/ ?>
|
||||
<?PHP
|
||||
if ($_GET["file"]) {
|
||||
require_once("xslfo2pdf.php");
|
||||
$buffer = file_get_contents($_GET["file"]);
|
||||
$fo2pdf = new XslFo2Pdf();
|
||||
if (!$fo2pdf->generatePdf($buffer, $_GET["file"], "D")) {
|
||||
echo "Failed parsing file:".$_GET["file"]."<br>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$files = addDir("examples");
|
||||
foreach ($files as $file) {
|
||||
echo('<a href="xslfo2pdf_example.php?file='.$file.'">'.$file.'</a><br>');
|
||||
}
|
||||
}
|
||||
|
||||
function addDir($dirname) {
|
||||
$dir = dir($dirname);
|
||||
$files = array();
|
||||
while ($file = $dir->read()) {
|
||||
if($file != "." && $file != "..") {
|
||||
if (!is_dir($dirname."/".$file)) {
|
||||
$path_parts = pathinfo($file);
|
||||
|
||||
if ($path_parts['extension'] == "xml" ||
|
||||
$path_parts['extension'] == "fo") {
|
||||
$files[] = $dirname . "/" . $file;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$files += addDir($dirname."/".$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
$dir->close();
|
||||
asort($files);
|
||||
return $files;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user