fhiiqm/keydepot_user_list.php
changeset 39 4ce411ed28b6
child 41 9c668cd391fa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/keydepot_user_list.php	Wed Jul 31 15:10:48 2013 +0200
@@ -0,0 +1,112 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 07/2013
+ * 
+ * Liste Depotverwalter+Rechte
+ */
+
+    error_reporting(E_ALL ^ E_NOTICE);
+    
+    session_start();
+    if (! isset($_SESSION["userid"]))
+    { 
+        include_once ("inc/func_lib.inc.php");	
+        login($_SERVER['PHP_SELF']);
+        exit;
+    }
+    
+    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("kr",$_SESSION["recht"]) && !in_array("ke",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	$dbc = new dbconnection();
+    $redit = 0;
+    $uid = $_SESSION["userid"];
+    $sql = "SELECT edit FROM KeyDepot_userweb WHERE depot_ID = 'FHI' AND userid = '$uid'";
+    $redit = $dbc -> querySingleItem($sql);
+    if (!$redit)   
+    {
+        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="/fhiiqm/css/db.css" rel="STYLESHEET" type="TEXT/CSS"  media="screen"/> 
+   	<link href="/fhiiqm/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>KeyDepot-Verwalter+Rechte</title>
+
+</head>
+
+<body>
+<?php
+    echo "&nbsp;";  
+        echo "<div class=\"float-br smaller sc\" valign='top'>";
+        echo "&nbsp;&nbsp;&nbsp;user: " . $_SESSION["userid"];
+        echo "&nbsp;&nbsp;&nbsp;<a href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n";
+        echo "<div class=\"float-r sc\"><img src=\"/fhiiqm/img/key.png\" border=\"0\" alt=\"key\" title=\"key\"/></div>\n";
+
+    echo "<div align='center'><h3>Schl&uuml;sseltyp-Depot Verwalter und Rechte</h3>\n";
+    echo "<p>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten Rechte Schl&uuml;sseltyp-Depotverwalter</p>";
+    $sql = "SELECT u.userid,
+            	SUM(CASE depot_ID WHEN 'FHI' THEN d.edit+1 END) AS FHI,
+            	SUM(CASE depot_ID WHEN 'AC' THEN d.edit+1 END) AS AC,
+            	SUM(CASE depot_ID WHEN 'CP' THEN d.edit+1 END) AS CP,
+            	SUM(CASE depot_ID WHEN 'ELA' THEN d.edit+1 END) AS ELab,
+            	SUM(CASE depot_ID WHEN 'FWT' THEN d.edit+1 END) AS FWT,
+            	SUM(CASE depot_ID WHEN 'HT' THEN d.edit+1 END) AS HT,
+            	SUM(CASE depot_ID WHEN 'MP' THEN d.edit+1 END) AS MP,
+            	SUM(CASE depot_ID WHEN 'PC' THEN d.edit+1 END) AS PC,
+            	SUM(CASE depot_ID WHEN 'TH' THEN d.edit+1 END) AS TH
+            	FROM user_recht u LEFT OUTER JOIN KeyDepot_userweb d ON u.userid=d.userid
+                WHERE u.recht_ID = 'ke'   
+            	GROUP BY u.userid";
+    $result = $dbc -> queryObjectArray($sql);
+    if ($result)
+    {
+        $adep = array("FHI","AC","CP","MP","PC","TH","ELab","FWT","HT");
+		$bg1 = "#F8F8F8";
+		$bg2 = "#DEDFE1";
+		$bg = "#FFFFFF";
+        echo "<table width='35%' border='0' cellspacing='2' cellpadding='2'>\n";
+        echo "<tr bgcolor='#68ACBF'><th>userid</th><th>FHI</th><th>AC</th><th>CP</th><th>MP</th><th>PC</th><th>TH</th><th>E-Lab</th><th>FWT</th><th>HT</th><th></th></tr>\n";
+        foreach ($result as $row)
+        {
+			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
+            echo "<tr bgcolor='" . $bg . "'>";
+            echo "<td><b>$row->userid</b></td>";
+            foreach ($adep as $dep)
+            {
+                if ($row->$dep == 2)
+                    $recht = "x+ed";
+                elseif ($row->$dep == 1)
+                    $recht = "x";
+                else $recht = "";
+                echo "<td class='center'><b>$recht</b></td>";
+            }
+//            echo "<td>".($row->FHI == 2)? "x+ed" : (($row->FHI == 1)? "x" : "")."</td>";
+            if (in_array("ke",$_SESSION["recht"]))
+                echo "<td><a href='/fhiiqm/keydepot_user_ed.php?u=$row->userid'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td>";
+            else echo "<td>&nbsp;</td>";
+            echo "</tr>\n";
+        }
+        echo "</table>\n";
+        echo "<p>Legende: 'x' - Depot verwalten, 'ed' - Depotkorrekturen, Transfer von Schl&uuml;sseltypen zwischen Depots</p>\n";
+        echo "</div>\n";
+//        echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"keydepot_user_ed.php\" target=\"_self\" title=\"Rechte DepotVw erfassen\">Schl&uuml;ssel-Depotverwalter Rechte erfassen</a></p>\n"; 
+    }
+?>
+</body>
+</html>
\ No newline at end of file