Merge remote-tracking branch 'origin/master'

This commit is contained in:
Manfred Kindl
2018-11-26 18:14:01 +01:00
72 changed files with 4573 additions and 1530 deletions
+700 -100
View File
File diff suppressed because it is too large Load Diff
+93
View File
@@ -0,0 +1,93 @@
<?php
/* Copyright (C) 2018 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
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at>,
*/
/**
* This class provides static functions for handling Result values
*/
class ErrorHandler
{
/**
* Returns a Success Object
* @param $retval object
* @return result object
*/
public static function success($retval = '')
{
$data = new stdClass();
$data->error = false;
$data->errormsg = '';
$data->retval = $retval;
return $data;
}
/**
* Returns an Error Object
* @param $retval object (optional)
* @return result object
*/
public static function error($errormsg = '', $retval = '')
{
$data = new stdClass();
$data->error = true;
$data->errormsg = $errormsg;
$data->retval = $retval;
return $data;
}
/**
* Checks if the Result object is Successfull
* @param result object
* @return boolean
*/
public static function isSuccess($result)
{
if (is_object($result) && isset($result->error) && $result->error === false)
{
return true;
}
return false;
}
/**
* Checks if the Result object is an error
* @param result object
* @return boolean
*/
public static function isError($result)
{
return !ErrorHandler::isSuccess($result);
}
/*
* Checks if the Result object contains additional data
* @param result object
* @return boolean
*/
public static function hasData($result)
{
if (is_object($result) && isset($result->retval) && $result->retval!='')
{
return true;
}
return false;
}
}
+49
View File
@@ -23,6 +23,8 @@ require_once(dirname(__FILE__).'/basis_db.class.php');
require_once(dirname(__FILE__).'/authentication.class.php');
require_once(dirname(__FILE__).'/betriebsmittelperson.class.php');
require_once(dirname(__FILE__).'/personlog.class.php');
require_once(dirname(__FILE__).'/benutzerberechtigung.class.php');
require_once(dirname(__FILE__).'/mitarbeiter.class.php');
// Auth: Benutzer des Webportals
/**
@@ -1112,4 +1114,51 @@ function setLeadingZero($number, $length = 2)
}
}
/** Check if uid is a supervisor
*
* @param string $uid
* @param string $employee_uid
* @return boolean True if $uid is direct leader of $employee_uid.
*/
function check_isVorgesetzter($uid, $employee_uid)
{
$mitarbeiter = new Mitarbeiter();
$mitarbeiter->getUntergebene($uid);
$untergebenen_arr = $mitarbeiter->untergebene;
// Check, if uid is an employee of supervisor
if (!empty($untergebenen_arr) &&
in_array($employee_uid, $untergebenen_arr))
{
return true;
}
else
{
return false;
}
}
/** Check if uid is a supervisor on higher oe level
*
* @param string $uid
* @param string $employee_uid
* @return boolean True if $uid is indirect supervisor (leader on higher oe-level)
* of $employee_uid.
*/
function check_isVorgesetzter_indirekt($uid, $employee_uid)
{
$mitarbeiter = new Mitarbeiter();
$mitarbeiter->getUntergebene($uid, true);
$untergebenen_ofChildOEs_arr = $mitarbeiter->untergebene;
if (!empty($untergebenen_ofChildOEs_arr) &&
in_array($employee_uid, $untergebenen_ofChildOEs_arr))
{
return true;
}
else
{
return false;
}
}
?>
Regular → Executable
+20 -16
View File
@@ -24,6 +24,7 @@
* @create 20-12-2006
*/
require_once(dirname(__FILE__).'/basis_db.class.php');
require_once(dirname(__FILE__).'/sprache.class.php');
class kontakt extends basis_db
{
@@ -281,7 +282,7 @@ class kontakt extends basis_db
$qry = "SELECT tbl_kontakt.*, tbl_firma.name as firma_name, tbl_firma.firma_id
FROM public.tbl_kontakt LEFT JOIN public.tbl_standort USING(standort_id) LEFT JOIN public.tbl_firma USING(firma_id) WHERE person_id=".$this->db_add_param($person_id, FHC_INTEGER)."
AND kontakttyp =".$this->db_add_param($kontakttyp, FHC_STRING);
if ($order != null)
$qry .= " ORDER BY ".$order;
@@ -332,9 +333,10 @@ class kontakt extends basis_db
$this->errormsg = 'Person_id ist ungueltig';
return false;
}
$qry = "SELECT tbl_kontakt.*, tbl_firma.name as firma_name, tbl_firma.firma_id
FROM public.tbl_kontakt LEFT JOIN public.tbl_standort USING(standort_id) LEFT JOIN public.tbl_firma USING(firma_id) WHERE person_id=".$this->db_add_param($person_id, FHC_INTEGER).';';
$sprache = new sprache();
$bezeichnung_mehrsprachig = $sprache->getSprachQuery('bezeichnung_mehrsprachig');
$qry = "SELECT tbl_kontakt.*, tbl_firma.name as firma_name, tbl_firma.firma_id, tbl_kontakttyp.beschreibung as kontakttyp_name, $bezeichnung_mehrsprachig
FROM public.tbl_kontakt JOIN tbl_kontakttyp USING (kontakttyp) LEFT JOIN public.tbl_standort USING(standort_id) LEFT JOIN public.tbl_firma USING(firma_id) WHERE person_id=".$this->db_add_param($person_id, FHC_INTEGER).';';
if($this->db_query($qry))
{
@@ -356,6 +358,8 @@ class kontakt extends basis_db
$obj->insertamum = $row->insertamum;
$obj->insertvon = $row->insertvon;
$obj->ext_id = $row->ext_id;
$obj->kontakttyp_name = $row->kontakttyp_name;
$obj->bezeichnung_mehrsprachig = $sprache->parseSprachResult('bezeichnung_mehrsprachig',$row);
$this->result[] = $obj;
}
@@ -512,15 +516,15 @@ class kontakt extends basis_db
return false;
}
}
/**
* Sucht nach Kontaktdaten, die den Suchkriterien entsprechen
* @param string $searchstring String, nach dem gesucht werden soll.
* @param string $searchstring String, nach dem gesucht werden soll.
* Wenn $typ = nummer ist, werden eventuelle nicht-numerische Zeichen mit preg_replace entfernt,
* und es wird nach den Typen "telefon","mobil","so.tel","firmenhandy" und "notfallkontakt" gesucht
* @param string $typ Optional. Kontakttyp. Möglich sind <b>"nummer"</b>,"telefon","mobil","so.tel","firmenhandy","firmenhandy","email","fax" und "homepage".
* Wenn $typ = nummer ist, werden eventuelle nicht-numerische Zeichen mit preg_replace entfernt,
* und es wird nach den Typen "telefon","mobil","so.tel","firmenhandy" und "notfallkontakt" gesucht
* und es wird nach den Typen "telefon","mobil","so.tel","firmenhandy" und "notfallkontakt" gesucht
* @return boolean
*/
public function searchKontakt ($searchstring, $typ = '')
@@ -534,18 +538,18 @@ class kontakt extends basis_db
return false;
}
}
$qry = "SELECT
$qry = "SELECT
*
FROM
FROM
public.tbl_kontakt
WHERE
WHERE
1=1";
if ($typ == 'nummer')
$qry .= " AND regexp_replace(kontakt , '[^0-9]', '', 'g') LIKE ('%".$this->db_escape($searchstring)."%')";
else
$qry .= " AND LOWER (kontakt) LIKE LOWER ('%".$this->db_escape($searchstring)."%')";
if ($typ != '' && $typ != 'nummer')
$qry .= " AND kontakttyp=".$this->db_add_param($typ);
@@ -554,7 +558,7 @@ class kontakt extends basis_db
while($row = $this->db_fetch_object())
{
$obj = new kontakt();
$obj->kontakt_id = $row->kontakt_id;
$obj->person_id = $row->person_id;
$obj->standort_id = $row->standort_id;
@@ -567,10 +571,10 @@ class kontakt extends basis_db
$obj->insertamum = $row->insertamum;
$obj->insertvon = $row->insertvon;
$obj->ext_id = $row->ext_id;
$this->result[] = $obj;
}
return true;
}
else
@@ -580,4 +584,4 @@ class kontakt extends basis_db
}
}
}
?>
?>
+69 -1
View File
@@ -1091,8 +1091,12 @@ class mitarbeiter extends benutzer
/**
* Gibt ein Array mit den UIDs der aktiv beschäftigten Untergebenen zurueck
* @param string $uid UID.
* @param boolean $include_OE_childs Wenn true, dann werden auch alle aktiv
* beschäftigten Untergebenen der Kind-OEs des Leiters zurückgegeben.
* @return boolean
*/
public function getUntergebene($uid=null)
public function getUntergebene($uid=null, $include_OE_childs = false)
{
if (is_null($uid))
$uid=$this->uid;
@@ -1113,6 +1117,70 @@ class mitarbeiter extends benutzer
$oe.=$this->db_add_param($row->oe_kurzbz);
}
}
// Kinder-Organisationseinheiten holen
if ($include_OE_childs == true)
{
if (!empty($oe))
{
$child_oe_arr = array(); // array of string child oes
$qry = '
WITH RECURSIVE
oes (oe_kurzbz, oe_parent_kurzbz) AS
(
SELECT
oe_kurzbz,
oe_parent_kurzbz
FROM
public.tbl_organisationseinheit
WHERE
oe_kurzbz IN ('. $oe. ')
UNION ALL
SELECT
o.oe_kurzbz,
o.oe_parent_kurzbz
FROM
public.tbl_organisationseinheit o, oes
WHERE
o.oe_parent_kurzbz = oes.oe_kurzbz
)
SELECT
oe_kurzbz
FROM
oes
GROUP BY
oe_kurzbz';
if($this->db_query($qry))
{
while($row = $this->db_fetch_object())
{
$child_oe_arr []= $this->db_add_param($row->oe_kurzbz);
}
}
// eliminate duplicates
$child_oe_arr = array_unique($child_oe_arr);
// check if leader has child oes by comparing the original
// string of oes with string of child oes.
if ($oe == implode(',', $child_oe_arr))
{
$this->result ['isIndirectSupervisor']= false;
}
else
{
$this->result ['isIndirectSupervisor']= true;
}
// overwrite $oe with child oes for further query
$oe = implode(',', $child_oe_arr);
}
}
//Alle Personen holen die dieser Organisationseinheit untergeordnet sind
$qry = "
+117
View File
@@ -20,6 +20,7 @@
* Rudolf Hangl <rudolf.hangl@technikum-wien.at> and
* Gerald Simane-Sequens <gerald.simane-sequens@technikum-wien.at>
* Stefan Puraner <puraner@technikum-wien.at>
* Cristina Hainberger <hainberg@technikum-wien.at>
*/
/**
* Klasse Organisationseinheit
@@ -46,6 +47,7 @@ class organisationseinheit extends basis_db
public $oe_kurzbz_orig;
public $beschreibung;
public $oetyp_bezeichnung;
/**
@@ -454,6 +456,79 @@ class organisationseinheit extends basis_db
}
}
/**
* Get names and types of ALL parent organisational units recursivly for all ascending
* org units of given organisational unit. (All parent organisational units)
* @param string $oe_kurzbz
* @return boolean True on success. If true, returns object-array with name
* and types of given organisational unit and of its parent organisational units.
*/
public function getParents_withOEType($oe_kurzbz)
{
$parents=array();
$qry="
WITH RECURSIVE
oes (oe_kurzbz, oe_parent_kurzbz) AS
(
SELECT
oe_kurzbz,
oe_parent_kurzbz,
bezeichnung AS oe_bezeichnung,
organisationseinheittyp_kurzbz
FROM
public.tbl_organisationseinheit
WHERE
oe_kurzbz=".$this->db_add_param($oe_kurzbz)."
AND
aktiv = true
UNION ALL
SELECT
o.oe_kurzbz,
o.oe_parent_kurzbz,
o.bezeichnung,
o.organisationseinheittyp_kurzbz
FROM
public.tbl_organisationseinheit o, oes
WHERE
o.oe_kurzbz = oes.oe_parent_kurzbz
AND
aktiv = true
)
SELECT
oe_kurzbz,
oe_bezeichnung,
tbl_organisationseinheittyp.bezeichnung AS oe_typ_bezeichnung
FROM
oes
JOIN
public.tbl_organisationseinheittyp
USING (organisationseinheittyp_kurzbz)";
if($result = $this->db_query($qry))
{
while($row = $this->db_fetch_object($result))
{
$obj = new stdClass();
$obj->oe_kurzbz = $row->oe_kurzbz;
$obj->oe_bezeichnung = $row->oe_bezeichnung;
$obj->oe_typ_bezeichnung = (!is_null($row->oe_typ_bezeichnung) ? $row->oe_typ_bezeichnung : '');
$this->result[]= $obj;
}
return $this->result;
}
else
{
$this->errormsg='Fehler beim Laden der Daten';
return false;
}
}
/**
* Prueft ob $child eine Organisationseinheit unterhalb der OE $oe_kurzbz ist
*
@@ -756,5 +831,47 @@ class organisationseinheit extends basis_db
}
}
}
/**
* Get full term of organisational unit type
* @param string $oetyp_kurzbz
* @return boolean True on success. If true, returns full term of given organisational unit type.
*/
public function getOETypBezeichnung($oetyp_kurzbz)
{
if (isset($oetyp_kurzbz) && !empty($oetyp_kurzbz))
{
$qry = '
SELECT
bezeichnung
FROM
public.tbl_organisationseinheittyp
WHERE
organisationseinheittyp_kurzbz = '. $this->db_add_param($oetyp_kurzbz). ';';
if ($this->db_query($qry))
{
if ($row = $this->db_fetch_object())
{
$this->oetyp_bezeichnung = $row->bezeichnung;
return true;
}
else
{
return false;
}
}
else
{
$this->errormsg = "Fehler in der Abfrage zum Einholen OE-Typ Bezeichnung.";
return false;
}
}
else
{
$this->errormsg = 'OE Typ fehlt bzw. darf nicht leer sein.';
return false;
}
}
}
?>
+214
View File
@@ -0,0 +1,214 @@
<?php
/* Copyright (C) 2007 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: Cristina Hainberger <hainberg@technikum-wien.at>
*/
require_once(dirname(__FILE__).'/basis_db.class.php');
require_once(dirname(__FILE__).'/mail.class.php');
require_once(dirname(__FILE__).'/vorlage.class.php');
const DEFAULT_SANCHO_HEADER_IMG = 'sancho_header_DEFAULT.jpg';
/**
* Send single Mail with Sancho Design and Layout.
* @param string $vorlage_kurzbz Name of the template for specific mail content.
* @param array $vorlage_data Associative array with specific mail content varibales
* to be replaced in the content template.
* @param string $to Email-adress.
* @param string $subject Subject of mail.
* @param string $headerImg Filename of the specific Sancho header image.
* @return boolean True, if succeeded.
*/
function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerImg = DEFAULT_SANCHO_HEADER_IMG)
{
$from = 'sancho@'. DOMAIN;
$sanchoHeader_img = dirname(__FILE__). '/../skin/images/sancho/'. $headerImg;
$sanchoFooter_img = dirname(__FILE__). '/../skin/images/sancho/sancho_footer.jpg';
// Set unique content id for embedding header and footer image
$cid_header = uniqid();
$cid_footer = uniqid();
// Set specific mail content into specific content template
$content = parseMailContent($vorlage_kurzbz, $vorlage_data);
// Create data array with specific content and image content ids
$layout = array(
'CID_header' => $cid_header,
'CID_footer' => $cid_footer,
'content' => $content
);
// Set the data array into overall sancho mail template
$body = parseMailContent('Sancho_Mail_Template', $layout);
// Send mail
$mail = new Mail($to, $from, $subject, $body);
// * embed the images
$mail->addEmbeddedImage($sanchoHeader_img, 'image/jpg', '', $cid_header);
$mail->addEmbeddedImage($sanchoFooter_img, 'image/jpg', '', $cid_footer);
// * embed the html content
$mail->setHTMLContent($body);
return $mail->send();
}
// ******************************************* HELPER FUNCTIONS
/**
* Replace variables in the mail content template with specific mail content data.
* @param string $vorlage_kurzbz Name of the template for specific mail content.
* @param array $vorlage_data Associative array with specific mail content varibales
* to be replaced in the content template.
* @return string
*/
function parseMailContent($vorlage_kurzbz, $vorlage_data)
{
$vorlage = new Vorlage();
$vorlage->getAktuelleVorlage('etw', $vorlage_kurzbz);
// If the text and the subject of the template are not empty
if (!empty($vorlage->text))
{
// Parses template text
$parsedText = parseVorlagetext($vorlage->text, $vorlage_data);
return $parsedText;
}
}
/**
* parseVorlagetext() - will parse a Vorlagetext.
*
* @param string $text REQUIRED
* @param array $data REQUIRED
* @return string
*/
function parseVorlagetext($text, $data = array())
{
if (empty($text))
return 'Error in parsing Vorlagentext';
$text = parse_string($text, $data, true);
return $text;
}
/**
* Parse a String
*
* Parses pseudo-variables contained in the specified string,
* replacing them with the data in the second param
*
* @param string
* @param array
* @param bool
* @return string
*/
function parse_string($template, $data, $return = FALSE)
{
if ($template === '')
{
return FALSE;
}
$replace = array();
foreach ($data as $key => $val)
{
$replace = array_merge(
$replace,
is_array($val)
? parse_pair($key, $val, $template)
: parse_single($key, (string) $val, $template)
);
}
unset($data);
$template = strtr($template, $replace);
if ($template === FALSE)
{
return false;
}
return $template;
}
/**
* Parse a single key/value
*
* @param string
* @param string
* @param string
* @return string
*/
function parse_single($key, $val, $string)
{
return array('{'. $key. '}' => (string) $val);
}
/**
* Parse a tag pair
*
* Parses tag pairs: {some_tag} string... {/some_tag}
*
* @param string
* @param array
* @param string
* @return string
*/
function parse_pair($variable, $data, $string)
{
$replace = array();
preg_match_all(
'#'.preg_quote('{'. $variable. '}').'(.+?)'.preg_quote('{'.'/'.$variable. '}').'#s',
$string,
$matches,
PREG_SET_ORDER
);
foreach ($matches as $match)
{
$str = '';
foreach ($data as $row)
{
$temp = array();
foreach ($row as $key => $val)
{
if (is_array($val))
{
$pair = parse_pair($key, $val, $match[1]);
if ( ! empty($pair))
{
$temp = array_merge($temp, $pair);
}
continue;
}
$temp['{'.$key. '}'] = $val;
}
$str .= strtr($match[1], $temp);
}
$replace[$match[0]] = $str;
}
return $replace;
}
+40 -12
View File
@@ -244,31 +244,31 @@ class studiengang extends basis_db
}
/**
* Gibt alle aktiven Studiengaenge und Lehrgaenge (mit Typ) zurueck, bei denen das Attribut onlinebewerbung true ist.
* Gibt alle aktiven Studiengaenge und Lehrgaenge (mit Typ) zurueck, bei denen das Attribut onlinebewerbung true ist.
*
* @param string $order Spalten, nach denen Sortiert werden soll.<br>Default: tbl_studiengang.typ, tbl_lgartcode.bezeichnung ASC, tbl_studiengang.bezeichnung.
* @param string $order Spalten, nach denen Sortiert werden soll.<br>Default: tbl_studiengang.typ, tbl_lgartcode.bezeichnung ASC, tbl_studiengang.bezeichnung.
* @return boolean
*/
public function getAllForOnlinebewerbung($order = 'tbl_studiengang.typ, tbl_lgartcode.bezeichnung ASC, tbl_studiengang.bezeichnung')
{
$qry = "SELECT
tbl_studiengang.studiengang_kz,
tbl_studiengang.typ,
$qry = "SELECT
tbl_studiengang.studiengang_kz,
tbl_studiengang.typ,
tbl_studiengangstyp.bezeichnung AS typ_bezeichnung,
tbl_studiengang.lgartcode,
tbl_studiengang.bezeichnung AS studiengangbezeichnung,
tbl_studiengang.english AS studiengangbezeichnung_englisch,
tbl_organisationseinheit.organisationseinheittyp_kurzbz,
tbl_organisationseinheit.organisationseinheittyp_kurzbz,
tbl_organisationseinheit.standort,
tbl_lgartcode.bezeichnung AS lehrgangsart
FROM public.tbl_studiengang
LEFT JOIN bis.tbl_lgartcode USING (lgartcode)
FROM public.tbl_studiengang
LEFT JOIN bis.tbl_lgartcode USING (lgartcode)
LEFT JOIN public.tbl_organisationseinheit USING (oe_kurzbz)
JOIN public.tbl_organisationseinheittyp USING (organisationseinheittyp_kurzbz)
JOIN public.tbl_studiengangstyp USING (typ)
WHERE tbl_studiengang.onlinebewerbung IS TRUE
WHERE tbl_studiengang.onlinebewerbung IS TRUE
AND tbl_studiengang.aktiv IS TRUE";
$qry .= " ORDER BY ".$order;
if(!$result = $this->db_query($qry))
@@ -276,12 +276,12 @@ class studiengang extends basis_db
$this->errormsg = 'Datensatz konnte nicht geladen werden';
return false;
}
while($row = $this->db_fetch_object($result))
{
$this->result[] = $row;
}
return true;
}
@@ -1045,6 +1045,34 @@ class studiengang extends basis_db
}
return true;
}
/**
* Prueft ob ein Studiengang in einem Studiensemester mehrere Studienplaene mit unterschiedlichen Orgformen hat
* @param $studiengang_kz integer Kennzahl des Studiengangs.
* @param $studiensemester_kurzbz varchar Studiensemester (optional).
* @return true wenn mehrere Orgformen vorhanden sind, false wenn nicht.
*/
public function isMischform($studiengang_kz, $studiensemester_kurzbz = null)
{
$qry = "SELECT distinct orgform_kurzbz
FROM
lehre.tbl_studienplan
JOIN lehre.tbl_studienordnung USING(studienordnung_id)
JOIN lehre.tbl_studienplan_semester USING(studienplan_id)
WHERE
studiengang_kz=".$this->db_add_param($studiengang_kz);
if(!is_null($studiensemester_kurzbz))
$qry .= " AND studiensemester_kurzbz=".$this->db_add_param($studiensemester_kurzbz);
if($result = $this->db_query($qry))
{
if($this->db_num_rows($result)>1)
return true;
else
return false;
}
}
/**
* Laedt die Studiengänge die vom übergeben Typ sind