fhiiqm/user_recht_list.php
changeset 22 aae5b0ecc47b
child 26 3c1e3ac7089f
equal deleted inserted replaced
21:97dba0fe820c 22:aae5b0ecc47b
       
     1 <?php
       
     2 
       
     3 /**
       
     4  * @author Bettina Schwarzer, Fritz-Haber-Institut
       
     5  * @copyright 01/2012
       
     6  * 
       
     7  * Liste Rechte je Nutzer
       
     8  */
       
     9 
       
    10 
       
    11     error_reporting(E_ALL ^ E_NOTICE);
       
    12 
       
    13     session_start();
       
    14     if (! isset($_SESSION["userid"]))
       
    15     { 
       
    16         include_once ("inc/func_lib.inc.php");	
       
    17         login($_SERVER["PHP_SELF"]);
       
    18         exit;
       
    19     }
       
    20     
       
    21     if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("rte",$_SESSION["recht"]) && !in_array("rtr",$_SESSION["recht"])))
       
    22     {
       
    23         header("Location: start.php");
       
    24         exit;
       
    25     }    
       
    26 
       
    27 ?>
       
    28     
       
    29     
       
    30 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       
    31 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
       
    32 
       
    33 <head>
       
    34 	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
       
    35     <link type="text/css" href="/fhiiqm/css/db.css" rel="Stylesheet" media="screen"/>	
       
    36     <link type="text/css" href="/fhiiqm/css/db_print.css" rel="Stylesheet" media="print"/>	
       
    37 	<title>Nutzer-Recht fhiiqm</title>
       
    38 </head>
       
    39 
       
    40 <body>
       
    41 
       
    42 <?php
       
    43     echo "&nbsp;";  
       
    44     echo "<div class=\"float-br smaller\" valign='top'>";
       
    45     echo "&nbsp;&nbsp;&nbsp;user: " . $_SESSION["userid"];
       
    46     echo "&nbsp;&nbsp;&nbsp;<a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n";
       
    47     echo "<div class=\"float-r\"><img src=\"img/user_go.png\" border=\"0\" alt=\"User, Rechte eingeben\" title=\"User, Rechte eingeben\"/></div>\n";
       
    48 
       
    49 	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
       
    50 	if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
       
    51     
       
    52     $sql = "SELECT userid,
       
    53             count(CASE recht_ID WHEN 'ar' THEN 1 END) AS anlage_read,
       
    54             COUNT(CASE recht_ID WHEN 'ae' THEN 1 END) AS anlage_edit,
       
    55             COUNT(CASE recht_ID WHEN 'fmr' THEN 1 END) AS funkt_ma_read,
       
    56             COUNT(CASE recht_ID WHEN 'fme' THEN 1 END) AS funkt_ma_edit,
       
    57             COUNT(CASE recht_ID WHEN 'ir' THEN 1 END) AS info_read,
       
    58             COUNT(CASE recht_ID WHEN 'ie' THEN 1 END) AS info_edit,
       
    59             COUNT(CASE recht_ID WHEN 'lr' THEN 1 END) AS laser_read,
       
    60             COUNT(CASE recht_ID WHEN 'le' THEN 1 END) AS laser_edit,
       
    61             COUNT(CASE recht_ID WHEN 'pr' THEN 1 END) AS prod_read,
       
    62             COUNT(CASE recht_ID WHEN 'pe' THEN 1 END) AS prod_edit,
       
    63             COUNT(CASE recht_ID WHEN 'rr' THEN 1 END) AS raum_read,
       
    64             COUNT(CASE recht_ID WHEN 're' THEN 1 END) AS raum_edit,
       
    65             COUNT(CASE recht_ID WHEN 'rtr' THEN 1 END) AS recht_read,
       
    66             COUNT(CASE recht_ID WHEN 'rte' THEN 1 END) AS recht_edit,
       
    67             COUNT(CASE recht_ID WHEN 'vr' THEN 1 END) AS vertrag_read,
       
    68             COUNT(CASE recht_ID WHEN 've' THEN 1 END) AS vertrag_edit,
       
    69             COUNT(CASE recht_ID WHEN 'vpr' THEN 1 END) AS vertr_part_read,
       
    70             COUNT(CASE recht_ID WHEN 'vpe' THEN 1 END) AS vertr_part_edit
       
    71             FROM `fhiiqm`.`user_recht` 
       
    72             GROUP BY userid";
       
    73     if ($result = $dbc -> queryObjectArray($sql))
       
    74     {
       
    75         $bg1 = "#F8F8F8";
       
    76 		$bg2 = "#DEDFE1";
       
    77 		$bg = "#FFFFFF";
       
    78      
       
    79         echo "<div align='center'>\n";
       
    80         echo "<p><b>Liste der fhiiqm-Nutzer und Rechte</b></p>\n";
       
    81         echo "<p>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Sichten/Bearbeiten der Nutzer-Rechte</p>";
       
    82         
       
    83         echo "<table cellpadding='2' cellspacing='2'>\n";
       
    84         // Listenkopf
       
    85         echo "<tr bgcolor='#68ACBF'>";
       
    86         echo "<th>userid</th><th>Anlage read</th><th>Anlage edit</th>
       
    87                 <th>FktMa read</th><th>FktMa edit</th>
       
    88                 <th>Info read</th><th>Info edit</th>
       
    89                 <th>Laser read</th><th>Laser edit</th>
       
    90                 <th>Prod read</th><th>Prod edit</th>
       
    91                 <th>Raum read</th><th>Raum edit</th>
       
    92                 <th>Recht read</th><th>Recht edit</th>
       
    93                 <th>Vertrag read</th><th>Vertrag edit</th>
       
    94                 <th>VtrPart read</th><th>VtrPart edit</th>
       
    95         </tr>\n";
       
    96         foreach ($result as $row)
       
    97         {
       
    98 			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
       
    99             echo "<tr bgcolor='" . $bg . "'><td><b>$row->userid</b></td>";
       
   100             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->anlage_read)) ."</b></td>";
       
   101             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->anlage_edit)) ."</b></td>";
       
   102             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->funkt_ma_read)) ."</b></td>";
       
   103             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->funkt_ma_edit)) ."</b></td>";
       
   104             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->info_read)) ."</b></td>";
       
   105             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->info_edit)) ."</b></td>";
       
   106             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->laser_read)) ."</b></td>";
       
   107             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->laser_edit)) ."</b></td>";
       
   108             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->prod_read)) ."</b></td>";
       
   109             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->prod_edit)) ."</b></td>";
       
   110             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->raum_read)) ."</b></td>";
       
   111             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->raum_edit)) ."</b></td>";
       
   112             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->recht_read)) ."</b></td>";
       
   113             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->recht_edit)) ."</b></td>";
       
   114             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->vertrag_read)) ."</b></td>";
       
   115             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->vertrag_edit)) ."</b></td>";
       
   116             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->vertr_part_read)) ."</b></td>";
       
   117             echo "<td class='center'><b>" . str_replace("0","&nbsp;",str_replace("1","x",$row->vertr_part_edit)) ."</b></td>";
       
   118             echo "</tr>\n";
       
   119         }
       
   120         echo "</table></div>\n";
       
   121     }
       
   122     if (!is_null($_SESSION["recht"]) && in_array("re",$_SESSION["recht"]))
       
   123         echo "<p class=\"sc\">&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/recht_ed.php\" target=\"_self\" title=\"Nutzer erfassen\">Weiteren Nutzer & Rechte erfassen</a></p>\n";    
       
   124 
       
   125 ?>
       
   126 </body>
       
   127 </html>