fhiiqm/keydepot_user_list.php
changeset 39 4ce411ed28b6
child 41 9c668cd391fa
equal deleted inserted replaced
38:45c139f74ea4 39:4ce411ed28b6
       
     1 <?php
       
     2 
       
     3 /**
       
     4  * @author Bettina Schwarzer, Fritz-Haber-Institut
       
     5  * @copyright 07/2013
       
     6  * 
       
     7  * Liste Depotverwalter+Rechte
       
     8  */
       
     9 
       
    10     error_reporting(E_ALL ^ E_NOTICE);
       
    11     
       
    12     session_start();
       
    13     if (! isset($_SESSION["userid"]))
       
    14     { 
       
    15         include_once ("inc/func_lib.inc.php");	
       
    16         login($_SERVER['PHP_SELF']);
       
    17         exit;
       
    18     }
       
    19     
       
    20     if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("kr",$_SESSION["recht"]) && !in_array("ke",$_SESSION["recht"])))
       
    21     {
       
    22         header("Location: start.php");
       
    23         exit;
       
    24     }    
       
    25 
       
    26 	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
       
    27 	$dbc = new dbconnection();
       
    28     $redit = 0;
       
    29     $uid = $_SESSION["userid"];
       
    30     $sql = "SELECT edit FROM KeyDepot_userweb WHERE depot_ID = 'FHI' AND userid = '$uid'";
       
    31     $redit = $dbc -> querySingleItem($sql);
       
    32     if (!$redit)   
       
    33     {
       
    34         header("Location: start.php");
       
    35         exit;
       
    36     }    
       
    37 
       
    38 ?>
       
    39 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       
    40 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
       
    41 
       
    42 <head>
       
    43 	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
       
    44    	<link href="/fhiiqm/css/db.css" rel="STYLESHEET" type="TEXT/CSS"  media="screen"/> 
       
    45    	<link href="/fhiiqm/css/db_print.css" rel="STYLESHEET" type="TEXT/CSS"  media="print"/> 
       
    46     <link type="text/css" href="/fhiiqm/css/jquery/ui-lightness-1.8.21/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />	
       
    47     <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-1.7.2.min.js"></script>
       
    48     <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-ui-1.8.21.custom.min.js"></script>
       
    49 	<title>KeyDepot-Verwalter+Rechte</title>
       
    50 
       
    51 </head>
       
    52 
       
    53 <body>
       
    54 <?php
       
    55     echo "&nbsp;";  
       
    56         echo "<div class=\"float-br smaller sc\" valign='top'>";
       
    57         echo "&nbsp;&nbsp;&nbsp;user: " . $_SESSION["userid"];
       
    58         echo "&nbsp;&nbsp;&nbsp;<a href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n";
       
    59         echo "<div class=\"float-r sc\"><img src=\"/fhiiqm/img/key.png\" border=\"0\" alt=\"key\" title=\"key\"/></div>\n";
       
    60 
       
    61     echo "<div align='center'><h3>Schl&uuml;sseltyp-Depot Verwalter und Rechte</h3>\n";
       
    62     echo "<p>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten Rechte Schl&uuml;sseltyp-Depotverwalter</p>";
       
    63     $sql = "SELECT u.userid,
       
    64             	SUM(CASE depot_ID WHEN 'FHI' THEN d.edit+1 END) AS FHI,
       
    65             	SUM(CASE depot_ID WHEN 'AC' THEN d.edit+1 END) AS AC,
       
    66             	SUM(CASE depot_ID WHEN 'CP' THEN d.edit+1 END) AS CP,
       
    67             	SUM(CASE depot_ID WHEN 'ELA' THEN d.edit+1 END) AS ELab,
       
    68             	SUM(CASE depot_ID WHEN 'FWT' THEN d.edit+1 END) AS FWT,
       
    69             	SUM(CASE depot_ID WHEN 'HT' THEN d.edit+1 END) AS HT,
       
    70             	SUM(CASE depot_ID WHEN 'MP' THEN d.edit+1 END) AS MP,
       
    71             	SUM(CASE depot_ID WHEN 'PC' THEN d.edit+1 END) AS PC,
       
    72             	SUM(CASE depot_ID WHEN 'TH' THEN d.edit+1 END) AS TH
       
    73             	FROM user_recht u LEFT OUTER JOIN KeyDepot_userweb d ON u.userid=d.userid
       
    74                 WHERE u.recht_ID = 'ke'   
       
    75             	GROUP BY u.userid";
       
    76     $result = $dbc -> queryObjectArray($sql);
       
    77     if ($result)
       
    78     {
       
    79         $adep = array("FHI","AC","CP","MP","PC","TH","ELab","FWT","HT");
       
    80 		$bg1 = "#F8F8F8";
       
    81 		$bg2 = "#DEDFE1";
       
    82 		$bg = "#FFFFFF";
       
    83         echo "<table width='35%' border='0' cellspacing='2' cellpadding='2'>\n";
       
    84         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";
       
    85         foreach ($result as $row)
       
    86         {
       
    87 			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
       
    88             echo "<tr bgcolor='" . $bg . "'>";
       
    89             echo "<td><b>$row->userid</b></td>";
       
    90             foreach ($adep as $dep)
       
    91             {
       
    92                 if ($row->$dep == 2)
       
    93                     $recht = "x+ed";
       
    94                 elseif ($row->$dep == 1)
       
    95                     $recht = "x";
       
    96                 else $recht = "";
       
    97                 echo "<td class='center'><b>$recht</b></td>";
       
    98             }
       
    99 //            echo "<td>".($row->FHI == 2)? "x+ed" : (($row->FHI == 1)? "x" : "")."</td>";
       
   100             if (in_array("ke",$_SESSION["recht"]))
       
   101                 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>";
       
   102             else echo "<td>&nbsp;</td>";
       
   103             echo "</tr>\n";
       
   104         }
       
   105         echo "</table>\n";
       
   106         echo "<p>Legende: 'x' - Depot verwalten, 'ed' - Depotkorrekturen, Transfer von Schl&uuml;sseltypen zwischen Depots</p>\n";
       
   107         echo "</div>\n";
       
   108 //        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"; 
       
   109     }
       
   110 ?>
       
   111 </body>
       
   112 </html>