mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-13 18:19:27 +00:00
Uebersicht ueber die Ampeln für Leiter
This commit is contained in:
Executable
+208
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 FH Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at>
|
||||
*/
|
||||
require_once('../../../config/cis.config.inc.php');
|
||||
require_once('../../../include/functions.inc.php');
|
||||
require_once('../../../include/ampel.class.php');
|
||||
require_once('../../../include/datum.class.php');
|
||||
require_once('../../../include/phrasen.class.php');
|
||||
require_once('../../../include/benutzerfunktion.class.php');
|
||||
require_once('../../../include/organisationseinheit.class.php');
|
||||
|
||||
$user = get_uid();
|
||||
$sprache = getSprache();
|
||||
$p = new phrasen($sprache);
|
||||
$basis = new basis();
|
||||
|
||||
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" href="../../../skin/fhcomplete.css" type="text/css"/>
|
||||
<link rel="stylesheet" href="../../../skin/style.css.php" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" href="../../../skin/tablesort.css" type="text/css"/>
|
||||
<link rel="stylesheet" href="../../../skin/jquery.css" type="text/css"/>
|
||||
<script type="text/javascript" src="../../../include/js/jquery.js"></script>
|
||||
<title>',$p->t('tools/ampelsystem'),'</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("#myTable").tablesorter(
|
||||
{
|
||||
sortList: [[4,0]],
|
||||
widgets: [\'zebra\']
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>',$p->t('tools/ampelsystem'),'</h1>
|
||||
';
|
||||
|
||||
|
||||
$datum_obj = new datum();
|
||||
$benutzerfunktion = new benutzerfunktion();
|
||||
$benutzerfunktion->getBenutzerFunktionen('Leitung', '', '', $user);
|
||||
|
||||
$organisationseinheit = new organisationseinheit();
|
||||
|
||||
$oes=array();
|
||||
foreach ($benutzerfunktion->result as $row)
|
||||
{
|
||||
$oe = $organisationseinheit->getChilds($row->oe_kurzbz);
|
||||
$oes = array_merge($oe, $oes);
|
||||
}
|
||||
array_unique($oes);
|
||||
if(count($oes)==0)
|
||||
die($p->t('global/keineBerechtigungFuerDieseSeite'));
|
||||
|
||||
if(!$organisationseinheit->loadArray($oes,'organisationseinheittyp_kurzbz, bezeichnung'))
|
||||
echo 'Fehler:'.$organisationseinheit->errormsg;
|
||||
|
||||
if(isset($_POST['oe_kurzbz']))
|
||||
$oe_kurzbz=$_POST['oe_kurzbz'];
|
||||
else
|
||||
$oe_kurzbz='';
|
||||
|
||||
if(isset($_POST['ampel_id']))
|
||||
$ampel_id = $_POST['ampel_id'];
|
||||
else
|
||||
$ampel_id = '';
|
||||
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
echo $p->t('global/organisationseinheit').': <SELECT name="oe_kurzbz">';
|
||||
echo '<OPTION value="">'.$p->t('global/alle').'</OPTION>';
|
||||
foreach($organisationseinheit->result as $row)
|
||||
{
|
||||
if($oe_kurzbz==$row->oe_kurzbz)
|
||||
$selected='selected="selected"';
|
||||
else
|
||||
$selected='';
|
||||
|
||||
echo '<OPTION value="'.$basis->convert_html_chars($row->oe_kurzbz).'" '.$selected.'>';
|
||||
echo $basis->convert_html_chars($row->organisationseinheittyp_kurzbz.' '.$row->bezeichnung);
|
||||
echo '</OPTION>';
|
||||
}
|
||||
echo '</SELECT>';
|
||||
|
||||
$ampel = new ampel();
|
||||
$ampel->getAll();
|
||||
echo ' '.$p->t('tools/ampel').': <SELECT name="ampel_id">';
|
||||
echo '<OPTION value="">'.$p->t('global/alle').'</OPTION>';
|
||||
foreach($ampel->result as $row)
|
||||
{
|
||||
if($ampel_id==$row->ampel_id)
|
||||
$selected='selected="selected"';
|
||||
else
|
||||
$selected='';
|
||||
|
||||
echo '<OPTION value="'.$basis->convert_html_chars($row->ampel_id).'" '.$selected.'>';
|
||||
echo $basis->convert_html_chars($row->kurzbz);
|
||||
echo '</OPTION>';
|
||||
}
|
||||
echo '</SELECT>';
|
||||
echo '<input type="submit" value="OK" />';
|
||||
echo '</form><br>';
|
||||
|
||||
|
||||
$oe_arr = $oe_kurzbz!=''?array($oe_kurzbz):$oes;
|
||||
//echo 'OE: '.$oe_kurzbz.' Ampel:'.$ampel_id;
|
||||
$ampel = new ampel();
|
||||
if(!$ampel->loadAmpelMitarbeiter($oe_arr, $ampel_id))
|
||||
die('Fehler:'.$ampel->errormsg);
|
||||
|
||||
|
||||
echo '
|
||||
<table id="myTable" class="tablesorter">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>'.$p->t('tools/ampelStatus').'</th>
|
||||
<th>'.$p->t('tools/ampelBeschreibung').'</th>
|
||||
<th>'.$p->t('global/institut').'</th>
|
||||
<th>'.$p->t('tools/ampelMitarbeiter').'</th>
|
||||
<th>'.$p->t('tools/ampelRestdauer').'</th>
|
||||
<th>'.$p->t('tools/ampelDeadline').'</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
';
|
||||
|
||||
foreach($ampel->result as $row)
|
||||
{
|
||||
$ts_deadline = $datum_obj->mktime_fromdate($row->deadline);
|
||||
$vlz = "-".$row->vorlaufzeit." day";
|
||||
$ts_vorlaufzeit = strtotime($vlz, $ts_deadline);
|
||||
$ts_now = $datum_obj->mktime_fromdate(date('Y-m-d'));
|
||||
|
||||
if($ts_vorlaufzeit<=$ts_now && $ts_now<=$ts_deadline)
|
||||
$ampelstatus='gelb';
|
||||
elseif($ts_now>$ts_deadline)
|
||||
$ampelstatus='rot';
|
||||
elseif($ts_now<$ts_deadline && $ts_vorlaufzeit>=$ts_now)
|
||||
$ampelstatus='gruen';
|
||||
|
||||
//if($bestaetigt = $ampel->isBestaetigt($user,$row->ampel_id))
|
||||
// $ampelstatus='';
|
||||
if($row->ampel_benutzer_bestaetigt_id!='')
|
||||
{
|
||||
$ampelstatus='';
|
||||
$bestaetigt=true;
|
||||
}
|
||||
else
|
||||
$bestaetigt=false;
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td align="center">';
|
||||
switch($ampelstatus)
|
||||
{
|
||||
case 'rot':
|
||||
$status= '<img src="../../../skin/images/ampel_rot.png">';
|
||||
break;
|
||||
case 'gelb':
|
||||
$status= '<img src="../../../skin/images/ampel_gelb.png">';
|
||||
break;
|
||||
case 'gruen':
|
||||
$status= '<img src="../../../skin/images/ampel_gruen.png">';
|
||||
break;
|
||||
default:
|
||||
$status= '-';
|
||||
break;
|
||||
}
|
||||
echo $status;
|
||||
|
||||
echo '</td>';
|
||||
$beschreibung = $row->beschreibung[$sprache];
|
||||
if($beschreibung=='' && isset($row->beschreibung[DEFAULT_LANGUAGE]))
|
||||
$beschreibung = $row->beschreibung[DEFAULT_LANGUAGE];
|
||||
echo '<td>'.$beschreibung.'</td>';
|
||||
$institut = $row->oe_kurzbz;
|
||||
echo '<td>'.$institut.'</td>';
|
||||
$name = $row->titelpre.' '.$row->vorname.' '.$row->nachname.' '.$row->titelpost;
|
||||
echo '<td>'.$name.'</td>';
|
||||
echo '<td>'.(($ts_deadline-$ts_now)/86400).'</td>';
|
||||
echo '<td>'.$datum_obj->formatDatum($row->deadline,'d.m.Y').'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</tbody></table>';
|
||||
|
||||
echo '</body>
|
||||
</html>';
|
||||
?>
|
||||
@@ -423,6 +423,83 @@ class ampel extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt Ampeln und Mitarbeiter zu einer OE/Ampel
|
||||
* @param $oe_arr
|
||||
* @param $ampel_id
|
||||
*/
|
||||
public function loadAmpelMitarbeiter($oe_arr, $ampel_id)
|
||||
{
|
||||
$sprache = new sprache();
|
||||
$beschreibung = $sprache->getSprachQuery('beschreibung');
|
||||
|
||||
if(!is_numeric($ampel_id) && $ampel_id!='')
|
||||
{
|
||||
$this->errormsg = 'Ampel ID ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ampeln holen
|
||||
$qry = "SELECT *,".$beschreibung." FROM public.tbl_ampel";
|
||||
if($ampel_id!='')
|
||||
$qry.=" WHERE ampel_id='".$ampel_id."'";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
// Alle Mitarbeiter dazu holen
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
(".$row->benutzer_select.") a
|
||||
JOIN public.tbl_benutzerfunktion USING(uid)
|
||||
JOIN campus.vw_benutzer USING(uid)
|
||||
LEFT JOIN public.tbl_ampel_benutzer_bestaetigt USING(uid)
|
||||
WHERE
|
||||
(tbl_ampel_benutzer_bestaetigt.ampel_id is null OR tbl_ampel_benutzer_bestaetigt.ampel_id='".$row->ampel_id."')
|
||||
AND
|
||||
(funktion_kurzbz='oezuordnung' AND oe_kurzbz in(".$this->implode4SQL($oe_arr)."))
|
||||
|
||||
";
|
||||
|
||||
if($result_ma = $this->db_query($qry))
|
||||
{
|
||||
while($row_ma = $this->db_fetch_object($result_ma))
|
||||
{
|
||||
$obj = new ampel();
|
||||
|
||||
$obj->ampel_id = $row->ampel_id;
|
||||
$obj->kurzbz = $row->kurzbz;
|
||||
$obj->beschreibung = $sprache->parseSprachResult('beschreibung', $row);
|
||||
$obj->benutzer_select = $row->benutzer_select;
|
||||
$obj->deadline = $row->deadline;
|
||||
$obj->vorlaufzeit = $row->vorlaufzeit;
|
||||
$obj->verfallszeit = $row->verfallszeit;
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
|
||||
$obj->vorname = $row_ma->vorname;
|
||||
$obj->nachname = $row_ma->nachname;
|
||||
$obj->titelpre = $row_ma->titelpre;
|
||||
$obj->titelpost = $row_ma->titelpost;
|
||||
$obj->oe_kurzbz = $row_ma->oe_kurzbz;
|
||||
|
||||
$obj->ampel_benutzer_bestaetigt_id = $row_ma->ampel_benutzer_bestaetigt_id;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -101,5 +101,16 @@ class basis
|
||||
$datum+=3600;
|
||||
return $datum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Konvertiert eine Zeichenkette,
|
||||
* damit diese in HTML Dokumenten sicher ausgegeben werden kann
|
||||
*
|
||||
* @param $value
|
||||
*/
|
||||
public function convert_html_chars($value)
|
||||
{
|
||||
return htmlspecialchars($value);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -171,7 +171,7 @@ class benutzerfunktion extends basis_db
|
||||
* @return false wenn nicht vorhanden oder fehler
|
||||
* sonst true
|
||||
*/
|
||||
public function getBenutzerFunktionen($funktion_kurzbz, $oe_kurzbz='', $semester='')
|
||||
public function getBenutzerFunktionen($funktion_kurzbz, $oe_kurzbz='', $semester='', $uid='')
|
||||
{
|
||||
$qry = "SELECT * FROM public.tbl_benutzerfunktion
|
||||
WHERE funktion_kurzbz='".addslashes($funktion_kurzbz)."'
|
||||
@@ -182,7 +182,9 @@ class benutzerfunktion extends basis_db
|
||||
$qry.=" AND oe_kurzbz='".addslashes($oe_kurzbz)."'";
|
||||
if($semester!='')
|
||||
$qry.=" AND semester='".addslashes($semester)."'";
|
||||
|
||||
if($uid!='')
|
||||
$qry.=" AND uid='".addslashes($uid)."'";
|
||||
|
||||
$qry.=" ORDER BY funktion_kurzbz, oe_kurzbz, semester";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
|
||||
@@ -27,6 +27,7 @@ $this->phrasen['tools/keineZahlungenVorhanden']='Derzeit sind keine Zahlungen vo
|
||||
|
||||
//Ampeln
|
||||
$this->phrasen['tools/ampelsystem']='Ampelsystem';
|
||||
$this->phrasen['tools/ampel']='Ampel';
|
||||
$this->phrasen['tools/nichtZugeteilt']='Sie sind nicht zu dieser Ampel zugeteilt';
|
||||
$this->phrasen['tools/ampelNichtGefunden']='Die angegeben Ampel wurde nicht gefunden';
|
||||
$this->phrasen['tools/ampelStatus']='Status';
|
||||
@@ -35,5 +36,6 @@ $this->phrasen['tools/ampelDeadline']='Deadline';
|
||||
$this->phrasen['tools/ampelAktion']='Aktion';
|
||||
$this->phrasen['tools/ampelBestaetigen']='bestätigen';
|
||||
$this->phrasen['tools/ampelBestaetigt']='bestätigt';
|
||||
|
||||
$this->phrasen['tools/ampelMitarbeiter']='Mitarbeiter';
|
||||
$this->phrasen['tools/ampelRestdauer']='Restdauer in Tagen';
|
||||
?>
|
||||
|
||||
@@ -27,6 +27,7 @@ $this->phrasen['tools/keineZahlungenVorhanden']='Currently there are no payments
|
||||
|
||||
//Ampeln
|
||||
$this->phrasen['tools/ampelsystem']='Ampelsystem';
|
||||
$this->phrasen['tools/ampel']='Ampel';
|
||||
$this->phrasen['tools/nichtZugeteilt']='Sie sind nicht zu dieser Ampel zugeteilt';
|
||||
$this->phrasen['tools/ampelNichtGefunden']='Die angegeben Ampel wurde nicht gefunden';
|
||||
$this->phrasen['tools/ampelStatus']='Status';
|
||||
@@ -35,4 +36,6 @@ $this->phrasen['tools/ampelDeadline']='Deadline';
|
||||
$this->phrasen['tools/ampelAktion']='Action';
|
||||
$this->phrasen['tools/ampelBestaetigen']='confirm';
|
||||
$this->phrasen['tools/ampelBestaetigt']='confirmed';
|
||||
$this->phrasen['tools/ampelMitarbeiter']='Employee';
|
||||
$this->phrasen['tools/ampelRestdauer']='Remaining Days';
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user