<?php
/**
* @author Bettina Schwarzer, Fritz-Haber-Institut
* @copyright 05/2012
*
* Liste Arbeitsplatztyp - AS Massnahme
* Tabelle 'AS_Massnahme_Arbplatz' wird nicht mehr genutzt (19.06.2012, bs)
*
*/
error_reporting(E_ALL ^ E_NOTICE);
session_start();
if (! isset($_SESSION["userid"]))
{
include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
login($_SERVER["PHP_SELF"]);
exit;
}
if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("asr",$_SESSION["recht"]) && !in_array("ase",$_SESSION["recht"])))
{
header("Location: start.php");
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link href="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen"/>
<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print"/>
<link type="text/css" href="/fhiiqm/css/jquery/ui-lightness-1.8.21/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="/fhiiqm/js/jquery/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/fhiiqm/js/jquery/jquery-ui-1.8.21.custom.min.js"></script>
<title>Arbplatztyp-AS-Maßnahme-Liste</title>
</head>
<body onload="document.ffilter.filter.focus();">
<script>
$(document).ready(function() {
$("#dialog").dialog({
bgiframe: true,
autoOpen: false,
height: 300,
width: 400,
resizable: true,
modal: true
});
$('#open0').click(function() {
$('#dialog').dialog("open");
});
$('#open1').click(function() {
$('#dialog').dialog("open");
});
});
</script>
<?php
include_once ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
$dbc = new dbconnection();
echo " ";
echo "<div class=\"float-br smaller\" valign='top'>";
echo " user: " . $_SESSION["userid"];
echo " <a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n";
echo "<div class=\"float-r\"><img src=\"img/role.png\" border=\"0\" alt=\"Arbeitsplatztypen-AS Massnahmen\" title=\"Arbeitsplatztypen-AS Massnahmen\"/></div>\n";
// Felder, nach denen gefiltert werden kann
$fields = array(2=>"Gefärdungs-Nr.");
$sort = $_GET["s"]; // Sortierung nach Spalte
if (!isset($sort) && !$sort) $sort = $_POST["s"];
$dir = $_GET["d"]; // Sortierrichtung
if (!isset($dir) && !$dir) $dir = $_POST["d"];
$fnum = $_GET["f"]; // Spaltennummer, nach der aktuell gefiltert wird
if (!isset($fnum) && !$fnum) $fnum = $_POST["f"];
$filter = $_POST["filter"];
if (!isset($filter) && !$filter) $filter = $_GET["b"];
$subf = $_POST["subf"]; // submit
if (!isset($fnum) && !$fnum) $fnum = 1;
if (!isset($filter) && !$filter) $filter = "";
if (!isset($sort) && !$sort) $sort = 1;
if (!isset($dir) && !$dir) $dir = "";
$sql = "SELECT ma.arbplatz_typ,arbplatz_typ_bez, ma.asm_ID, m.asm_bez, asm_bem
FROM fhiiqm.AS_Massnahme_Arbplatz ma
LEFT OUTER JOIN Arbplatz_Typ t ON ma.arbplatz_typ=t.arbplatz_typ
LEFT OUTER JOIN AS_Massnahme m ON ma.asm_ID=m.asm_ID ";
if ($fnum == 4 & $filter > " ")
$sql .= " WHERE asm_bez LIKE '%$filter%' ";
$sql .= " ORDER BY $sort $dir";
$result = $dbc ->queryObjectArray($sql);
echo "<div align='center'>\n";
echo "<p><b>Liste Arbeitsplatztypen - Maßnahmen</b></p>\n";
if ($result)
{
$bg1 = "#F8F8F8";
$bg2 = "#DEDFE1";
$bg = "#FFFFFF";
echo "<table border='0' cellspacing='0'>\n";
echo "<tr><td class='bigger'>Mittels '<img src='/fhiiqm/img/auf.gif' border='0' width='11' hight='11' />' / '<img src='/fhiiqm/img/ab.gif' border='0' width='11' hight='11' />'
können Sie nach jeder Spalte auf- bzw. absteigend sortieren</td></tr>
<td class='bigger'>'<img src='/fhiiqm/img/filter.gif' border='0' width='14' hight='11' />' ermöglicht das Filtern nach Maßnahmen</td></tr>\n
<tr><td class='bigger'>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten Arbeitsplatztyp - Maßnahmen</td></tr>\n
<tr><td class='bigger'> </td></tr>";
echo "</table>\n";
if (isset($fnum) && $fnum>1 && !$filter && !$subf)
{
// Formular anzeigen fuer Filterbegriff
$text = $fields[$fnum];
echo "<form action=" . $_SERVER['PHP_SELF'] . " method='post' enctype='application/x-www-form-urlencoded' id='ffilter' name='ffilter' target='_self'>\n";
echo "<input type='hidden' name='f' value='$fnum'>";
echo "<table width=\"30%\" border=\"0\">\n";
echo "<tr><td>filtern nach $text: </td>";
echo "<td><input id='filter' name='filter' type=\"text\" size=\"30\" maxlength=\"30\" value=\"$filter\"/></td>";
echo "<td><input class=\"button\" type=\"submit\" value=\"finden\" name=\"subf\" title=\"subf\" /></td></tr></table>\n";
echo "</form>\n";
echo "<p> </p>\n";
}
echo "<table border='0'>\n";
// Listenkopf generieren
echo "<tr bgcolor='#68ACBF'>";
tab_column(1,"Arbeitsplatz-Typ",$sort,$dir,0,$fnum,$filter,0,9999);
tab_column(4,"Maßnahmen",$sort,$dir,4,$fnum,$filter,0,9999);
echo "<th>Bemerkung</th>";
echo "<th> </th></tr>";
$vt = "?"; $i=0;
if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
foreach ($result as $row)
{
if ($row->arbplatz_typ != $vt)
{
if ($vt != "?")
{
echo "</td><td><a href='/fhiiqm/ap_massn_ed.php?i=$vt'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
}
echo "<tr bgcolor='" . $bg . "'>";
echo "<td>$row->arbplatz_typ - $row->arbplatz_typ_bez</td>";
}
else echo "<tr bgcolor='" . $bg . "'><td> </td>";
echo "<td>$row->asm_bez</td>";
if (strlen($row->asm_bem) > 100)
{
$plus = "<a href='#' id='open$i'>...(weiter)</a>";
$bem[$i] = $row->asm_bem;
$i++;
}
else $plus = "";
echo "<td>". nl2br(substr($row->asm_bem,0,100)). $plus;
$vt = $row->arbplatz_typ;
}
echo "</td><td><a href='/fhiiqm/ap_massn_ed.php?i=$vt'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
echo "</table>\n</div>\n";
}
else
{
echo "<p class='red'> Leider nichts gefunden für ". $fields["$fnum"] . " wie '$filter'!</p><br /></div>";
echo " <a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Massnahmengen Arbeitsplatztyp\" class=\"sc\">Liste AS-Maßnahmen Arbeitsplatztyp</a></p>\n";
}
echo "<div id='dialog' title='Erläuterung Maßnahme' style='display:none'>";
echo nl2br($bem[$i]);
echo "</div>";
?>
</body>
</html>