mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-21 00:42:15 +00:00
Merge branch 'master' into feature-15029/Docsbox
This commit is contained in:
@@ -53,6 +53,7 @@ class adresse extends basis_db
|
||||
public $rechnungsadresse=false; // boolean
|
||||
public $anmerkung; // string
|
||||
public $co_name;
|
||||
public $bezeichnung_mehrsprachig;
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
@@ -133,10 +134,10 @@ class adresse extends basis_db
|
||||
$this->errormsg = 'person_id muss eine gültige Zahl sein';
|
||||
return false;
|
||||
}
|
||||
|
||||
$sprache = new sprache();
|
||||
//Lesen der Daten aus der Datenbank
|
||||
$qry = "SELECT * FROM public.tbl_adresse WHERE person_id=".$this->db_add_param($pers_id, FHC_INTEGER, false);
|
||||
$qry.=" ORDER BY zustelladresse DESC";
|
||||
$qry = "SELECT *, ". $sprache->getSprachQuery('bezeichnung_mehrsprachig') ." FROM public.tbl_adresse JOIN public.tbl_adressentyp ON typ = adressentyp_kurzbz WHERE person_id=".$this->db_add_param($pers_id, FHC_INTEGER, false);
|
||||
$qry.=" ORDER BY zustelladresse DESC, sort";
|
||||
|
||||
if(!$this->db_query($qry))
|
||||
{
|
||||
@@ -167,6 +168,7 @@ class adresse extends basis_db
|
||||
$adr_obj->co_name = $row->co_name;
|
||||
$adr_obj->rechnungsadresse = $this->db_parse_bool($row->rechnungsadresse);
|
||||
$adr_obj->anmerkung = $row->anmerkung;
|
||||
$adr_obj->bezeichnung_mehrsprachig = $sprache->parseSprachResult('bezeichnung_mehrsprachig',$row);
|
||||
|
||||
$this->result[] = $adr_obj;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__) . '/basis_db.class.php');
|
||||
|
||||
class adressentyp extends basis_db {
|
||||
|
||||
public $result = array();
|
||||
public $adressentyp;
|
||||
public $bezeichnung;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
$qry = "SELECT * FROM public.tbl_adressentyp ORDER BY sort";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$obj = new adressentyp();
|
||||
|
||||
$obj->adressentyp = $row->adressentyp_kurzbz;
|
||||
$obj->bezeichnung = $row->bezeichnung;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -309,6 +309,10 @@ class benutzer extends person
|
||||
*/
|
||||
public function search($searchItems, $limit=null, $aktiv=true, $positivePersonalnr=false)
|
||||
{
|
||||
// SearchItems imploden und trimmen, um preg_split(Zeichenweise trennung) durchfuehren zu koennen
|
||||
$searchItems_string_orig = implode(' ', $searchItems);
|
||||
$searchItems_string = generateSpecialCharacterString($searchItems_string_orig);
|
||||
|
||||
$qry = "SELECT * FROM (
|
||||
SELECT
|
||||
distinct on (uid) vorname, nachname, uid, mitarbeiter_uid, personalnummer, titelpre, titelpost, lektor, fixangestellt, alias, tbl_benutzer.aktiv, anrede,
|
||||
@@ -350,8 +354,8 @@ class benutzer extends person
|
||||
if($positivePersonalnr === true)
|
||||
$qry.=" (personalnummer >= 0 OR personalnummer IS NULL) AND";
|
||||
|
||||
$qry.=" (lower(vorname || ' ' || nachname) like lower('%".$this->db_escape(implode(' ',$searchItems))."%')";
|
||||
$qry.=" OR lower(nachname || ' ' || vorname) like lower('%".$this->db_escape(implode(' ',$searchItems))."%')";
|
||||
$qry.=" (lower(vorname || ' ' || nachname) ~* lower(".$this->db_add_param($searchItems_string).")";
|
||||
$qry.=" OR lower(nachname || ' ' || vorname) ~* lower(".$this->db_add_param($searchItems_string).")";
|
||||
$qry.=" OR lower(uid) like lower('%".$this->db_escape(implode(' ',$searchItems))."%')";
|
||||
$qry.=" OR lower(telefonklappe) like lower('%".$this->db_escape(implode(' ',$searchItems))."%')";
|
||||
|
||||
|
||||
@@ -1186,7 +1186,22 @@ class betriebsmittel extends basis_db
|
||||
//Kartennummern die im Hex-Format sind werden umgewandelt
|
||||
if (!is_numeric($kartennummer))
|
||||
{
|
||||
$kartennummer=substr($kartennummer,strlen($kartennummer)-2,2).substr($kartennummer,strlen($kartennummer)-4,2). substr($kartennummer,strlen($kartennummer)-6,2).substr($kartennummer,0,2);
|
||||
$tmp_kn_str = null;
|
||||
for ($i=0; strlen($kartennummer) > $i; $i+=2) {
|
||||
|
||||
#wenn die strlen($kartennummer) gerade ist (TW hat 8 Stellen, FHB 14 Stellen)
|
||||
$tmp_kn_str .= substr($kartennummer,strlen($kartennummer)-($i+2),2);
|
||||
|
||||
//#wenn ich ungerade und der letzte Durchgang ist dann nur mehr die eine Nummer nach vorne
|
||||
//if ((strlen($kartennummer)%2 != 0) && ($i+2 > strlen($kartennummer))) {
|
||||
// $tmp_kn_str .= substr($kartennummer,strlen($kartennummer)-($i+1),1);
|
||||
//#sonst normal immer 2 stellen nach vorne ruecken
|
||||
//} else {
|
||||
// $tmp_kn_str .= substr($kartennummer,strlen($kartennummer)-($i+2),2);
|
||||
//}
|
||||
}
|
||||
$kartennummer = $tmp_kn_str;
|
||||
|
||||
$kartennummer=hexdec( $kartennummer);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class bisverwendung extends basis_db
|
||||
public $inkludierte_lehre;
|
||||
public $zeitaufzeichnungspflichtig;
|
||||
public $azgrelevant;
|
||||
public $homeoffice;
|
||||
public $homeoffice=false;
|
||||
|
||||
public $ba1bez;
|
||||
public $ba2bez;
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 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: Harald Bamberger <harald.bamberger@technikum-wien.at>
|
||||
*/
|
||||
require_once(dirname(__DIR__) . '/basis_db.class.php');
|
||||
/**
|
||||
* Description of covidhelper
|
||||
*
|
||||
* @author bambi
|
||||
*/
|
||||
class CovidHelper extends basis_db
|
||||
{
|
||||
const STATUS_OK = 1;
|
||||
const STATUS_NOTOK = 0;
|
||||
const STATUS_UNKNOWN = -1;
|
||||
const STATUS_NOTSET = -2;
|
||||
|
||||
const TITLE_OK = 'Nachweis gültig';
|
||||
const TITLE_NOTOK = 'Nachweis ungültig';
|
||||
const TITLE_UNKNOWN = 'Nachweis unbekannt';
|
||||
|
||||
const DB_SCHEMA = 'public';
|
||||
const DB_TABLE = 'tbl_person';
|
||||
const DB_UDFNAME = 'udf_3gvalid';
|
||||
|
||||
protected $isUdfDefined;
|
||||
|
||||
protected $uids;
|
||||
protected $covidstatus;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->uids = array();
|
||||
$this->covidstatus = array();
|
||||
$this->isUdfDefined = false;
|
||||
$this->checkIfUdfValuesAreDefined();
|
||||
}
|
||||
|
||||
public function isUdfDefined()
|
||||
{
|
||||
return $this->isUdfDefined;
|
||||
}
|
||||
|
||||
public function fetchCovidStatus(array $uids)
|
||||
{
|
||||
$this->uids = $uids;
|
||||
$this->covidstatus = array();
|
||||
$this->fetchCovidValidStatus();
|
||||
}
|
||||
|
||||
public function getIconHtml($uid)
|
||||
{
|
||||
$html = '';
|
||||
$status = isset($this->covidstatus[$uid]) ? $this->covidstatus[$uid] : self::STATUS_NOTSET;
|
||||
switch ($status)
|
||||
{
|
||||
case self::STATUS_OK:
|
||||
$html = '<i title="' . $this->getTitle($uid) . '" class="fa fa-check-circle" aria-hidden="true" style="color: green; margin-right: .5em;"></i>';
|
||||
break;
|
||||
case self::STATUS_NOTOK:
|
||||
case self::STATUS_UNKNOWN:
|
||||
$html = '<i title="' . $this->getTitle($uid) . '" class="fa fa-times-circle" aria-hidden="true" style="color: red; margin-right: .5em;"></i>';
|
||||
break;
|
||||
/*
|
||||
case self::STATUS_UNKNOWN:
|
||||
$html = '<i title="' . $this->getTitle($uid) . '" class="fa fa-question-circle" aria-hidden="true" style="color: grey; margin-right: .5em;"></i>';
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
$html = '';
|
||||
break;
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function getBootstrapClass($uid)
|
||||
{
|
||||
$class = '';
|
||||
$status = isset($this->covidstatus[$uid]) ? $this->covidstatus[$uid] : self::STATUS_NOTSET;
|
||||
switch ($status)
|
||||
{
|
||||
case self::STATUS_OK:
|
||||
$class = 'success';
|
||||
break;
|
||||
case self::STATUS_NOTOK:
|
||||
case self::STATUS_UNKNOWN:
|
||||
$class = 'danger';
|
||||
break;
|
||||
/*
|
||||
case self::STATUS_UNKNOWN:
|
||||
$class = 'warning';
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
$class = '';
|
||||
break;
|
||||
}
|
||||
return $class;
|
||||
}
|
||||
|
||||
public function getTitle($uid)
|
||||
{
|
||||
$title = '';
|
||||
$status = isset($this->covidstatus[$uid]) ? $this->covidstatus[$uid] : self::STATUS_NOTSET;
|
||||
switch ($status)
|
||||
{
|
||||
case self::STATUS_OK:
|
||||
$title = self::TITLE_OK;
|
||||
break;
|
||||
case self::STATUS_NOTOK:
|
||||
case self::STATUS_UNKNOWN:
|
||||
$title = self::TITLE_NOTOK;
|
||||
break;
|
||||
/*
|
||||
case self::STATUS_UNKNOWN:
|
||||
$title = self::TITLE_UNKNOWN;
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
$title = '';
|
||||
break;
|
||||
}
|
||||
return $title;
|
||||
}
|
||||
|
||||
public function getCovidStatus()
|
||||
{
|
||||
return $this->covidstatus;
|
||||
}
|
||||
|
||||
protected function fetchCovidValidStatus()
|
||||
{
|
||||
if( !($this->isUdfDefined && is_array($this->uids) && (count($this->uids) > 0)) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
$sql = <<<EOSQL
|
||||
SELECT b.uid, CASE
|
||||
WHEN (p."udf_values" -> 'udf_3gvalid')::text::date >= CURRENT_DATE::text::date THEN 1
|
||||
WHEN (p."udf_values" -> 'udf_3gvalid')::text::date < CURRENT_DATE::text::date THEN 0
|
||||
ELSE -1
|
||||
END AS covidvalid
|
||||
FROM tbl_person p
|
||||
JOIN tbl_benutzer b ON b.person_id = p.person_id AND b.uid IN ({$this->implode4SQL($this->uids)})
|
||||
EOSQL;
|
||||
|
||||
$this->covidstatus = array();
|
||||
if( $this->db_query($sql) )
|
||||
{
|
||||
while( false !== ($row = $this->db_fetch_object()) )
|
||||
{
|
||||
$this->covidstatus[$row->uid] = $row->covidvalid;
|
||||
}
|
||||
} else {
|
||||
$this->errormsg = "Fehler in der Abfrage des Covidstatus.";
|
||||
}
|
||||
}
|
||||
|
||||
public function checkIfUdfValuesAreDefined()
|
||||
{
|
||||
$sql = 'SELECT count(name) AS "udfdefined" '
|
||||
. 'FROM "system"."tbl_udf", jsonb_to_recordset("jsons") AS items(name text) '
|
||||
. 'WHERE "schema" = \'' . self::DB_SCHEMA . '\' '
|
||||
. 'AND "table" = \'' . self::DB_TABLE . '\' '
|
||||
. 'AND "name" = \'' . self::DB_UDFNAME . '\'';
|
||||
if ( $this->db_query($sql) )
|
||||
{
|
||||
if ($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->isUdfDefined = ($row->udfdefined > 0) ? true : false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = "Fehler in der Abfrage beim Pruefen der UDFs. Kein Datensatz gefunden.";
|
||||
$this->isUdfDefined = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = "Fehler in der Abfrage beim Pruefen der UDFs.";
|
||||
$this->isUdfDefined = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
-28
@@ -455,42 +455,50 @@ function intersect($str1, $str2)
|
||||
* Konvertiert Problematische Sonderzeichen in Strings fuer
|
||||
* Accountnamen und EMail-Aliase
|
||||
*
|
||||
* @param $str
|
||||
* @return bereinigter String
|
||||
* @param string $str Inputparameter.
|
||||
* @return string bereinigter String.
|
||||
*/
|
||||
function convertProblemChars($str)
|
||||
{
|
||||
$enc = 'UTF-8';
|
||||
|
||||
$acentos = array(
|
||||
'A' => '/À|Á|Â|Ã|Å/',
|
||||
'Ae' => '/Ä/',
|
||||
'a' => '/à|á|â|ã|å/',
|
||||
'ae'=> '/ä/',
|
||||
'C' => '/Ç/',
|
||||
'c' => '/ç/',
|
||||
'E' => '/È|É|Ê|Ë/',
|
||||
'e' => '/è|é|ê|ë/',
|
||||
'I' => '/Ì|Í|Î|Ï/',
|
||||
'i' => '/ì|í|î|ï/',
|
||||
'N' => '/Ñ/',
|
||||
'n' => '/ñ/',
|
||||
'O' => '/Ò|Ó|Ô|Õ/',
|
||||
'Oe' => '/Ö/',
|
||||
'o' => '/ò|ó|ô|õ/',
|
||||
'oe' => '/ö/',
|
||||
'U' => '/Ù|Ú|Û/',
|
||||
'Ue' => '/Ü/',
|
||||
'u' => '/ù|ú|û/',
|
||||
'ue' => '/ü/',
|
||||
'Y' => '/Ý/',
|
||||
'y' => '/ý|ÿ/',
|
||||
'a.' => '/ª/',
|
||||
'o.' => '/º/',
|
||||
'ss' => '/ß/'
|
||||
'A' => '/À|Á|Â|Ã|Å|Ă|Ǎ/',
|
||||
'Ae' => '/Ä/',
|
||||
'a' => '/à|á|â|ã|å|ă|ǎ/',
|
||||
'ae' => '/ä/',
|
||||
'C' => '/Ç|Č/',
|
||||
'c' => '/ç|č/',
|
||||
'E' => '/È|É|Ê|Ë/',
|
||||
'e' => '/è|é|ê|ë/',
|
||||
'I' => '/Ì|Í|Î|Ï|Ǐ/',
|
||||
'i' => '/ì|í|î|ï|ǐ/',
|
||||
'N' => '/Ñ|Ň|ň/',
|
||||
'n' => '/ñ/',
|
||||
'O' => '/Ò|Ó|Ô|Õ|Ǒ/',
|
||||
'Oe' => '/Ö/',
|
||||
'o' => '/ò|ó|ô|õ|ǒ/',
|
||||
'oe' => '/ö/',
|
||||
'R' => '/Ř/',
|
||||
'r' => '/ř/',
|
||||
'S' => '/Š/',
|
||||
's' => '/š/',
|
||||
'T' => '/Ť/',
|
||||
't' => '/ť/',
|
||||
'U' => '/Ù|Ú|Û|Ŭ|Ǔ/',
|
||||
'Ue' => '/Ü/',
|
||||
'u' => '/ù|ú|û|ŭ|ǔ/',
|
||||
'ue' => '/ü/',
|
||||
'Y' => '/Ý/',
|
||||
'y' => '/ý|ÿ/',
|
||||
'Z' => '/Ž/',
|
||||
'z' => '/ž/',
|
||||
'a.' => '/ª/',
|
||||
'o.' => '/º/',
|
||||
'ss' => '/ß/'
|
||||
);
|
||||
|
||||
return preg_replace($acentos, array_keys($acentos), htmlentities($str,ENT_NOQUOTES, $enc));
|
||||
return preg_replace($acentos, array_keys($acentos), htmlentities($str, ENT_NOQUOTES | ENT_HTML5, $enc));
|
||||
}
|
||||
|
||||
//Ersetzt alle Problemzeichen in einem String bevor dieser als xml oder rdf ausgegeben wird
|
||||
|
||||
@@ -713,7 +713,7 @@ class konto extends basis_db
|
||||
$qry = "select sum(betrag) as betrag from public.tbl_konto
|
||||
join public.tbl_benutzer benutzer using(person_id)
|
||||
where uid=".$this->db_add_param($uid)." and studiensemester_kurzbz = ".$this->db_add_param($stsem)."
|
||||
and buchungstyp_kurzbz = 'Studiengebuehr' and betrag > 0";
|
||||
and buchungstyp_kurzbz in('Studiengebuehr','StudiengebuehrAnzahlung','StudiengebuehrRestzahlung') and betrag > 0";
|
||||
if($studiengang_kz!= null)
|
||||
$qry.=" and studiengang_kz = ".$this->db_add_param($studiengang_kz, FHC_INTEGER).";";
|
||||
|
||||
|
||||
@@ -0,0 +1,294 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 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: Harald Bamberger <harald.bamberger@technikum-wien.at>
|
||||
* Manfred Kindl <manfred.kindl@technikum-wien.at>
|
||||
*/
|
||||
require_once('../../../config/cis.config.inc.php');
|
||||
require_once('../../../include/lehrveranstaltung.class.php');
|
||||
require_once('../../../include/lehreinheitgruppe.class.php');
|
||||
require_once('../../../include/lehreinheit.class.php');
|
||||
require_once('../../../include/benutzerberechtigung.class.php');
|
||||
require_once('../../../include/lehreinheitmitarbeiter.class.php');
|
||||
require_once('../../../include/studiensemester.class.php');
|
||||
require_once('../../../include/functions.inc.php');
|
||||
require_once('../../../include/erhalter.class.php');
|
||||
require_once('../../../include/datum.class.php');
|
||||
/**
|
||||
* Description of lehrelisthelper
|
||||
*
|
||||
* @author bambi
|
||||
*/
|
||||
class LehreListHelper
|
||||
{
|
||||
protected $db;
|
||||
protected $studiensemester;
|
||||
protected $lvid;
|
||||
protected $lv;
|
||||
protected $lehreinheit;
|
||||
protected $stg;
|
||||
|
||||
protected $arr_lehrende;
|
||||
protected $studentuids;
|
||||
protected $data;
|
||||
|
||||
protected $gruppen_string;
|
||||
protected $lehrende_string;
|
||||
protected $raum_string;
|
||||
|
||||
public function __construct(basis_db $db, $studiensemester, $lvid,
|
||||
lehrveranstaltung $lv, studiengang $stg, $lehreinheit='')
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->studiensemester = $studiensemester;
|
||||
$this->lvid = $lvid;
|
||||
$this->lv = $lv;
|
||||
$this->lehreinheit = $lehreinheit;
|
||||
$this->stg = $stg;
|
||||
|
||||
$this->arr_lehrende = array();
|
||||
$this->studentuids = array();
|
||||
$this->data = array();
|
||||
|
||||
$this->gruppen_string = '';
|
||||
$this->lehrende_string = '';
|
||||
$this->raum_string = '';
|
||||
|
||||
$this->loadMemberGroups();
|
||||
$this->loadPlannedRooms();
|
||||
$this->initData();
|
||||
$this->loadLehrende();
|
||||
$this->loadStudierende();
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function getStudentUids()
|
||||
{
|
||||
return $this->studentuids;
|
||||
}
|
||||
|
||||
public function getArr_Lehrende()
|
||||
{
|
||||
return $this->arr_lehrende;
|
||||
}
|
||||
|
||||
public function getLehrende_String()
|
||||
{
|
||||
return $this->lehrende_string;
|
||||
}
|
||||
|
||||
protected function loadMemberGroups()
|
||||
{
|
||||
// Teilnehmende Gruppen laden
|
||||
$qry = "SELECT DISTINCT ON(kuerzel, semester, verband, gruppe, gruppe_kurzbz)
|
||||
UPPER(stg_typ::varchar(1) || stg_kurzbz) as kuerzel,
|
||||
semester,
|
||||
verband,
|
||||
gruppe,
|
||||
gruppe_kurzbz
|
||||
FROM campus.vw_lehreinheit
|
||||
WHERE lehrveranstaltung_id=".$this->db->db_add_param($this->lvid, FHC_INTEGER)."
|
||||
AND studiensemester_kurzbz=".$this->db->db_add_param($this->studiensemester);
|
||||
if($this->lehreinheit!='')
|
||||
$qry.=" AND lehreinheit_id=".$this->db->db_add_param($this->lehreinheit, FHC_INTEGER);
|
||||
|
||||
$this->gruppen_string = '';
|
||||
if($result = $this->db->db_query($qry))
|
||||
{
|
||||
while($row = $this->db->db_fetch_object($result))
|
||||
{
|
||||
if($this->gruppen_string!='')
|
||||
$this->gruppen_string.=', ';
|
||||
if($row->gruppe_kurzbz=='')
|
||||
$this->gruppen_string.=trim($row->kuerzel.'-'.$row->semester.$row->verband.$row->gruppe);
|
||||
else
|
||||
$this->gruppen_string.=$row->gruppe_kurzbz;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function loadPlannedRooms()
|
||||
{
|
||||
// Verplante Räume laden
|
||||
$qry = "SELECT distinct(ort_kurzbz)
|
||||
FROM lehre.tbl_stundenplan
|
||||
WHERE lehreinheit_id in
|
||||
(
|
||||
SELECT lehreinheit_id
|
||||
FROM campus.vw_lehreinheit
|
||||
WHERE lehrveranstaltung_id = ".$this->db->db_add_param($this->lvid, FHC_INTEGER)."
|
||||
AND studiensemester_kurzbz = ".$this->db->db_add_param($this->studiensemester)."
|
||||
)";
|
||||
if($this->lehreinheit!='')
|
||||
$qry.= " AND tbl_stundenplan.lehreinheit_id = ".$this->db->db_add_param($this->lehreinheit, FHC_INTEGER);
|
||||
|
||||
|
||||
$this->raum_string = '';
|
||||
if($result = $this->db->db_query($qry))
|
||||
{
|
||||
while($row = $this->db->db_fetch_object($result))
|
||||
{
|
||||
if($this->raum_string!='')
|
||||
$this->raum_string.=', ';
|
||||
if($row->ort_kurzbz!='')
|
||||
$this->raum_string.=$row->ort_kurzbz;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function initData()
|
||||
{
|
||||
$studiengang_bezeichnung=$this->stg->bezeichnung;
|
||||
|
||||
$this->stg->getAllTypes();
|
||||
|
||||
$this->data = array(
|
||||
'gruppen'=>$this->gruppen_string,
|
||||
'bezeichnung'=>$this->lv->bezeichnung,
|
||||
'lehrveranstaltung_id'=>$this->lv->lehrveranstaltung_id,
|
||||
'studiengang'=>$studiengang_bezeichnung,
|
||||
'studiengang_kz'=>$this->lv->studiengang_kz,
|
||||
'typ'=>$this->stg->studiengang_typ_arr[$this->stg->typ],
|
||||
'ects'=>$this->lv->ects,
|
||||
'sprache'=>$this->lv->sprache,
|
||||
'studiensemester'=>$this->studiensemester,
|
||||
'semester'=>$this->lv->semester,
|
||||
'orgform'=>$this->lv->orgform_kurzbz,
|
||||
'raum'=>$this->raum_string,
|
||||
);
|
||||
}
|
||||
|
||||
protected function loadLehrende()
|
||||
{
|
||||
//Lehrende der LV laden und in ein Array schreiben
|
||||
$lehrende = new lehreinheitmitarbeiter();
|
||||
$lehrende->getMitarbeiterLV($this->lvid, $this->studiensemester, $this->lehreinheit);
|
||||
$this->arr_lehrende = array();
|
||||
if (isset($lehrende->result))
|
||||
{
|
||||
foreach($lehrende->result AS $row)
|
||||
{
|
||||
$this->data[]=array('lehrende'=>array('uid'=>$row->uid,'name'=>$row->vorname.' '.$row->nachname));
|
||||
$this->arr_lehrende[]=mb_strtoupper($row->uid);
|
||||
$this->lehrende_string .= (strlen($this->lehrende_string) > 0)
|
||||
? ', ' . $row->vorname . ' ' . $row->nachname
|
||||
: $row->vorname . ' ' . $row->nachname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function loadStudierende()
|
||||
{
|
||||
//Studierende der LV laden und in ein Array schreiben
|
||||
|
||||
$qry = 'SELECT
|
||||
distinct on(nachname, vorname, person_id) vorname, nachname, matrikelnr, public.tbl_student.student_uid,
|
||||
tbl_studentlehrverband.semester, tbl_studentlehrverband.verband, tbl_studentlehrverband.gruppe,
|
||||
(SELECT status_kurzbz FROM public.tbl_prestudentstatus WHERE prestudent_id=tbl_student.prestudent_id ORDER BY datum DESC, insertamum DESC, ext_id DESC LIMIT 1) as status,
|
||||
tbl_bisio.bisio_id, tbl_bisio.von, tbl_bisio.bis, tbl_student.studiengang_kz AS stg_kz_student,
|
||||
tbl_note.lkt_ueberschreibbar, tbl_note.anmerkung, tbl_mitarbeiter.mitarbeiter_uid, tbl_person.matr_nr, tbl_studiengang.kurzbzlang, tbl_mobilitaet.mobilitaetstyp_kurzbz,
|
||||
(CASE WHEN bis.tbl_mobilitaet.studiensemester_kurzbz = vw_student_lehrveranstaltung.studiensemester_kurzbz THEN 1 ELSE 0 END) as doubledegree
|
||||
FROM
|
||||
campus.vw_student_lehrveranstaltung
|
||||
JOIN public.tbl_benutzer USING(uid)
|
||||
JOIN public.tbl_person USING(person_id) LEFT JOIN public.tbl_student ON(uid=student_uid)
|
||||
LEFT JOIN public.tbl_mitarbeiter ON(uid=mitarbeiter_uid)
|
||||
LEFT JOIN public.tbl_studentlehrverband USING(student_uid,studiensemester_kurzbz)
|
||||
LEFT JOIN lehre.tbl_zeugnisnote on(vw_student_lehrveranstaltung.lehrveranstaltung_id=tbl_zeugnisnote.lehrveranstaltung_id AND tbl_zeugnisnote.student_uid=tbl_student.student_uid AND tbl_zeugnisnote.studiensemester_kurzbz=tbl_studentlehrverband.studiensemester_kurzbz)
|
||||
LEFT JOIN lehre.tbl_note USING (note)
|
||||
LEFT JOIN bis.tbl_bisio ON(uid=tbl_bisio.student_uid)
|
||||
LEFT JOIN public.tbl_studiengang ON(tbl_student.studiengang_kz=tbl_studiengang.studiengang_kz)
|
||||
LEFT JOIN bis.tbl_mobilitaet USING(prestudent_id)
|
||||
WHERE
|
||||
vw_student_lehrveranstaltung.lehrveranstaltung_id='.$this->db->db_add_param($this->lvid, FHC_INTEGER).' AND
|
||||
vw_student_lehrveranstaltung.studiensemester_kurzbz='.$this->db->db_add_param($this->studiensemester);
|
||||
|
||||
|
||||
if($this->lehreinheit!='')
|
||||
$qry.=' AND vw_student_lehrveranstaltung.lehreinheit_id='.$this->db->db_add_param($this->lehreinheit, FHC_INTEGER);
|
||||
|
||||
$qry.=' ORDER BY nachname, vorname, person_id, tbl_bisio.bis, doubledegree DESC';
|
||||
|
||||
$stsem_obj = new studiensemester();
|
||||
$stsem_obj->load($this->studiensemester);
|
||||
$stsemdatumvon = $stsem_obj->start;
|
||||
$stsemdatumbis = $stsem_obj->ende;
|
||||
|
||||
$erhalter = new erhalter();
|
||||
$erhalter->getAll();
|
||||
|
||||
$a_o_kz = '9'.sprintf("%03s", $erhalter->result[0]->erhalter_kz); //Stg_Kz AO-Studierende auslesen (9005 fuer FHTW)
|
||||
$anzahl_studierende = 0;
|
||||
$datum = new datum();
|
||||
$zusatz = '';
|
||||
|
||||
$this->studentuids = array();
|
||||
if($result = $this->db->db_query($qry))
|
||||
{
|
||||
while($row = $this->db->db_fetch_object($result))
|
||||
{
|
||||
if($row->status!='Abbrecher' && $row->status!='Unterbrecher')
|
||||
{
|
||||
$anzahl_studierende++;
|
||||
|
||||
if($row->status=='Incoming') //Incoming
|
||||
$zusatz='(i)';
|
||||
else
|
||||
$zusatz='';
|
||||
|
||||
if($row->bisio_id!='' && $row->status!='Incoming' && ($row->bis > $stsemdatumvon || $row->bis=='') && $row->von < $stsemdatumbis) //Outgoing
|
||||
$zusatz.='(o)(ab '.$datum->formatDatum($row->von,'d.m.Y').')';
|
||||
|
||||
if($row->lkt_ueberschreibbar == 'f') // angerechnet / intern angerechnet / nicht zugelassen
|
||||
$zusatz.= '('. $row->anmerkung. ')';
|
||||
|
||||
if($row->mitarbeiter_uid!='') //mitarbeiter
|
||||
$zusatz.='(ma)';
|
||||
|
||||
if($row->stg_kz_student==$a_o_kz) //Außerordentliche Studierende
|
||||
$zusatz.='(a.o.)';
|
||||
|
||||
if(($row->mobilitaetstyp_kurzbz != '') && ($row->doubledegree == 1)) //Double Degree Student
|
||||
$zusatz .= '(d.d.)';
|
||||
|
||||
$this->studentuids[] = $row->student_uid;
|
||||
$this->data[]=array('student'=>array(
|
||||
'uid' => $row->student_uid,
|
||||
'vorname'=>$row->vorname,
|
||||
'nachname'=>$row->nachname,
|
||||
'personenkennzeichen'=>trim($row->matrikelnr),
|
||||
'matr_nr'=>$row->matr_nr,
|
||||
'semester'=>$row->semester,
|
||||
'verband'=>trim($row->verband),
|
||||
'gruppe'=>trim($row->gruppe),
|
||||
'zusatz'=>$zusatz,
|
||||
'studiengang_kurzbz'=>$row->kurzbzlang,
|
||||
'mobilitaetstyp_kurzbz'=>$row->mobilitaetstyp_kurzbz
|
||||
));
|
||||
}
|
||||
}
|
||||
//Anzahl Studierende in Array $data (an erster Stelle) einfuegen
|
||||
$this->data = array_reverse($this->data, true);
|
||||
$this->data['anzahl_studierende'] = $anzahl_studierende;
|
||||
$this->data = array_reverse($this->data, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1143
-1142
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 fhcomplete.org
|
||||
/* Copyright (C) 2021 fhcomplete.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
@@ -16,9 +16,10 @@
|
||||
* 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> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
* Stefan Puraner <puraner@technikum-wien.at>
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at>,
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>,
|
||||
* Stefan Puraner <puraner@technikum-wien.at> and
|
||||
* Manuela Thamer <manuela.thamer@technikum-wien.at>
|
||||
*/
|
||||
require_once(dirname(__FILE__) . '/basis_db.class.php');
|
||||
require_once(dirname(__FILE__) . '/functions.inc.php');
|
||||
@@ -2458,6 +2459,44 @@ class lehrveranstaltung extends basis_db
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt den LV-Leiter einer Lehrveranstaltung
|
||||
* ist keiner der Lektoren als LV-Leitung eingetragen, wird Null zurückgegeben
|
||||
* @param int $lehrveranstaltung_id ID der Lehrveranstaltung.
|
||||
* @param char $studiensemester_kurzbz Studiensemester.
|
||||
* @return char $mitarbeiter_uid UID des Mitarbeiters oder NULL, wenn keine LV-Leitung vorhanden
|
||||
*/
|
||||
public function getEingetrageneLVLeitung($lehrveranstaltung_id, $studiensemester_kurzbz)
|
||||
{
|
||||
$qry = "SELECT
|
||||
mitarbeiter_uid
|
||||
FROM
|
||||
lehre.tbl_lehreinheit
|
||||
JOIN lehre.tbl_lehreinheitmitarbeiter USING(lehreinheit_id)
|
||||
WHERE
|
||||
tbl_lehreinheit.lehrveranstaltung_id=".$this->db_add_param($lehrveranstaltung_id)."
|
||||
AND tbl_lehreinheit.studiensemester_kurzbz=".$this->db_add_param($studiensemester_kurzbz)."
|
||||
AND lehrfunktion_kurzbz='LV-Leitung';";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
return $row->mitarbeiter_uid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Keine Eintrag gefunden';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert den Koordinator einer Lehrveranstaltung
|
||||
* @param $lehrveranstaltung_id
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
require_once(dirname(__FILE__).'/person.class.php');
|
||||
require_once(dirname(__FILE__).'/benutzer.class.php');
|
||||
require_once(dirname(__FILE__).'/functions.inc.php');
|
||||
require_once(dirname(__FILE__).'/udf.class.php');
|
||||
require_once(dirname(__FILE__).'/udf.class.php'); // required only to check if UDFs are defined
|
||||
|
||||
class mitarbeiter extends benutzer
|
||||
{
|
||||
@@ -849,6 +849,8 @@ class mitarbeiter extends benutzer
|
||||
$obj->titelpost = $row->titelpost;
|
||||
$obj->kurzbz = $row->kurzbz;
|
||||
$obj->vornamen = $row->vornamen;
|
||||
$obj->aktiv =$this->db_parse_bool($row->aktiv);
|
||||
$obj->fixangestellt = $this->db_parse_bool($row->fixangestellt);
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
@@ -916,6 +918,10 @@ class mitarbeiter extends benutzer
|
||||
*/
|
||||
public function searchPersonal($filter)
|
||||
{
|
||||
// Filter imploden und trimmen, um preg_split(Zeichenweise trennung) durchfuehren zu koennen
|
||||
//$searchItems_string_orig = implode(' ', $filter);
|
||||
$searchItems_string = generateSpecialCharacterString($filter);
|
||||
|
||||
$qry = "SELECT
|
||||
distinct on(mitarbeiter_uid) *, tbl_benutzer.aktiv as aktiv, tbl_mitarbeiter.insertamum,
|
||||
tbl_mitarbeiter.insertvon, tbl_mitarbeiter.updateamum, tbl_mitarbeiter.updatevon, tbl_person.svnr
|
||||
@@ -923,8 +929,8 @@ class mitarbeiter extends benutzer
|
||||
public.tbl_mitarbeiter
|
||||
JOIN public.tbl_benutzer ON(mitarbeiter_uid=uid)
|
||||
JOIN public.tbl_person USING(person_id)
|
||||
WHERE lower(COALESCE(nachname,'') ||' '|| COALESCE(vorname,'')) ~* lower(".$this->db_add_param($filter).") OR
|
||||
lower(COALESCE(vorname,'') ||' '|| COALESCE(nachname,'')) ~* lower(".$this->db_add_param($filter).") OR
|
||||
WHERE lower(COALESCE(nachname,'') ||' '|| COALESCE(vorname,'')) ~* lower(".$this->db_add_param($searchItems_string).") OR
|
||||
lower(COALESCE(vorname,'') ||' '|| COALESCE(nachname,'')) ~* lower(".$this->db_add_param($searchItems_string).") OR
|
||||
uid ~* ".$this->db_add_param($filter)." ";
|
||||
if(is_numeric($filter))
|
||||
$qry.="OR personalnummer = ".$this->db_add_param($filter)." OR svnr = ".$this->db_add_param($filter).";";
|
||||
@@ -1090,6 +1096,55 @@ class mitarbeiter extends benutzer
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt UID des letzten Vorgesetzten zurück
|
||||
* @param string $uid Mitarbeiter.
|
||||
* @return uid letzter Vorgesetzter
|
||||
*/
|
||||
public function getLastVorgesetzter($uid = null)
|
||||
{
|
||||
$return = false;
|
||||
if (is_null($uid))
|
||||
$uid = $this->uid;
|
||||
|
||||
$qry = "SELECT
|
||||
uid as vorgesetzter
|
||||
FROM
|
||||
public.tbl_benutzerfunktion
|
||||
WHERE
|
||||
funktion_kurzbz='Leitung' AND
|
||||
(datum_von is null OR datum_von<=now()) AND
|
||||
(datum_bis is null OR datum_bis>=now()) AND
|
||||
oe_kurzbz in (SELECT oe_kurzbz
|
||||
FROM public.tbl_benutzerfunktion
|
||||
WHERE
|
||||
funktion_kurzbz='oezuordnung' AND uid=".$this->db_add_param($uid)."
|
||||
ORDER BY datum_von DESC
|
||||
LIMIT 1
|
||||
);
|
||||
";
|
||||
|
||||
if ($this->db_query($qry))
|
||||
{
|
||||
while ($row = $this->db_fetch_object())
|
||||
{
|
||||
if ($row->vorgesetzter != '')
|
||||
{
|
||||
$return = $this->vorgesetzter = $row->vorgesetzter;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei einer Datenbankabfrage!';
|
||||
$return = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gibt ein Array mit den UIDs der aktiv beschäftigten Untergebenen zurueck
|
||||
* @param string $uid UID.
|
||||
@@ -1309,6 +1364,7 @@ class mitarbeiter extends benutzer
|
||||
WHERE
|
||||
bismelden
|
||||
AND personalnummer>0
|
||||
AND tbl_bisverwendung.beginn<='.$this->db_add_param($meldungEnde).'
|
||||
AND (tbl_bisverwendung.ende is NULL OR tbl_bisverwendung.ende>'.$this->db_add_param($meldungBeginn).')
|
||||
ORDER BY uid, nachname,vorname
|
||||
';
|
||||
@@ -1418,22 +1474,25 @@ class mitarbeiter extends benutzer
|
||||
$hasUDF = false;
|
||||
$udf = new UDF();
|
||||
|
||||
$qry = "SELECT DISTINCT ON(mitarbeiter_uid) *,
|
||||
tbl_benutzer.aktiv as aktiv,
|
||||
tbl_mitarbeiter.insertamum,
|
||||
tbl_mitarbeiter.insertvon,
|
||||
tbl_mitarbeiter.updateamum,
|
||||
tbl_mitarbeiter.updatevon";
|
||||
$qry = "SELECT
|
||||
*,
|
||||
tbl_benutzer.aktiv as aktiv,
|
||||
tbl_mitarbeiter.insertamum,
|
||||
tbl_mitarbeiter.insertvon,
|
||||
tbl_mitarbeiter.updateamum,
|
||||
tbl_mitarbeiter.updatevon";
|
||||
|
||||
if ($hasUDF = $udf->personHasUDF())
|
||||
{
|
||||
$qry .= ", public.tbl_person.udf_values AS p_udf_values";
|
||||
}
|
||||
|
||||
$qry .= " FROM ((public.tbl_mitarbeiter JOIN public.tbl_benutzer ON(mitarbeiter_uid=uid))
|
||||
JOIN public.tbl_person USING(person_id))
|
||||
LEFT JOIN public.tbl_benutzerfunktion USING(uid)
|
||||
WHERE uid in(".$this->db_implode4SQL($uid_arr).")";;
|
||||
$qry .= " FROM
|
||||
public.tbl_mitarbeiter
|
||||
JOIN public.tbl_benutzer ON(mitarbeiter_uid=uid)
|
||||
JOIN public.tbl_person USING(person_id)
|
||||
WHERE uid in(".$this->db_implode4SQL($uid_arr).")";
|
||||
$qry .= " ORDER BY nachname, vorname";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
require_once(dirname(__FILE__).'/datum.class.php');
|
||||
require_once(dirname(__FILE__).'/udf.class.php');
|
||||
|
||||
class person extends basis_db
|
||||
{
|
||||
@@ -64,6 +65,7 @@ class person extends basis_db
|
||||
public $foto_sperre = false; // boolean
|
||||
public $matr_nr; //varchar(32)
|
||||
public $bpk; //varchar(255)
|
||||
public $udf_values; //json
|
||||
|
||||
/**
|
||||
* Konstruktor - Uebergibt die Connection und laedt optional eine Person
|
||||
@@ -84,6 +86,8 @@ class person extends basis_db
|
||||
**/
|
||||
public function load($personId)
|
||||
{
|
||||
$udf = new UDF();
|
||||
|
||||
//person_id auf gueltigkeit pruefen
|
||||
if (is_numeric($personId) && $personId != '')
|
||||
{
|
||||
@@ -91,8 +95,11 @@ class person extends basis_db
|
||||
gebdatum, gebort, gebzeit, foto, anmerkung, homepage, svnr, ersatzkennzeichen,
|
||||
familienstand, anzahlkinder, aktiv, insertamum, insertvon, updateamum, updatevon, ext_id,
|
||||
geschlecht, staatsbuergerschaft, geburtsnation, kurzbeschreibung, zugangscode, foto_sperre,
|
||||
matr_nr, bpk
|
||||
FROM public.tbl_person
|
||||
matr_nr, bpk";
|
||||
if ($hasUDF = $udf->personHasUDF())
|
||||
$qry .= ", udf_values ";
|
||||
|
||||
$qry .= "FROM public.tbl_person
|
||||
WHERE person_id = " . $this->db_add_param($personId, FHC_INTEGER);
|
||||
|
||||
if (!$this->db_query($qry))
|
||||
@@ -135,6 +142,10 @@ class person extends basis_db
|
||||
$this->foto_sperre = $this->db_parse_bool($row->foto_sperre);
|
||||
$this->matr_nr = $row->matr_nr;
|
||||
$this->bpk = $row->bpk;
|
||||
if ($hasUDF)
|
||||
{
|
||||
$this->udf_values = $row->udf_values;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -32,12 +32,12 @@ class basis_db extends db
|
||||
//Connection Herstellen
|
||||
if (DB_CONNECT_PERSISTENT)
|
||||
{
|
||||
if(!basis_db::$db_conn = pg_pconnect($conn_str))
|
||||
if(!basis_db::$db_conn = @pg_pconnect($conn_str))
|
||||
die('Fehler beim Oeffnen der Datenbankverbindung');
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!basis_db::$db_conn = pg_connect($conn_str))
|
||||
if(!basis_db::$db_conn = @pg_connect($conn_str))
|
||||
die('Fehler beim Oeffnen der Datenbankverbindung');
|
||||
}
|
||||
}
|
||||
|
||||
+101
-33
@@ -26,6 +26,7 @@ require_once(dirname(__FILE__).'/log.class.php');
|
||||
require_once(dirname(__FILE__).'/phrasen.class.php');
|
||||
require_once(dirname(__FILE__).'/globals.inc.php');
|
||||
require_once(dirname(__FILE__).'/sprache.class.php');
|
||||
require_once(dirname(__FILE__).'/udf.class.php');
|
||||
|
||||
$sprache = getSprache();
|
||||
$lang = new sprache();
|
||||
@@ -44,10 +45,12 @@ class prestudent extends person
|
||||
public $zgvort;
|
||||
public $zgvdatum;
|
||||
public $zgvnation;
|
||||
public $zgv_erfuellt;
|
||||
public $zgvmas_code;
|
||||
public $zgvmaort;
|
||||
public $zgvmadatum;
|
||||
public $zgvmanation;
|
||||
public $zgvmas_erfuellt;
|
||||
public $ausstellungsstaat;
|
||||
public $aufnahmeschluessel;
|
||||
public $facheinschlberuf;
|
||||
@@ -68,9 +71,13 @@ class prestudent extends person
|
||||
public $zgvdoktorort;
|
||||
public $zgvdoktordatum;
|
||||
public $zgvdoktornation;
|
||||
public $zgvdoktor_erfuellt;
|
||||
public $gsstudientyp_kurzbz='Intern';
|
||||
public $aufnahmegruppe_kurzbz;
|
||||
public $priorisierung = null;
|
||||
public $foerderrelevant = null;
|
||||
public $standort_code = null;
|
||||
public $udf_values = null;
|
||||
|
||||
public $status_kurzbz;
|
||||
public $studiensemester_kurzbz;
|
||||
@@ -137,10 +144,12 @@ class prestudent extends person
|
||||
$this->zgvort = $row->zgvort;
|
||||
$this->zgvdatum = $row->zgvdatum;
|
||||
$this->zgvnation = $row->zgvnation;
|
||||
$this->zgv_erfuellt = $row->zgv_erfuellt;
|
||||
$this->zgvmas_code = $row->zgvmas_code;
|
||||
$this->zgvmaort = $row->zgvmaort;
|
||||
$this->zgvmadatum = $row->zgvmadatum;
|
||||
$this->zgvmanation = $row->zgvmanation;
|
||||
$this->zgvmas_erfuellt = $row->zgvmas_erfuellt;
|
||||
$this->aufnahmeschluessel = $row->aufnahmeschluessel;
|
||||
$this->facheinschlberuf = $this->db_parse_bool($row->facheinschlberuf);
|
||||
$this->anmeldungreihungstest = $row->anmeldungreihungstest;
|
||||
@@ -161,9 +170,12 @@ class prestudent extends person
|
||||
$this->zgvdoktorort = $row->zgvdoktorort;
|
||||
$this->zgvdoktordatum = $row->zgvdoktordatum;
|
||||
$this->zgvdoktornation = $row->zgvdoktornation;
|
||||
$this->zgvdoktor_erfuellt = $row->zgvdoktor_erfuellt;
|
||||
$this->gsstudientyp_kurzbz = $row->gsstudientyp_kurzbz;
|
||||
$this->aufnahmegruppe_kurzbz = $row->aufnahmegruppe_kurzbz;
|
||||
$this->priorisierung = $row->priorisierung;
|
||||
$this->foerderrelevant = $this->db_parse_bool($row->foerderrelevant);
|
||||
$this->standort_code = $row->standort_code;
|
||||
|
||||
if(!person::load($row->person_id))
|
||||
return false;
|
||||
@@ -220,6 +232,11 @@ class prestudent extends person
|
||||
$this->errormsg = 'ZGV Master Ort darf nicht länger als 64 Zeichen sein.';
|
||||
return false;
|
||||
}
|
||||
if(mb_strlen($this->zgvdoktorort)>64)
|
||||
{
|
||||
$this->errormsg = 'ZGV Doktor Ort darf nicht länger als 64 Zeichen sein.';
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -245,12 +262,14 @@ class prestudent extends person
|
||||
if($this->new) //Wenn new true ist dann ein INSERT absetzen ansonsten ein UPDATE
|
||||
{
|
||||
$qry = 'BEGIN;INSERT INTO public.tbl_prestudent (aufmerksamdurch_kurzbz, person_id,
|
||||
studiengang_kz, berufstaetigkeit_code, ausbildungcode, zgv_code, zgvort, zgvdatum, zgvnation,
|
||||
zgvmas_code, zgvmaort, zgvmadatum, zgvmanation, aufnahmeschluessel, facheinschlberuf,
|
||||
studiengang_kz, berufstaetigkeit_code, ausbildungcode, zgv_code, zgvort, zgvdatum, zgvnation, zgv_erfuellt,
|
||||
zgvmas_code, zgvmaort, zgvmadatum, zgvmanation, zgvmas_erfuellt, zgvdoktor_code, zgvdoktorort, zgvdoktordatum,
|
||||
zgvdoktornation,aufnahmeschluessel, facheinschlberuf,
|
||||
reihungstest_id, anmeldungreihungstest, reihungstestangetreten, rt_gesamtpunkte,
|
||||
rt_punkte1, rt_punkte2, rt_punkte3, bismelden, insertamum, insertvon,
|
||||
updateamum, updatevon, anmerkung, dual, ausstellungsstaat, mentor,
|
||||
gsstudientyp_kurzbz, aufnahmegruppe_kurzbz, priorisierung) VALUES('.
|
||||
gsstudientyp_kurzbz, aufnahmegruppe_kurzbz, priorisierung, zgvdoktor_erfuellt, foerderrelevant, standort_code) VALUES('.
|
||||
|
||||
$this->db_add_param($this->aufmerksamdurch_kurzbz).",".
|
||||
$this->db_add_param($this->person_id).",".
|
||||
$this->db_add_param($this->studiengang_kz).",".
|
||||
@@ -260,10 +279,16 @@ class prestudent extends person
|
||||
$this->db_add_param($this->zgvort).",".
|
||||
$this->db_add_param($this->zgvdatum).",".
|
||||
$this->db_add_param($this->zgvnation).",".
|
||||
$this->db_add_param($this->zgv_erfuellt).",".
|
||||
$this->db_add_param($this->zgvmas_code).",".
|
||||
$this->db_add_param($this->zgvmaort).",".
|
||||
$this->db_add_param($this->zgvmadatum).",".
|
||||
$this->db_add_param($this->zgvmanation).",".
|
||||
$this->db_add_param($this->zgvmas_erfuellt).",".
|
||||
$this->db_add_param($this->zgvdoktor_code).",".
|
||||
$this->db_add_param($this->zgvdoktorort).",".
|
||||
$this->db_add_param($this->zgvdoktordatum).",".
|
||||
$this->db_add_param($this->zgvdoktornation).",".
|
||||
$this->db_add_param($this->aufnahmeschluessel).",".
|
||||
$this->db_add_param($this->facheinschlberuf, FHC_BOOLEAN).",".
|
||||
$this->db_add_param($this->reihungstest_id).",".
|
||||
@@ -284,7 +309,10 @@ class prestudent extends person
|
||||
$this->db_add_param($this->mentor).",".
|
||||
$this->db_add_param($this->gsstudientyp_kurzbz).",".
|
||||
$this->db_add_param($this->aufnahmegruppe_kurzbz).",".
|
||||
$this->db_add_param($this->priorisierung).");";
|
||||
$this->db_add_param($this->priorisierung).",".
|
||||
$this->db_add_param($this->zgvdoktor_erfuellt).",".
|
||||
$this->db_add_param($this->foerderrelevant, FHC_BOOLEAN).",".
|
||||
$this->db_add_param($this->standort_code).");";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -298,10 +326,16 @@ class prestudent extends person
|
||||
' zgvort='.$this->db_add_param($this->zgvort).",".
|
||||
' zgvdatum='.$this->db_add_param($this->zgvdatum).",".
|
||||
' zgvnation='.$this->db_add_param($this->zgvnation).",".
|
||||
' zgv_erfuellt='.$this->db_add_param($this->zgv_erfuellt).",".
|
||||
' zgvmas_code='.$this->db_add_param($this->zgvmas_code).",".
|
||||
' zgvmaort='.$this->db_add_param($this->zgvmaort).",".
|
||||
' zgvmadatum='.$this->db_add_param($this->zgvmadatum).",".
|
||||
' zgvmanation='.$this->db_add_param($this->zgvmanation).",".
|
||||
' zgvmas_erfuellt='.$this->db_add_param($this->zgvmas_erfuellt).",".
|
||||
' zgvdoktor_code='.$this->db_add_param($this->zgvdoktor_code).",".
|
||||
' zgvdoktorort='.$this->db_add_param($this->zgvdoktorort).",".
|
||||
' zgvdoktordatum='.$this->db_add_param($this->zgvdoktordatum).",".
|
||||
' zgvdoktornation='.$this->db_add_param($this->zgvdoktornation).",".
|
||||
' aufnahmeschluessel='.$this->db_add_param($this->aufnahmeschluessel).",".
|
||||
' facheinschlberuf='.$this->db_add_param($this->facheinschlberuf, FHC_BOOLEAN).",".
|
||||
' reihungstest_id='.$this->db_add_param($this->reihungstest_id).",".
|
||||
@@ -320,7 +354,10 @@ class prestudent extends person
|
||||
' dual='.$this->db_add_param($this->dual, FHC_BOOLEAN).",".
|
||||
' ausstellungsstaat='.$this->db_add_param($this->ausstellungsstaat).",".
|
||||
' aufnahmegruppe_kurzbz='.$this->db_add_param($this->aufnahmegruppe_kurzbz).",".
|
||||
' priorisierung='.$this->db_add_param($this->priorisierung).' '.
|
||||
' priorisierung='.$this->db_add_param($this->priorisierung).",".
|
||||
' zgvdoktor_erfuellt='.$this->db_add_param($this->zgvdoktor_erfuellt).', '.
|
||||
' foerderrelevant='.$this->db_add_param($this->foerderrelevant, FHC_BOOLEAN).",".
|
||||
' standort_code='.$this->db_add_param($this->standort_code)." ".
|
||||
" WHERE prestudent_id=".$this->db_add_param($this->prestudent_id).";";
|
||||
}
|
||||
|
||||
@@ -796,10 +833,12 @@ class prestudent extends person
|
||||
case "zgv":
|
||||
$stg_obj = new studiengang();
|
||||
$stg_obj->load($studiengang_kz);
|
||||
if($stg_obj->typ=='m')
|
||||
$qry.=" AND a.rolle='Interessent' AND a.zgvmas_code is not null";
|
||||
if($stg_obj->typ=='m')
|
||||
$qry.=" AND a.rolle='Interessent' AND a.zgvmas_code is not null AND a.zgvmas_erfuellt = 't'";
|
||||
elseif($stg_obj->typ=='p')
|
||||
$qry.=" AND a.rolle='Interessent' AND a.zgvdoktor_code is not null AND a.zgvdoktor_erfuellt = 't'";
|
||||
else
|
||||
$qry.=" AND a.rolle='Interessent' AND a.zgv_code is not null";
|
||||
$qry.=" AND a.rolle='Interessent' AND a.zgv_code is not null AND a.zgv_erfuellt = 't'";
|
||||
break;
|
||||
case "reihungstestangemeldet":
|
||||
$qry.="
|
||||
@@ -896,10 +935,17 @@ class prestudent extends person
|
||||
$ps->zgvort = $row->zgvort;
|
||||
$ps->zgvdatum = $row->zgvdatum;
|
||||
$ps->zgvnation = $row->zgvnation;
|
||||
$ps->zgv_erfuellt = $row->zgv_erfuellt;
|
||||
$ps->zgvmas_code = $row->zgvmas_code;
|
||||
$ps->zgvmaort = $row->zgvmaort;
|
||||
$ps->zgvmadatum = $row->zgvmadatum;
|
||||
$ps->zgvmanation = $row->zgvmanation;
|
||||
$ps->zgvmas_erfuellt = $row->zgvmas_erfuellt;
|
||||
$ps->zgvdoktor_code = $row->zgvdoktor_code;
|
||||
$ps->zgvdoktorort = $row->zgvdoktorort;
|
||||
$ps->zgvdoktordatum = $row->zgvdoktordatum;
|
||||
$ps->zgvdoktornation = $row->zgvdoktornation;
|
||||
$ps->zgvdoktor_erfuellt = $row->zgvdoktor_erfuellt;
|
||||
$ps->ausstellungsstaat = $row->ausstellungsstaat;
|
||||
$ps->aufnahmeschluessel = $row->aufnahmeschluessel;
|
||||
$ps->facheinschlberuf = $this->db_parse_bool($row->facheinschlberuf);
|
||||
@@ -916,6 +962,8 @@ class prestudent extends person
|
||||
$ps->gsstudientyp_kurzbz = $row->gsstudientyp_kurzbz;
|
||||
$ps->aufnahmegruppe_kurzbz = $row->aufnahmegruppe_kurzbz;
|
||||
$ps->priorisierung = $row->priorisierung;
|
||||
$ps->foerderrelevant = $row->foerderrelevant;
|
||||
$ps->standort_code = $row->standort_code;
|
||||
|
||||
$ps->status_kurzbz = $row->status_kurzbz;
|
||||
$ps->studiensemester_kurzbz = $row->studiensemester_kurzbz;
|
||||
@@ -1078,23 +1126,23 @@ class prestudent extends person
|
||||
studiensemester_kurzbz, ausbildungssemester, datum, insertamum, insertvon,
|
||||
updateamum, updatevon, ext_id, orgform_kurzbz, bestaetigtam, bestaetigtvon, anmerkung,
|
||||
bewerbung_abgeschicktamum, studienplan_id, rt_stufe, statusgrund_id) VALUES('.
|
||||
$this->db_add_param($this->prestudent_id).",".
|
||||
$this->db_add_param($this->status_kurzbz).",".
|
||||
$this->db_add_param($this->studiensemester_kurzbz).",".
|
||||
$this->db_add_param($this->ausbildungssemester).",".
|
||||
$this->db_add_param($this->datum).",".
|
||||
$this->db_add_param($this->insertamum).",".
|
||||
$this->db_add_param($this->insertvon).",".
|
||||
$this->db_add_param($this->updateamum).",".
|
||||
$this->db_add_param($this->updatevon).",".
|
||||
$this->db_add_param($this->ext_id_prestudent).",".
|
||||
$this->db_add_param($this->orgform_kurzbz).",".
|
||||
$this->db_add_param($this->bestaetigtam).",".
|
||||
$this->db_add_param($this->bestaetigtvon).",".
|
||||
$this->db_add_param($this->anmerkung_status).",".
|
||||
$this->db_add_param($this->bewerbung_abgeschicktamum).",".
|
||||
$this->db_add_param($this->studienplan_id,FHC_INTEGER).",".
|
||||
$this->db_add_param($this->rt_stufe,FHC_INTEGER).",".
|
||||
$this->db_add_param($this->prestudent_id).",".
|
||||
$this->db_add_param($this->status_kurzbz).",".
|
||||
$this->db_add_param($this->studiensemester_kurzbz).",".
|
||||
$this->db_add_param($this->ausbildungssemester).",".
|
||||
$this->db_add_param($this->datum).",".
|
||||
$this->db_add_param($this->insertamum).",".
|
||||
$this->db_add_param($this->insertvon).",".
|
||||
$this->db_add_param($this->updateamum).",".
|
||||
$this->db_add_param($this->updatevon).",".
|
||||
$this->db_add_param($this->ext_id_prestudent).",".
|
||||
$this->db_add_param($this->orgform_kurzbz).",".
|
||||
$this->db_add_param($this->bestaetigtam).",".
|
||||
$this->db_add_param($this->bestaetigtvon).",".
|
||||
$this->db_add_param($this->anmerkung_status).",".
|
||||
$this->db_add_param($this->bewerbung_abgeschicktamum).",".
|
||||
$this->db_add_param($this->studienplan_id,FHC_INTEGER).",".
|
||||
$this->db_add_param($this->rt_stufe,FHC_INTEGER).",".
|
||||
$this->db_add_param($this->statusgrund_id, FHC_INTEGER).");";
|
||||
}
|
||||
else
|
||||
@@ -1403,6 +1451,9 @@ class prestudent extends person
|
||||
person_id=".$this->db_add_param($person_id, FHC_INTEGER)."
|
||||
ORDER BY prestudent_id";
|
||||
|
||||
$udf = new UDF();
|
||||
$hasUDF = $udf->prestudentHasUDF();
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
@@ -1418,10 +1469,12 @@ class prestudent extends person
|
||||
$obj->zgvort = $row->zgvort;
|
||||
$obj->zgvdatum = $row->zgvdatum;
|
||||
$obj->zgvnation = $row->zgvnation;
|
||||
$obj->zgv_erfuellt = $row->zgv_erfuellt;
|
||||
$obj->zgvmas_code = $row->zgvmas_code;
|
||||
$obj->zgvmaort = $row->zgvmaort;
|
||||
$obj->zgvmadatum = $row->zgvmadatum;
|
||||
$obj->zgvmanation = $row->zgvmanation;
|
||||
$obj->zgvmas_erfuellt = $row->zgvmas_erfuellt;
|
||||
$obj->aufnahmeschluessel = $row->aufnahmeschluessel;
|
||||
$obj->facheinschlberuf = $this->db_parse_bool($row->facheinschlberuf);
|
||||
$obj->anmeldungreihungstest = $row->anmeldungreihungstest;
|
||||
@@ -1445,6 +1498,13 @@ class prestudent extends person
|
||||
$obj->gsstudientyp_kurzbz = $row->gsstudientyp_kurzbz;
|
||||
$obj->aufnahmegruppe_kurzbz = $row->aufnahmegruppe_kurzbz;
|
||||
$obj->priorisierung = $row->priorisierung;
|
||||
$obj->zgvdoktor_erfuellt = $row->zgvdoktor_erfuellt;
|
||||
|
||||
if ($hasUDF)
|
||||
{
|
||||
$obj->udf_values = $row->udf_values;
|
||||
}
|
||||
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
@@ -1468,7 +1528,7 @@ class prestudent extends person
|
||||
(
|
||||
'bachelor' => array(),
|
||||
'master' => array(),
|
||||
//'doktor' => array(),
|
||||
'doktor' => array(),
|
||||
);
|
||||
$attribute = array
|
||||
(
|
||||
@@ -2065,11 +2125,11 @@ class prestudent extends person
|
||||
$log->sql = $qry;
|
||||
$log->sqlundo = 'INSERT INTO public.tbl_prestudent(
|
||||
prestudent_id, aufmerksamdurch_kurzbz, studiengang_kz, berufstaetigkeit_code, ausbildungcode,
|
||||
zgv_code, zgvort, zgvdatum, zgvnation, zgvmas_code, zgvmaort, zgvmadatum, zgvmanation,
|
||||
zgv_code, zgvort, zgvdatum, zgvnation,zgv_erfuellt, zgvmas_code, zgvmaort, zgvmadatum, zgvmanation,zgvmas_erfuellt,
|
||||
aufnahmeschluessel, facheinschlberuf, anmeldungreihungstest, reihungstestangetreten, reihungstest_id,
|
||||
punkte, rt_punkte1, rt_punkte2, rt_punkte3, bismelden, person_id, anmerkung, mentor, ext_id_prestudent,
|
||||
dual, ausstellungsstaat, zgvdoktor_code, zgvdoktorort, zgvdoktordatum, zgvdoktornation,
|
||||
gsstudientyp_kurzbz, aufnahmegruppe_kurzbz, priorisierung) VALUES('.
|
||||
gsstudientyp_kurzbz, aufnahmegruppe_kurzbz, priorisierung,zgvdoktor_erfuellt) VALUES('.
|
||||
$this->db_add_param($this->prestudent_id).','.
|
||||
$this->db_add_param($this->aufmerksamdurch_kurzbz).','.
|
||||
$this->db_add_param($this->studiengang_kz).','.
|
||||
@@ -2079,10 +2139,12 @@ class prestudent extends person
|
||||
$this->db_add_param($this->zgvort).','.
|
||||
$this->db_add_param($this->zgvdatum).','.
|
||||
$this->db_add_param($this->zgvnation).','.
|
||||
$this->db_add_param($this->zgv_erfuellt).','.
|
||||
$this->db_add_param($this->zgvmas_code).','.
|
||||
$this->db_add_param($this->zgvmaort).','.
|
||||
$this->db_add_param($this->zgvmadatum).','.
|
||||
$this->db_add_param($this->zgvmanation).','.
|
||||
$this->db_add_param($this->zgvmas_erfuellt).','.
|
||||
$this->db_add_param($this->aufnahmeschluessel).','.
|
||||
$this->db_add_param($this->facheinschlberuf, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->anmeldungreihungstest).','.
|
||||
@@ -2105,7 +2167,8 @@ class prestudent extends person
|
||||
$this->db_add_param($this->zgvdoktornation).','.
|
||||
$this->db_add_param($this->gsstudientyp_kurzbz).','.
|
||||
$this->db_add_param($this->aufnahmegruppe_kurzbz).','.
|
||||
$this->db_add_param($this->priorisierung).');';
|
||||
$this->db_add_param($this->priorisierung).','.
|
||||
$this->db_add_param($this->zgvdoktor_erfuellt).');';
|
||||
|
||||
if($log->save(true))
|
||||
{
|
||||
@@ -2216,9 +2279,9 @@ class prestudent extends person
|
||||
WHERE laststatus NOT IN ('Abbrecher', 'Abgewiesener', 'Absolvent')
|
||||
AND priorisierung <= ".$this->db_add_param($priorisierungAbsolut, FHC_INTEGER);
|
||||
|
||||
if ($result = $this->db_query($qry))
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if ($row = $this->db_fetch_object($result))
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
return $row->prio_relativ;
|
||||
}
|
||||
@@ -2233,8 +2296,9 @@ class prestudent extends person
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Prueft, ob eine Person einen aktuellen PreStudentstatus-Eintrag besitzt, der die ZGV Master ersetzt
|
||||
* @param int $person_id ID der zu überprüfenden Person.
|
||||
@@ -2425,10 +2489,14 @@ class prestudent extends person
|
||||
$qry = "SELECT
|
||||
UPPER(tbl_studiengang.typ || tbl_studiengang.kurzbz) as kuerzel
|
||||
FROM
|
||||
public.tbl_prestudent
|
||||
public.tbl_prestudent pt
|
||||
JOIN public.tbl_prestudentstatus USING (prestudent_id)
|
||||
JOIN public.tbl_studiengang USING (studiengang_kz)
|
||||
WHERE person_id = ".$this->db_add_param($person_id, FHC_INTEGER)."
|
||||
AND NOT EXISTS
|
||||
(SELECT * FROM public.tbl_prestudentstatus ps
|
||||
WHERE ps.prestudent_id = pt.prestudent_id
|
||||
AND status_kurzbz = 'Abbrecher' )
|
||||
AND status_kurzbz in ('Absolvent','Diplomand','Unterbrecher','Student')
|
||||
AND typ in ('b','m','d')
|
||||
ORDER BY status_kurzbz ASC
|
||||
|
||||
+181
-99
@@ -45,8 +45,10 @@ class projekt extends basis_db
|
||||
public $updatevon; // string
|
||||
public $budget;
|
||||
public $farbe;
|
||||
public $anzahl_ma; // integer
|
||||
public $aufwand_pt; // integer
|
||||
public $anzahl_ma; // integer
|
||||
public $aufwand_pt; // integer
|
||||
public $zeitaufzeichnung; //bool
|
||||
public $sap_project_id;
|
||||
|
||||
|
||||
/**
|
||||
@@ -70,8 +72,10 @@ class projekt extends basis_db
|
||||
{
|
||||
$qry = "SELECT * FROM fue.tbl_projekt WHERE projekt_kurzbz=" . $this->db_add_param($projekt_kurzbz);
|
||||
|
||||
if ($this->db_query($qry)) {
|
||||
if ($row = $this->db_fetch_object()) {
|
||||
if ($this->db_query($qry))
|
||||
{
|
||||
if ($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->projekt_kurzbz = $row->projekt_kurzbz;
|
||||
$this->nummer = $row->nummer;
|
||||
$this->titel = $row->titel;
|
||||
@@ -83,6 +87,7 @@ class projekt extends basis_db
|
||||
$this->farbe = $row->farbe;
|
||||
$this->anzahl_ma = $row->anzahl_ma;
|
||||
$this->aufwand_pt = $row->aufwand_pt;
|
||||
$this->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -119,8 +124,10 @@ class projekt extends basis_db
|
||||
$qry .= ' AND oe_kurzbz=' . $this->db_add_param($oe);
|
||||
|
||||
$qry .= ' ORDER BY oe_kurzbz;';
|
||||
if ($this->db_query($qry)) {
|
||||
while ($row = $this->db_fetch_object()) {
|
||||
if ($this->db_query($qry))
|
||||
{
|
||||
while ($row = $this->db_fetch_object())
|
||||
{
|
||||
$obj = new projekt();
|
||||
|
||||
$obj->projekt_kurzbz = $row->projekt_kurzbz;
|
||||
@@ -135,6 +142,7 @@ class projekt extends basis_db
|
||||
$obj->aufwandstyp_kurzbz = $row->aufwandstyp_kurzbz;
|
||||
$obj->anzahl_ma = $row->anzahl_ma;
|
||||
$obj->aufwand_pt = $row->aufwand_pt;
|
||||
$obj->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung);
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
@@ -160,9 +168,11 @@ class projekt extends basis_db
|
||||
if (!is_null($oe))
|
||||
$qry .= " AND oe_kurzbz=" . $this->db_add_param($oe);
|
||||
$qry .= ' ORDER BY oe_kurzbz;';
|
||||
//echo $qry;
|
||||
if ($this->db_query($qry)) {
|
||||
while ($row = $this->db_fetch_object()) {
|
||||
|
||||
if ($this->db_query($qry))
|
||||
{
|
||||
while ($row = $this->db_fetch_object())
|
||||
{
|
||||
$obj = new projekt();
|
||||
|
||||
$obj->projekt_kurzbz = $row->projekt_kurzbz;
|
||||
@@ -176,6 +186,7 @@ class projekt extends basis_db
|
||||
$obj->farbe = $row->farbe;
|
||||
$obj->anzahl_ma = $row->anzahl_ma;
|
||||
$obj->aufwand_pt = $row->aufwand_pt;
|
||||
$obj->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung);
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
@@ -188,7 +199,6 @@ class projekt extends basis_db
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Laedt die Projeke einer Organisationseinheit
|
||||
* @param string $oe Organisationseinheit.
|
||||
@@ -200,9 +210,11 @@ class projekt extends basis_db
|
||||
if (!is_null($oe))
|
||||
$qry .= " WHERE oe_kurzbz=" . $this->db_add_param($oe);
|
||||
$qry .= ' ORDER BY oe_kurzbz;';
|
||||
//echo $qry;
|
||||
if ($this->db_query($qry)) {
|
||||
while ($row = $this->db_fetch_object()) {
|
||||
|
||||
if ($this->db_query($qry))
|
||||
{
|
||||
while ($row = $this->db_fetch_object())
|
||||
{
|
||||
$obj = new projekt();
|
||||
|
||||
$obj->projekt_kurzbz = $row->projekt_kurzbz;
|
||||
@@ -217,6 +229,7 @@ class projekt extends basis_db
|
||||
$obj->aufwandstyp_kurzbz = $row->aufwandstyp_kurzbz;
|
||||
$obj->anzahl_ma = $row->anzahl_ma;
|
||||
$obj->aufwand_pt = $row->aufwand_pt;
|
||||
$obj->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung);
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
@@ -236,21 +249,26 @@ class projekt extends basis_db
|
||||
protected function validate()
|
||||
{
|
||||
//Gesamtlaenge pruefen
|
||||
if ($this->projekt_kurzbz == null) {
|
||||
if ($this->projekt_kurzbz == null)
|
||||
{
|
||||
$this->errormsg = 'Projekt kurzbz darf nicht NULL sein!';
|
||||
}
|
||||
if ($this->oe_kurzbz == null) {
|
||||
if ($this->oe_kurzbz == null)
|
||||
{
|
||||
$this->errormsg = 'OE kurbz darf nicht NULL sein!';
|
||||
}
|
||||
if (mb_strlen($this->projekt_kurzbz) > 16) {
|
||||
if (mb_strlen($this->projekt_kurzbz) > 16)
|
||||
{
|
||||
$this->errormsg = 'Projektyp_kurzbz darf nicht länger als 16 Zeichen sein';
|
||||
return false;
|
||||
}
|
||||
if (mb_strlen($this->nummer) > 8) {
|
||||
if (mb_strlen($this->nummer) > 8)
|
||||
{
|
||||
$this->errormsg = 'Nummer darf nicht länger als 8 Zeichen sein';
|
||||
return false;
|
||||
}
|
||||
if (mb_strlen($this->titel) > 256) {
|
||||
if (mb_strlen($this->titel) > 256)
|
||||
{
|
||||
$this->errormsg = 'Titel darf nicht länger als 256 Zeichen sein';
|
||||
return false;
|
||||
}
|
||||
@@ -275,49 +293,55 @@ class projekt extends basis_db
|
||||
if ($new == null)
|
||||
$new = $this->new;
|
||||
|
||||
if ($new) {
|
||||
if ($new)
|
||||
{
|
||||
//Neuen Datensatz einfuegen
|
||||
|
||||
$qry = 'INSERT INTO fue.tbl_projekt (projekt_kurzbz, nummer, titel,beschreibung, beginn, ende, budget, farbe, oe_kurzbz, aufwand_pt, anzahl_ma, aufwandstyp_kurzbz) VALUES(' .
|
||||
$this->db_add_param($this->projekt_kurzbz) . ', ' .
|
||||
$this->db_add_param($this->nummer) . ', ' .
|
||||
$this->db_add_param($this->titel) . ', ' .
|
||||
$this->db_add_param($this->beschreibung) . ', ' .
|
||||
$this->db_add_param($this->beginn) . ', ' .
|
||||
$this->db_add_param($this->ende) . ', ' .
|
||||
$this->db_add_param($this->budget) . ', ' .
|
||||
$this->db_add_param($this->farbe) . ', ' .
|
||||
$this->db_add_param($this->oe_kurzbz) . ',' .
|
||||
$this->db_add_param($this->aufwand_pt) . ',' .
|
||||
$this->db_add_param($this->anzahl_ma) . ',' .
|
||||
$this->db_add_param($this->aufwandstyp_kurzbz) . ');';
|
||||
$qry = 'INSERT INTO fue.tbl_projekt (projekt_kurzbz, nummer, titel,beschreibung, beginn, ende, budget, farbe, oe_kurzbz, aufwand_pt, anzahl_ma, aufwandstyp_kurzbz, zeitaufzeichnung) VALUES('.
|
||||
$this->db_add_param($this->projekt_kurzbz).', '.
|
||||
$this->db_add_param($this->nummer).', '.
|
||||
$this->db_add_param($this->titel).', '.
|
||||
$this->db_add_param($this->beschreibung).', '.
|
||||
$this->db_add_param($this->beginn).', '.
|
||||
$this->db_add_param($this->ende).', '.
|
||||
$this->db_add_param($this->budget).', '.
|
||||
$this->db_add_param($this->farbe).', '.
|
||||
$this->db_add_param($this->oe_kurzbz).','.
|
||||
$this->db_add_param($this->aufwand_pt).','.
|
||||
$this->db_add_param($this->anzahl_ma).','.
|
||||
$this->db_add_param($this->aufwandstyp_kurzbz).', '.
|
||||
$this->db_add_param($this->zeitaufzeichnung,FHC_BOOLEAN).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
//Updaten des bestehenden Datensatzes
|
||||
|
||||
$qry = 'UPDATE fue.tbl_projekt SET ' .
|
||||
'projekt_kurzbz=' . $this->db_add_param($this->projekt_kurzbz) . ', ' .
|
||||
'nummer=' . $this->db_add_param($this->nummer) . ', ' .
|
||||
'titel=' . $this->db_add_param($this->titel) . ', ' .
|
||||
'beschreibung=' . $this->db_add_param($this->beschreibung) . ', ' .
|
||||
'beginn=' . $this->db_add_param($this->beginn) . ', ' .
|
||||
'ende=' . $this->db_add_param($this->ende) . ', ' .
|
||||
'budget=' . $this->db_add_param($this->budget) . ', ' .
|
||||
'farbe=' . $this->db_add_param($this->farbe) . ', ' .
|
||||
'oe_kurzbz=' . $this->db_add_param($this->oe_kurzbz) . ', ' .
|
||||
'anzahl_ma=' . $this->db_add_param($this->anzahl_ma) . ', ' .
|
||||
'aufwand_pt=' . $this->db_add_param($this->aufwand_pt) . ', ' .
|
||||
'aufwandstyp_kurzbz=' . $this->db_add_param($this->aufwandstyp_kurzbz) . ' ' .
|
||||
'WHERE projekt_kurzbz=' . $this->db_add_param($this->projekt_kurzbz) . ';';
|
||||
$qry = 'UPDATE fue.tbl_projekt SET '.
|
||||
'projekt_kurzbz='.$this->db_add_param($this->projekt_kurzbz).', '.
|
||||
'nummer='.$this->db_add_param($this->nummer).', '.
|
||||
'titel='.$this->db_add_param($this->titel).', '.
|
||||
'beschreibung='.$this->db_add_param($this->beschreibung).', '.
|
||||
'beginn='.$this->db_add_param($this->beginn).', '.
|
||||
'ende='.$this->db_add_param($this->ende).', '.
|
||||
'budget='.$this->db_add_param($this->budget).', '.
|
||||
'farbe='.$this->db_add_param($this->farbe).', '.
|
||||
'oe_kurzbz='.$this->db_add_param($this->oe_kurzbz).', '.
|
||||
'anzahl_ma='.$this->db_add_param($this->anzahl_ma).', '.
|
||||
'aufwand_pt='.$this->db_add_param($this->aufwand_pt).', '.
|
||||
'aufwandstyp_kurzbz='.$this->db_add_param($this->aufwandstyp_kurzbz).', '.
|
||||
'zeitaufzeichnung='.$this->db_add_param($this->zeitaufzeichnung,FHC_BOOLEAN).' '.
|
||||
'WHERE projekt_kurzbz='.$this->db_add_param($this->projekt_kurzbz).';';
|
||||
}
|
||||
|
||||
if ($this->db_query($qry)) {
|
||||
if ($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern der Daten';
|
||||
$this->getErrorMsg();
|
||||
var_dump($this->getErrorMsg());
|
||||
$this->errormsg = $this->getErrorMsg();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -331,7 +355,8 @@ class projekt extends basis_db
|
||||
{
|
||||
$qry = "DELETE FROM lehre.tbl_projek WHERE projekt_kurzbz=" . $this->db_add_param($projekt_kurzbz);
|
||||
|
||||
if ($this->db_query($qry)) {
|
||||
if ($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -365,29 +390,33 @@ class projekt extends basis_db
|
||||
)";
|
||||
|
||||
if ($projektphasen == true)
|
||||
{
|
||||
$qry .= "UNION
|
||||
|
||||
SELECT DISTINCT
|
||||
tbl_projekt.*
|
||||
FROM
|
||||
fue.tbl_projektphase
|
||||
JOIN fue.tbl_projekt USING (projekt_kurzbz)
|
||||
JOIN fue.tbl_projekt_ressource USING (projektphase_id)
|
||||
JOIN fue.tbl_ressource ON (tbl_ressource.ressource_id=tbl_projekt_ressource.ressource_id)
|
||||
WHERE
|
||||
(
|
||||
(
|
||||
(tbl_projekt.beginn<=now() or tbl_projekt.beginn is null)
|
||||
AND (tbl_projekt.ende + interval '1 month 1 day' >=now() OR tbl_projekt.ende is null)
|
||||
) OR (
|
||||
(tbl_projektphase.start<=now() or tbl_projektphase.start is null)
|
||||
AND (tbl_projektphase.ende + interval '1 month 1 day' >=now() OR tbl_projektphase.ende is null)
|
||||
)
|
||||
)
|
||||
AND mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid);
|
||||
SELECT DISTINCT
|
||||
tbl_projekt.*
|
||||
FROM
|
||||
fue.tbl_projektphase
|
||||
JOIN fue.tbl_projekt USING (projekt_kurzbz)
|
||||
JOIN fue.tbl_projekt_ressource USING (projektphase_id)
|
||||
JOIN fue.tbl_ressource ON (tbl_ressource.ressource_id=tbl_projekt_ressource.ressource_id)
|
||||
WHERE
|
||||
(
|
||||
(
|
||||
(tbl_projekt.beginn<=now() or tbl_projekt.beginn is null)
|
||||
AND (tbl_projekt.ende + interval '1 month 1 day' >=now() OR tbl_projekt.ende is null)
|
||||
) OR (
|
||||
(tbl_projektphase.start<=now() or tbl_projektphase.start is null)
|
||||
AND (tbl_projektphase.ende + interval '1 month 1 day' >=now() OR tbl_projektphase.ende is null)
|
||||
)
|
||||
)
|
||||
AND mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid);
|
||||
}
|
||||
|
||||
if ($result = $this->db_query($qry)) {
|
||||
while ($row = $this->db_fetch_object($result)) {
|
||||
if ($result = $this->db_query($qry))
|
||||
{
|
||||
while ($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new projekt();
|
||||
|
||||
$obj->projekt_kurzbz = $row->projekt_kurzbz;
|
||||
@@ -397,6 +426,7 @@ class projekt extends basis_db
|
||||
$obj->beginn = $row->beginn;
|
||||
$obj->ende = $row->ende;
|
||||
$obj->oe_kurzbz = $row->oe_kurzbz;
|
||||
$obj->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung);
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
@@ -410,7 +440,7 @@ class projekt extends basis_db
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert Ein Array mit Porjekten von allen Projekten des Mitarbeiters mit UID.
|
||||
* Liefert Ein Array mit Projekten von allen Projekten des Mitarbeiters mit UID.
|
||||
* Optional auch mit den Zuteilungen zu Projektphasen.
|
||||
* @param string $mitarbeiter_uid MitarbeiterUID.
|
||||
* @param bool $projektphasen Default false. Wenn true, werden auch Zuteilungen zu Projektphasen geliefert.
|
||||
@@ -419,44 +449,91 @@ class projekt extends basis_db
|
||||
function getProjekteListForMitarbeiter($mitarbeiter_uid, $projektphasen = false)
|
||||
{
|
||||
$projectList = array();
|
||||
$exists = @$this->db_query('SELECT 1 FROM sync.tbl_projects_timesheets_project LIMIT 1;');
|
||||
|
||||
$qry = "SELECT DISTINCT
|
||||
tbl_projekt.*
|
||||
FROM
|
||||
fue.tbl_ressource
|
||||
JOIN fue.tbl_projekt_ressource USING(ressource_id)
|
||||
JOIN fue.tbl_projekt USING(projekt_kurzbz)
|
||||
WHERE (beginn<=now() or beginn is null)
|
||||
";
|
||||
|
||||
if ($exists)
|
||||
{
|
||||
$qry .= ", tbl_sap_projects_timesheets.project_id
|
||||
";
|
||||
}
|
||||
|
||||
$qry .= "FROM
|
||||
fue.tbl_ressource
|
||||
JOIN fue.tbl_projekt_ressource USING(ressource_id)
|
||||
JOIN fue.tbl_projekt USING(projekt_kurzbz)
|
||||
";
|
||||
|
||||
if ($exists)
|
||||
{
|
||||
$qry .= "LEFT JOIN sync.tbl_projects_timesheets_project USING(projekt_id)
|
||||
LEFT JOIN sync.tbl_sap_projects_timesheets USING(projects_timesheet_id)
|
||||
";
|
||||
}
|
||||
|
||||
$qry .= "WHERE (beginn<=now() or beginn is null)
|
||||
AND (ende + interval '1 month 1 day' >=now() OR ende is null)
|
||||
AND
|
||||
(
|
||||
mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid) . " OR
|
||||
student_uid=" . $this->db_add_param($mitarbeiter_uid) . "
|
||||
)";
|
||||
)
|
||||
";
|
||||
|
||||
if ($exists)
|
||||
{
|
||||
$qry .= "AND tbl_projects_timesheets_project.projektphase_id IS NULL
|
||||
";
|
||||
}
|
||||
|
||||
if ($projektphasen == true)
|
||||
{
|
||||
$qry .= "UNION
|
||||
SELECT DISTINCT
|
||||
tbl_projekt.*
|
||||
";
|
||||
|
||||
SELECT DISTINCT
|
||||
tbl_projekt.*
|
||||
FROM
|
||||
fue.tbl_projektphase
|
||||
JOIN fue.tbl_projekt USING (projekt_kurzbz)
|
||||
JOIN fue.tbl_projekt_ressource USING (projektphase_id)
|
||||
JOIN fue.tbl_ressource ON (tbl_ressource.ressource_id=tbl_projekt_ressource.ressource_id)
|
||||
WHERE
|
||||
(
|
||||
(
|
||||
(tbl_projekt.beginn<=now() or tbl_projekt.beginn is null)
|
||||
AND (tbl_projekt.ende + interval '1 month 1 day' >=now() OR tbl_projekt.ende is null)
|
||||
) OR (
|
||||
(tbl_projektphase.start<=now() or tbl_projektphase.start is null)
|
||||
AND (tbl_projektphase.ende + interval '1 month 1 day' >=now() OR tbl_projektphase.ende is null)
|
||||
)
|
||||
)
|
||||
AND mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid);
|
||||
if ($exists)
|
||||
{
|
||||
$qry .= ", tbl_sap_projects_timesheets.project_task_id
|
||||
";
|
||||
}
|
||||
|
||||
if ($result = $this->db_query($qry)) {
|
||||
while ($row = $this->db_fetch_object($result)) {
|
||||
$qry .= "FROM fue.tbl_projektphase
|
||||
JOIN fue.tbl_projekt USING (projekt_kurzbz)
|
||||
JOIN fue.tbl_projekt_ressource USING(projektphase_id)
|
||||
JOIN fue.tbl_ressource ON (tbl_ressource.ressource_id=tbl_projekt_ressource.ressource_id)
|
||||
";
|
||||
|
||||
if ($exists)
|
||||
{
|
||||
$qry .= "LEFT JOIN sync.tbl_projects_timesheets_project ON tbl_projects_timesheets_project.projektphase_id = tbl_projekt_ressource.projektphase_id
|
||||
LEFT JOIN sync.tbl_sap_projects_timesheets USING(projects_timesheet_id)
|
||||
";
|
||||
}
|
||||
|
||||
$qry .= "WHERE
|
||||
(
|
||||
(
|
||||
(tbl_projekt.beginn<=now() or tbl_projekt.beginn is null)
|
||||
AND (tbl_projekt.ende + interval '1 month 1 day' >=now() OR tbl_projekt.ende is null)
|
||||
) OR (
|
||||
(tbl_projektphase.start<=now() or tbl_projektphase.start is null)
|
||||
AND (tbl_projektphase.ende + interval '1 month 1 day' >=now() OR tbl_projektphase.ende is null)
|
||||
)
|
||||
)
|
||||
";
|
||||
};
|
||||
|
||||
$qry .= "AND mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid);
|
||||
|
||||
if ($result = $this->db_query($qry))
|
||||
{
|
||||
while ($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new projekt();
|
||||
|
||||
$obj->projekt_kurzbz = $row->projekt_kurzbz;
|
||||
@@ -466,6 +543,8 @@ class projekt extends basis_db
|
||||
$obj->beginn = $row->beginn;
|
||||
$obj->ende = $row->ende;
|
||||
$obj->oe_kurzbz = $row->oe_kurzbz;
|
||||
if ($exists)
|
||||
$obj->sap_project_id = $row->project_id;
|
||||
|
||||
$this->result[] = $obj;
|
||||
|
||||
@@ -486,8 +565,10 @@ class projekt extends basis_db
|
||||
join wawi.tbl_projekt_bestellung USING (projekt_kurzbz)
|
||||
where bestellung_id= " . $this->db_add_param($bestellung_id);
|
||||
|
||||
if ($this->db_query($qry)) {
|
||||
if ($row = $this->db_fetch_object()) {
|
||||
if ($this->db_query($qry))
|
||||
{
|
||||
if ($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->projekt_kurzbz = $row->projekt_kurzbz;
|
||||
$this->nummer = $row->nummer;
|
||||
$this->titel = $row->titel;
|
||||
@@ -499,6 +580,7 @@ class projekt extends basis_db
|
||||
$this->farbe = $row->farbe;
|
||||
$this->anzahl_ma = $row->anzahl_ma;
|
||||
$this->aufwand_pt = $row->aufwand_pt;
|
||||
$this->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -548,7 +630,7 @@ class projekt extends basis_db
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
error_log('Exception abgefangen: ', $e->getMessage(), "\n");
|
||||
error_log('Exception abgefangen: ', $e->getMessage(), "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* Karl Burkhart <burkhart@technikum-wien.at>
|
||||
*/
|
||||
/**
|
||||
* Klasse projekttask
|
||||
* Klasse projektphase
|
||||
* @create 2011-05-23
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
@@ -48,6 +48,8 @@ class projektphase extends basis_db
|
||||
public $insertvon; // bigint
|
||||
public $updateamum; // timestamp
|
||||
public $updatevon; // bigint
|
||||
public $zeitaufzeichnung; // bool
|
||||
public $project_task_id;
|
||||
|
||||
|
||||
/**
|
||||
@@ -92,7 +94,7 @@ class projektphase extends basis_db
|
||||
$this->start = $row->start;
|
||||
$this->ende = $row->ende;
|
||||
$this->personentage = $row->personentage;
|
||||
$this->farbe = $row->farbe;
|
||||
$this->farbe = $row->farbe;
|
||||
$this->budget = $row->budget;
|
||||
$this->ressource_id = $row->ressource_id;
|
||||
$this->ressource_bezeichnung = $row->ressource_bezeichnung;
|
||||
@@ -100,6 +102,7 @@ class projektphase extends basis_db
|
||||
$this->insertvon = $row->insertvon;
|
||||
$this->updateamum = $row->updateamum;
|
||||
$this->updatevon = $row->updatevon;
|
||||
$this->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -134,7 +137,6 @@ class projektphase extends basis_db
|
||||
WHERE p.projektphase_fk=tasks.projektphase_fk
|
||||
) SELECT *
|
||||
FROM tasks) and projektphase_id not in (".$this->db_add_param($projektphase_id, FHC_INTEGER).")";
|
||||
//echo "\n".$qry."\n";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
@@ -151,17 +153,18 @@ class projektphase extends basis_db
|
||||
$obj->start = $row->start;
|
||||
$obj->ende = $row->ende;
|
||||
//$obj->personentage = $row->personentage;
|
||||
$obj->farbe = $row->farbe;
|
||||
$obj->farbe = $row->farbe;
|
||||
$obj->budget = $row->budget;
|
||||
$obj->ressource_id = $row->ressource_id;
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
$obj->updateamum = $row->updateamum;
|
||||
$obj->updatevon = $row->updatevon;
|
||||
$obj->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung);
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
//var_dump($this->result);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -183,7 +186,6 @@ class projektphase extends basis_db
|
||||
$qry = "SELECT tbl_projektphase.*, tbl_ressource.bezeichnung AS ressource_bezeichnung
|
||||
FROM fue.tbl_projektphase LEFT OUTER JOIN fue.tbl_ressource USING (ressource_id)
|
||||
WHERE projekt_kurzbz=".$this->db_add_param($projekt_kurzbz);
|
||||
//echo "\n".$qry."\n";
|
||||
|
||||
if(!is_null($foreignkey))
|
||||
$qry .= " and projektphase_fk is NULL";
|
||||
@@ -204,8 +206,8 @@ class projektphase extends basis_db
|
||||
$obj->beschreibung = $row->beschreibung;
|
||||
$obj->start = $row->start;
|
||||
$obj->ende = $row->ende;
|
||||
//$obj->personentage = $row->personentage;
|
||||
$obj->farbe = $row->farbe;
|
||||
$obj->personentage = $row->personentage;
|
||||
$obj->farbe = $row->farbe;
|
||||
$obj->budget = $row->budget;
|
||||
$obj->ressource_id = $row->ressource_id;
|
||||
$obj->ressource_bezeichnung = $row->ressource_bezeichnung;
|
||||
@@ -213,10 +215,10 @@ class projektphase extends basis_db
|
||||
$obj->insertvon = $row->insertvon;
|
||||
$obj->updateamum = $row->updateamum;
|
||||
$obj->updatevon = $row->updatevon;
|
||||
$obj->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung);
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
//var_dump($this->result);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -226,22 +228,22 @@ class projektphase extends basis_db
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lädt alle Unterphasen zu einem Projekt
|
||||
* @param type $phase_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function getAllUnterphasen($phase_id)
|
||||
{
|
||||
$qry = "SELECT tbl_projektphase.*, tbl_ressource.bezeichnung AS ressource_bezeichung
|
||||
/**
|
||||
* Lädt alle Unterphasen zu einem Projekt
|
||||
* @param type $phase_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function getAllUnterphasen($phase_id)
|
||||
{
|
||||
$qry = "SELECT tbl_projektphase.*, tbl_ressource.bezeichnung AS ressource_bezeichung
|
||||
FROM fue.tbl_projektphase LEFT OUTER JOIN fue.tbl_ressource USING (ressource_id)
|
||||
WHERE projektphase_fk =".$this->db_add_param($phase_id, FHC_INTEGER);
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$obj = new projektphase();
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$obj = new projektphase();
|
||||
|
||||
$obj->projekt_kurzbz = $row->projekt_kurzbz;
|
||||
$obj->projektphase_id = $row->projektphase_id;
|
||||
@@ -252,7 +254,7 @@ class projektphase extends basis_db
|
||||
$obj->start = $row->start;
|
||||
$obj->ende = $row->ende;
|
||||
//$obj->personentage = $row->personentage;
|
||||
$obj->farbe = $row->farbe;
|
||||
$obj->farbe = $row->farbe;
|
||||
$obj->budget = $row->budget;
|
||||
$obj->ressource_id = $row->ressource_id;
|
||||
$obj->ressource_bezeichnung = $row->ressource_bezeichnung;
|
||||
@@ -260,17 +262,18 @@ class projektphase extends basis_db
|
||||
$obj->insertvon = $row->insertvon;
|
||||
$obj->updateamum = $row->updateamum;
|
||||
$obj->updatevon = $row->updatevon;
|
||||
$obj->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung);
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = "Fehler beim laden der Daten";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = "Fehler beim Laden der Daten";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prueft die Variablen auf Gueltigkeit
|
||||
@@ -319,22 +322,22 @@ class projektphase extends basis_db
|
||||
if($new)
|
||||
{
|
||||
//Neuen Datensatz einfuegen
|
||||
|
||||
$qry='BEGIN; INSERT INTO fue.tbl_projektphase (projekt_kurzbz, projektphase_fk, bezeichnung, typ,
|
||||
beschreibung, start, ende, budget, ressource_id, insertvon, insertamum, updatevon, updateamum, farbe, personentage) VALUES ('.
|
||||
$this->db_add_param($this->projekt_kurzbz).', '.
|
||||
$this->db_add_param($this->projektphase_fk).', '.
|
||||
$this->db_add_param($this->bezeichnung).', '.
|
||||
$this->db_add_param($this->typ).', '.
|
||||
$this->db_add_param($this->beschreibung).', '.
|
||||
$this->db_add_param($this->start).', '.
|
||||
$this->db_add_param($this->ende).', '.
|
||||
$this->db_add_param($this->budget).', '.
|
||||
$this->db_add_param($this->ressource_id).', '.
|
||||
$this->db_add_param($this->insertvon).', now(), '.
|
||||
$this->db_add_param($this->updatevon).', now(), '.
|
||||
$this->db_add_param($this->farbe).', '.
|
||||
$this->db_add_param($this->personentage).' );';
|
||||
beschreibung, start, ende, budget, ressource_id, insertvon, insertamum, updatevon, updateamum, farbe, personentage, zeitaufzeichnung) VALUES ('.
|
||||
$this->db_add_param($this->projekt_kurzbz).', '.
|
||||
$this->db_add_param($this->projektphase_fk).', '.
|
||||
$this->db_add_param($this->bezeichnung).', '.
|
||||
$this->db_add_param($this->typ).', '.
|
||||
$this->db_add_param($this->beschreibung).', '.
|
||||
$this->db_add_param($this->start).', '.
|
||||
$this->db_add_param($this->ende).', '.
|
||||
$this->db_add_param($this->budget).', '.
|
||||
$this->db_add_param($this->ressource_id).', '.
|
||||
$this->db_add_param($this->insertvon).', now(), '.
|
||||
$this->db_add_param($this->updatevon).', now(), '.
|
||||
$this->db_add_param($this->farbe).', '.
|
||||
$this->db_add_param($this->personentage).', '.
|
||||
$this->db_add_param($this->zeitaufzeichnung,FHC_BOOLEAN).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -349,11 +352,12 @@ class projektphase extends basis_db
|
||||
'start='.$this->db_add_param($this->start).', '.
|
||||
'ende='.$this->db_add_param($this->ende).', '.
|
||||
'budget='.$this->db_add_param($this->budget).', '.
|
||||
'ressource_id='.$this->db_add_param($this->ressource_id).', '.
|
||||
'farbe='.$this->db_add_param($this->farbe).', '.
|
||||
'ressource_id='.$this->db_add_param($this->ressource_id).', '.
|
||||
'farbe='.$this->db_add_param($this->farbe).', '.
|
||||
'personentage='.$this->db_add_param($this->personentage).', '.
|
||||
'updateamum= now(), '.
|
||||
'updatevon='.$this->db_add_param($this->updatevon).' '.
|
||||
'updatevon='.$this->db_add_param($this->updatevon).', '.
|
||||
'zeitaufzeichnung='.$this->db_add_param($this->zeitaufzeichnung,FHC_BOOLEAN).' '.
|
||||
'WHERE projektphase_id='.$this->db_add_param($this->projektphase_id, FHC_INTEGER).';';
|
||||
}
|
||||
|
||||
@@ -528,7 +532,7 @@ class projektphase extends basis_db
|
||||
* gibt den Fortschritt der Phase in Prozent zurück --> Phasen die auf die übergebene Phase zeigen werden berücksichtigt
|
||||
* @param $projektphase_id
|
||||
*/
|
||||
public function getFortschritt($projektphase_id)
|
||||
public function getFortschritt($projektphase_id)
|
||||
{
|
||||
$qry = "Select * from fue.tbl_projektphase phase
|
||||
join fue.tbl_projekttask task using(projektphase_id)
|
||||
@@ -685,26 +689,42 @@ public function getFortschritt($projektphase_id)
|
||||
public function getProjectphaseForMitarbeiter($mitarbeiter_uid)
|
||||
{
|
||||
$projecphasetList = array();
|
||||
$exists = @$this->db_query('SELECT 1 FROM sync.tbl_projects_timesheets_project LIMIT 1;');
|
||||
|
||||
$qry = "
|
||||
SELECT
|
||||
DISTINCT tbl_projektphase.*
|
||||
FROM
|
||||
fue.tbl_projektphase
|
||||
JOIN fue.tbl_projekt USING (projekt_kurzbz)
|
||||
JOIN fue.tbl_projekt_ressource USING (projektphase_id)
|
||||
JOIN fue.tbl_ressource ON (tbl_ressource.ressource_id=tbl_projekt_ressource.ressource_id)
|
||||
WHERE
|
||||
(
|
||||
(
|
||||
(tbl_projekt.beginn<=now() or tbl_projekt.beginn is null)
|
||||
AND (tbl_projekt.ende + interval '1 month 1 day' >=now() OR tbl_projekt.ende is null)
|
||||
) AND (
|
||||
(tbl_projektphase.start<=now() or tbl_projektphase.start is null)
|
||||
AND (tbl_projektphase.ende + interval '1 month 1 day' >=now() OR tbl_projektphase.ende is null)
|
||||
)
|
||||
)
|
||||
AND mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid);
|
||||
$qry = "SELECT DISTINCT tbl_projektphase.*,
|
||||
tbl_projekt.titel
|
||||
";
|
||||
|
||||
if ($exists)
|
||||
{
|
||||
$qry .= ", tbl_sap_projects_timesheets.project_task_id
|
||||
";
|
||||
}
|
||||
|
||||
$qry .= "FROM fue.tbl_projektphase
|
||||
JOIN fue.tbl_projekt USING (projekt_kurzbz)
|
||||
JOIN fue.tbl_projekt_ressource USING(projektphase_id)
|
||||
JOIN fue.tbl_ressource ON (tbl_ressource.ressource_id=tbl_projekt_ressource.ressource_id)
|
||||
";
|
||||
|
||||
if ($exists)
|
||||
{
|
||||
$qry .= "LEFT JOIN sync.tbl_projects_timesheets_project ON tbl_projects_timesheets_project.projektphase_id = tbl_projekt_ressource.projektphase_id
|
||||
LEFT JOIN sync.tbl_sap_projects_timesheets USING(projects_timesheet_id)
|
||||
";
|
||||
}
|
||||
|
||||
$qry .= "WHERE
|
||||
(
|
||||
(
|
||||
(tbl_projekt.beginn<=now() or tbl_projekt.beginn is null)
|
||||
AND (tbl_projekt.ende + interval '1 month 1 day' >=now() OR tbl_projekt.ende is null)
|
||||
) AND (
|
||||
(tbl_projektphase.start<=now() or tbl_projektphase.start is null)
|
||||
AND (tbl_projektphase.ende + interval '1 month 1 day' >=now() OR tbl_projektphase.ende is null)
|
||||
)
|
||||
)
|
||||
AND mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid);
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
@@ -718,6 +738,7 @@ public function getFortschritt($projektphase_id)
|
||||
$obj->bezeichnung = $row->bezeichnung;
|
||||
$obj->typ = $row->typ;
|
||||
$obj->beschreibung = $row->beschreibung;
|
||||
$obj->projekttitel = $row->titel;
|
||||
$obj->start = $row->start;
|
||||
$obj->ende = $row->ende;
|
||||
$obj->personentage = $row->personentage;
|
||||
@@ -728,6 +749,8 @@ public function getFortschritt($projektphase_id)
|
||||
$obj->insertvon = $row->insertvon;
|
||||
$obj->updateamum = $row->updateamum;
|
||||
$obj->updatevon = $row->updatevon;
|
||||
if ($exists)
|
||||
$obj->project_task_id = $row->project_task_id;
|
||||
|
||||
$this->result[] = $obj;
|
||||
|
||||
|
||||
+22
-19
@@ -361,13 +361,13 @@ class pruefling extends basis_db
|
||||
|
||||
$qry = "
|
||||
SELECT DISTINCT ON (vw_auswertung_ablauf.gebiet_id) gebiet_id,
|
||||
vw_auswertung_ablauf.*,
|
||||
vw_auswertung_ablauf.*,
|
||||
tbl_studiengang.typ
|
||||
FROM
|
||||
FROM
|
||||
testtool.vw_auswertung_ablauf
|
||||
JOIN
|
||||
JOIN
|
||||
public.tbl_studiengang USING (studiengang_kz)
|
||||
WHERE
|
||||
WHERE
|
||||
reihungstest_id = ".$this->db_add_param($reihungstest_id, FHC_INTEGER);
|
||||
|
||||
// Ggf. die Basis-Fragengebiete ermitteln (ohne Quereinsteigergebiete)
|
||||
@@ -387,8 +387,8 @@ class pruefling extends basis_db
|
||||
if (!empty($basis_gebiet_id_toString))
|
||||
{
|
||||
$qry .= "
|
||||
AND
|
||||
gebiet_id IN (". $basis_gebiet_id_toString. ")
|
||||
AND
|
||||
gebiet_id IN (". $basis_gebiet_id_toString. ")
|
||||
";
|
||||
}
|
||||
}
|
||||
@@ -400,13 +400,16 @@ class pruefling extends basis_db
|
||||
{
|
||||
$excluded_gebiete = unserialize(FAS_REIHUNGSTEST_EXCLUDE_GEBIETE);
|
||||
$exclude_gebiet_id_arr = $excluded_gebiete;
|
||||
$exclude_gebiet_id_toString = implode(', ', $exclude_gebiet_id_arr);
|
||||
$qry .= "
|
||||
AND
|
||||
gebiet_id NOT IN (". $exclude_gebiet_id_toString. ")
|
||||
AND
|
||||
typ = 'b'
|
||||
";
|
||||
if (is_array($exclude_gebiet_id_arr) && count($exclude_gebiet_id_arr) > 0)
|
||||
{
|
||||
$exclude_gebiet_id_toString = implode(', ', $exclude_gebiet_id_arr);
|
||||
$qry .= "
|
||||
AND
|
||||
gebiet_id NOT IN (". $exclude_gebiet_id_toString. ")
|
||||
AND
|
||||
typ = 'b'
|
||||
";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,21 +424,21 @@ class pruefling extends basis_db
|
||||
prestudent_id
|
||||
FROM
|
||||
public.tbl_rt_person
|
||||
JOIN
|
||||
JOIN
|
||||
public.tbl_prestudent USING(person_id)
|
||||
JOIN
|
||||
public.tbl_prestudentstatus USING (prestudent_id, studienplan_id)
|
||||
JOIN
|
||||
JOIN
|
||||
tbl_reihungstest ON (
|
||||
tbl_rt_person.rt_id = tbl_reihungstest.reihungstest_id
|
||||
tbl_rt_person.rt_id = tbl_reihungstest.reihungstest_id
|
||||
)
|
||||
WHERE
|
||||
tbl_rt_person.person_id = ".$this->db_add_param($person_id, FHC_INTEGER)."
|
||||
AND
|
||||
AND
|
||||
tbl_rt_person.rt_id = ".$this->db_add_param($reihungstest_id, FHC_INTEGER)."
|
||||
AND
|
||||
AND
|
||||
tbl_prestudentstatus.status_kurzbz='Interessent'
|
||||
AND
|
||||
AND
|
||||
tbl_prestudentstatus.studiensemester_kurzbz = tbl_reihungstest.studiensemester_kurzbz
|
||||
ORDER BY tbl_reihungstest.datum DESC, tbl_prestudent.priorisierung ASC LIMIT 1
|
||||
)
|
||||
|
||||
@@ -1247,15 +1247,16 @@ class reihungstest extends basis_db
|
||||
*/
|
||||
public function getReihungstestPersonDatum($prestudent_id, $datum)
|
||||
{
|
||||
$qry = "SELECT
|
||||
tbl_rt_person.*
|
||||
FROM
|
||||
public.tbl_rt_person
|
||||
JOIN public.tbl_prestudent USING(person_id)
|
||||
JOIN public.tbl_reihungstest ON(tbl_reihungstest.reihungstest_id=tbl_rt_person.rt_id)
|
||||
WHERE
|
||||
tbl_prestudent.prestudent_id = ".$this->db_add_param($prestudent_id)."
|
||||
AND tbl_reihungstest.datum=".$this->db_add_param($datum);
|
||||
$qry = "SELECT rt_person.*
|
||||
FROM tbl_prestudent ps
|
||||
JOIN tbl_prestudentstatus pss ON ps.prestudent_id = pss.prestudent_id
|
||||
JOIN tbl_rt_person rt_person ON ps.person_id = rt_person.person_id
|
||||
JOIN tbl_reihungstest rt ON rt_person.rt_id = rt.reihungstest_id
|
||||
JOIN tbl_rt_studienplan rtstp ON rt.reihungstest_id = rtstp.reihungstest_id
|
||||
WHERE ps.prestudent_id = ".$this->db_add_param($prestudent_id)."
|
||||
AND rtstp.studienplan_id = pss.studienplan_id
|
||||
AND rt.datum=".$this->db_add_param($datum);
|
||||
|
||||
if ($result = $this->db_query($qry))
|
||||
{
|
||||
while ($row = $this->db_fetch_object($result))
|
||||
|
||||
@@ -1,687 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/3_0.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Alexander Zhukov <alex@veresk.ru> Original port from Python |
|
||||
// | Authors: Harry Fuecks <hfuecks@phppatterns.com> Port to PEAR + more |
|
||||
// | Authors: Many @ Sitepointforums Advanced PHP Forums |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: HTMLSax3.php,v 1.1 2007/07/20 17:16:35 claudiucristea Exp $
|
||||
//
|
||||
/**
|
||||
* Main parser components
|
||||
* @package XML_HTMLSax3
|
||||
* @version $Id: HTMLSax3.php,v 1.1 2007/07/20 17:16:35 claudiucristea Exp $
|
||||
*/
|
||||
/**
|
||||
* Required classes
|
||||
*/
|
||||
if (!defined('XML_HTMLSAX3')) {
|
||||
define('XML_HTMLSAX3', 'XML/');
|
||||
}
|
||||
require_once(XML_HTMLSAX3 . 'HTMLSax3/States.php');
|
||||
require_once(XML_HTMLSAX3 . 'HTMLSax3/Decorators.php');
|
||||
|
||||
/**
|
||||
* Base State Parser
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
* @abstract
|
||||
*/
|
||||
class XML_HTMLSax3_StateParser {
|
||||
/**
|
||||
* Instance of user front end class to be passed to callbacks
|
||||
* @var XML_HTMLSax3
|
||||
* @access private
|
||||
*/
|
||||
var $htmlsax;
|
||||
/**
|
||||
* User defined object for handling elements
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $handler_object_element;
|
||||
/**
|
||||
* User defined open tag handler method
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $handler_method_opening;
|
||||
/**
|
||||
* User defined close tag handler method
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $handler_method_closing;
|
||||
/**
|
||||
* User defined object for handling data in elements
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $handler_object_data;
|
||||
/**
|
||||
* User defined data handler method
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $handler_method_data;
|
||||
/**
|
||||
* User defined object for handling processing instructions
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $handler_object_pi;
|
||||
/**
|
||||
* User defined processing instruction handler method
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $handler_method_pi;
|
||||
/**
|
||||
* User defined object for handling JSP/ASP tags
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $handler_object_jasp;
|
||||
/**
|
||||
* User defined JSP/ASP handler method
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $handler_method_jasp;
|
||||
/**
|
||||
* User defined object for handling XML escapes
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $handler_object_escape;
|
||||
/**
|
||||
* User defined XML escape handler method
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $handler_method_escape;
|
||||
/**
|
||||
* User defined handler object or NullHandler
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $handler_default;
|
||||
/**
|
||||
* Parser options determining parsing behavior
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $parser_options = array();
|
||||
/**
|
||||
* XML document being parsed
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $rawtext;
|
||||
/**
|
||||
* Position in XML document relative to start (0)
|
||||
* @var int
|
||||
* @access private
|
||||
*/
|
||||
var $position;
|
||||
/**
|
||||
* Length of the XML document in characters
|
||||
* @var int
|
||||
* @access private
|
||||
*/
|
||||
var $length;
|
||||
/**
|
||||
* Array of state objects
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $State = array();
|
||||
|
||||
/**
|
||||
* Constructs XML_HTMLSax3_StateParser setting up states
|
||||
* @var XML_HTMLSax3 instance of user front end class
|
||||
* @access protected
|
||||
*/
|
||||
function XML_HTMLSax3_StateParser (& $htmlsax) {
|
||||
$this->htmlsax = & $htmlsax;
|
||||
$this->State[XML_HTMLSAX3_STATE_START] = new XML_HTMLSax3_StartingState();
|
||||
|
||||
$this->State[XML_HTMLSAX3_STATE_CLOSING_TAG] = new XML_HTMLSax3_ClosingTagState();
|
||||
$this->State[XML_HTMLSAX3_STATE_TAG] = new XML_HTMLSax3_TagState();
|
||||
$this->State[XML_HTMLSAX3_STATE_OPENING_TAG] = new XML_HTMLSax3_OpeningTagState();
|
||||
|
||||
$this->State[XML_HTMLSAX3_STATE_PI] = new XML_HTMLSax3_PiState();
|
||||
$this->State[XML_HTMLSAX3_STATE_JASP] = new XML_HTMLSax3_JaspState();
|
||||
$this->State[XML_HTMLSAX3_STATE_ESCAPE] = new XML_HTMLSax3_EscapeState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the position back one character
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
function unscanCharacter() {
|
||||
$this->position -= 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the position forward one character
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
function ignoreCharacter() {
|
||||
$this->position += 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next character from the XML document or void if at end
|
||||
* @access protected
|
||||
* @return mixed
|
||||
*/
|
||||
function scanCharacter() {
|
||||
if ($this->position < $this->length) {
|
||||
return $this->rawtext{$this->position++};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string from the current position to the next occurance
|
||||
* of the supplied string
|
||||
* @param string string to search until
|
||||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
function scanUntilString($string) {
|
||||
$start = $this->position;
|
||||
$this->position = strpos($this->rawtext, $string, $start);
|
||||
if ($this->position === FALSE) {
|
||||
$this->position = $this->length;
|
||||
}
|
||||
return substr($this->rawtext, $start, $this->position - $start);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string from the current position until the first instance of
|
||||
* one of the characters in the supplied string argument
|
||||
* @param string string to search until
|
||||
* @access protected
|
||||
* @return string
|
||||
* @abstract
|
||||
*/
|
||||
function scanUntilCharacters($string) {}
|
||||
|
||||
/**
|
||||
* Moves the position forward past any whitespace characters
|
||||
* @access protected
|
||||
* @return void
|
||||
* @abstract
|
||||
*/
|
||||
function ignoreWhitespace() {}
|
||||
|
||||
/**
|
||||
* Begins the parsing operation, setting up any decorators, depending on
|
||||
* parse options invoking _parse() to execute parsing
|
||||
* @param string XML document to parse
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
function parse($data) {
|
||||
if ($this->parser_options['XML_OPTION_TRIM_DATA_NODES']==1) {
|
||||
$decorator = new XML_HTMLSax3_Trim(
|
||||
$this->handler_object_data,
|
||||
$this->handler_method_data);
|
||||
$this->handler_object_data =& $decorator;
|
||||
$this->handler_method_data = 'trimData';
|
||||
}
|
||||
if ($this->parser_options['XML_OPTION_CASE_FOLDING']==1) {
|
||||
$open_decor = new XML_HTMLSax3_CaseFolding(
|
||||
$this->handler_object_element,
|
||||
$this->handler_method_opening,
|
||||
$this->handler_method_closing);
|
||||
$this->handler_object_element =& $open_decor;
|
||||
$this->handler_method_opening ='foldOpen';
|
||||
$this->handler_method_closing ='foldClose';
|
||||
}
|
||||
if ($this->parser_options['XML_OPTION_LINEFEED_BREAK']==1) {
|
||||
$decorator = new XML_HTMLSax3_Linefeed(
|
||||
$this->handler_object_data,
|
||||
$this->handler_method_data);
|
||||
$this->handler_object_data =& $decorator;
|
||||
$this->handler_method_data = 'breakData';
|
||||
}
|
||||
if ($this->parser_options['XML_OPTION_TAB_BREAK']==1) {
|
||||
$decorator = new XML_HTMLSax3_Tab(
|
||||
$this->handler_object_data,
|
||||
$this->handler_method_data);
|
||||
$this->handler_object_data =& $decorator;
|
||||
$this->handler_method_data = 'breakData';
|
||||
}
|
||||
if ($this->parser_options['XML_OPTION_ENTITIES_UNPARSED']==1) {
|
||||
$decorator = new XML_HTMLSax3_Entities_Unparsed(
|
||||
$this->handler_object_data,
|
||||
$this->handler_method_data);
|
||||
$this->handler_object_data =& $decorator;
|
||||
$this->handler_method_data = 'breakData';
|
||||
}
|
||||
if ($this->parser_options['XML_OPTION_ENTITIES_PARSED']==1) {
|
||||
$decorator = new XML_HTMLSax3_Entities_Parsed(
|
||||
$this->handler_object_data,
|
||||
$this->handler_method_data);
|
||||
$this->handler_object_data =& $decorator;
|
||||
$this->handler_method_data = 'breakData';
|
||||
}
|
||||
// Note switched on by default
|
||||
if ($this->parser_options['XML_OPTION_STRIP_ESCAPES']==1) {
|
||||
$decorator = new XML_HTMLSax3_Escape_Stripper(
|
||||
$this->handler_object_escape,
|
||||
$this->handler_method_escape);
|
||||
$this->handler_object_escape =& $decorator;
|
||||
$this->handler_method_escape = 'strip';
|
||||
}
|
||||
$this->rawtext = $data;
|
||||
$this->length = strlen($data);
|
||||
$this->position = 0;
|
||||
$this->_parse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the parsing itself, delegating calls to a specific parser
|
||||
* state
|
||||
* @param constant state object to parse with
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
function _parse($state = XML_HTMLSAX3_STATE_START) {
|
||||
do {
|
||||
$state = $this->State[$state]->parse($this);
|
||||
} while ($state != XML_HTMLSAX3_STATE_STOP &&
|
||||
$this->position < $this->length);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parser for PHP Versions below 4.3.0. Uses a slower parsing mechanism than
|
||||
* the equivalent PHP 4.3.0+ subclass of StateParser
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
* @see XML_HTMLSax3_StateParser_Gtet430
|
||||
*/
|
||||
class XML_HTMLSax3_StateParser_Lt430 extends XML_HTMLSax3_StateParser {
|
||||
/**
|
||||
* Constructs XML_HTMLSax3_StateParser_Lt430 defining available
|
||||
* parser options
|
||||
* @var XML_HTMLSax3 instance of user front end class
|
||||
* @access protected
|
||||
*/
|
||||
function XML_HTMLSax3_StateParser_Lt430(& $htmlsax) {
|
||||
parent::XML_HTMLSax3_StateParser($htmlsax);
|
||||
$this->parser_options['XML_OPTION_TRIM_DATA_NODES'] = 0;
|
||||
$this->parser_options['XML_OPTION_CASE_FOLDING'] = 0;
|
||||
$this->parser_options['XML_OPTION_LINEFEED_BREAK'] = 0;
|
||||
$this->parser_options['XML_OPTION_TAB_BREAK'] = 0;
|
||||
$this->parser_options['XML_OPTION_ENTITIES_PARSED'] = 0;
|
||||
$this->parser_options['XML_OPTION_ENTITIES_UNPARSED'] = 0;
|
||||
$this->parser_options['XML_OPTION_STRIP_ESCAPES'] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string from the current position until the first instance of
|
||||
* one of the characters in the supplied string argument
|
||||
* @param string string to search until
|
||||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
function scanUntilCharacters($string) {
|
||||
$startpos = $this->position;
|
||||
while ($this->position < $this->length && strpos($string, $this->rawtext{$this->position}) === FALSE) {
|
||||
$this->position++;
|
||||
}
|
||||
return substr($this->rawtext, $startpos, $this->position - $startpos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the position forward past any whitespace characters
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
function ignoreWhitespace() {
|
||||
while ($this->position < $this->length &&
|
||||
strpos(" \n\r\t", $this->rawtext{$this->position}) !== FALSE) {
|
||||
$this->position++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Begins the parsing operation, setting up the unparsed XML entities
|
||||
* decorator if necessary then delegating further work to parent
|
||||
* @param string XML document to parse
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
function parse($data) {
|
||||
parent::parse($data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parser for PHP Versions equal to or greater than 4.3.0. Uses a faster
|
||||
* parsing mechanism than the equivalent PHP < 4.3.0 subclass of StateParser
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
* @see XML_HTMLSax3_StateParser_Lt430
|
||||
*/
|
||||
class XML_HTMLSax3_StateParser_Gtet430 extends XML_HTMLSax3_StateParser {
|
||||
/**
|
||||
* Constructs XML_HTMLSax3_StateParser_Gtet430 defining available
|
||||
* parser options
|
||||
* @var XML_HTMLSax3 instance of user front end class
|
||||
* @access protected
|
||||
*/
|
||||
function XML_HTMLSax3_StateParser_Gtet430(& $htmlsax) {
|
||||
parent::XML_HTMLSax3_StateParser($htmlsax);
|
||||
$this->parser_options['XML_OPTION_TRIM_DATA_NODES'] = 0;
|
||||
$this->parser_options['XML_OPTION_CASE_FOLDING'] = 0;
|
||||
$this->parser_options['XML_OPTION_LINEFEED_BREAK'] = 0;
|
||||
$this->parser_options['XML_OPTION_TAB_BREAK'] = 0;
|
||||
$this->parser_options['XML_OPTION_ENTITIES_PARSED'] = 0;
|
||||
$this->parser_options['XML_OPTION_ENTITIES_UNPARSED'] = 0;
|
||||
$this->parser_options['XML_OPTION_STRIP_ESCAPES'] = 0;
|
||||
}
|
||||
/**
|
||||
* Returns a string from the current position until the first instance of
|
||||
* one of the characters in the supplied string argument.
|
||||
* @param string string to search until
|
||||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
function scanUntilCharacters($string) {
|
||||
$startpos = $this->position;
|
||||
$length = strcspn($this->rawtext, $string, $startpos);
|
||||
$this->position += $length;
|
||||
return substr($this->rawtext, $startpos, $length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the position forward past any whitespace characters
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
function ignoreWhitespace() {
|
||||
$this->position += strspn($this->rawtext, " \n\r\t", $this->position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begins the parsing operation, setting up the parsed and unparsed
|
||||
* XML entity decorators if necessary then delegating further work
|
||||
* to parent
|
||||
* @param string XML document to parse
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
function parse($data) {
|
||||
parent::parse($data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Default NullHandler for methods which were not set by user
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_NullHandler {
|
||||
/**
|
||||
* Generic handler method which does nothing
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
function DoNothing() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* User interface class. All user calls should only be made to this class
|
||||
* @package XML_HTMLSax3
|
||||
* @access public
|
||||
*/
|
||||
class XML_HTMLSax3 {
|
||||
/**
|
||||
* Instance of concrete subclass of XML_HTMLSax3_StateParser
|
||||
* @var XML_HTMLSax3_StateParser
|
||||
* @access private
|
||||
*/
|
||||
var $state_parser;
|
||||
|
||||
/**
|
||||
* Constructs XML_HTMLSax3 selecting concrete StateParser subclass
|
||||
* depending on PHP version being used as well as setting the default
|
||||
* NullHandler for all callbacks<br />
|
||||
* <b>Example:</b>
|
||||
* <pre>
|
||||
* $myHandler = & new MyHandler();
|
||||
* $parser = new XML_HTMLSax3();
|
||||
* $parser->set_object($myHandler);
|
||||
* $parser->set_option('XML_OPTION_CASE_FOLDING');
|
||||
* $parser->set_element_handler('myOpenHandler','myCloseHandler');
|
||||
* $parser->set_data_handler('myDataHandler');
|
||||
* $parser->parser($xml);
|
||||
* </pre>
|
||||
* @access public
|
||||
*/
|
||||
function XML_HTMLSax3() {
|
||||
if (version_compare(phpversion(), '4.3', 'ge')) {
|
||||
$this->state_parser = new XML_HTMLSax3_StateParser_Gtet430($this);
|
||||
} else {
|
||||
$this->state_parser = new XML_HTMLSax3_StateParser_Lt430($this);
|
||||
}
|
||||
$nullhandler = new XML_HTMLSax3_NullHandler();
|
||||
$this->set_object($nullhandler);
|
||||
$this->set_element_handler('DoNothing', 'DoNothing');
|
||||
$this->set_data_handler('DoNothing');
|
||||
$this->set_pi_handler('DoNothing');
|
||||
$this->set_jasp_handler('DoNothing');
|
||||
$this->set_escape_handler('DoNothing');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user defined handler object. Returns a PEAR Error
|
||||
* if supplied argument is not an object.
|
||||
* @param object handler object containing SAX callback methods
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
function set_object(&$object) {
|
||||
if ( is_object($object) ) {
|
||||
$this->state_parser->handler_default =& $object;
|
||||
return true;
|
||||
} else {
|
||||
require_once('PEAR.php');
|
||||
PEAR::raiseError('XML_HTMLSax3::set_object requires '.
|
||||
'an object instance');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a parser option. By default all options are switched off.
|
||||
* Returns a PEAR Error if option is invalid<br />
|
||||
* <b>Available options:</b>
|
||||
* <ul>
|
||||
* <li>XML_OPTION_TRIM_DATA_NODES: trim whitespace off the beginning
|
||||
* and end of data passed to the data handler</li>
|
||||
* <li>XML_OPTION_LINEFEED_BREAK: linefeeds result in additional data
|
||||
* handler calls</li>
|
||||
* <li>XML_OPTION_TAB_BREAK: tabs result in additional data handler
|
||||
* calls</li>
|
||||
* <li>XML_OPTION_ENTITIES_UNPARSED: XML entities are returned as
|
||||
* seperate data handler calls in unparsed form</li>
|
||||
* <li>XML_OPTION_ENTITIES_PARSED: (PHP 4.3.0+ only) XML entities are
|
||||
* returned as seperate data handler calls and are parsed with
|
||||
* PHP's html_entity_decode() function</li>
|
||||
* <li>XML_OPTION_STRIP_ESCAPES: strips out the -- -- comment markers
|
||||
* or CDATA markup inside an XML escape, if found.</li>
|
||||
* </ul>
|
||||
* To get HTMLSax to behave in the same way as the native PHP SAX parser,
|
||||
* using it's default state, you need to switch on XML_OPTION_LINEFEED_BREAK,
|
||||
* XML_OPTION_ENTITIES_PARSED and XML_OPTION_CASE_FOLDING
|
||||
* @param string name of parser option
|
||||
* @param int (optional) 1 to switch on, 0 for off
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
function set_option($name, $value=1) {
|
||||
if ( array_key_exists($name,$this->state_parser->parser_options) ) {
|
||||
$this->state_parser->parser_options[$name] = $value;
|
||||
return true;
|
||||
} else {
|
||||
require_once('PEAR.php');
|
||||
PEAR::raiseError('XML_HTMLSax3::set_option('.$name.') illegal');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the data handler method which deals with the contents of XML
|
||||
* elements.<br />
|
||||
* The handler method must accept two arguments, the first being an
|
||||
* instance of XML_HTMLSax3 and the second being the contents of an
|
||||
* XML element e.g.
|
||||
* <pre>
|
||||
* function myDataHander(& $parser,$data){}
|
||||
* </pre>
|
||||
* @param string name of method
|
||||
* @access public
|
||||
* @return void
|
||||
* @see set_object
|
||||
*/
|
||||
function set_data_handler($data_method) {
|
||||
$this->state_parser->handler_object_data =& $this->state_parser->handler_default;
|
||||
$this->state_parser->handler_method_data = $data_method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the open and close tag handlers
|
||||
* <br />The open handler method must accept three arguments; the parser,
|
||||
* the tag name and an array of attributes e.g.
|
||||
* <pre>
|
||||
* function myOpenHander(& $parser,$tagname,$attrs=array()){}
|
||||
* </pre>
|
||||
* The close handler method must accept two arguments; the parser and
|
||||
* the tag name e.g.
|
||||
* <pre>
|
||||
* function myCloseHander(& $parser,$tagname){}
|
||||
* </pre>
|
||||
* @param string name of open method
|
||||
* @param string name of close method
|
||||
* @access public
|
||||
* @return void
|
||||
* @see set_object
|
||||
*/
|
||||
function set_element_handler($opening_method, $closing_method) {
|
||||
$this->state_parser->handler_object_element =& $this->state_parser->handler_default;
|
||||
$this->state_parser->handler_method_opening = $opening_method;
|
||||
$this->state_parser->handler_method_closing = $closing_method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the processing instruction handler method e.g. for PHP open
|
||||
* and close tags<br />
|
||||
* The handler method must accept three arguments; the parser, the
|
||||
* PI target and data inside the PI
|
||||
* <pre>
|
||||
* function myPIHander(& $parser,$target, $data){}
|
||||
* </pre>
|
||||
* @param string name of method
|
||||
* @access public
|
||||
* @return void
|
||||
* @see set_object
|
||||
*/
|
||||
function set_pi_handler($pi_method) {
|
||||
$this->state_parser->handler_object_pi =& $this->state_parser->handler_default;
|
||||
$this->state_parser->handler_method_pi = $pi_method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the XML escape handler method e.g. for comments and doctype
|
||||
* declarations<br />
|
||||
* The handler method must accept two arguments; the parser and the
|
||||
* contents of the escaped section
|
||||
* <pre>
|
||||
* function myEscapeHander(& $parser, $data){}
|
||||
* </pre>
|
||||
* @param string name of method
|
||||
* @access public
|
||||
* @return void
|
||||
* @see set_object
|
||||
*/
|
||||
function set_escape_handler($escape_method) {
|
||||
$this->state_parser->handler_object_escape =& $this->state_parser->handler_default;
|
||||
$this->state_parser->handler_method_escape = $escape_method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the JSP/ASP markup handler<br />
|
||||
* The handler method must accept two arguments; the parser and
|
||||
* body of the JASP tag
|
||||
* <pre>
|
||||
* function myJaspHander(& $parser, $data){}
|
||||
* </pre>
|
||||
* @param string name of method
|
||||
* @access public
|
||||
* @return void
|
||||
* @see set_object
|
||||
*/
|
||||
function set_jasp_handler ($jasp_method) {
|
||||
$this->state_parser->handler_object_jasp =& $this->state_parser->handler_default;
|
||||
$this->state_parser->handler_method_jasp = $jasp_method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current string position of the "cursor" inside the XML
|
||||
* document
|
||||
* <br />Intended for use from within a user defined handler called
|
||||
* via the $parser reference e.g.
|
||||
* <pre>
|
||||
* function myDataHandler(& $parser,$data) {
|
||||
* echo( 'Current position: '.$parser->get_current_position() );
|
||||
* }
|
||||
* </pre>
|
||||
* @access public
|
||||
* @return int
|
||||
* @see get_length
|
||||
*/
|
||||
function get_current_position() {
|
||||
return $this->state_parser->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string length of the XML document being parsed
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
function get_length() {
|
||||
return $this->state_parser->length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start parsing some XML
|
||||
* @param string XML document
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function parse($data) {
|
||||
$this->state_parser->parse($data);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,363 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/3_0.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Alexander Zhukov <alex@veresk.ru> Original port from Python |
|
||||
// | Authors: Harry Fuecks <hfuecks@phppatterns.com> Port to PEAR + more |
|
||||
// | Authors: Many @ Sitepointforums Advanced PHP Forums |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: Decorators.php,v 1.1 2007/07/20 17:16:35 claudiucristea Exp $
|
||||
//
|
||||
/**
|
||||
* Decorators for dealing with parser options
|
||||
* @package XML_HTMLSax3
|
||||
* @version $Id: Decorators.php,v 1.1 2007/07/20 17:16:35 claudiucristea Exp $
|
||||
* @see XML_HTMLSax3::set_option
|
||||
*/
|
||||
/**
|
||||
* Trims the contents of element data from whitespace at start and end
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_Trim {
|
||||
/**
|
||||
* Original handler object
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $orig_obj;
|
||||
/**
|
||||
* Original handler method
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $orig_method;
|
||||
/**
|
||||
* Constructs XML_HTMLSax3_Trim
|
||||
* @param object handler object being decorated
|
||||
* @param string original handler method
|
||||
* @access protected
|
||||
*/
|
||||
function XML_HTMLSax3_Trim(&$orig_obj, $orig_method) {
|
||||
$this->orig_obj =& $orig_obj;
|
||||
$this->orig_method = $orig_method;
|
||||
}
|
||||
/**
|
||||
* Trims the data
|
||||
* @param XML_HTMLSax3
|
||||
* @param string element data
|
||||
* @access protected
|
||||
*/
|
||||
function trimData(&$parser, $data) {
|
||||
$data = trim($data);
|
||||
if ($data != '') {
|
||||
$this->orig_obj->{$this->orig_method}($parser, $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Coverts tag names to upper case
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_CaseFolding {
|
||||
/**
|
||||
* Original handler object
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $orig_obj;
|
||||
/**
|
||||
* Original open handler method
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $orig_open_method;
|
||||
/**
|
||||
* Original close handler method
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $orig_close_method;
|
||||
/**
|
||||
* Constructs XML_HTMLSax3_CaseFolding
|
||||
* @param object handler object being decorated
|
||||
* @param string original open handler method
|
||||
* @param string original close handler method
|
||||
* @access protected
|
||||
*/
|
||||
function XML_HTMLSax3_CaseFolding(&$orig_obj, $orig_open_method, $orig_close_method) {
|
||||
$this->orig_obj =& $orig_obj;
|
||||
$this->orig_open_method = $orig_open_method;
|
||||
$this->orig_close_method = $orig_close_method;
|
||||
}
|
||||
/**
|
||||
* Folds up open tag callbacks
|
||||
* @param XML_HTMLSax3
|
||||
* @param string tag name
|
||||
* @param array tag attributes
|
||||
* @access protected
|
||||
*/
|
||||
function foldOpen(&$parser, $tag, $attrs=array(), $empty = FALSE) {
|
||||
$this->orig_obj->{$this->orig_open_method}($parser, strtoupper($tag), $attrs, $empty);
|
||||
}
|
||||
/**
|
||||
* Folds up close tag callbacks
|
||||
* @param XML_HTMLSax3
|
||||
* @param string tag name
|
||||
* @access protected
|
||||
*/
|
||||
function foldClose(&$parser, $tag, $empty = FALSE) {
|
||||
$this->orig_obj->{$this->orig_close_method}($parser, strtoupper($tag), $empty);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Breaks up data by linefeed characters, resulting in additional
|
||||
* calls to the data handler
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_Linefeed {
|
||||
/**
|
||||
* Original handler object
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $orig_obj;
|
||||
/**
|
||||
* Original handler method
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $orig_method;
|
||||
/**
|
||||
* Constructs XML_HTMLSax3_LineFeed
|
||||
* @param object handler object being decorated
|
||||
* @param string original handler method
|
||||
* @access protected
|
||||
*/
|
||||
function XML_HTMLSax3_LineFeed(&$orig_obj, $orig_method) {
|
||||
$this->orig_obj =& $orig_obj;
|
||||
$this->orig_method = $orig_method;
|
||||
}
|
||||
/**
|
||||
* Breaks the data up by linefeeds
|
||||
* @param XML_HTMLSax3
|
||||
* @param string element data
|
||||
* @access protected
|
||||
*/
|
||||
function breakData(&$parser, $data) {
|
||||
$data = explode("\n",$data);
|
||||
foreach ( $data as $chunk ) {
|
||||
$this->orig_obj->{$this->orig_method}($parser, $chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Breaks up data by tab characters, resulting in additional
|
||||
* calls to the data handler
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_Tab {
|
||||
/**
|
||||
* Original handler object
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $orig_obj;
|
||||
/**
|
||||
* Original handler method
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $orig_method;
|
||||
/**
|
||||
* Constructs XML_HTMLSax3_Tab
|
||||
* @param object handler object being decorated
|
||||
* @param string original handler method
|
||||
* @access protected
|
||||
*/
|
||||
function XML_HTMLSax3_Tab(&$orig_obj, $orig_method) {
|
||||
$this->orig_obj =& $orig_obj;
|
||||
$this->orig_method = $orig_method;
|
||||
}
|
||||
/**
|
||||
* Breaks the data up by linefeeds
|
||||
* @param XML_HTMLSax3
|
||||
* @param string element data
|
||||
* @access protected
|
||||
*/
|
||||
function breakData(&$parser, $data) {
|
||||
$data = explode("\t",$data);
|
||||
foreach ( $data as $chunk ) {
|
||||
$this->orig_obj->{$this->orig_method}($this, $chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Breaks up data by XML entities and parses them with html_entity_decode(),
|
||||
* resulting in additional calls to the data handler<br />
|
||||
* Requires PHP 4.3.0+
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_Entities_Parsed {
|
||||
/**
|
||||
* Original handler object
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $orig_obj;
|
||||
/**
|
||||
* Original handler method
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $orig_method;
|
||||
/**
|
||||
* Constructs XML_HTMLSax3_Entities_Parsed
|
||||
* @param object handler object being decorated
|
||||
* @param string original handler method
|
||||
* @access protected
|
||||
*/
|
||||
function XML_HTMLSax3_Entities_Parsed(&$orig_obj, $orig_method) {
|
||||
$this->orig_obj =& $orig_obj;
|
||||
$this->orig_method = $orig_method;
|
||||
}
|
||||
/**
|
||||
* Breaks the data up by XML entities
|
||||
* @param XML_HTMLSax3
|
||||
* @param string element data
|
||||
* @access protected
|
||||
*/
|
||||
function breakData(&$parser, $data) {
|
||||
$data = preg_split('/(&.+?;)/',$data,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
foreach ( $data as $chunk ) {
|
||||
$chunk = html_entity_decode($chunk,ENT_NOQUOTES);
|
||||
$this->orig_obj->{$this->orig_method}($this, $chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Compatibility with older PHP versions
|
||||
*/
|
||||
if (version_compare(phpversion(), '4.3', '<') && !function_exists('html_entity_decode') ) {
|
||||
function html_entity_decode($str, $style=ENT_NOQUOTES) {
|
||||
return strtr($str,
|
||||
array_flip(get_html_translation_table(HTML_ENTITIES,$style)));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Breaks up data by XML entities but leaves them unparsed,
|
||||
* resulting in additional calls to the data handler<br />
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_Entities_Unparsed {
|
||||
/**
|
||||
* Original handler object
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $orig_obj;
|
||||
/**
|
||||
* Original handler method
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $orig_method;
|
||||
/**
|
||||
* Constructs XML_HTMLSax3_Entities_Unparsed
|
||||
* @param object handler object being decorated
|
||||
* @param string original handler method
|
||||
* @access protected
|
||||
*/
|
||||
function XML_HTMLSax3_Entities_Unparsed(&$orig_obj, $orig_method) {
|
||||
$this->orig_obj =& $orig_obj;
|
||||
$this->orig_method = $orig_method;
|
||||
}
|
||||
/**
|
||||
* Breaks the data up by XML entities
|
||||
* @param XML_HTMLSax3
|
||||
* @param string element data
|
||||
* @access protected
|
||||
*/
|
||||
function breakData(&$parser, $data) {
|
||||
$data = preg_split('/(&.+?;)/',$data,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
foreach ( $data as $chunk ) {
|
||||
$this->orig_obj->{$this->orig_method}($this, $chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips the HTML comment markers or CDATA sections from an escape.
|
||||
* If XML_OPTIONS_FULL_ESCAPES is on, this decorator is not used.<br />
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_Escape_Stripper {
|
||||
/**
|
||||
* Original handler object
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $orig_obj;
|
||||
/**
|
||||
* Original handler method
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $orig_method;
|
||||
/**
|
||||
* Constructs XML_HTMLSax3_Entities_Unparsed
|
||||
* @param object handler object being decorated
|
||||
* @param string original handler method
|
||||
* @access protected
|
||||
*/
|
||||
function XML_HTMLSax3_Escape_Stripper(&$orig_obj, $orig_method) {
|
||||
$this->orig_obj =& $orig_obj;
|
||||
$this->orig_method = $orig_method;
|
||||
}
|
||||
/**
|
||||
* Breaks the data up by XML entities
|
||||
* @param XML_HTMLSax3
|
||||
* @param string element data
|
||||
* @access protected
|
||||
*/
|
||||
function strip(&$parser, $data) {
|
||||
// Check for HTML comments first
|
||||
if ( substr($data,0,2) == '--' ) {
|
||||
$patterns = array(
|
||||
'/^\-\-/', // Opening comment: --
|
||||
'/\-\-$/', // Closing comment: --
|
||||
);
|
||||
$data = preg_replace($patterns,'',$data);
|
||||
|
||||
// Check for XML CDATA sections (note: don't do both!)
|
||||
} else if ( substr($data,0,1) == '[' ) {
|
||||
$patterns = array(
|
||||
'/^\[.*CDATA.*\[/s', // Opening CDATA
|
||||
'/\].*\]$/s', // Closing CDATA
|
||||
);
|
||||
$data = preg_replace($patterns,'',$data);
|
||||
}
|
||||
|
||||
$this->orig_obj->{$this->orig_method}($this, $data);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,287 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2002 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/3_0.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Alexander Zhukov <alex@veresk.ru> Original port from Python |
|
||||
// | Authors: Harry Fuecks <hfuecks@phppatterns.com> Port to PEAR + more |
|
||||
// | Authors: Many @ Sitepointforums Advanced PHP Forums |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: States.php,v 1.1 2007/07/20 17:16:35 claudiucristea Exp $
|
||||
//
|
||||
/**
|
||||
* Parsing states.
|
||||
* @package XML_HTMLSax3
|
||||
* @version $Id: States.php,v 1.1 2007/07/20 17:16:35 claudiucristea Exp $
|
||||
*/
|
||||
/**
|
||||
* Define parser states
|
||||
*/
|
||||
define('XML_HTMLSAX3_STATE_STOP', 0);
|
||||
define('XML_HTMLSAX3_STATE_START', 1);
|
||||
define('XML_HTMLSAX3_STATE_TAG', 2);
|
||||
define('XML_HTMLSAX3_STATE_OPENING_TAG', 3);
|
||||
define('XML_HTMLSAX3_STATE_CLOSING_TAG', 4);
|
||||
define('XML_HTMLSAX3_STATE_ESCAPE', 6);
|
||||
define('XML_HTMLSAX3_STATE_JASP', 7);
|
||||
define('XML_HTMLSAX3_STATE_PI', 8);
|
||||
/**
|
||||
* StartingState searches for the start of any XML tag
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_StartingState {
|
||||
/**
|
||||
* @param XML_HTMLSax3_StateParser subclass
|
||||
* @return constant XML_HTMLSAX3_STATE_TAG
|
||||
* @access protected
|
||||
*/
|
||||
function parse(&$context) {
|
||||
$data = $context->scanUntilString('<');
|
||||
if ($data != '') {
|
||||
$context->handler_object_data->
|
||||
{$context->handler_method_data}($context->htmlsax, $data);
|
||||
}
|
||||
$context->IgnoreCharacter();
|
||||
return XML_HTMLSAX3_STATE_TAG;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Decides which state to move one from after StartingState
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_TagState {
|
||||
/**
|
||||
* @param XML_HTMLSax3_StateParser subclass
|
||||
* @return constant the next state to move into
|
||||
* @access protected
|
||||
*/
|
||||
function parse(&$context) {
|
||||
switch($context->ScanCharacter()) {
|
||||
case '/':
|
||||
return XML_HTMLSAX3_STATE_CLOSING_TAG;
|
||||
break;
|
||||
case '?':
|
||||
return XML_HTMLSAX3_STATE_PI;
|
||||
break;
|
||||
case '%':
|
||||
return XML_HTMLSAX3_STATE_JASP;
|
||||
break;
|
||||
case '!':
|
||||
return XML_HTMLSAX3_STATE_ESCAPE;
|
||||
break;
|
||||
default:
|
||||
$context->unscanCharacter();
|
||||
return XML_HTMLSAX3_STATE_OPENING_TAG;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Dealing with closing XML tags
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_ClosingTagState {
|
||||
/**
|
||||
* @param XML_HTMLSax3_StateParser subclass
|
||||
* @return constant XML_HTMLSAX3_STATE_START
|
||||
* @access protected
|
||||
*/
|
||||
function parse(&$context) {
|
||||
$tag = $context->scanUntilCharacters('/>');
|
||||
if ($tag != '') {
|
||||
$char = $context->scanCharacter();
|
||||
if ($char == '/') {
|
||||
$char = $context->scanCharacter();
|
||||
if ($char != '>') {
|
||||
$context->unscanCharacter();
|
||||
}
|
||||
}
|
||||
$context->handler_object_element->
|
||||
{$context->handler_method_closing}($context->htmlsax, $tag, FALSE);
|
||||
}
|
||||
return XML_HTMLSAX3_STATE_START;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Dealing with opening XML tags
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_OpeningTagState {
|
||||
/**
|
||||
* Handles attributes
|
||||
* @param string attribute name
|
||||
* @param string attribute value
|
||||
* @return void
|
||||
* @access protected
|
||||
* @see XML_HTMLSax3_AttributeStartState
|
||||
*/
|
||||
function parseAttributes(&$context) {
|
||||
$Attributes = array();
|
||||
|
||||
$context->ignoreWhitespace();
|
||||
$attributename = $context->scanUntilCharacters("=/> \n\r\t");
|
||||
while ($attributename != '') {
|
||||
$attributevalue = NULL;
|
||||
$context->ignoreWhitespace();
|
||||
$char = $context->scanCharacter();
|
||||
if ($char == '=') {
|
||||
$context->ignoreWhitespace();
|
||||
$char = $context->ScanCharacter();
|
||||
if ($char == '"') {
|
||||
$attributevalue= $context->scanUntilString('"');
|
||||
$context->IgnoreCharacter();
|
||||
} else if ($char == "'") {
|
||||
$attributevalue = $context->scanUntilString("'");
|
||||
$context->IgnoreCharacter();
|
||||
} else {
|
||||
$context->unscanCharacter();
|
||||
$attributevalue =
|
||||
$context->scanUntilCharacters("> \n\r\t");
|
||||
}
|
||||
} else if ($char !== NULL) {
|
||||
$attributevalue = NULL;
|
||||
$context->unscanCharacter();
|
||||
}
|
||||
$Attributes[$attributename] = $attributevalue;
|
||||
|
||||
$context->ignoreWhitespace();
|
||||
$attributename = $context->scanUntilCharacters("=/> \n\r\t");
|
||||
}
|
||||
return $Attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param XML_HTMLSax3_StateParser subclass
|
||||
* @return constant XML_HTMLSAX3_STATE_START
|
||||
* @access protected
|
||||
*/
|
||||
function parse(&$context) {
|
||||
$tag = $context->scanUntilCharacters("/> \n\r\t");
|
||||
if ($tag != '') {
|
||||
$this->attrs = array();
|
||||
$Attributes = $this->parseAttributes($context);
|
||||
$char = $context->scanCharacter();
|
||||
if ($char == '/') {
|
||||
$char = $context->scanCharacter();
|
||||
if ($char != '>') {
|
||||
$context->unscanCharacter();
|
||||
}
|
||||
$context->handler_object_element->
|
||||
{$context->handler_method_opening}($context->htmlsax, $tag,
|
||||
$Attributes, TRUE);
|
||||
$context->handler_object_element->
|
||||
{$context->handler_method_closing}($context->htmlsax, $tag,
|
||||
TRUE);
|
||||
} else {
|
||||
$context->handler_object_element->
|
||||
{$context->handler_method_opening}($context->htmlsax, $tag,
|
||||
$Attributes, FALSE);
|
||||
}
|
||||
}
|
||||
return XML_HTMLSAX3_STATE_START;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deals with XML escapes handling comments and CDATA correctly
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_EscapeState {
|
||||
/**
|
||||
* @param XML_HTMLSax3_StateParser subclass
|
||||
* @return constant XML_HTMLSAX3_STATE_START
|
||||
* @access protected
|
||||
*/
|
||||
function parse(&$context) {
|
||||
$char = $context->ScanCharacter();
|
||||
if ($char == '-') {
|
||||
$char = $context->ScanCharacter();
|
||||
if ($char == '-') {
|
||||
$context->unscanCharacter();
|
||||
$context->unscanCharacter();
|
||||
$text = $context->scanUntilString('-->');
|
||||
$text .= $context->scanCharacter();
|
||||
$text .= $context->scanCharacter();
|
||||
} else {
|
||||
$context->unscanCharacter();
|
||||
$text = $context->scanUntilString('>');
|
||||
}
|
||||
} else if ( $char == '[') {
|
||||
$context->unscanCharacter();
|
||||
$text = $context->scanUntilString(']>');
|
||||
$text.= $context->scanCharacter();
|
||||
} else {
|
||||
$context->unscanCharacter();
|
||||
$text = $context->scanUntilString('>');
|
||||
}
|
||||
|
||||
$context->IgnoreCharacter();
|
||||
if ($text != '') {
|
||||
$context->handler_object_escape->
|
||||
{$context->handler_method_escape}($context->htmlsax, $text);
|
||||
}
|
||||
return XML_HTMLSAX3_STATE_START;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Deals with JASP/ASP markup
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_JaspState {
|
||||
/**
|
||||
* @param XML_HTMLSax3_StateParser subclass
|
||||
* @return constant XML_HTMLSAX3_STATE_START
|
||||
* @access protected
|
||||
*/
|
||||
function parse(&$context) {
|
||||
$text = $context->scanUntilString('%>');
|
||||
if ($text != '') {
|
||||
$context->handler_object_jasp->
|
||||
{$context->handler_method_jasp}($context->htmlsax, $text);
|
||||
}
|
||||
$context->IgnoreCharacter();
|
||||
$context->IgnoreCharacter();
|
||||
return XML_HTMLSAX3_STATE_START;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Deals with XML processing instructions
|
||||
* @package XML_HTMLSax3
|
||||
* @access protected
|
||||
*/
|
||||
class XML_HTMLSax3_PiState {
|
||||
/**
|
||||
* @param XML_HTMLSax3_StateParser subclass
|
||||
* @return constant XML_HTMLSAX3_STATE_START
|
||||
* @access protected
|
||||
*/
|
||||
function parse(&$context) {
|
||||
$target = $context->scanUntilCharacters(" \n\r\t");
|
||||
$data = $context->scanUntilString('?>');
|
||||
if ($data != '') {
|
||||
$context->handler_object_pi->
|
||||
{$context->handler_method_pi}($context->htmlsax, $target, $data);
|
||||
}
|
||||
$context->IgnoreCharacter();
|
||||
$context->IgnoreCharacter();
|
||||
return XML_HTMLSAX3_STATE_START;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,671 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/**
|
||||
* SafeHTML Parser
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* @category HTML
|
||||
* @package SafeHTML
|
||||
* @author Roman Ivanov <thingol@mail.ru>
|
||||
* @copyright 2004-2005 Roman Ivanov
|
||||
* @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
|
||||
* @version 1.3.7
|
||||
* @link http://pixel-apes.com/safehtml/
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* This package requires HTMLSax3 package
|
||||
*/
|
||||
define("XML_HTMLSAX3", '');
|
||||
require_once(XML_HTMLSAX3 . 'HTMLSax3.php');
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* SafeHTML Parser
|
||||
*
|
||||
* This parser strips down all potentially dangerous content within HTML:
|
||||
* <ul>
|
||||
* <li>opening tag without its closing tag</li>
|
||||
* <li>closing tag without its opening tag</li>
|
||||
* <li>any of these tags: "base", "basefont", "head", "html", "body", "applet",
|
||||
* "object", "iframe", "frame", "frameset", "script", "layer", "ilayer", "embed",
|
||||
* "bgsound", "link", "meta", "style", "title", "blink", "xml" etc.</li>
|
||||
* <li>any of these attributes: on*, data*, dynsrc</li>
|
||||
* <li>javascript:/vbscript:/about: etc. protocols</li>
|
||||
* <li>expression/behavior etc. in styles</li>
|
||||
* <li>any other active content</li>
|
||||
* </ul>
|
||||
* It also tries to convert code to XHTML valid, but htmltidy is far better
|
||||
* solution for this task.
|
||||
*
|
||||
* <b>Example:</b>
|
||||
* <pre>
|
||||
* $parser =& new SafeHTML();
|
||||
* $result = $parser->parse($doc);
|
||||
* </pre>
|
||||
*
|
||||
* @category HTML
|
||||
* @package SafeHTML
|
||||
* @author Roman Ivanov <thingol@mail.ru>
|
||||
* @copyright 1997-2005 Roman Ivanov
|
||||
* @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
|
||||
* @version Release: @package_version@
|
||||
* @link http://pear.php.net/package/SafeHTML
|
||||
*/
|
||||
class SafeHTML
|
||||
{
|
||||
/**
|
||||
* Storage for resulting HTML output
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $_xhtml = '';
|
||||
|
||||
/**
|
||||
* Array of counters for each tag
|
||||
*
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $_counter = array();
|
||||
|
||||
/**
|
||||
* Stack of unclosed tags
|
||||
*
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $_stack = array();
|
||||
|
||||
/**
|
||||
* Array of counters for tags that must be deleted with all content
|
||||
*
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $_dcCounter = array();
|
||||
|
||||
/**
|
||||
* Stack of unclosed tags that must be deleted with all content
|
||||
*
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $_dcStack = array();
|
||||
|
||||
/**
|
||||
* Stores level of list (ol/ul) nesting
|
||||
*
|
||||
* @var int
|
||||
* @access private
|
||||
*/
|
||||
var $_listScope = 0;
|
||||
|
||||
/**
|
||||
* Stack of unclosed list tags
|
||||
*
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $_liStack = array();
|
||||
|
||||
/**
|
||||
* Array of prepared regular expressions for protocols (schemas) matching
|
||||
*
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $_protoRegexps = array();
|
||||
|
||||
/**
|
||||
* Array of prepared regular expressions for CSS matching
|
||||
*
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $_cssRegexps = array();
|
||||
|
||||
/**
|
||||
* List of single tags ("<tag />")
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $singleTags = array('area', 'br', 'img', 'input', 'hr', 'wbr', );
|
||||
|
||||
/**
|
||||
* List of dangerous tags (such tags will be deleted)
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $deleteTags = array(
|
||||
'applet', 'base', 'basefont', 'bgsound', 'blink', 'body',
|
||||
'embed', 'frame', 'frameset', 'head', 'html', 'ilayer',
|
||||
'iframe', 'layer', 'link', 'meta', 'object', 'style',
|
||||
'title', 'script',
|
||||
);
|
||||
|
||||
/**
|
||||
* List of dangerous tags (such tags will be deleted, and all content
|
||||
* inside this tags will be also removed)
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $deleteTagsContent = array('script', 'style', 'title', 'xml', );
|
||||
|
||||
/**
|
||||
* Type of protocols filtering ('white' or 'black')
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $protocolFiltering = 'white';
|
||||
|
||||
/**
|
||||
* List of "dangerous" protocols (used for blacklist-filtering)
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $blackProtocols = array(
|
||||
'about', 'chrome', 'data', 'disk', 'hcp',
|
||||
'help', 'javascript', 'livescript', 'lynxcgi', 'lynxexec',
|
||||
'ms-help', 'ms-its', 'mhtml', 'mocha', 'opera',
|
||||
'res', 'resource', 'shell', 'vbscript', 'view-source',
|
||||
'vnd.ms.radio', 'wysiwyg',
|
||||
);
|
||||
|
||||
/**
|
||||
* List of "safe" protocols (used for whitelist-filtering)
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $whiteProtocols = array(
|
||||
'ed2k', 'file', 'ftp', 'gopher', 'http', 'https',
|
||||
'irc', 'mailto', 'news', 'nntp', 'telnet', 'webcal',
|
||||
'xmpp', 'callto',
|
||||
);
|
||||
|
||||
/**
|
||||
* List of attributes that can contain protocols
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $protocolAttributes = array(
|
||||
'action', 'background', 'codebase', 'dynsrc', 'href', 'lowsrc', 'src',
|
||||
);
|
||||
|
||||
/**
|
||||
* List of dangerous CSS keywords
|
||||
*
|
||||
* Whole style="" attribute will be removed, if parser will find one of
|
||||
* these keywords
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $cssKeywords = array(
|
||||
'absolute', 'behavior', 'behaviour', 'content', 'expression',
|
||||
'fixed', 'include-source', 'moz-binding',
|
||||
);
|
||||
|
||||
/**
|
||||
* List of tags that can have no "closing tag"
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
* @deprecated XHTML does not allow such tags
|
||||
*/
|
||||
var $noClose = array();
|
||||
|
||||
/**
|
||||
* List of block-level tags that terminates paragraph
|
||||
*
|
||||
* Paragraph will be closed when this tags opened
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $closeParagraph = array(
|
||||
'address', 'blockquote', 'center', 'dd', 'dir', 'div',
|
||||
'dl', 'dt', 'h1', 'h2', 'h3', 'h4',
|
||||
'h5', 'h6', 'hr', 'isindex', 'listing', 'marquee',
|
||||
'menu', 'multicol', 'ol', 'p', 'plaintext', 'pre',
|
||||
'table', 'ul', 'xmp',
|
||||
);
|
||||
|
||||
/**
|
||||
* List of table tags, all table tags outside a table will be removed
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $tableTags = array(
|
||||
'caption', 'col', 'colgroup', 'tbody', 'td', 'tfoot', 'th',
|
||||
'thead', 'tr',
|
||||
);
|
||||
|
||||
/**
|
||||
* List of list tags
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $listTags = array('dir', 'menu', 'ol', 'ul', 'dl', );
|
||||
|
||||
/**
|
||||
* List of dangerous attributes
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $attributes = array('dynsrc', 'id', 'name', );
|
||||
|
||||
/**
|
||||
* List of allowed "namespaced" attributes
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $attributesNS = array('xml:lang', );
|
||||
|
||||
/**
|
||||
* Constructs class
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function SafeHTML()
|
||||
{
|
||||
//making regular expressions based on Proto & CSS arrays
|
||||
foreach ($this->blackProtocols as $proto) {
|
||||
$preg = "/[\s\x01-\x1F]*";
|
||||
for ($i=0; $i<strlen($proto); $i++) {
|
||||
$preg .= $proto{$i} . "[\s\x01-\x1F]*";
|
||||
}
|
||||
$preg .= ":/i";
|
||||
$this->_protoRegexps[] = $preg;
|
||||
}
|
||||
|
||||
foreach ($this->cssKeywords as $css) {
|
||||
$this->_cssRegexps[] = '/' . $css . '/i';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the writing of attributes - called from $this->_openHandler()
|
||||
*
|
||||
* @param array $attrs array of attributes $name => $value
|
||||
* @return boolean
|
||||
* @access private
|
||||
*/
|
||||
function _writeAttrs ($attrs)
|
||||
{
|
||||
if (is_array($attrs)) {
|
||||
foreach ($attrs as $name => $value) {
|
||||
|
||||
$name = strtolower($name);
|
||||
|
||||
if (strpos($name, 'on') === 0) {
|
||||
continue;
|
||||
}
|
||||
if (strpos($name, 'data') === 0) {
|
||||
continue;
|
||||
}
|
||||
if (in_array($name, $this->attributes)) {
|
||||
continue;
|
||||
}
|
||||
if (!preg_match("/^[a-z0-9]+$/i", $name)) {
|
||||
if (!in_array($name, $this->attributesNS))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (($value === TRUE) || (is_null($value))) {
|
||||
$value = $name;
|
||||
}
|
||||
|
||||
if ($name == 'style') {
|
||||
|
||||
// removes insignificant backslahes
|
||||
$value = str_replace("\\", '', $value);
|
||||
|
||||
// removes CSS comments
|
||||
while (1)
|
||||
{
|
||||
$_value = preg_replace("!/\*.*?\*/!s", '', $value);
|
||||
if ($_value == $value) break;
|
||||
$value = $_value;
|
||||
}
|
||||
|
||||
// replace all & to &
|
||||
$value = str_replace('&', '&', $value);
|
||||
$value = str_replace('&', '&', $value);
|
||||
|
||||
foreach ($this->_cssRegexps as $css) {
|
||||
if (preg_match($css, $value)) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
foreach ($this->_protoRegexps as $proto) {
|
||||
if (preg_match($proto, $value)) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tempval = preg_replace('/&#(\d+);?/me', "chr('\\1')", $value); //"'
|
||||
$tempval = preg_replace('/&#x([0-9a-f]+);?/mei', "chr(hexdec('\\1'))", $tempval);
|
||||
|
||||
if ((in_array($name, $this->protocolAttributes)) &&
|
||||
(strpos($tempval, ':') !== false))
|
||||
{
|
||||
if ($this->protocolFiltering == 'black') {
|
||||
foreach ($this->_protoRegexps as $proto) {
|
||||
if (preg_match($proto, $tempval)) continue 2;
|
||||
}
|
||||
} else {
|
||||
$_tempval = explode(':', $tempval);
|
||||
$proto = $_tempval[0];
|
||||
if (!in_array($proto, $this->whiteProtocols)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$value = str_replace("\"", """, $value);
|
||||
$this->_xhtml .= ' ' . $name . '="' . $value . '"';
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opening tag handler - called from HTMLSax
|
||||
*
|
||||
* @param object $parser HTML Parser
|
||||
* @param string $name tag name
|
||||
* @param array $attrs tag attributes
|
||||
* @return boolean
|
||||
* @access private
|
||||
*/
|
||||
function _openHandler(&$parser, $name, $attrs)
|
||||
{
|
||||
$name = strtolower($name);
|
||||
|
||||
if (in_array($name, $this->deleteTagsContent)) {
|
||||
array_push($this->_dcStack, $name);
|
||||
$this->_dcCounter[$name] = isset($this->_dcCounter[$name]) ? $this->_dcCounter[$name]+1 : 1;
|
||||
}
|
||||
if (count($this->_dcStack) != 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (in_array($name, $this->deleteTags)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!preg_match("/^[a-z0-9]+$/i", $name)) {
|
||||
if (preg_match("!(?:\@|://)!i", $name)) {
|
||||
$this->_xhtml .= '<' . $name . '>';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (in_array($name, $this->singleTags)) {
|
||||
$this->_xhtml .= '<' . $name;
|
||||
$this->_writeAttrs($attrs);
|
||||
$this->_xhtml .= ' />';
|
||||
return true;
|
||||
}
|
||||
|
||||
// TABLES: cannot open table elements when we are not inside table
|
||||
if ((isset($this->_counter['table'])) && ($this->_counter['table'] <= 0)
|
||||
&& (in_array($name, $this->tableTags)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// PARAGRAPHS: close paragraph when closeParagraph tags opening
|
||||
if ((in_array($name, $this->closeParagraph)) && (in_array('p', $this->_stack))) {
|
||||
$this->_closeHandler($parser, 'p');
|
||||
}
|
||||
|
||||
// LISTS: we should close <li> if <li> of the same level opening
|
||||
if ($name == 'li' && count($this->_liStack) &&
|
||||
$this->_listScope == $this->_liStack[count($this->_liStack)-1])
|
||||
{
|
||||
$this->_closeHandler($parser, 'li');
|
||||
}
|
||||
|
||||
// LISTS: we want to know on what nesting level of lists we are
|
||||
if (in_array($name, $this->listTags)) {
|
||||
$this->_listScope++;
|
||||
}
|
||||
if ($name == 'li') {
|
||||
array_push($this->_liStack, $this->_listScope);
|
||||
}
|
||||
|
||||
$this->_xhtml .= '<' . $name;
|
||||
$this->_writeAttrs($attrs);
|
||||
$this->_xhtml .= '>';
|
||||
array_push($this->_stack,$name);
|
||||
$this->_counter[$name] = isset($this->_counter[$name]) ? $this->_counter[$name]+1 : 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closing tag handler - called from HTMLSax
|
||||
*
|
||||
* @param object $parsers HTML parser
|
||||
* @param string $name tag name
|
||||
* @return boolean
|
||||
* @access private
|
||||
*/
|
||||
function _closeHandler(&$parser, $name)
|
||||
{
|
||||
|
||||
$name = strtolower($name);
|
||||
|
||||
if (isset($this->_dcCounter[$name]) && ($this->_dcCounter[$name] > 0) &&
|
||||
(in_array($name, $this->deleteTagsContent)))
|
||||
{
|
||||
while ($name != ($tag = array_pop($this->_dcStack))) {
|
||||
$this->_dcCounter[$tag]--;
|
||||
}
|
||||
|
||||
$this->_dcCounter[$name]--;
|
||||
}
|
||||
|
||||
if (count($this->_dcStack) != 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((isset($this->_counter[$name])) && ($this->_counter[$name] > 0)) {
|
||||
while ($name != ($tag = array_pop($this->_stack))) {
|
||||
$this->_closeTag($tag);
|
||||
}
|
||||
|
||||
$this->_closeTag($name);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes tag
|
||||
*
|
||||
* @param string $tag tag name
|
||||
* @return boolean
|
||||
* @access private
|
||||
*/
|
||||
function _closeTag($tag)
|
||||
{
|
||||
if (!in_array($tag, $this->noClose)) {
|
||||
$this->_xhtml .= '</' . $tag . '>';
|
||||
}
|
||||
|
||||
$this->_counter[$tag]--;
|
||||
|
||||
if (in_array($tag, $this->listTags)) {
|
||||
$this->_listScope--;
|
||||
}
|
||||
|
||||
if ($tag == 'li') {
|
||||
array_pop($this->_liStack);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Character data handler - called from HTMLSax
|
||||
*
|
||||
* @param object $parser HTML parser
|
||||
* @param string $data textual data
|
||||
* @return boolean
|
||||
* @access private
|
||||
*/
|
||||
function _dataHandler(&$parser, $data)
|
||||
{
|
||||
if (count($this->_dcStack) == 0) {
|
||||
$this->_xhtml .= $data;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape handler - called from HTMLSax
|
||||
*
|
||||
* @param object $parser HTML parser
|
||||
* @param string $data comments or other type of data
|
||||
* @return boolean
|
||||
* @access private
|
||||
*/
|
||||
function _escapeHandler(&$parser, $data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the XHTML document
|
||||
*
|
||||
* @return string Processed (X)HTML document
|
||||
* @access public
|
||||
*/
|
||||
function getXHTML ()
|
||||
{
|
||||
while ($tag = array_pop($this->_stack)) {
|
||||
$this->_closeTag($tag);
|
||||
}
|
||||
|
||||
return $this->_xhtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears current document data
|
||||
*
|
||||
* @return boolean
|
||||
* @access public
|
||||
*/
|
||||
function clear()
|
||||
{
|
||||
$this->_xhtml = '';
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main parsing fuction
|
||||
*
|
||||
* @param string $doc HTML document for processing
|
||||
* @return string Processed (X)HTML document
|
||||
* @access public
|
||||
*/
|
||||
function parse($doc)
|
||||
{
|
||||
|
||||
// Save all '<' symbols
|
||||
$doc = preg_replace("/<(?=[^a-zA-Z\/\!\?\%])/", '<', $doc);
|
||||
|
||||
// Web documents shouldn't contains \x00 symbol
|
||||
$doc = str_replace("\x00", '', $doc);
|
||||
|
||||
// Opera6 bug workaround
|
||||
$doc = str_replace("\xC0\xBC", '<', $doc);
|
||||
|
||||
// UTF-7 encoding ASCII decode
|
||||
$doc = $this->repackUTF7($doc);
|
||||
|
||||
// Instantiate the parser
|
||||
$parser= new XML_HTMLSax3();
|
||||
|
||||
// Set up the parser
|
||||
$parser->set_object($this);
|
||||
|
||||
$parser->set_element_handler('_openHandler','_closeHandler');
|
||||
$parser->set_data_handler('_dataHandler');
|
||||
$parser->set_escape_handler('_escapeHandler');
|
||||
|
||||
$parser->parse($doc);
|
||||
|
||||
return $this->getXHTML();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UTF-7 decoding fuction
|
||||
*
|
||||
* @param string $str HTML document for recode ASCII part of UTF-7 back to ASCII
|
||||
* @return string Decoded document
|
||||
* @access private
|
||||
*/
|
||||
function repackUTF7($str)
|
||||
{
|
||||
return preg_replace_callback('!\+([0-9a-zA-Z/]+)\-!', array($this, 'repackUTF7Callback'), $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional UTF-7 decoding fuction
|
||||
*
|
||||
* @param string $str String for recode ASCII part of UTF-7 back to ASCII
|
||||
* @return string Recoded string
|
||||
* @access private
|
||||
*/
|
||||
function repackUTF7Callback($str)
|
||||
{
|
||||
$str = base64_decode($str[1]);
|
||||
$str = preg_replace_callback('/^((?:\x00.)*)((?:[^\x00].)+)/', array($this, 'repackUTF7Back'), $str);
|
||||
return preg_replace('/\x00(.)/', '$1', $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional UTF-7 encoding fuction
|
||||
*
|
||||
* @param string $str String for recode ASCII part of UTF-7 back to ASCII
|
||||
* @return string Recoded string
|
||||
* @access private
|
||||
*/
|
||||
function repackUTF7Back($str)
|
||||
{
|
||||
return $str[1].'+'.rtrim(base64_encode($str[2]), '=').'-';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* c-hanging-comment-ender-p: nil
|
||||
* End:
|
||||
*/
|
||||
|
||||
?>
|
||||
@@ -510,6 +510,7 @@ class statistik extends basis_db
|
||||
$this->html='';
|
||||
$this->csv='';
|
||||
$this->json=array();
|
||||
set_time_limit(120);
|
||||
|
||||
if($this->sql!='')
|
||||
{
|
||||
@@ -552,6 +553,12 @@ class statistik extends basis_db
|
||||
{
|
||||
$name = $this->db_field_name($this->data,$spalte);
|
||||
$this->html.= '<td>'.$this->convert_html_chars($row->$name).'</td>';
|
||||
// Umwandeln von Punkt in Komma bei Float-Werten
|
||||
if (is_numeric($row->$name))
|
||||
{
|
||||
if (strpos($row->$name,'.') != false)
|
||||
$row->$name = number_format($row->$name,2,",","");
|
||||
}
|
||||
$this->csv.= '"'.$row->$name.'",';
|
||||
}
|
||||
|
||||
|
||||
@@ -571,7 +571,7 @@ class student extends benutzer
|
||||
{
|
||||
$qry = "SELECT tbl_student.* FROM public.tbl_benutzer JOIN public.tbl_student ON(uid=student_uid)
|
||||
WHERE person_id=".$this->db_add_param($person_id, FHC_INTEGER);
|
||||
|
||||
|
||||
if($studiengang_kz != '')
|
||||
{
|
||||
$qry .= " AND studiengang_kz=".$this->db_add_param($studiengang_kz, FHC_INTEGER);
|
||||
|
||||
@@ -53,6 +53,9 @@ class studiengang extends basis_db
|
||||
public $studienplaetze; // smallint
|
||||
public $oe_kurzbz; // varchar(32)
|
||||
public $onlinebewerbung; // boolean
|
||||
public $melderelevant; // boolean
|
||||
public $foerderrelevant; // boolean
|
||||
public $standort_code; // integer
|
||||
|
||||
public $kuerzel; // = typ + kurzbz (Bsp: BBE)
|
||||
public $kuerzel_arr = array(); // Array mit allen Kurzeln Index=studiengangs_kz
|
||||
@@ -128,6 +131,9 @@ class studiengang extends basis_db
|
||||
$this->moodle = $this->db_parse_bool($row->moodle);
|
||||
$this->mischform = $this->db_parse_bool($row->mischform);
|
||||
$this->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige);
|
||||
$this->melderelevant = $this->db_parse_bool($row->melderelevant);
|
||||
$this->foerderrelevant = $this->db_parse_bool($row->foerderrelevant);
|
||||
$this->standort_code = $row->standort_code;
|
||||
|
||||
$this->bezeichnung_arr['German'] = $this->bezeichnung;
|
||||
$this->bezeichnung_arr['English'] = $this->english;
|
||||
@@ -201,6 +207,9 @@ class studiengang extends basis_db
|
||||
$stg_obj->moodle = $this->db_parse_bool($row->moodle);
|
||||
$stg_obj->mischform = $this->db_parse_bool($row->mischform);
|
||||
$stg_obj->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige);
|
||||
$stg_obj->melderelevant = $this->db_parse_bool($row->melderelevant);
|
||||
$stg_obj->foerderrelevant = $this->db_parse_bool($row->foerderrelevant);
|
||||
$stg_obj->standort_code = $row->standort_code;
|
||||
|
||||
$stg_obj->bezeichnung_arr['German'] = $row->bezeichnung;
|
||||
$stg_obj->bezeichnung_arr['English'] = $row->english;
|
||||
@@ -419,6 +428,9 @@ class studiengang extends basis_db
|
||||
$stg_obj->moodle = $this->db_parse_bool($row->moodle);
|
||||
$stg_obj->mischform = $this->db_parse_bool($row->mischform);
|
||||
$stg_obj->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige);
|
||||
$stg_obj->melderelevant = $this->db_parse_bool($row->melderelevant);
|
||||
$stg_obj->foerderrelevant = $this->db_parse_bool($row->foerderrelevant);
|
||||
$stg_obj->standort_code = $row->standort_code;
|
||||
|
||||
$stg_obj->bezeichnung_arr['German'] = $row->bezeichnung;
|
||||
$stg_obj->bezeichnung_arr['English'] = $row->english;
|
||||
@@ -488,7 +500,8 @@ class studiengang extends basis_db
|
||||
$qry = 'INSERT INTO public.tbl_studiengang (studiengang_kz, kurzbz, kurzbzlang, bezeichnung, english,
|
||||
typ, farbe, email, telefon, max_verband, max_semester, max_gruppe, erhalter_kz, bescheid, bescheidbgbl1,
|
||||
bescheidbgbl2, bescheidgz, bescheidvom, titelbescheidvom, aktiv, onlinebewerbung, orgform_kurzbz, zusatzinfo_html,
|
||||
oe_kurzbz, moodle, sprache, testtool_sprachwahl, studienplaetze, lgartcode, mischform,projektarbeit_note_anzeige) VALUES ('.
|
||||
oe_kurzbz, moodle, sprache, testtool_sprachwahl, studienplaetze, lgartcode, mischform,projektarbeit_note_anzeige,
|
||||
melderelevant, foerderrelevant, standort_code) VALUES ('.
|
||||
$this->db_add_param($this->studiengang_kz, FHC_INTEGER).', '.
|
||||
$this->db_add_param($this->kurzbz).', '.
|
||||
$this->db_add_param($this->kurzbzlang).', '.
|
||||
@@ -519,7 +532,10 @@ class studiengang extends basis_db
|
||||
$this->db_add_param($this->studienplaetze).', '.
|
||||
$this->db_add_param($this->lgartcode).', '.
|
||||
$this->db_add_param($this->mischform, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->projektarbeit_note_anzeige, FHC_BOOLEAN).');';
|
||||
$this->db_add_param($this->projektarbeit_note_anzeige, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->melderelevant, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->foerderrelevant, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->standort_code).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -556,7 +572,10 @@ class studiengang extends basis_db
|
||||
'testtool_sprachwahl='.$this->db_add_param($this->testtool_sprachwahl, FHC_BOOLEAN).', '.
|
||||
'studienplaetze='.$this->db_add_param($this->studienplaetze).', '.
|
||||
'lgartcode='.$this->db_add_param($this->lgartcode).', '.
|
||||
'mischform='.$this->db_add_param($this->mischform, FHC_BOOLEAN).' '.
|
||||
'mischform='.$this->db_add_param($this->mischform, FHC_BOOLEAN).', '.
|
||||
'melderelevant='.$this->db_add_param($this->melderelevant, FHC_BOOLEAN).', '.
|
||||
'foerderrelevant='.$this->db_add_param($this->foerderrelevant, FHC_BOOLEAN).', '.
|
||||
'standort_code='.$this->db_add_param($this->standort_code).' '.
|
||||
'WHERE studiengang_kz='.$this->db_add_param($this->studiengang_kz, FHC_INTEGER, false).';';
|
||||
}
|
||||
|
||||
@@ -679,6 +698,9 @@ class studiengang extends basis_db
|
||||
$this->onlinebewerbung = $this->db_parse_bool($row->onlinebewerbung);
|
||||
$this->moodle = $this->db_parse_bool($row->moodle);
|
||||
$this->mischform = $this->db_parse_bool($row->mischform);
|
||||
$this->melderelevant = $this->db_parse_bool($row->melderelevant);
|
||||
$this->foerderrelevant = $this->db_parse_bool($row->foerderrelevant);
|
||||
$this->standort_code = $row->standort_code;
|
||||
$this->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige);
|
||||
|
||||
$this->bezeichnung_arr['German'] = $this->bezeichnung;
|
||||
@@ -819,6 +841,9 @@ class studiengang extends basis_db
|
||||
$obj->moodle = $this->db_parse_bool($row->moodle);
|
||||
$obj->mischform = $this->db_parse_bool($row->mischform);
|
||||
$obj->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige);
|
||||
$obj->melderelevant = $this->db_parse_bool($row->melderelevant);
|
||||
$obj->foerderrelevant = $this->db_parse_bool($row->foerderrelevant);
|
||||
$obj->standort_code = $row->standort_code;
|
||||
$obj->aktiv = $this->db_parse_bool($row->aktiv);
|
||||
|
||||
$this->result[] = $obj;
|
||||
@@ -891,6 +916,9 @@ class studiengang extends basis_db
|
||||
$obj->moodle = $this->db_parse_bool($row->moodle);
|
||||
$obj->mischform = $this->db_parse_bool($row->mischform);
|
||||
$obj->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige);
|
||||
$obj->melderelevant = $this->db_parse_bool($row->melderelevant);
|
||||
$obj->foerderrelevant = $this->db_parse_bool($row->foerderrelevant);
|
||||
$obj->standort_code = $row->standort_code;
|
||||
|
||||
$obj->bezeichnung_arr['German'] = $obj->bezeichnung;
|
||||
$obj->bezeichnung_arr['English'] = $obj->english;
|
||||
@@ -993,6 +1021,9 @@ class studiengang extends basis_db
|
||||
$obj->moodle = $this->db_parse_bool($row->moodle);
|
||||
$obj->mischform = $this->db_parse_bool($row->mischform);
|
||||
$obj->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige);
|
||||
$obj->melderelevant = $this->db_parse_bool($row->melderelevant);
|
||||
$obj->foerderrelevant = $this->db_parse_bool($row->foerderrelevant);
|
||||
$obj->standort_code = $row->standort_code;
|
||||
|
||||
$obj->bezeichnung_arr['German'] = $obj->bezeichnung;
|
||||
$obj->bezeichnung_arr['English'] = $obj->english;
|
||||
@@ -1073,7 +1104,7 @@ class studiengang extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Laedt die Studiengänge die vom übergeben Typ sind
|
||||
* @param string $typ
|
||||
@@ -1088,13 +1119,13 @@ class studiengang extends basis_db
|
||||
tbl_studiengang.typ=".$this->db_add_param($typ)."
|
||||
ORDER BY
|
||||
kurzbz";
|
||||
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$obj = new studiengang();
|
||||
|
||||
|
||||
$obj->studiengang_kz = $row->studiengang_kz;
|
||||
$obj->kurzbz = $row->kurzbz;
|
||||
$obj->kurzbzlang = $row->kurzbzlang;
|
||||
@@ -1127,10 +1158,13 @@ class studiengang extends basis_db
|
||||
$obj->moodle = $this->db_parse_bool($row->moodle);
|
||||
$obj->mischform = $this->db_parse_bool($row->mischform);
|
||||
$obj->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige);
|
||||
|
||||
$obj->melderelevant = $this->db_parse_bool($row->melderelevant);
|
||||
$obj->foerderrelevant = $this->db_parse_bool($row->foerderrelevant);
|
||||
$obj->standort_code = $row->standort_code;
|
||||
|
||||
$obj->bezeichnung_arr['German'] = $obj->bezeichnung;
|
||||
$obj->bezeichnung_arr['English'] = $obj->english;
|
||||
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -72,7 +72,7 @@ class studienplatz extends basis_db
|
||||
parent::__construct();
|
||||
|
||||
if(!is_null($studienplatz_id))
|
||||
$this->load($studienplatz_id);
|
||||
$this->loadStudienplatz($studienplatz_id);
|
||||
}
|
||||
|
||||
public function __set($name,$value)
|
||||
|
||||
@@ -190,6 +190,7 @@ $menu=array
|
||||
'StudienplanZuteilung'=>array('name'=>'Studienplan Zuteilung', 'link'=>'lehre/studienplan_zuteilung.php', 'target'=>'main','permissions'=>array('assistenz')),
|
||||
'lv_merge'=>array('name'=>'LVs zusammenlegen', 'link'=>'lehre/lv_merge.php', 'target'=>'main','permissions'=>array('lehre/lehrveranstaltung')),
|
||||
'akteupdate'=>array('name'=>'Akten überschreiben', 'link'=>'personen/akteupdate.php', 'target'=>'main','permissions'=>array('admin')),
|
||||
'gemeindeupdate'=>array('name'=>'Gemeinden aktualisieren', 'link'=>'stammdaten/set_gemeinde.php', 'target'=>'main','permissions'=>array('basis/gemeinde')),
|
||||
),
|
||||
'Auswertung'=> array
|
||||
(
|
||||
|
||||
+50
-18
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2009 Technikum-Wien
|
||||
/* Copyright (C) 2009-2021 fhcomplete.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
@@ -15,11 +15,11 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Bison Paolo <bison@technikum-wien.at>
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
require_once(dirname(__FILE__).'/../config/global.config.inc.php');
|
||||
require_once(dirname(__FILE__).'/benutzerberechtigung.class.php');
|
||||
|
||||
/**
|
||||
* Used to export UDF in MS Excel format
|
||||
@@ -286,14 +286,21 @@ class UDF extends basis_db
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of associative arrays that contains the couple name and title related to an UDF
|
||||
* These data are retrived from the UDF definitions given as parameter
|
||||
*/
|
||||
private function _getUDFDefinition($jsons)
|
||||
{
|
||||
/**
|
||||
* Returns an array of associative arrays that contains the couple name and title related to an UDF
|
||||
* These data are retrived from the UDF definitions given as parameter
|
||||
*/
|
||||
private function _getUDFDefinition($jsons)
|
||||
{
|
||||
$names = array();
|
||||
$uid = get_uid(); // get the UID of the logged person
|
||||
|
||||
if ($uid == null) return names(); // if no logged then it is not possible to loads UDFs
|
||||
|
||||
// Gets the permissions for the logged user
|
||||
$berechtigung = new benutzerberechtigung();
|
||||
$berechtigung->getBerechtigungen($uid);
|
||||
|
||||
if ($jsons != null && ($jsonsDecoded = json_decode($jsons)) != null)
|
||||
{
|
||||
if (is_object($jsonsDecoded) || is_array($jsonsDecoded))
|
||||
@@ -305,27 +312,51 @@ class UDF extends basis_db
|
||||
|
||||
$this->_sortJsonSchemas($jsonsDecoded);
|
||||
|
||||
foreach($jsonsDecoded as $udfJsonShema)
|
||||
foreach ($jsonsDecoded as $udfJsonShema)
|
||||
{
|
||||
if (isset($udfJsonShema->name) && isset($udfJsonShema->title))
|
||||
// Checks if the requiredPermissions property exists
|
||||
if (isset($udfJsonShema->requiredPermissions))
|
||||
{
|
||||
$tmpArray = array('name' => $udfJsonShema->name, 'title' => $udfJsonShema->title);
|
||||
$isAllowed = false;
|
||||
|
||||
if (isset($udfJsonShema->type)
|
||||
&& ($udfJsonShema->type == 'dropdown' || $udfJsonShema->type == 'multipledropdown')
|
||||
&& isset($udfJsonShema->listValues) && isset($udfJsonShema->listValues->enum))
|
||||
// If requiredPermissions is an array check if at least one of the permissions belongs to the logged user
|
||||
if (is_array($udfJsonShema->requiredPermissions))
|
||||
{
|
||||
$tmpArray['enum'] = $udfJsonShema->listValues->enum;
|
||||
foreach ($udfJsonShema->requiredPermissions as $permission)
|
||||
{
|
||||
$isAllowed = $berechtigung->isBerechtigt($permission);
|
||||
if ($isAllowed === true) break;
|
||||
}
|
||||
}
|
||||
else // otherwise check it directly
|
||||
{
|
||||
$isAllowed = $berechtigung->isBerechtigt($udfJsonShema->requiredPermissions);
|
||||
}
|
||||
|
||||
$names[] = $tmpArray;
|
||||
}
|
||||
// If the logged user has at least one of the required permissions
|
||||
if ($isAllowed === true)
|
||||
{
|
||||
if (isset($udfJsonShema->name) && isset($udfJsonShema->title))
|
||||
{
|
||||
$tmpArray = array('name' => $udfJsonShema->name, 'title' => $udfJsonShema->title);
|
||||
|
||||
if (isset($udfJsonShema->type)
|
||||
&& ($udfJsonShema->type == 'dropdown' || $udfJsonShema->type == 'multipledropdown')
|
||||
&& isset($udfJsonShema->listValues) && isset($udfJsonShema->listValues->enum))
|
||||
{
|
||||
$tmpArray['enum'] = $udfJsonShema->listValues->enum;
|
||||
}
|
||||
|
||||
$names[] = $tmpArray;
|
||||
}
|
||||
} // otherwise this UDF is discarted because the requiredPermissions is mandatory
|
||||
} // otherwise this UDF is discarted because the requiredPermissions is mandatory
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $names;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads UDf titles from phrases
|
||||
@@ -374,3 +405,4 @@ class UDF extends basis_db
|
||||
return $titles;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -566,6 +566,7 @@ class vorlage extends basis_db
|
||||
$this->insertvon = $row->insertvon;
|
||||
$this->updateamum = $row->updateamum;
|
||||
$this->updatevon = $row->updatevon;
|
||||
$this->vorlagestudiengang_id = $row->vorlagestudiengang_id;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -812,20 +812,141 @@ or not exists
|
||||
|
||||
$qry = "select max(datum) from addon.tbl_casetime_timesheet where ".$where." and abgeschicktamum is not null";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if ($result = $this->db_query($qry))
|
||||
{
|
||||
$datum = $this->db_fetch_object($result);
|
||||
return $datum->max;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft, ob es für einen bestimmten User für einen bestimmten Tag eine Zeitaufzeichnung gibt
|
||||
* @param string $user Uid des zu prüfenden Users.
|
||||
* @param date $vonDay Startdatum des zu prüfenden Zeitraumes im Format d.m.Y.
|
||||
* @param date $bisDay Enddatum des zu prüfenden Zeitraumes im Format d.m.Y.
|
||||
* @return boolean true, wenn vorhanden, sonst false
|
||||
*/
|
||||
public function existsZeitaufzeichnung($user, $vonDay, $bisDay)
|
||||
{
|
||||
$datum = date($vonDay);
|
||||
$year = substr($datum, 6, 4);
|
||||
$month = substr($datum, 3, 2);
|
||||
$day = substr($datum, 0, 2);
|
||||
|
||||
$datumbisDay = date($bisDay);
|
||||
$yearbisDay = substr($datumbisDay, 6, 4);
|
||||
$monthbisDay = substr($datumbisDay, 3, 2);
|
||||
$daybisDay = substr($datumbisDay, 0, 2);
|
||||
|
||||
$bisDay = date("Y-m-d", (mktime(0, 0, 0, $monthbisDay, $daybisDay + 1, $yearbisDay)));
|
||||
$datum = date("Y-m-d", (mktime(0, 0, 0, $month, $day, $year)));
|
||||
|
||||
$qry = "
|
||||
SELECT *
|
||||
FROM campus.tbl_zeitaufzeichnung
|
||||
WHERE uid = ". $this->db_add_param($user). "
|
||||
AND start >= ". $this->db_add_param($datum). "
|
||||
AND ende < ". $this->db_add_param($bisDay). ";
|
||||
";
|
||||
|
||||
if ($this->db_query($qry))
|
||||
{
|
||||
$num_rows = $this->db_num_rows();
|
||||
if ($num_rows >= 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Check, if there is a blocking PausenError
|
||||
*
|
||||
* @param string $uid User uid.
|
||||
* @param string $datumday Day to be check in the format "Y-m-d".
|
||||
* @return boolean True if there is a Pausen error.
|
||||
*/
|
||||
public function checkPausenErrors($uid, $datumday)
|
||||
{
|
||||
$tagesbeginn = '';
|
||||
$tagesende = '';
|
||||
$pausesumme = 0;
|
||||
$tagessaldo = '';
|
||||
$elsumme = '00:00';
|
||||
$pflichtpause = false;
|
||||
$blockingError = false;
|
||||
$datum = new datum();
|
||||
|
||||
$this->getListeUserFromTo($uid, $datumday, $datumday, null);
|
||||
|
||||
foreach ($this->result as $row)
|
||||
{
|
||||
$datumtag = $datum->formatDatum($row->datum, 'Y-m-d');
|
||||
|
||||
if (($tagesbeginn == '' || $datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format = 'Y-m-d H:i:s')) > $datum->mktime_fromtimestamp($datum->formatDatum($row->start, $format = 'Y-m-d H:i:s'))) && $row->aktivitaet_kurzbz != 'LehreExtern' && $row->aktivitaet_kurzbz != 'Ersatzruhe')
|
||||
$tagesbeginn = $datum->formatDatum($row->start, 'H:i');
|
||||
|
||||
if (($tagesende == '' || $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format = 'Y-m-d H:i:s')) < $datum->mktime_fromtimestamp($datum->formatDatum($row->ende, $format = 'Y-m-d H:i:s'))) && $row->aktivitaet_kurzbz != 'LehreExtern' && $row->aktivitaet_kurzbz != 'Ersatzruhe')
|
||||
$tagesende = $datum->formatDatum($row->ende, 'H:i');
|
||||
|
||||
if ($row->aktivitaet_kurzbz == "Pause")
|
||||
{
|
||||
list($h1, $m1) = explode(':', $row->diff);
|
||||
$pausesumme += ($h1 * 3600 + $m1 * 60);
|
||||
}
|
||||
}
|
||||
|
||||
$tagessaldo = $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format = 'Y-m-d H:i:s')) - $datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format = 'Y-m-d H:i:s')) - 3600;
|
||||
|
||||
list($h2, $m2) = explode(':', $elsumme);
|
||||
$elsumme = $h2 * 3600 + $m2 * 60;
|
||||
|
||||
|
||||
if ($datum->formatDatum($datumday, 'Y-m-d') >= '2019-11-06')
|
||||
{
|
||||
$pausesumme = $pausesumme;
|
||||
}
|
||||
elseif ($tagessaldo > 18000 && $tagessaldo < 19800 && $pflichtpause == false && $elsumme == 0)
|
||||
{
|
||||
$pausesumme = $tagessaldo - 18000;
|
||||
}
|
||||
elseif ($tagessaldo > 18000 && $pflichtpause == false && $elsumme == 0)
|
||||
{
|
||||
$pausesumme = $pausesumme + 1800;
|
||||
}
|
||||
|
||||
if ($elsumme > 0)
|
||||
{
|
||||
$pausesumme = $pausesumme + $elsumme;
|
||||
$pflichtpause = true;
|
||||
}
|
||||
|
||||
$tagessaldo = $tagessaldo - $pausesumme;
|
||||
|
||||
//check if blocking error
|
||||
if (($tagessaldo > 19800 && $pausesumme < 1800) || ($tagessaldo > 18000 && $tagessaldo < 19800 && $pausesumme < $tagessaldo - 18000))
|
||||
{
|
||||
$blockingError = true;
|
||||
}
|
||||
|
||||
return $blockingError;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
<?php
|
||||
require_once('../../../include/datum.class.php');
|
||||
require_once('../../../include/projekt.class.php');
|
||||
require_once('../../../include/projektphase.class.php');
|
||||
require_once('../../../include/zeitaufzeichnung.class.php');
|
||||
|
||||
/**
|
||||
* Description of zeitaufzeichnung_import
|
||||
*
|
||||
* @author chris
|
||||
*/
|
||||
class zeitaufzeichnung_import {
|
||||
|
||||
protected $errors;
|
||||
protected $warnings;
|
||||
protected $infos;
|
||||
|
||||
protected $p;
|
||||
protected $datum;
|
||||
|
||||
protected $project;
|
||||
protected $phase;
|
||||
protected $limitdate;
|
||||
|
||||
protected $zeit;
|
||||
|
||||
|
||||
/**
|
||||
* @param phrasen $p The Translator object
|
||||
*/
|
||||
public function __construct($p) {
|
||||
$this->errors = [];
|
||||
$this->warnings = [];
|
||||
$this->infos = [];
|
||||
|
||||
$this->p = $p;
|
||||
$this->datum = new datum();
|
||||
|
||||
$this->project = new projekt();
|
||||
$this->phase = new projektphase();
|
||||
$this->limitdate = date('c', strtotime("+5 weeks"));
|
||||
|
||||
$this->zeit = new zeitaufzeichnung();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasErrors() {
|
||||
return !empty($this->errors);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasWarnings() {
|
||||
return !empty($this->warnings);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasInfos() {
|
||||
return !empty($this->infos);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ErrorsToHTML() {
|
||||
$html = '';
|
||||
foreach ($this->errors as $msg) {
|
||||
$html .= '<span style="color:red;"><b>' . $msg . '</b></span><br>' . "\n";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function WarningsToHTML() {
|
||||
$html = '';
|
||||
foreach ($this->warnings as $msg) {
|
||||
$html .= '<span style="color:orange;"><b>' . $msg . '</b></span><br>' . "\n";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function InfosToHTML() {
|
||||
$html = '';
|
||||
foreach ($this->infos as $msg) {
|
||||
$html .= '<span style="color:green;"><b>' . $msg . '</b></span><br>' . "\n";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function OutputToHTML() {
|
||||
return $this->InfosToHTML() . $this->WarningsToHTML() . $this->ErrorsToHTML();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $msg
|
||||
* @return void
|
||||
*/
|
||||
protected function addError($msg) {
|
||||
$this->errors[] = $msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $msg
|
||||
* @return void
|
||||
*/
|
||||
protected function addWarning($msg) {
|
||||
$this->warnings[] = $msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $msg
|
||||
* @return void
|
||||
*/
|
||||
protected function addInfo($msg) {
|
||||
$this->infos[] = $msg;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $uid The user id
|
||||
* @param string $day "Y-m-d" formatted datestring
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkZeitsperren($uid, $day) {
|
||||
$zs = new zeitsperre();
|
||||
|
||||
if (!$zs->getSperreByDate($uid, $day, null, zeitsperre::NUR_BLOCKIERENDE_ZEITSPERREN)) {
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ": Fehler beim Überprüfen der Zeitsperren");
|
||||
}
|
||||
|
||||
if (count($zs->result) !== 0) {
|
||||
$zsdate = new DateTime($day);
|
||||
$zsdate = $zsdate->format('d.m.Y');
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ": " . $this->p->t("zeitaufzeichnung/zeitsperreVorhanden", [$zsdate, $zs->result[0]->zeitsperretyp_kurzbz]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $date datetimestring
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkLimitdatum($date) {
|
||||
if ($this->datum->formatDatum($date, 'Y-m-d H:i:s') > $this->limitdate) {
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich da (' . $date . ') zu weit in der Zukunft liegt.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $start datestring
|
||||
* @param string $end datestring
|
||||
* @param string $aktivitaet_kurzbz
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkDienstreise($start, $end, $aktivitaet_kurzbz) {
|
||||
$startDate = $this->datum->formatDatum($start, 'Y-m-d');
|
||||
$endDate = $this->datum->formatDatum($end, 'Y-m-d');
|
||||
if ($startDate != $endDate && $aktivitaet_kurzbz != "DienstreiseMT") {
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten")
|
||||
.': Eingabe nicht möglich, da keine Zeitaufzeichnung über mehrere Tage erlaubt ist (ausgenommen Dienstreisen).');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $end timestring
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkTagesgenau($end) {
|
||||
$endTime = $this->datum->formatDatum($end, 'H:i:s');
|
||||
if ($endTime == '00:00:00') {
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten")
|
||||
.': Bitte Arbeitszeiten gemäß Arbeitsaufzeichnung Leitfaden tagesgenau abgrenzen: Nur Eingaben von 00:00 bis 23:59 erlaubt!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projekt_kurzbz
|
||||
* @param string $start datestring
|
||||
* @param string $end datestring
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkProjectInterval($projekt_kurzbz, $start, $end) {
|
||||
if (!$this->project->checkProjectInCorrectTime($projekt_kurzbz, $start, $end)) {
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt: (' . $start . ') (' . $end . ')');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $phase The Projektphase ID
|
||||
* @param string $start datestring
|
||||
* @param string $end datestring
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkPhaseInterval($phase, $start, $end) {
|
||||
if (!$this->phase->checkProjectphaseInCorrectTime($phase, $start, $end)) {
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt: (' . $start . ') (' . $end . ')');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,435 @@
|
||||
<?php
|
||||
require_once('zeitaufzeichnung_import.class.php');
|
||||
require_once('../../../include/organisationseinheit.class.php');
|
||||
|
||||
/**
|
||||
* Description of zeitaufzeichnung_csv_import
|
||||
*
|
||||
* @author bambi
|
||||
*/
|
||||
class zeitaufzeichnung_import_csv extends zeitaufzeichnung_import {
|
||||
|
||||
const USER = 0;
|
||||
const AKTIVITAET = 1;
|
||||
const STARTDT = 2;
|
||||
const ENDEDT = 3;
|
||||
const BESCHREIBUNG = 4;
|
||||
const OE = 5;
|
||||
const PROJEKT = 6;
|
||||
const PHASE = 7;
|
||||
const SERVICE = 8;
|
||||
const HOMEOFFICE = 9;
|
||||
const ANZAHL_PFLICHTFELDER = 4;
|
||||
|
||||
protected $tmpname;
|
||||
protected $fh;
|
||||
|
||||
protected $anzahl;
|
||||
protected $importtage_array;
|
||||
protected $ende_vorher;
|
||||
|
||||
protected $user;
|
||||
|
||||
protected $project_kurzbz_array;
|
||||
protected $projectphasen_kurzbz_array;
|
||||
|
||||
protected $sperrdatum;
|
||||
|
||||
protected $current_line;
|
||||
|
||||
protected $homeoffice;
|
||||
|
||||
|
||||
/**
|
||||
* @param phrasen $p The Translator object
|
||||
* @param string $user The user ID
|
||||
* @param string $sperrdatum "c" formatted datetimestring
|
||||
* @param string $filename
|
||||
*/
|
||||
public function __construct(phrasen $p, $user, $sperrdatum, $filename) {
|
||||
parent::__construct($p);
|
||||
|
||||
$this->user = $user;
|
||||
$this->tmpname = $filename;
|
||||
$this->sperrdatum = $sperrdatum;
|
||||
|
||||
$this->project_kurzbz_array = [];
|
||||
$projects = $this->project->getProjekteListForMitarbeiter($user);
|
||||
foreach ($projects as $pp)
|
||||
$this->project_kurzbz_array[] = (string) $pp->projekt_kurzbz;
|
||||
|
||||
$this->projectphasen_kurzbz_array = [];
|
||||
$projektphasen = $this->phase->getProjectphaseForMitarbeiter($user);
|
||||
foreach ($projektphasen as $pp)
|
||||
$this->projectphasen_kurzbz_array[] = (string) $pp->projektphase_id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $msg
|
||||
* @param boolean $prepend_current_line
|
||||
* @return void
|
||||
*/
|
||||
protected function addError($msg, $prepend_current_line = false) {
|
||||
if( $prepend_current_line ) {
|
||||
$msg = 'Zeile ' . $this->current_line . ' - ' . $msg;
|
||||
}
|
||||
$this->errors[] = $msg;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function import() {
|
||||
try {
|
||||
$this->checkMimeType();
|
||||
$this->openFileForReading();
|
||||
$this->checkEncoding();
|
||||
$this->iterateRows();
|
||||
$this->checkAndCleanup();
|
||||
} catch (Exception $ex) {
|
||||
$this->addError($ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkMimeType() {
|
||||
$mimeType = mime_content_type($this->tmpname);
|
||||
if ($mimeType !== 'text/plain' ) {
|
||||
throw new Exception('Datei ist nicht im CSV Format.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function openFileForReading() {
|
||||
if (false === ($this->fh = fopen($this->tmpname, 'r')) )
|
||||
{
|
||||
throw new Exception('CSV - Datei konnte nicht zum lesen geöffnet werden.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkEncoding() {
|
||||
$filecontent = file_get_contents($this->tmpname);
|
||||
if (!mb_detect_encoding($filecontent, 'UTF-8', true) ) {
|
||||
throw new Exception('Datei konnte nicht importiert werden. Encoding ist nicht UTF-8!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function iterateRows() {
|
||||
set_time_limit(0);
|
||||
|
||||
$this->anzahl = 0;
|
||||
$this->importtage_array = array();
|
||||
$this->ende_vorher = date('Y-m-d H:i:s');
|
||||
|
||||
$data = null;
|
||||
$this->current_line = 0;
|
||||
while (($data = fgetcsv($this->fh, 1000, ';', '"')) !== FALSE) {
|
||||
if ((false !== strpos($data[self::USER], '#'))
|
||||
|| count($data) < self::ANZAHL_PFLICHTFELDER) {
|
||||
// ignore lines starting with #
|
||||
continue;
|
||||
}
|
||||
$this->current_line++;
|
||||
$this->processData($data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
protected function processData($data) {
|
||||
try {
|
||||
$this->checkUser($data[self::USER]);
|
||||
$this->initData($data);
|
||||
$this->checkProject($data[self::PROJEKT], $data[self::PHASE]);
|
||||
$this->checkPhase($data[self::PHASE]);
|
||||
|
||||
$this->checkZeitsperren($this->user, $this->datum->formatDatum($data[self::STARTDT], 'Y-m-d'));
|
||||
$this->checkSperrdatum($data[self::STARTDT]);
|
||||
$this->checkLimitdatum($data[self::STARTDT]);
|
||||
$this->checkDienstreise($data[self::STARTDT], $data[self::ENDEDT], $data[self::AKTIVITAET]);
|
||||
$this->checkTagesgenau($data[self::ENDEDT]);
|
||||
if(empty($data[self::PHASE]))
|
||||
$this->checkProjectInterval($data[self::PROJEKT], $data[self::STARTDT], $data[self::ENDEDT]);
|
||||
$this->checkPhaseInterval($data[self::PHASE], $data[self::STARTDT], $data[self::ENDEDT]);
|
||||
$this->checkVals($data[self::OE],$data[self::PROJEKT],$data[self::PHASE],$data[self::SERVICE]);
|
||||
$this->mapLehreIntern($data);
|
||||
$this->prepareZeitaufzeichnung($data);
|
||||
$this->checkImporttage($data[self::STARTDT]);
|
||||
$this->saveZeit($data[self::STARTDT], $data[self::ENDEDT]);
|
||||
} catch (Exception $ex) {
|
||||
$this->addError($ex->getMessage(), true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $user The User ID
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkUser($user) {
|
||||
if ($user !== $this->user || (strpos($user, '#') !== false))
|
||||
{
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Falsche UID nicht importiert (' . $user . ')');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $project The Project ID or empty string
|
||||
* @param string $phase The Phase ID or empty string
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkProject($project, $phase) {
|
||||
if(!empty($project) && !in_array($project, $this->project_kurzbz_array) && empty($phase))
|
||||
{
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgendem Projekt entweder nicht zugewiesen sind oder das Projekt schon abgeschlossen wurde: (' . $project . ')');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $phase The Phase ID or empty string
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkPhase($phase) {
|
||||
if(!empty($phase) && !in_array($phase, $this->projectphasen_kurzbz_array))
|
||||
{
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgender Projektphase entweder nicht zugewiesen sind oder die Projektphase schon abgeschlossen wurde: (' . $phase . ')');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
protected function initData(&$data) {
|
||||
foreach ([self::OE, self::PROJEKT, self::PHASE, self::SERVICE] as $key)
|
||||
if (!isset($data[$key]))
|
||||
$data[$key] = NULL;
|
||||
|
||||
if (!isset($data[self::HOMEOFFICE]))
|
||||
$data[$key] = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $start datetimestring
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkSperrdatum($start) {
|
||||
if ($this->datum->formatDatum($start, 'Y-m-d H:i:s') < $this->sperrdatum) {
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Eingabe nicht möglich da vor dem Sperrdatum (' . $start . ')');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $oe_val
|
||||
* @param string $project_val
|
||||
* @param string $phase_val
|
||||
* @param string $service_val
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkVals($oe_val, $project_val, $phase_val, $service_val) {
|
||||
$failedvals = $this->_checkVals($oe_val, $project_val, $phase_val, $service_val);
|
||||
if( count($failedvals) > 0 )
|
||||
{
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Werte ('.implode(', ', $failedvals).')');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $oe_val
|
||||
* @param string $project_val
|
||||
* @param string $phase_val
|
||||
* @param string $service_val
|
||||
* @return array
|
||||
*/
|
||||
protected function _checkVals ($oe_val, $project_val, $phase_val, $service_val) {
|
||||
$error = [];
|
||||
if ($service_val && ( filter_var($service_val, FILTER_VALIDATE_INT) === false )) {
|
||||
$error[] = 'service';
|
||||
}
|
||||
if ($phase_val && ( filter_var($phase_val, FILTER_VALIDATE_INT) === false )) {
|
||||
$error[] = 'phase';
|
||||
}
|
||||
if ($oe_val) {
|
||||
$oecheck = new organisationseinheit($oe_val);
|
||||
if ($oecheck->errormsg) {
|
||||
$error[] = 'OE';
|
||||
}
|
||||
}
|
||||
if ($project_val) {
|
||||
$procheck = new projekt($project_val);
|
||||
if ($procheck->errormsg) {
|
||||
$error[] = 'projekt';
|
||||
}
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
protected function mapLehreIntern(&$data) {
|
||||
if ($data[self::AKTIVITAET] == 'LehreIntern') {
|
||||
$data[self::AKTIVITAET] = 'Lehre';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareZeitaufzeichnung($data) {
|
||||
$this->zeit->new = true;
|
||||
$this->zeit->beschreibung = NULL;
|
||||
$this->zeit->oe_kurzbz_1 = NULL;
|
||||
$this->zeit->projekt_kurzbz = NULL;
|
||||
$this->zeit->projektphase_id = NULL;
|
||||
$this->zeit->service_id = NULL;
|
||||
|
||||
$this->zeit->insertamum = date('Y-m-d H:i:s');
|
||||
$this->zeit->updateamum = date('Y-m-d H:i:s');
|
||||
$this->zeit->updatevon = $this->user;
|
||||
$this->zeit->insertvon = $this->user;
|
||||
$this->zeit->uid = $data[self::USER];
|
||||
$this->zeit->aktivitaet_kurzbz = $data[self::AKTIVITAET];
|
||||
$this->zeit->start = $this->datum->formatDatum($data[self::STARTDT], 'Y-m-d H:i:s');
|
||||
$this->zeit->ende = $this->datum->formatDatum($data[self::ENDEDT], 'Y-m-d H:i:s');
|
||||
if (isset($data[self::BESCHREIBUNG])) {
|
||||
$this->zeit->beschreibung = $data[self::BESCHREIBUNG];
|
||||
}
|
||||
if (isset($data[self::OE])) {
|
||||
$this->zeit->oe_kurzbz_1 = $data[self::OE];
|
||||
}
|
||||
if (isset($data[self::PROJEKT])) {
|
||||
$this->zeit->projekt_kurzbz = $data[self::PROJEKT];
|
||||
}
|
||||
if (isset($data[self::PHASE])) {
|
||||
$this->zeit->projektphase_id = $data[self::PHASE];
|
||||
}
|
||||
if (isset($data[self::SERVICE])) {
|
||||
$this->zeit->service_id = $data[self::SERVICE];
|
||||
}
|
||||
$this->zeit->homeoffice = false;
|
||||
if (isset($data[self::HOMEOFFICE])) {
|
||||
$this->zeit->homeoffice = (strtolower($data[self::HOMEOFFICE]) == 'true');
|
||||
if (strtolower($data[self::HOMEOFFICE]) == 'true') {
|
||||
// check, ob homeoffice gemäß Bisverwendung
|
||||
$vonCSV = $this->datum->formatDatum($data[self::STARTDT], 'Y-m-d');
|
||||
$verwendung = new bisverwendung();
|
||||
$verwendung->getVerwendungDatum($data[self::USER], $vonCSV);
|
||||
|
||||
foreach ($verwendung->result as $v) {
|
||||
if ($v->homeoffice) {
|
||||
$this->zeit->homeoffice = true;
|
||||
} else {
|
||||
$this->addWarning($this->p->t("zeitaufzeichnung/homeofficeNichtErlaubt", [$vonCSV]));
|
||||
$this->zeit->homeoffice = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $start datestring
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkImporttage($start) {
|
||||
$tag = $this->datum->formatDatum($start, 'Y-m-d');
|
||||
|
||||
if (!in_array($tag, $this->importtage_array)) {
|
||||
$this->importtage_array[] = $tag;
|
||||
$this->zeit->deleteEntriesForUser($this->user, $tag);
|
||||
} else if ($this->ende_vorher < $this->zeit->start) {
|
||||
$this->savePause();
|
||||
}
|
||||
|
||||
$this->ende_vorher = $this->zeit->ende;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function savePause() {
|
||||
$pause = new zeitaufzeichnung();
|
||||
$pause->new = true;
|
||||
$pause->insertamum = date('Y-m-d H:i:s');
|
||||
$pause->updateamum = date('Y-m-d H:i:s');
|
||||
$pause->updatevon = $this->user;
|
||||
$pause->insertvon = $this->user;
|
||||
$pause->uid = $this->user;
|
||||
$pause->aktivitaet_kurzbz = 'Pause';
|
||||
$pause->start = $this->ende_vorher;
|
||||
$pause->ende = $this->zeit->start;
|
||||
$pause->beschreibung = '';
|
||||
$pause->homeoffice = $this->zeit->homeoffice;
|
||||
if(!$pause->save())
|
||||
{
|
||||
$this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $start datetimestring
|
||||
* @param string $end datetimestring
|
||||
* @return void
|
||||
*/
|
||||
protected function saveZeit($start, $end) {
|
||||
if ($start != $end) {
|
||||
if (!$this->zeit->save()) {
|
||||
$this->addError($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $this->zeit->errormsg . '(' . $this->zeit->start . ')', true);
|
||||
} else {
|
||||
$this->anzahl++;
|
||||
}
|
||||
} else {
|
||||
$this->anzahl++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function checkAndCleanup() {
|
||||
if ($this->anzahl > 0) {
|
||||
$this->addInfo($this->p->t("global/datenWurdenGespeichert") . ' (' . $this->anzahl . ')');
|
||||
foreach ($this->importtage_array as $ptag) {
|
||||
$this->zeit->cleanPausenForUser($this->user, $ptag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
<?php
|
||||
require_once('zeitaufzeichnung_import.class.php');
|
||||
|
||||
/**
|
||||
* Description of zeitaufzeichnung_import_post
|
||||
*
|
||||
* @author chris
|
||||
*/
|
||||
class zeitaufzeichnung_import_post extends zeitaufzeichnung_import {
|
||||
|
||||
protected $datum;
|
||||
|
||||
protected $user;
|
||||
protected $edit;
|
||||
protected $data;
|
||||
|
||||
|
||||
/**
|
||||
* @param phrasen $p The Translator object
|
||||
* @param string $user The user ID
|
||||
* @param boolean $edit Edit or create a new one
|
||||
* @param array $data The array keys are:
|
||||
* - aktivitaet_kurzbz string
|
||||
* - beschreibung string
|
||||
* - bis datum
|
||||
* - bis_pause datum
|
||||
* - homeoffice boolean
|
||||
* - kunde_uid string ID
|
||||
* - oe_kurzbz_1 string
|
||||
* - oe_kurzbz_2 string
|
||||
* - projekt_kurzbz string
|
||||
* - projektphase_id string ID
|
||||
* - service_id string ID
|
||||
* - von datum
|
||||
* - von_pause datum
|
||||
* - zeitaufzeichnung_id string ID
|
||||
* @param string $filename
|
||||
*/
|
||||
public function __construct(phrasen $p, $user, $edit, $data) {
|
||||
parent::__construct($p);
|
||||
|
||||
$this->user = $user;
|
||||
$this->edit = $edit;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ErrorsToHTML() {
|
||||
$html = '';
|
||||
foreach ($this->errors as $msg) {
|
||||
$html .= '<span id="triggerPhasenReset" style="color:red;"><b>' . $msg . '</b></span><br>' . "\n";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function import() {
|
||||
try {
|
||||
$this->checkNew($this->data['zeitaufzeichnung_id']);
|
||||
$this->prepareZeitaufzeichnung($this->data['aktivitaet_kurzbz'], $this->data['von'], $this->data['bis'], $this->data['beschreibung'], $this->data['oe_kurzbz_1'], $this->data['oe_kurzbz_2'], $this->data['projekt_kurzbz'], $this->data['projektphase_id'], $this->data['homeoffice'], $this->data['service_id'], $this->data['kunde_uid']);
|
||||
$this->checkZeitsperren($this->user, $this->datum->formatDatum($this->data['von'], 'Y-m-d'));
|
||||
$this->checkProjectInterval($this->data['projekt_kurzbz'], $this->data['von'], $this->data['bis']);
|
||||
$this->checkLimitdatum($this->data['von']);
|
||||
$this->checkLimitdatum($this->data['bis']);
|
||||
$this->checkPhaseInterval($this->data['projektphase_id'], $this->data['von'], $this->data['bis']);
|
||||
$this->checkDienstreise($this->data['von'], $this->data['bis'], $this->data['aktivitaet_kurzbz']);
|
||||
$this->checkTagesgenau($this->data['bis']);
|
||||
$this->processPause($this->data['von_pause'], $this->data['bis_pause']);
|
||||
$this->saveZeit();
|
||||
} catch (Exception $ex) {
|
||||
$this->addError($ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $zeitaufzeichnung_id
|
||||
* @return void
|
||||
*/
|
||||
protected function checkNew($zeitaufzeichnung_id) {
|
||||
if($this->edit) {
|
||||
if(!$this->zeit->load($zeitaufzeichnung_id))
|
||||
die($this->p->t("global/fehlerBeimLadenDesDatensatzes"));
|
||||
|
||||
$this->zeit->new = false;
|
||||
} else {
|
||||
$this->zeit->new = true;
|
||||
$this->zeit->insertamum = date('Y-m-d H:i:s');
|
||||
$this->zeit->insertvon = $this->user;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $aktivitaet_kurzbz
|
||||
* @param string $von datetime
|
||||
* @param string $bis datetime
|
||||
* @param string $beschreibung
|
||||
* @param string $oe_kurzbz_1
|
||||
* @param string $oe_kurzbz_2
|
||||
* @param string $projekt_kurzbz
|
||||
* @param string $projektphase_id
|
||||
* @param boolean $homeoffice
|
||||
* @param string $service_id
|
||||
* @param string $kunde_uid
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareZeitaufzeichnung($aktivitaet_kurzbz, $von, $bis, $beschreibung, $oe_kurzbz_1, $oe_kurzbz_2, $projekt_kurzbz, $projektphase_id, $homeoffice, $service_id, $kunde_uid) {
|
||||
$this->zeit->uid = $this->user;
|
||||
$this->zeit->aktivitaet_kurzbz = $aktivitaet_kurzbz;
|
||||
$this->zeit->start = $this->datum->formatDatum($von, 'Y-m-d H:i:s');
|
||||
$this->zeit->ende = $this->datum->formatDatum($bis, 'Y-m-d H:i:s');
|
||||
$this->zeit->beschreibung = $beschreibung;
|
||||
$this->zeit->oe_kurzbz_1 = $oe_kurzbz_1;
|
||||
$this->zeit->oe_kurzbz_2 = $oe_kurzbz_2;
|
||||
$this->zeit->updateamum = date('Y-m-d H:i:s');
|
||||
$this->zeit->updatevon = $this->user;
|
||||
$this->zeit->projekt_kurzbz = $projekt_kurzbz;
|
||||
$this->zeit->projektphase_id = $projektphase_id;
|
||||
$this->zeit->homeoffice = $homeoffice;
|
||||
$this->zeit->service_id = $service_id;
|
||||
$this->zeit->kunde_uid = $kunde_uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $start datetime
|
||||
* @param string $end datetime
|
||||
* @return void
|
||||
*/
|
||||
protected function processPause($start, $end) {
|
||||
if (isset($_POST['genPause'])) {
|
||||
$p_start = $this->datum->formatDatum($start, 'Y-m-d H:i:s');
|
||||
$p_end = $this->datum->formatDatum($end, 'Y-m-d H:i:s');
|
||||
$this->checkPauseInArbeitszeit($p_start, $p_end);
|
||||
$this->checkPauseValid($p_start, $p_end);
|
||||
$this->savePause($start, $end);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $start "Y-m-d H:i:s" formatted datetime
|
||||
* @param string $end "Y-m-d H:i:s" formatted datetime
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkPauseInArbeitszeit($start, $end) {
|
||||
if ($this->zeit->start > $start || $this->zeit->ende < $end) {
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Pause außerhalb der Arbeitszeit');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $start "Y-m-d H:i:s" formatted datetime
|
||||
* @param string $end "Y-m-d H:i:s" formatted datetime
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkPauseValid($start, $end) {
|
||||
if ($start > $end) {
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': Fehlerhafte Pausenzeiten');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $start datetime
|
||||
* @param string $end datetime
|
||||
* @return void
|
||||
*/
|
||||
protected function savePause($start, $end) {
|
||||
//Eintrag Arbeit bis zur Pause
|
||||
$ende = $this->zeit->ende;
|
||||
$this->zeit->ende = $this->datum->formatDatum($start, 'Y-m-d H:i:s');
|
||||
if (!$this->zeit->save()) {
|
||||
$this->addError($p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $this->zeit->errormsg);
|
||||
}
|
||||
//Eintrag für die Pause
|
||||
$pause = new zeitaufzeichnung();
|
||||
$pause->new = true;
|
||||
$pause->insertamum = date('Y-m-d H:i:s');
|
||||
$pause->updateamum = date('Y-m-d H:i:s');
|
||||
$pause->updatevon = $this->user;
|
||||
$pause->insertvon = $this->user;
|
||||
$pause->uid = $this->user;
|
||||
$pause->aktivitaet_kurzbz = 'Pause';
|
||||
$pause->homeoffice = $this->zeit->homeoffice;
|
||||
$pause->start = $this->datum->formatDatum($start, 'Y-m-d H:i:s');
|
||||
$pause->ende = $this->datum->formatDatum($end, 'Y-m-d H:i:s');
|
||||
$pause->beschreibung = '';
|
||||
if (!$pause->save()) {
|
||||
$this->addError($p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $pause->errormsg);
|
||||
}
|
||||
// Eintrag Arbeit ab der Pause
|
||||
if ($this->zeit->new == false) {
|
||||
$this->zeit->new = true;
|
||||
$this->zeit->insertamum = date('Y-m-d H:i:s');
|
||||
$this->zeit->insertvon = $this->user;
|
||||
}
|
||||
|
||||
$this->zeit->start = $this->datum->formatDatum($end, 'Y-m-d H:i:s');
|
||||
$this->zeit->ende = $ende;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function saveZeit() {
|
||||
if (!$this->zeit->save()) {
|
||||
throw new Exception($this->p->t("global/fehlerBeimSpeichernDerDaten") . ': ' . $this->zeit->errormsg);
|
||||
} else if (!$this->hasErrors()) {
|
||||
$this->addInfo($this->p->t("global/datenWurdenGespeichert"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,6 +23,9 @@ require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
|
||||
class zeitsperre extends basis_db
|
||||
{
|
||||
const NUR_BLOCKIERENDE_ZEITSPERREN = true;
|
||||
const BLOCKIERENDE_ZEITSPERREN = "'Krank','Urlaub','ZA','DienstV','PflegeU','DienstF','CovidSB','CovidKS'";
|
||||
|
||||
public $new; // boolean
|
||||
public $result = array(); // news Objekt
|
||||
|
||||
@@ -57,6 +60,11 @@ class zeitsperre extends basis_db
|
||||
$this->load($zeitsperre_id);
|
||||
}
|
||||
|
||||
public static function getBlockierendeZeitsperren()
|
||||
{
|
||||
return explode("','",trim(self::BLOCKIERENDE_ZEITSPERREN, '\''));
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt alle Zeitsperren eines Benutzers wo ende>=now() ist
|
||||
* @param $uid
|
||||
@@ -368,11 +376,13 @@ class zeitsperre extends basis_db
|
||||
*
|
||||
* @param $user
|
||||
* @param $datum
|
||||
* @param $stunde
|
||||
* @param $stunde optional, wird nur abgefragt, wenn != null
|
||||
* @param $nurblockierend boolean default false
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function getSperreByDate($user, $datum, $stunde)
|
||||
public function getSperreByDate($user, $datum, $stunde=null, $nurblockierend=false)
|
||||
{
|
||||
$this->result = array();
|
||||
$qry = "
|
||||
SELECT
|
||||
*
|
||||
@@ -380,16 +390,23 @@ class zeitsperre extends basis_db
|
||||
campus.tbl_zeitsperre
|
||||
WHERE
|
||||
vondatum<=".$this->db_add_param($datum)."
|
||||
AND bisdatum>=".$this->db_add_param($datum)." AND
|
||||
((vondatum=".$this->db_add_param($datum)." AND vonstunde<=".$this->db_add_param($stunde).") OR vonstunde is null OR vondatum<>".$this->db_add_param($datum).") AND
|
||||
((bisdatum=".$this->db_add_param($datum)." AND bisstunde>=".$this->db_add_param($stunde).") OR bisstunde is null OR bisdatum<>".$this->db_add_param($datum).") AND
|
||||
mitarbeiter_uid=".$this->db_add_param($user);
|
||||
AND bisdatum>=".$this->db_add_param($datum);
|
||||
|
||||
if( $nurblockierend ) {
|
||||
$qry .= " AND zeitsperretyp_kurzbz in (" . self::BLOCKIERENDE_ZEITSPERREN . ")";
|
||||
}
|
||||
|
||||
if(!is_null($stunde))
|
||||
$qry.=" AND
|
||||
((vondatum=".$this->db_add_param($datum)." AND vonstunde<=".$this->db_add_param($stunde).") OR vonstunde is null OR vondatum<>".$this->db_add_param($datum).") AND
|
||||
((bisdatum=".$this->db_add_param($datum)." AND bisstunde>=".$this->db_add_param($stunde).") OR bisstunde is null OR bisdatum<>".$this->db_add_param($datum).")";
|
||||
|
||||
$qry .= "AND mitarbeiter_uid=".$this->db_add_param($user);
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
|
||||
$obj = new zeitsperre();
|
||||
|
||||
$obj->zeitsperre_id = $row->zeitsperre_id;
|
||||
@@ -482,7 +499,7 @@ class zeitsperre extends basis_db
|
||||
|
||||
$qry = "select datum::date, freigabevon, zeitsperretyp_kurzbz
|
||||
from (SELECT generate_series(vondatum::timestamp, bisdatum::timestamp, '1 day') as datum, freigabevon, mitarbeiter_uid, zeitsperretyp_kurzbz FROM campus.tbl_zeitsperre where vonstunde is null and bisstunde is null) a
|
||||
where a.mitarbeiter_uid = ".$this->db_add_param($uid)." and datum>(now() - interval '".$anz_tage." Days') and zeitsperretyp_kurzbz in ('Krank','Urlaub', 'ZA', 'DienstV','PflegeU', 'DienstF')";
|
||||
where a.mitarbeiter_uid = ".$this->db_add_param($uid)." and datum>(now() - interval '".$anz_tage." Days') and zeitsperretyp_kurzbz in (" . self::BLOCKIERENDE_ZEITSPERREN . ")";
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user