<?php
include_once 'classes/TestProjektSmarty.class.php';
require_once("config.inc.php");
$templatename = substr(basename($_SERVER['PHP_SELF']),0,-3)."html";
$smarty = new Smarty();
require_once "language/german.inc.php";

$action = $_GET['action'];

if($action == ''){

  $db = dbconnect();
  
  $result_bearb = $db->query("SELECT count(*) Anz 
                                 FROM dep_rollen_user_zuord a, dep_rolle b, dep_rollen_rechte_zuord c, dep_rechte d
                                WHERE a.roid=b.roid
                                  AND b.roid=c.roid
                                  AND c.reid=d.reid
                                  AND a.imtuid = '$uid' 
                                  AND d.bereich='ADB'");
  $row_bearb = $result_bearb->fetch_array();

  if($row_bearb[Anz] > 0){
    $smarty->assign('menu_admin_bearb', "1");
  }


  
    
    $query = "SELECT beschreibung, dateiname, target
                FROM dep_rollen_user_zuord a, dep_rolle b, dep_rollen_rechte_zuord c, dep_rechte d
               WHERE a.roid=b.roid
                 AND b.roid=c.roid
                 AND c.reid=d.reid
                 AND a.imtuid = '$uid' 
                 AND d.bereich='ADB'
               ORDER BY sort_order ASC";
  
    $result = $db->query ($query)
              or die ("Cannot execute query");
    
    $table_data1 = array();
      
    while ($row = $result->fetch_array()){

      array_push($table_data1, array(  
       'beschreibung' => $row[beschreibung],
       'dateiname' => $row[dateiname],
       'target' => $row[target]
      )
      );
    }
    
    $smarty->assign('table_data1', $table_data1);
    

    
    
    $query3 = "SELECT beschreibung, dateiname, target
                FROM dep_rollen_user_zuord a, dep_rolle b, dep_rollen_rechte_zuord c, dep_rechte d
               WHERE a.roid=b.roid
                 AND b.roid=c.roid
                 AND c.reid=d.reid
                 AND a.imtuid = '$uid' 
                 AND d.bereich='ADA'
               ORDER BY sort_order ASC";
  
    $result3 = $db->query ($query3)
              or die ("Cannot execute query3");
    
    $table_data3 = array();
      
    while ($row3 = $result3->fetch_array()){

      array_push($table_data3, array(  
       'beschreibung' => $row3[beschreibung],
       'dateiname' => $row3[dateiname],
       'target' => $row3[target]
      )
      );
    }
    
    $smarty->assign('table_data3', $table_data3);
}




$smarty->assign('action', "$action");
$smarty->display("$template/$templatename");

?>