mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 16:02:15 +00:00
Merge branch 'master' of https://github.com/FH-Complete/FHC-Core
Conflicts: content/pdfExport.php
This commit is contained in:
@@ -237,7 +237,7 @@ class anwesenheit extends basis_db
|
||||
$qry = "SELECT
|
||||
datum, a.einheiten,
|
||||
(SELECT true FROM campus.tbl_anwesenheit
|
||||
WHERE lehreinheit_id=".$this->db_add_param($lehreinheit_id)." AND datum=a.datum) as anwesend,
|
||||
WHERE lehreinheit_id=".$this->db_add_param($lehreinheit_id)." AND datum=a.datum LIMIT 1) as anwesend,
|
||||
(SELECT stundensatz FROM lehre.tbl_lehreinheitmitarbeiter WHERE lehreinheit_id=".$this->db_add_param($lehreinheit_id)."
|
||||
AND mitarbeiter_uid=".$this->db_add_param($mitarbeiter_uid).") as stundensatz
|
||||
FROM
|
||||
|
||||
@@ -364,7 +364,7 @@ class cronjob extends basis_db
|
||||
public function execute()
|
||||
{
|
||||
$return = true;
|
||||
if($this->standalone && isJobRunning())
|
||||
if($this->standalone && $this->isJobRunning())
|
||||
{
|
||||
$this->errormsg = 'Job kann nicht ausgefuehrt werden, da noch ein anderer Job laeuft';
|
||||
return false;
|
||||
|
||||
+637
-630
File diff suppressed because it is too large
Load Diff
+458
-402
@@ -1,402 +1,458 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 FH 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: Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
|
||||
class notiz extends basis_db
|
||||
{
|
||||
public $new;
|
||||
public $result=array();
|
||||
|
||||
//Tabellenspalten
|
||||
public $notiz_id;
|
||||
public $titel;
|
||||
public $text;
|
||||
public $verfasser_uid;
|
||||
public $bearbeiter_uid;
|
||||
public $start;
|
||||
public $ende;
|
||||
public $erledigt;
|
||||
public $insertamum;
|
||||
public $insertvon;
|
||||
public $updateamum;
|
||||
public $updatevon;
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
* @param $notiz_id
|
||||
*/
|
||||
public function __construct($notiz_id = null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if($notiz_id != null)
|
||||
$this->load($notiz_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt eine Notiz
|
||||
* @param $notiz_id
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function load($notiz_id)
|
||||
{
|
||||
if(!is_numeric($notiz_id))
|
||||
{
|
||||
$this->errormsg = 'NotizID ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SELECT * FROM public.tbl_notiz WHERE notiz_id=".$this->db_add_param($notiz_id, FHC_INTEGER);
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->notiz_id=$row->notiz_id;
|
||||
$this->titel=$row->titel;
|
||||
$this->text=$row->text;
|
||||
$this->verfasser_uid=$row->verfasser_uid;
|
||||
$this->bearbeiter_uid=$row->bearbeiter_uid;
|
||||
$this->start=$row->start;
|
||||
$this->ende=$row->ende;
|
||||
$this->erledigt=$this->db_parse_bool($row->erledigt);
|
||||
$this->insertamum=$row->insertamum;
|
||||
$this->insertvon=$row->insertvon;
|
||||
$this->updateamum=$row->updateamum;
|
||||
$this->updatevon=$row->updatevon;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Datensatz wurde nicht gefunden';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Löscht eine Notiz
|
||||
* @param $notiz_id
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function delete($notiz_id)
|
||||
{
|
||||
if(!is_numeric($notiz_id))
|
||||
{
|
||||
$this->errormsg = 'NotizID ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "Delete FROM public.tbl_notiz WHERE notiz_id=".$this->db_add_param($notiz_id, FHC_INTEGER);
|
||||
|
||||
if(!$this->db_query($qry))
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Loeschen der Daten';
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prueft die Daten vor dem Speichern
|
||||
* auf Gueltigkeit
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert den aktuellen Datensatz in die Datenbank
|
||||
* Wenn $neu auf true gesetzt ist wird ein neuer Datensatz angelegt
|
||||
* andernfalls wird der Datensatz mit der ID in $notiz_id aktualisiert
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function save($new=null)
|
||||
{
|
||||
if($new==null)
|
||||
$new=$this->new;
|
||||
|
||||
if(!$this->validate())
|
||||
return false;
|
||||
|
||||
if($new)
|
||||
{
|
||||
//Neuen Datensatz einfuegen
|
||||
$qry='BEGIN;INSERT INTO public.tbl_notiz (titel, text, verfasser_uid,
|
||||
bearbeiter_uid, start, ende, erledigt, insertamum, insertvon,
|
||||
updateamum, updatevon) VALUES('.
|
||||
$this->db_add_param($this->titel).', '.
|
||||
$this->db_add_param($this->text).', '.
|
||||
$this->db_add_param($this->verfasser_uid).','.
|
||||
$this->db_add_param($this->bearbeiter_uid).','.
|
||||
$this->db_add_param($this->start).','.
|
||||
$this->db_add_param($this->ende).','.
|
||||
$this->db_add_param($this->erledigt,FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->insertamum).','.
|
||||
$this->db_add_param($this->insertvon).','.
|
||||
$this->db_add_param($this->updateamum).','.
|
||||
$this->db_add_param($this->updatevon).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry='UPDATE public.tbl_notiz SET '.
|
||||
'titel='.$this->db_add_param($this->titel).', '.
|
||||
'text='.$this->db_add_param($this->text).', '.
|
||||
'verfasser_uid='.$this->db_add_param($this->verfasser_uid).', '.
|
||||
'bearbeiter_uid='.$this->db_add_param($this->bearbeiter_uid).', '.
|
||||
'start='.$this->db_add_param($this->start).', '.
|
||||
'ende='.$this->db_add_param($this->ende).', '.
|
||||
'erledigt='.$this->db_add_param($this->erledigt,FHC_BOOLEAN).', '.
|
||||
'updateamum='.$this->db_add_param($this->updateamum).', '.
|
||||
'updatevon='.$this->db_add_param($this->updatevon).' '.
|
||||
'WHERE notiz_id='.$this->db_add_param($this->notiz_id,FHC_INTEGER).';';
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($new)
|
||||
{
|
||||
$qry="SELECT currval('seq_notiz_notiz_id') as id;";
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$this->notiz_id = $row->id;
|
||||
$this->db_query('COMMIT;');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Lesen der Sequence';
|
||||
$this->db_query('ROLLBACK');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Lesen der Sequence';
|
||||
$this->db_query('ROLLBACK');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern des Datensatzes';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert die Zuordnung einer Notiz
|
||||
*
|
||||
*/
|
||||
public function saveZuordnung()
|
||||
{
|
||||
$qry = "INSERT INTO public.tbl_notizzuordnung(notiz_id, projekt_kurzbz, projektphase_id, projekttask_id,
|
||||
uid, person_id, prestudent_id, bestellung_id, lehreinheit_id, anrechnung_id) VALUES(".
|
||||
$this->db_add_param($this->notiz_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->projekt_kurzbz).','.
|
||||
$this->db_add_param($this->projektphase_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->projekttask_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->uid).','.
|
||||
$this->db_add_param($this->person_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->prestudent_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->bestellung_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->lehreinheit_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->anrechnung_id, FHC_INTEGER).');';
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Laedt die Notizen
|
||||
* @param $erledigt
|
||||
* @param $projekt_kurzbz
|
||||
* @param $projektphase_id
|
||||
* @param $projekttask_id
|
||||
* @param $uid
|
||||
* @param $person_id
|
||||
* @param $prestudent_id
|
||||
* @param $bestellung_id
|
||||
* @param $user
|
||||
* @param $lehreinheit_id
|
||||
* @param $anrechnung_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function getNotiz($erledigt=null, $projekt_kurzbz=null, $projektphase_id=null, $projekttask_id=null, $uid=null, $person_id=null, $prestudent_id=null, $bestellung_id=null, $user=null, $lehreinheit_id=null, $stundenplandev_id=null, $anrechnung_id=null)
|
||||
{
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
public.tbl_notiz
|
||||
LEFT JOIN public.tbl_notizzuordnung USING(notiz_id)
|
||||
WHERE 1=1";
|
||||
|
||||
if(!is_null($erledigt))
|
||||
{
|
||||
if($erledigt)
|
||||
$qry.=" AND erledigt=true";
|
||||
else
|
||||
$qry.=" AND erledigt=false";
|
||||
}
|
||||
if($projekt_kurzbz!='')
|
||||
$qry.=" AND projekt_kurzbz=".$this->db_add_param($projekt_kurzbz);
|
||||
if($projektphase_id!='')
|
||||
$qry.=" AND projektphase_id=".$this->db_add_param($projektphase_id, FHC_INTEGER);
|
||||
if($projekttask_id!='')
|
||||
$qry.=" AND projekttask_id=".$this->db_add_param($projekttask_id, FHC_INTEGER);
|
||||
if($uid!='')
|
||||
$qry.=" AND uid=".$this->db_add_param($uid);
|
||||
if($person_id!='')
|
||||
$qry.=" AND person_id=".$this->db_add_param($person_id, FHC_INTEGER);
|
||||
if($prestudent_id!='')
|
||||
$qry.=" AND prestudent_id=".$this->db_add_param($prestudent_id, FHC_INTEGER);
|
||||
if($bestellung_id!='')
|
||||
$qry.=" AND bestellung_id=".$this->db_add_param($bestellung_id, FHC_INTEGER);
|
||||
if($user!='')
|
||||
$qry.=" AND (verfasser_uid=".$this->db_add_param($user)." OR bearbeiter_uid=".$this->db_add_param($user).")";
|
||||
if($lehreinheit_id!='')
|
||||
$qry.=" AND lehreinheit_id=".$this->db_add_param($lehreinheit_id, FHC_INTEGER);
|
||||
if($anrechnung_id!='')
|
||||
$qry.=" AND anrechnung_id=".$this->db_add_param($anrechnung_id, FHC_INTEGER);
|
||||
|
||||
$qry.=' ORDER BY start, ende, titel';
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new notiz();
|
||||
|
||||
$obj->notiz_id=$row->notiz_id;
|
||||
$obj->titel=$row->titel;
|
||||
$obj->text=$row->text;
|
||||
$obj->verfasser_uid=$row->verfasser_uid;
|
||||
$obj->bearbeiter_uid=$row->bearbeiter_uid;
|
||||
$obj->start=$row->start;
|
||||
$obj->ende=$row->ende;
|
||||
$obj->erledigt=$this->db_parse_bool($row->erledigt);
|
||||
$obj->insertamum=$row->insertamum;
|
||||
$obj->insertvon=$row->insertvon;
|
||||
$obj->updateamum=$row->updateamum;
|
||||
$obj->updatevon=$row->updatevon;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
*
|
||||
|
||||
* Laedt die Notizen
|
||||
* @param $erledigt
|
||||
* @param $projekt_kurzbz
|
||||
* @param $projektphase_id
|
||||
* @param $projekttask_id
|
||||
* @param $uid
|
||||
* @param $person_id
|
||||
* @param $prestudent_id
|
||||
* @param $bestellung_id
|
||||
* @param $user
|
||||
* @param $lehreinheit_id
|
||||
* @param $anrechnung_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function getAnzahlNotizen($erledigt=null, $projekt_kurzbz=null, $projektphase_id=null, $projekttask_id=null, $uid=null, $person_id=null, $prestudent_id=null, $bestellung_id=null, $user=null, $lehreinheit_id=null, $anrechnung_id=null)
|
||||
{
|
||||
$qry = "SELECT
|
||||
count(*) as anzahl
|
||||
FROM
|
||||
public.tbl_notiz
|
||||
LEFT JOIN public.tbl_notizzuordnung USING(notiz_id)
|
||||
WHERE 1=1";
|
||||
|
||||
if(!is_null($erledigt))
|
||||
{
|
||||
if($erledigt)
|
||||
$qry.=" AND erledigt=true";
|
||||
else
|
||||
$qry.=" AND erledigt=false";
|
||||
}
|
||||
if($projekt_kurzbz!='')
|
||||
$qry.=" AND projekt_kurzbz=".$this->db_add_param($projekt_kurzbz);
|
||||
if($projektphase_id!='')
|
||||
$qry.=" AND projektphase_id=".$this->db_add_param($projektphase_id, FHC_INTEGER);
|
||||
if($projekttask_id!='')
|
||||
$qry.=" AND projekttask_id=".$this->db_add_param($projekttask_id, FHC_INTEGER);
|
||||
if($uid!='')
|
||||
$qry.=" AND uid=".$this->db_add_param($uid);
|
||||
if($person_id!='')
|
||||
$qry.=" AND person_id=".$this->db_add_param($person_id, FHC_INTEGER);
|
||||
if($prestudent_id!='')
|
||||
$qry.=" AND prestudent_id=".$this->db_add_param($prestudent_id, FHC_INTEGER);
|
||||
if($bestellung_id!='')
|
||||
$qry.=" AND bestellung_id=".$this->db_add_param($bestellung_id, FHC_INTEGER);
|
||||
if($user!='')
|
||||
$qry.=" AND (verfasser_uid=".$this->db_add_param($user)." OR bearbeiter_uid=".$this->db_add_param($user).")";
|
||||
if($lehreinheit_id!='')
|
||||
$qry.=" AND lehreinheit_id=".$this->db_add_param($lehreinheit_id, FHC_INTEGER);
|
||||
if($anrechnung_id!='')
|
||||
$qry.=" AND anrechnung_id=".$this->db_add_param($anrechnung_id, FHC_INTEGER);
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
return $row->anzahl;
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
/* Copyright (C) 2011 FH 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: Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
|
||||
class notiz extends basis_db
|
||||
{
|
||||
public $new;
|
||||
public $result=array();
|
||||
|
||||
//Tabellenspalten
|
||||
public $notiz_id;
|
||||
public $titel;
|
||||
public $text;
|
||||
public $verfasser_uid;
|
||||
public $bearbeiter_uid;
|
||||
public $start;
|
||||
public $ende;
|
||||
public $erledigt;
|
||||
public $insertamum;
|
||||
public $insertvon;
|
||||
public $updateamum;
|
||||
public $updatevon;
|
||||
|
||||
public $projekt_kurzbz;
|
||||
public $projektphase_id;
|
||||
public $projekttask_id;
|
||||
public $uid;
|
||||
public $person_id;
|
||||
public $prestudent_id;
|
||||
public $bestellung_id;
|
||||
public $lehreinheit_id;
|
||||
public $anrechnung_id;
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
* @param $notiz_id
|
||||
*/
|
||||
public function __construct($notiz_id = null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if($notiz_id != null)
|
||||
$this->load($notiz_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt eine Notiz
|
||||
* @param $notiz_id
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function load($notiz_id)
|
||||
{
|
||||
if(!is_numeric($notiz_id))
|
||||
{
|
||||
$this->errormsg = 'NotizID ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SELECT * FROM public.tbl_notiz WHERE notiz_id=".$this->db_add_param($notiz_id, FHC_INTEGER);
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->notiz_id=$row->notiz_id;
|
||||
$this->titel=$row->titel;
|
||||
$this->text=$row->text;
|
||||
$this->verfasser_uid=$row->verfasser_uid;
|
||||
$this->bearbeiter_uid=$row->bearbeiter_uid;
|
||||
$this->start=$row->start;
|
||||
$this->ende=$row->ende;
|
||||
$this->erledigt=$this->db_parse_bool($row->erledigt);
|
||||
$this->insertamum=$row->insertamum;
|
||||
$this->insertvon=$row->insertvon;
|
||||
$this->updateamum=$row->updateamum;
|
||||
$this->updatevon=$row->updatevon;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Datensatz wurde nicht gefunden';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Löscht eine Notiz
|
||||
* @param $notiz_id
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function delete($notiz_id)
|
||||
{
|
||||
if(!is_numeric($notiz_id))
|
||||
{
|
||||
$this->errormsg = 'NotizID ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "Delete FROM public.tbl_notiz WHERE notiz_id=".$this->db_add_param($notiz_id, FHC_INTEGER);
|
||||
|
||||
if(!$this->db_query($qry))
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Loeschen der Daten';
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prueft die Daten vor dem Speichern
|
||||
* auf Gueltigkeit
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert den aktuellen Datensatz in die Datenbank
|
||||
* Wenn $neu auf true gesetzt ist wird ein neuer Datensatz angelegt
|
||||
* andernfalls wird der Datensatz mit der ID in $notiz_id aktualisiert
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function save($new=null)
|
||||
{
|
||||
if($new==null)
|
||||
$new=$this->new;
|
||||
|
||||
if(!$this->validate())
|
||||
return false;
|
||||
|
||||
if($new)
|
||||
{
|
||||
//Neuen Datensatz einfuegen
|
||||
$qry='BEGIN;INSERT INTO public.tbl_notiz (titel, text, verfasser_uid,
|
||||
bearbeiter_uid, start, ende, erledigt, insertamum, insertvon,
|
||||
updateamum, updatevon) VALUES('.
|
||||
$this->db_add_param($this->titel).', '.
|
||||
$this->db_add_param($this->text).', '.
|
||||
$this->db_add_param($this->verfasser_uid).','.
|
||||
$this->db_add_param($this->bearbeiter_uid).','.
|
||||
$this->db_add_param($this->start).','.
|
||||
$this->db_add_param($this->ende).','.
|
||||
$this->db_add_param($this->erledigt,FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->insertamum).','.
|
||||
$this->db_add_param($this->insertvon).','.
|
||||
$this->db_add_param($this->updateamum).','.
|
||||
$this->db_add_param($this->updatevon).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry='UPDATE public.tbl_notiz SET '.
|
||||
'titel='.$this->db_add_param($this->titel).', '.
|
||||
'text='.$this->db_add_param($this->text).', '.
|
||||
'verfasser_uid='.$this->db_add_param($this->verfasser_uid).', '.
|
||||
'bearbeiter_uid='.$this->db_add_param($this->bearbeiter_uid).', '.
|
||||
'start='.$this->db_add_param($this->start).', '.
|
||||
'ende='.$this->db_add_param($this->ende).', '.
|
||||
'erledigt='.$this->db_add_param($this->erledigt,FHC_BOOLEAN).', '.
|
||||
'updateamum='.$this->db_add_param($this->updateamum).', '.
|
||||
'updatevon='.$this->db_add_param($this->updatevon).' '.
|
||||
'WHERE notiz_id='.$this->db_add_param($this->notiz_id,FHC_INTEGER).';';
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($new)
|
||||
{
|
||||
$qry="SELECT currval('seq_notiz_notiz_id') as id;";
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$this->notiz_id = $row->id;
|
||||
$this->db_query('COMMIT;');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Lesen der Sequence';
|
||||
$this->db_query('ROLLBACK');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Lesen der Sequence';
|
||||
$this->db_query('ROLLBACK');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern des Datensatzes';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert die Zuordnung einer Notiz
|
||||
*
|
||||
*/
|
||||
public function saveZuordnung()
|
||||
{
|
||||
$qry = "INSERT INTO public.tbl_notizzuordnung(notiz_id, projekt_kurzbz, projektphase_id, projekttask_id,
|
||||
uid, person_id, prestudent_id, bestellung_id, lehreinheit_id, anrechnung_id) VALUES(".
|
||||
$this->db_add_param($this->notiz_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->projekt_kurzbz).','.
|
||||
$this->db_add_param($this->projektphase_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->projekttask_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->uid).','.
|
||||
$this->db_add_param($this->person_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->prestudent_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->bestellung_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->lehreinheit_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->anrechnung_id, FHC_INTEGER).');';
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Laedt die Notizen
|
||||
* @param $erledigt
|
||||
* @param $projekt_kurzbz
|
||||
* @param $projektphase_id
|
||||
* @param $projekttask_id
|
||||
* @param $uid
|
||||
* @param $person_id
|
||||
* @param $prestudent_id
|
||||
* @param $bestellung_id
|
||||
* @param $user
|
||||
* @param $lehreinheit_id
|
||||
* @param $anrechnung_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function getNotiz($erledigt=null, $projekt_kurzbz=null, $projektphase_id=null, $projekttask_id=null, $uid=null, $person_id=null, $prestudent_id=null, $bestellung_id=null, $user=null, $lehreinheit_id=null, $stundenplandev_id=null, $anrechnung_id=null)
|
||||
{
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
public.tbl_notiz
|
||||
LEFT JOIN public.tbl_notizzuordnung USING(notiz_id)
|
||||
WHERE 1=1";
|
||||
|
||||
if(!is_null($erledigt))
|
||||
{
|
||||
if($erledigt)
|
||||
$qry.=" AND erledigt=true";
|
||||
else
|
||||
$qry.=" AND erledigt=false";
|
||||
}
|
||||
if($projekt_kurzbz!='')
|
||||
$qry.=" AND projekt_kurzbz=".$this->db_add_param($projekt_kurzbz);
|
||||
if($projektphase_id!='')
|
||||
$qry.=" AND projektphase_id=".$this->db_add_param($projektphase_id, FHC_INTEGER);
|
||||
if($projekttask_id!='')
|
||||
$qry.=" AND projekttask_id=".$this->db_add_param($projekttask_id, FHC_INTEGER);
|
||||
if($uid!='')
|
||||
$qry.=" AND uid=".$this->db_add_param($uid);
|
||||
if($person_id!='')
|
||||
$qry.=" AND person_id=".$this->db_add_param($person_id, FHC_INTEGER);
|
||||
if($prestudent_id!='')
|
||||
$qry.=" AND prestudent_id=".$this->db_add_param($prestudent_id, FHC_INTEGER);
|
||||
if($bestellung_id!='')
|
||||
$qry.=" AND bestellung_id=".$this->db_add_param($bestellung_id, FHC_INTEGER);
|
||||
if($user!='')
|
||||
$qry.=" AND (verfasser_uid=".$this->db_add_param($user)." OR bearbeiter_uid=".$this->db_add_param($user).")";
|
||||
if($lehreinheit_id!='')
|
||||
$qry.=" AND lehreinheit_id=".$this->db_add_param($lehreinheit_id, FHC_INTEGER);
|
||||
if($anrechnung_id!='')
|
||||
$qry.=" AND anrechnung_id=".$this->db_add_param($anrechnung_id, FHC_INTEGER);
|
||||
|
||||
$qry.=' ORDER BY start, ende, titel';
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new notiz();
|
||||
|
||||
$obj->notiz_id=$row->notiz_id;
|
||||
$obj->titel=$row->titel;
|
||||
$obj->text=$row->text;
|
||||
$obj->verfasser_uid=$row->verfasser_uid;
|
||||
$obj->bearbeiter_uid=$row->bearbeiter_uid;
|
||||
$obj->start=$row->start;
|
||||
$obj->ende=$row->ende;
|
||||
$obj->erledigt=$this->db_parse_bool($row->erledigt);
|
||||
$obj->insertamum=$row->insertamum;
|
||||
$obj->insertvon=$row->insertvon;
|
||||
$obj->updateamum=$row->updateamum;
|
||||
$obj->updatevon=$row->updatevon;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Laedt die Notizen vom Bewerbungstool
|
||||
* @param $person_id int
|
||||
* @return boolean
|
||||
*/
|
||||
public function getBewerbungstoolNotizen($person_id)
|
||||
{
|
||||
$qry = 'SELECT
|
||||
*
|
||||
FROM
|
||||
public.tbl_notiz
|
||||
LEFT JOIN public.tbl_notizzuordnung USING(notiz_id)
|
||||
WHERE person_id = ' . $this->db_add_param($person_id, FHC_INTEGER) .
|
||||
' AND insertvon = ' . $this->db_add_param('Bewerbungstool') .
|
||||
' ORDER BY notiz_id';
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new notiz();
|
||||
|
||||
$obj->notiz_id=$row->notiz_id;
|
||||
$obj->titel=$row->titel;
|
||||
$obj->text=$row->text;
|
||||
$obj->verfasser_uid=$row->verfasser_uid;
|
||||
$obj->bearbeiter_uid=$row->bearbeiter_uid;
|
||||
$obj->start=$row->start;
|
||||
$obj->ende=$row->ende;
|
||||
$obj->erledigt=$this->db_parse_bool($row->erledigt);
|
||||
$obj->insertamum=$row->insertamum;
|
||||
$obj->insertvon=$row->insertvon;
|
||||
$obj->updateamum=$row->updateamum;
|
||||
$obj->updatevon=$row->updatevon;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
*
|
||||
|
||||
* Laedt die Notizen
|
||||
* @param $erledigt
|
||||
* @param $projekt_kurzbz
|
||||
* @param $projektphase_id
|
||||
* @param $projekttask_id
|
||||
* @param $uid
|
||||
* @param $person_id
|
||||
* @param $prestudent_id
|
||||
* @param $bestellung_id
|
||||
* @param $user
|
||||
* @param $lehreinheit_id
|
||||
* @param $anrechnung_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function getAnzahlNotizen($erledigt=null, $projekt_kurzbz=null, $projektphase_id=null, $projekttask_id=null, $uid=null, $person_id=null, $prestudent_id=null, $bestellung_id=null, $user=null, $lehreinheit_id=null, $anrechnung_id=null)
|
||||
{
|
||||
$qry = "SELECT
|
||||
count(*) as anzahl
|
||||
FROM
|
||||
public.tbl_notiz
|
||||
LEFT JOIN public.tbl_notizzuordnung USING(notiz_id)
|
||||
WHERE 1=1";
|
||||
|
||||
if(!is_null($erledigt))
|
||||
{
|
||||
if($erledigt)
|
||||
$qry.=" AND erledigt=true";
|
||||
else
|
||||
$qry.=" AND erledigt=false";
|
||||
}
|
||||
if($projekt_kurzbz!='')
|
||||
$qry.=" AND projekt_kurzbz=".$this->db_add_param($projekt_kurzbz);
|
||||
if($projektphase_id!='')
|
||||
$qry.=" AND projektphase_id=".$this->db_add_param($projektphase_id, FHC_INTEGER);
|
||||
if($projekttask_id!='')
|
||||
$qry.=" AND projekttask_id=".$this->db_add_param($projekttask_id, FHC_INTEGER);
|
||||
if($uid!='')
|
||||
$qry.=" AND uid=".$this->db_add_param($uid);
|
||||
if($person_id!='')
|
||||
$qry.=" AND person_id=".$this->db_add_param($person_id, FHC_INTEGER);
|
||||
if($prestudent_id!='')
|
||||
$qry.=" AND prestudent_id=".$this->db_add_param($prestudent_id, FHC_INTEGER);
|
||||
if($bestellung_id!='')
|
||||
$qry.=" AND bestellung_id=".$this->db_add_param($bestellung_id, FHC_INTEGER);
|
||||
if($user!='')
|
||||
$qry.=" AND (verfasser_uid=".$this->db_add_param($user)." OR bearbeiter_uid=".$this->db_add_param($user).")";
|
||||
if($lehreinheit_id!='')
|
||||
$qry.=" AND lehreinheit_id=".$this->db_add_param($lehreinheit_id, FHC_INTEGER);
|
||||
if($anrechnung_id!='')
|
||||
$qry.=" AND anrechnung_id=".$this->db_add_param($anrechnung_id, FHC_INTEGER);
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
return $row->anzahl;
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,8 +348,8 @@ class preinteressent extends basis_db
|
||||
public function loadFreigegebene($studiengang_kz, $studiensemester_kurzbz='')
|
||||
{
|
||||
$qry = "SELECT tbl_preinteressent.*, tbl_preinteressentstudiengang.* FROM public.tbl_preinteressent JOIN public.tbl_preinteressentstudiengang USING(preinteressent_id) JOIN public.tbl_person USING(person_id) WHERE
|
||||
(studiengang_kz, person_id) NOT IN (SELECT studiengang_kz, person_id FROM public.tbl_prestudent WHERE person_id=tbl_person.person_id) AND freigabedatum is not null AND
|
||||
tbl_preinteressentstudiengang.studiengang_kz=".$this->db_add_param($studiengang_kz, FHC_INTEGER);
|
||||
(studiengang_kz, person_id) NOT IN (SELECT studiengang_kz, person_id FROM public.tbl_prestudent JOIN public.tbl_prestudentstatus USING(prestudent_id) WHERE status_kurzbz='Interessent' AND studiensemester_kurzbz=tbl_preinteressent.studiensemester_kurzbz AND person_id=tbl_person.person_id) AND freigabedatum is not null AND
|
||||
tbl_preinteressentstudiengang.studiengang_kz=".$this->db_add_param($studiengang_kz, FHC_INTEGER)." AND tbl_preinteressentstudiengang.uebernahmedatum is null";
|
||||
if($studiensemester_kurzbz!='')
|
||||
$qry.=" AND tbl_preinteressent.studiensemester_kurzbz=".$this->db_add_param($studiensemester_kurzbz);
|
||||
|
||||
|
||||
@@ -445,6 +445,7 @@ class prestudent extends person
|
||||
$rolle->studienplan_bezeichnung = $row->studienplan_bezeichnung;
|
||||
$rolle->bestaetigtam = $row->bestaetigtam;
|
||||
$rolle->bestaetigtvon = $row->bestaetigtvon;
|
||||
$rolle->anmerkung_status = $row->anmerkung;
|
||||
$this->result[] = $rolle;
|
||||
}
|
||||
return true;
|
||||
@@ -1079,6 +1080,53 @@ class prestudent extends person
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt die eingetragenen ZGV zurück
|
||||
* @return array
|
||||
*/
|
||||
public function getZgv() {
|
||||
|
||||
$zgv = array(
|
||||
'bachelor' => array(),
|
||||
'master' => array(),
|
||||
// 'doktor' => array(),
|
||||
);
|
||||
$attribute = array(
|
||||
'art',
|
||||
'ort',
|
||||
'datum',
|
||||
);
|
||||
$db_attribute = array(
|
||||
'zgv_code',
|
||||
'zgvort',
|
||||
'zgvdatum',
|
||||
'zgvmas_code',
|
||||
'zgvmaort',
|
||||
'zgvmadatum',
|
||||
'zgvdoktor_code',
|
||||
'zgvdoktorort',
|
||||
'zgvdoktordatum',
|
||||
);
|
||||
|
||||
foreach($this->result as $prestudent) {
|
||||
|
||||
foreach($zgv as &$value) {
|
||||
|
||||
foreach($attribute as $attribut) {
|
||||
$db_attribute_name = current($db_attribute);
|
||||
|
||||
if($prestudent->$db_attribute_name) {
|
||||
$value[$attribut] = $prestudent->$db_attribute_name;
|
||||
}
|
||||
next($db_attribute);
|
||||
}
|
||||
}
|
||||
reset($db_attribute);
|
||||
}
|
||||
|
||||
return $zgv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert die Anzahl der Bewerber im ausgewaehlten Bereich
|
||||
* @param $studiensemester_kurzbz Studiensemester
|
||||
|
||||
@@ -1,214 +0,0 @@
|
||||
<?php
|
||||
session_start(); // this MUST be called prior to any output including whitespaces and line breaks!
|
||||
|
||||
$GLOBALS['ct_recipient'] = 'YOU@EXAMPLE.COM'; // Change to your email address!
|
||||
$GLOBALS['ct_msg_subject'] = 'Securimage Test Contact Form';
|
||||
|
||||
$GLOBALS['DEBUG_MODE'] = 1;
|
||||
// CHANGE TO 0 TO TURN OFF DEBUG MODE
|
||||
// IN DEBUG MODE, ONLY THE CAPTCHA CODE IS VALIDATED, AND NO EMAIL IS SENT
|
||||
|
||||
|
||||
// Process the form, if it was submitted
|
||||
process_si_contact_form();
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
<title>Securimage Example Form</title>
|
||||
<style type="text/css">
|
||||
<!--
|
||||
#success_message { border: 1px solid #000; width: 550px; text-align: left; padding: 10px 7px; background: #33ff33; color: #000; font-weight; bold; font-size: 1.2em; border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; }
|
||||
fieldset { width: 90%; }
|
||||
legend { font-size: 24px; }
|
||||
.note { font-size: 18px; }
|
||||
-->
|
||||
</style>
|
||||
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function reloadCaptcha()
|
||||
{
|
||||
document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random();
|
||||
}
|
||||
|
||||
function processForm()
|
||||
{
|
||||
new Ajax.Request('<?php echo $_SERVER['PHP_SELF'] ?>', {
|
||||
method: 'post',
|
||||
parameters: $('contact_form').serialize(),
|
||||
onSuccess: function(transport) {
|
||||
try {
|
||||
var r = transport.responseText.evalJSON();
|
||||
|
||||
if (r.error == 0) {
|
||||
$('success_message').show();
|
||||
$('contact_form').reset();
|
||||
reloadCaptcha();
|
||||
setTimeout("$('success_message').hide()", 30000);
|
||||
} else {
|
||||
alert("There was an error with your submission.\n\n" + r.message);
|
||||
}
|
||||
} catch(ex) {
|
||||
alert("There was an error parsing the json");
|
||||
}
|
||||
},
|
||||
onFailure: function(err) {
|
||||
alert("Ajax request failed");
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<fieldset>
|
||||
<legend>Example Form</legend>
|
||||
|
||||
<p class="note">
|
||||
This is an example PHP form that processes user information, checks for errors, and validates the captcha code.<br />
|
||||
This example form also demonstrates how to submit a form to itself to display error messages.
|
||||
</p>
|
||||
|
||||
<div id="success_message" style="display: none">Your message has been sent!<br />We will contact you as soon as possible.</div>
|
||||
|
||||
<form method="post" action="" id="contact_form" onsubmit="return processForm()">
|
||||
<input type="hidden" name="do" value="contact" />
|
||||
|
||||
<p>
|
||||
<strong>Name*:</strong><br />
|
||||
<input type="text" name="ct_name" size="35" value="" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Email*:</strong><br />
|
||||
<input type="text" name="ct_email" size="35" value="" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>URL:</strong><br />
|
||||
<input type="text" name="ct_URL" size="35" value="" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Message*:</strong><br />
|
||||
<textarea name="ct_message" rows="12" cols="60"></textarea>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<img id="siimage" style="border: 1px solid #000; margin-right: 15px" src="./securimage_show.php?sid=<?php echo md5(uniqid()) ?>" alt="CAPTCHA Image" align="left" />
|
||||
<object type="application/x-shockwave-flash" data="./securimage_play.swf?bgcol=#ffffff&icon_file=./images/audio_icon.png&audio_file=./securimage_play.php" height="32" width="32">
|
||||
<param name="movie" value="./securimage_play.swf?bgcol=#ffffff&icon_file=./images/audio_icon.png&audio_file=./securimage_play.php" />
|
||||
</object>
|
||||
|
||||
<a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false"><img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0" /></a><br />
|
||||
<strong>Enter Code*:</strong><br />
|
||||
<input type="text" name="ct_captcha" size="12" maxlength="8" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<br />
|
||||
<input type="submit" value="Submit Message" />
|
||||
</p>
|
||||
|
||||
</form>
|
||||
</fieldset>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
|
||||
// The form processor PHP code
|
||||
function process_si_contact_form()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST' && @$_POST['do'] == 'contact') {
|
||||
// if the form has been submitted
|
||||
|
||||
foreach($_POST as $key => $value) {
|
||||
if (!is_array($key)) {
|
||||
// sanitize the input data
|
||||
if ($key != 'ct_message') $value = strip_tags($value);
|
||||
$_POST[$key] = htmlspecialchars(stripslashes(trim($value)));
|
||||
}
|
||||
}
|
||||
|
||||
$name = @$_POST['ct_name']; // name from the form
|
||||
$email = @$_POST['ct_email']; // email from the form
|
||||
$URL = @$_POST['ct_URL']; // url from the form
|
||||
$message = @$_POST['ct_message']; // the message from the form
|
||||
$captcha = @$_POST['ct_captcha']; // the user's entry for the captcha code
|
||||
$name = substr($name, 0, 64); // limit name to 64 characters
|
||||
|
||||
$errors = array(); // initialize empty error array
|
||||
|
||||
if (isset($GLOBALS['DEBUG_MODE']) && $GLOBALS['DEBUG_MODE'] == false) {
|
||||
// only check for errors if the form is not in debug mode
|
||||
|
||||
if (strlen($name) < 3) {
|
||||
// name too short, add error
|
||||
$errors['name_error'] = 'Your name is required';
|
||||
}
|
||||
|
||||
if (strlen($email) == 0) {
|
||||
// no email address given
|
||||
$errors['email_error'] = 'Email address is required';
|
||||
} else if ( !preg_match('/^(?:[\w\d]+\.?)+@(?:(?:[\w\d]\-?)+\.)+\w{2,4}$/i', $email)) {
|
||||
// invalid email format
|
||||
$errors['email_error'] = 'Email address entered is invalid';
|
||||
}
|
||||
|
||||
if (strlen($message) < 20) {
|
||||
// message length too short
|
||||
$errors['message_error'] = 'Please enter a message';
|
||||
}
|
||||
}
|
||||
|
||||
// Only try to validate the captcha if the form has no errors
|
||||
// This is especially important for ajax calls
|
||||
if (sizeof($errors) == 0) {
|
||||
require_once dirname(__FILE__) . '/securimage.php';
|
||||
$securimage = new Securimage();
|
||||
|
||||
if ($securimage->check($captcha) == false) {
|
||||
$errors['captcha_error'] = 'Incorrect security code entered';
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($errors) == 0) {
|
||||
// no errors, send the form
|
||||
$time = date('r');
|
||||
$message = "A message was submitted from the contact form. The following information was provided.<br /><br />"
|
||||
. "Name: $name<br />"
|
||||
. "Email: $email<br />"
|
||||
. "URL: $URL<br />"
|
||||
. "Message:<br />"
|
||||
. "<pre>$message</pre>"
|
||||
. "<br /><br />IP Address: {$_SERVER['REMOTE_ADDR']}<br />"
|
||||
. "Time: $time<br />"
|
||||
. "Browser: {$_SERVER['HTTP_USER_AGENT']}<br />";
|
||||
|
||||
if (isset($GLOBALS['DEBUG_MODE']) && $GLOBALS['DEBUG_MODE'] == false) {
|
||||
// send the message with mail()
|
||||
mail($GLOBALS['ct_recipient'], $GLOBALS['ct_msg_subject'], $message, "From: {$GLOBALS['ct_recipient']}\r\nReply-To: {$email}\r\nContent-type: text/html; charset=ISO-8859-1\r\nMIME-Version: 1.0");
|
||||
}
|
||||
|
||||
$return = array('error' => 0, 'message' => 'OK');
|
||||
die(json_encode($return));
|
||||
} else {
|
||||
$errmsg = '';
|
||||
foreach($errors as $key => $error) {
|
||||
// set up error messages to display with each field
|
||||
$errmsg .= " - {$error}\n";
|
||||
}
|
||||
|
||||
$return = array('error' => 1, 'message' => $errmsg);
|
||||
die(json_encode($return));
|
||||
}
|
||||
} // POST
|
||||
} // function process_si_contact_form()
|
||||
@@ -1,192 +0,0 @@
|
||||
<?php
|
||||
session_start(); // this MUST be called prior to any output including whitespaces and line breaks!
|
||||
|
||||
$GLOBALS['DEBUG_MODE'] = 1;
|
||||
// CHANGE TO 0 TO TURN OFF DEBUG MODE
|
||||
// IN DEBUG MODE, ONLY THE CAPTCHA CODE IS VALIDATED, AND NO EMAIL IS SENT
|
||||
|
||||
$GLOBALS['ct_recipient'] = 'YOU@EXAMPLE.COM'; // Change to your email address!
|
||||
$GLOBALS['ct_msg_subject'] = 'Securimage Test Contact Form';
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
||||
<title>Securimage Example Form</title>
|
||||
<style type="text/css">
|
||||
<!--
|
||||
.error { color: #f00; font-weight: bold; font-size: 1.2em; }
|
||||
.success { color: #00f; font-weight: bold; font-size: 1.2em; }
|
||||
fieldset { width: 90%; }
|
||||
legend { font-size: 24px; }
|
||||
.note { font-size: 18px;
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<fieldset>
|
||||
<legend>Example Form</legend>
|
||||
|
||||
<p class="note">
|
||||
This is an example PHP form that processes user information, checks for errors, and validates the captcha code.<br />
|
||||
This example form also demonstrates how to submit a form to itself to display error messages.
|
||||
</p>
|
||||
|
||||
<?php
|
||||
|
||||
process_si_contact_form(); // Process the form, if it was submitted
|
||||
|
||||
if (isset($_SESSION['ctform']['error']) && $_SESSION['ctform']['error'] == true): /* The last form submission had 1 or more errors */ ?>
|
||||
<span class="error">There was a problem with your submission. Errors are displayed below in red.</span><br /><br />
|
||||
<?php elseif (isset($_SESSION['ctform']['success']) && $_SESSION['ctform']['success'] == true): /* form was processed successfully */ ?>
|
||||
<span class="success">The captcha was correct and the message has been sent!</span><br /><br />
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" action="<?php echo $_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING'] ?>" id="contact_form">
|
||||
<input type="hidden" name="do" value="contact" />
|
||||
|
||||
<p>
|
||||
<strong>Name*:</strong> <?php echo @$_SESSION['ctform']['name_error'] ?><br />
|
||||
<input type="text" name="ct_name" size="35" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_name']) ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Email*:</strong> <?php echo @$_SESSION['ctform']['email_error'] ?><br />
|
||||
<input type="text" name="ct_email" size="35" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_email']) ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>URL:</strong> <?php echo @$_SESSION['ctform']['URL_error'] ?><br />
|
||||
<input type="text" name="ct_URL" size="35" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_URL']) ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Message*:</strong> <?php echo @$_SESSION['ctform']['message_error'] ?><br />
|
||||
<textarea name="ct_message" rows="12" cols="60"><?php echo htmlspecialchars(@$_SESSION['ctform']['ct_message']) ?></textarea>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<img id="siimage" style="border: 1px solid #000; margin-right: 15px" src="./securimage_show.php?sid=<?php echo md5(uniqid()) ?>" alt="CAPTCHA Image" align="left" />
|
||||
<object type="application/x-shockwave-flash" data="./securimage_play.swf?bgcol=#ffffff&icon_file=./images/audio_icon.png&audio_file=./securimage_play.php" height="32" width="32">
|
||||
<param name="movie" value="./securimage_play.swf?bgcol=#ffffff&icon_file=./images/audio_icon.png&audio_file=./securimage_play.php" />
|
||||
</object>
|
||||
|
||||
<a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false"><img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0" /></a><br />
|
||||
<strong>Enter Code*:</strong><br />
|
||||
<?php echo @$_SESSION['ctform']['captcha_error'] ?>
|
||||
<input type="text" name="ct_captcha" size="12" maxlength="16" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<br />
|
||||
<input type="submit" value="Submit Message" />
|
||||
</p>
|
||||
|
||||
</form>
|
||||
</fieldset>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
|
||||
// The form processor PHP code
|
||||
function process_si_contact_form()
|
||||
{
|
||||
$_SESSION['ctform'] = array(); // re-initialize the form session data
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST' && @$_POST['do'] == 'contact') {
|
||||
// if the form has been submitted
|
||||
|
||||
foreach($_POST as $key => $value) {
|
||||
if (!is_array($key)) {
|
||||
// sanitize the input data
|
||||
if ($key != 'ct_message') $value = strip_tags($value);
|
||||
$_POST[$key] = htmlspecialchars(stripslashes(trim($value)));
|
||||
}
|
||||
}
|
||||
|
||||
$name = @$_POST['ct_name']; // name from the form
|
||||
$email = @$_POST['ct_email']; // email from the form
|
||||
$URL = @$_POST['ct_URL']; // url from the form
|
||||
$message = @$_POST['ct_message']; // the message from the form
|
||||
$captcha = @$_POST['ct_captcha']; // the user's entry for the captcha code
|
||||
$name = substr($name, 0, 64); // limit name to 64 characters
|
||||
|
||||
$errors = array(); // initialize empty error array
|
||||
|
||||
if (isset($GLOBALS['DEBUG_MODE']) && $GLOBALS['DEBUG_MODE'] == false) {
|
||||
// only check for errors if the form is not in debug mode
|
||||
|
||||
if (strlen($name) < 3) {
|
||||
// name too short, add error
|
||||
$errors['name_error'] = 'Your name is required';
|
||||
}
|
||||
|
||||
if (strlen($email) == 0) {
|
||||
// no email address given
|
||||
$errors['email_error'] = 'Email address is required';
|
||||
} else if ( !preg_match('/^(?:[\w\d]+\.?)+@(?:(?:[\w\d]\-?)+\.)+\w{2,4}$/i', $email)) {
|
||||
// invalid email format
|
||||
$errors['email_error'] = 'Email address entered is invalid';
|
||||
}
|
||||
|
||||
if (strlen($message) < 20) {
|
||||
// message length too short
|
||||
$errors['message_error'] = 'Please enter a message';
|
||||
}
|
||||
}
|
||||
|
||||
// Only try to validate the captcha if the form has no errors
|
||||
// This is especially important for ajax calls
|
||||
if (sizeof($errors) == 0) {
|
||||
require_once dirname(__FILE__) . '/securimage.php';
|
||||
$securimage = new Securimage();
|
||||
|
||||
if ($securimage->check($captcha) == false) {
|
||||
$errors['captcha_error'] = 'Incorrect security code entered<br />';
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($errors) == 0) {
|
||||
// no errors, send the form
|
||||
$time = date('r');
|
||||
$message = "A message was submitted from the contact form. The following information was provided.<br /><br />"
|
||||
. "Name: $name<br />"
|
||||
. "Email: $email<br />"
|
||||
. "URL: $URL<br />"
|
||||
. "Message:<br />"
|
||||
. "<pre>$message</pre>"
|
||||
. "<br /><br />IP Address: {$_SERVER['REMOTE_ADDR']}<br />"
|
||||
. "Time: $time<br />"
|
||||
. "Browser: {$_SERVER['HTTP_USER_AGENT']}<br />";
|
||||
|
||||
$message = wordwrap($message, 70);
|
||||
|
||||
if (isset($GLOBALS['DEBUG_MODE']) && $GLOBALS['DEBUG_MODE'] == false) {
|
||||
// send the message with mail()
|
||||
mail($GLOBALS['ct_recipient'], $GLOBALS['ct_msg_subject'], $message, "From: {$GLOBALS['ct_recipient']}\r\nReply-To: {$email}\r\nContent-type: text/html; charset=ISO-8859-1\r\nMIME-Version: 1.0");
|
||||
}
|
||||
|
||||
$_SESSION['ctform']['error'] = false; // no error with form
|
||||
$_SESSION['ctform']['success'] = true; // message sent
|
||||
} else {
|
||||
// save the entries, this is to re-populate the form
|
||||
$_SESSION['ctform']['ct_name'] = $name; // save name from the form submission
|
||||
$_SESSION['ctform']['ct_email'] = $email; // save email
|
||||
$_SESSION['ctform']['ct_URL'] = $URL; // save URL
|
||||
$_SESSION['ctform']['ct_message'] = $message; // save message
|
||||
|
||||
foreach($errors as $key => $error) {
|
||||
// set up error messages to display with each field
|
||||
$_SESSION['ctform'][$key] = "<span style=\"font-weight: bold; color: #f00\">$error</span>";
|
||||
}
|
||||
|
||||
$_SESSION['ctform']['error'] = true; // set error floag
|
||||
}
|
||||
} // POST
|
||||
}
|
||||
|
||||
$_SESSION['ctform']['success'] = false; // clear success value after running
|
||||
@@ -681,4 +681,33 @@ class studiengang extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $studiengaenge array
|
||||
* @return array|bool
|
||||
*/
|
||||
public function getTypes($studiengaenge) {
|
||||
|
||||
$qry = 'SELECT distinct typ ' .
|
||||
'FROM public.tbl_studiengang ' .
|
||||
'WHERE studiengang_kz IN (' . implode(',', $studiengaenge) . ')';
|
||||
|
||||
$types = array();
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result)) {
|
||||
|
||||
$types[] = $row->typ;
|
||||
|
||||
}
|
||||
|
||||
return $types;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = "Fehler bei der Abfrage aufgetreten";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1967,6 +1967,7 @@ class wochenplan extends basis_db
|
||||
return false;
|
||||
}
|
||||
$num_orte=$this->db_num_rows();
|
||||
$orte = array();
|
||||
for ($i=0;$i<$num_orte;$i++)
|
||||
{
|
||||
$row = $this->db_fetch_object(null, $i);
|
||||
@@ -2083,10 +2084,13 @@ class wochenplan extends basis_db
|
||||
//Kollision mit Gruppe
|
||||
if($raster[$t][$s]->kollision)
|
||||
{
|
||||
foreach ($this->std_plan[$t][$s][0]->frei_orte as $ort=>$value)
|
||||
if(isset($this->std_plan[$t][$s][0]->frei_orte))
|
||||
{
|
||||
if(in_array($ort, $orte))
|
||||
$this->std_plan[$t][$s][0]->frei_orte[$ort]=(isset($this->std_plan[$t][$s][0]->frei_orte[$ort])?$this->std_plan[$t][$s][0]->frei_orte[$ort]+1:1);
|
||||
foreach ($this->std_plan[$t][$s][0]->frei_orte as $ort=>$value)
|
||||
{
|
||||
if(in_array($ort, $orte))
|
||||
$this->std_plan[$t][$s][0]->frei_orte[$ort]=(isset($this->std_plan[$t][$s][0]->frei_orte[$ort])?$this->std_plan[$t][$s][0]->frei_orte[$ort]+1:1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2104,9 +2108,12 @@ class wochenplan extends basis_db
|
||||
}
|
||||
else
|
||||
{
|
||||
// Bei Gruppenkollision den Wert bei allen Raumen erhoehen
|
||||
foreach ($this->std_plan[$t][$s][0]->frei_orte as $ort=>$value)
|
||||
$this->std_plan[$t][$s][0]->frei_orte[$ort]=(isset($this->std_plan[$t][$s][0]->frei_orte[$ort])?$this->std_plan[$t][$s][0]->frei_orte[$ort]+1:1);
|
||||
if(isset($this->std_plan[$t][$s][0]->frei_orte))
|
||||
{
|
||||
// Bei Gruppenkollision den Wert bei allen Raumen erhoehen
|
||||
foreach ($this->std_plan[$t][$s][0]->frei_orte as $ort=>$value)
|
||||
$this->std_plan[$t][$s][0]->frei_orte[$ort]=(isset($this->std_plan[$t][$s][0]->frei_orte[$ort])?$this->std_plan[$t][$s][0]->frei_orte[$ort]+1:1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user