diff --git a/cis/private/profile/index.php b/cis/private/profile/index.php
index 92bb787bb..dbef13bfd 100644
--- a/cis/private/profile/index.php
+++ b/cis/private/profile/index.php
@@ -66,6 +66,9 @@ if (isset($_GET['uid']) && $_GET['uid'] != $uid)
$uid = stripslashes($_GET['uid']);
$ansicht = true;
}
+
+$adminOrOwnUser = $rechte->isBerechtigt('admin') || !$ansicht;
+
if ($rechte->isBerechtigt('basis/kontakt'))
$ansicht = false;
@@ -159,12 +162,7 @@ echo '
$(document).ready(function()
{
- $("#t1").tablesorter(
- {
- sortList: [[0,0]],
- widgets: ["zebra"]
- });
- $("#t2").tablesorter(
+ $("#t1, #t2, #tfuture").tablesorter(
{
sortList: [[0,0]],
widgets: ["zebra"]
@@ -507,36 +505,55 @@ echo '
if (!defined('CIS_PROFIL_FUNKTIONEN_ANZEIGEN') || CIS_PROFIL_FUNKTIONEN_ANZEIGEN)
{
//Funktionen
- $qry = "SELECT
+ $baseqry = "SELECT
*, tbl_benutzerfunktion.oe_kurzbz as oe_kurzbz, tbl_organisationseinheit.bezeichnung as oe_bezeichnung,
tbl_benutzerfunktion.semester, tbl_benutzerfunktion.bezeichnung as bf_bezeichnung,
- tbl_benutzerfunktion.datum_von, tbl_benutzerfunktion.datum_bis
+ tbl_benutzerfunktion.wochenstunden, tbl_benutzerfunktion.datum_von, tbl_benutzerfunktion.datum_bis
FROM
public.tbl_benutzerfunktion
JOIN public.tbl_funktion USING(funktion_kurzbz)
JOIN public.tbl_organisationseinheit USING(oe_kurzbz)
WHERE
- uid=".$db->db_add_param($uid)." AND
- (tbl_benutzerfunktion.datum_bis is null OR tbl_benutzerfunktion.datum_bis>=now())";
+ uid=".$db->db_add_param($uid);
- if ($result_funktion = $db->db_query($qry))
+ $currfunkqry = $baseqry . " AND ((tbl_benutzerfunktion.datum_bis is null OR tbl_benutzerfunktion.datum_bis>=now())
+ AND (tbl_benutzerfunktion.datum_von is null OR tbl_benutzerfunktion.datum_von<=now()))";
+ $futurefunkqry = $baseqry . " AND (tbl_benutzerfunktion.datum_von>now())";
+
+ printFunctionsTable($currfunkqry, 'profil/funktionen', 't1', true);
+ printFunctionsTable($futurefunkqry, 'profil/zukuenftigeFunktionen', 'tfuture');
+}
+
+/**
+ * Print html table containing user functions.
+ * @param $query string execute for getting data
+ * @param $tableid string html table id
+ * @param $showVertragsstunden bool show Vertragsstunden sum near Wochenstunden sum
+ */
+function printFunctionsTable($query, $headingphrase, $tableid, $showVertragsstunden = false)
+{
+ global $db, $p, $datum_obj, $uid, $adminOrOwnUser;
+
+ if ($result_funktion = $db->db_query($query))
{
if ($db->db_num_rows($result_funktion) > 0)
{
- echo ''.$p->t('profil/funktionen').'
-
+ echo ''.$p->t($headingphrase).'';
+ echo '
+
| '.$p->t('global/bezeichnung').' |
'.$p->t('global/organisationseinheit').' |
- '.$p->t('global/semester').' |
- '.$p->t('global/institut').' |
'.$p->t('profil/gueltigvon').' |
- '.$p->t('profil/gueltigbis').' |
-
+ '.$p->t('profil/gueltigbis').' | '.
+ ($adminOrOwnUser ? ''.$p->t('profil/wochenstunden').' | ' : '').
+ '
';
+ $wochenstunden_sum = 0.00;
+
while($row_funktion = $db->db_fetch_object($result_funktion))
{
echo "
@@ -547,13 +564,50 @@ if (!defined('CIS_PROFIL_FUNKTIONEN_ANZEIGEN') || CIS_PROFIL_FUNKTIONEN_ANZEIGEN
echo ' - '.$row_funktion->bf_bezeichnung;
echo "
".$row_funktion->organisationseinheittyp_kurzbz.' '.$row_funktion->oe_bezeichnung." |
- $row_funktion->semester |
- $row_funktion->fachbereich_kurzbz |
".$datum_obj->formatDatum($row_funktion->datum_von,'d.m.Y')." |
- ".$datum_obj->formatDatum($row_funktion->datum_bis,'d.m.Y')." |
- ";
+ ".$datum_obj->formatDatum($row_funktion->datum_bis,'d.m.Y')." | ".
+ ($adminOrOwnUser ? "".number_format($row_funktion->wochenstunden, 2)." | " : "").
+ "";
+
+ if(isset($row_funktion->wochenstunden) && $adminOrOwnUser)
+ $wochenstunden_sum += (double)$row_funktion->wochenstunden;
}
- echo '
';
+ echo '
';
+
+ //vertragsstunden
+ if ($showVertragsstunden === true && $adminOrOwnUser)
+ {
+ $vertragsstunden = 0.00;
+ $qry = "SELECT sum(vertragsstunden) AS vertragsstdsumme from bis.tbl_bisverwendung
+ WHERE mitarbeiter_uid = ".$db->db_add_param($uid)."
+ AND (ende > now() OR ende IS NULL)";
+
+ if ($result_vertragsstd = $db->db_query($qry))
+ {
+ if ($db->db_num_rows($result_vertragsstd) > 0)
+ {
+ while($row_vertragsstd = $db->db_fetch_object($result_vertragsstd))
+ {
+ $vertragsstunden = $row_vertragsstd->vertragsstdsumme;
+ }
+ }
+ }
+ }
+
+ if ($adminOrOwnUser)
+ {
+ echo "
+
+
+ |
+ |
+ Summe Wochenstunden".($showVertragsstunden === true ? " (".$p->t('profil/vertragsstunden').")" : "")." |
+ ".number_format($wochenstunden_sum, 2).($showVertragsstunden === true ?
+ " (".number_format($vertragsstunden, 2).")" : "")." |
+
+ ";
+ }
+ echo "
";
}
}
}
diff --git a/locale/de-AT/profil.php b/locale/de-AT/profil.php
index 8ad0bb749..074379601 100644
--- a/locale/de-AT/profil.php
+++ b/locale/de-AT/profil.php
@@ -81,4 +81,7 @@ $this->phrasen['profil/fotoAuswählen']='Klicken Sie auf das Bild um ein Foto ho
$this->phrasen['profil/bildSpeichern']='Bild speichern';
$this->phrasen['profil/gueltigvon']='Gültig von';
$this->phrasen['profil/gueltigbis']='Gültig bis';
+$this->phrasen['profil/wochenstunden']='Wochenstunden';
+$this->phrasen['profil/vertragsstunden']='Vertragsstunden';
+$this->phrasen['profil/zukuenftigeFunktionen']='Zukünftige Funktionen';
?>
diff --git a/locale/en-US/profil.php b/locale/en-US/profil.php
index 8f58fd089..660936381 100644
--- a/locale/en-US/profil.php
+++ b/locale/en-US/profil.php
@@ -79,4 +79,7 @@ $this->phrasen['profil/fotoAuswählen']='Click on the image below to upload a ph
$this->phrasen['profil/bildSpeichern']='Save image';
$this->phrasen['profil/gueltigvon']='Valid from';
$this->phrasen['profil/gueltigbis']='Valid to';
+$this->phrasen['profil/wochenstunden']='week hours';
+$this->phrasen['profil/vertragsstunden']='contract hours';
+$this->phrasen['profil/zukuenftigeFunktionen']='Future functions';
?>
diff --git a/locale/it-IT/profil.php b/locale/it-IT/profil.php
index c3413af65..fc4d3bd6f 100644
--- a/locale/it-IT/profil.php
+++ b/locale/it-IT/profil.php
@@ -59,5 +59,7 @@ $this->phrasen['profil/wendenSieSichAn']='';
$this->phrasen['profil/zeitsperrenVon']='';
$this->phrasen['profil/zeitwuensche']='';
$this->phrasen['profil/zustaendigeAssistenz']='';
-
+$this->phrasen['profil/wochenstunden']='';
+$this->phrasen['profil/vertragsstunden']='';
+$this->phrasen['profil/zukuenftigeFunktionen']='';
?>