<?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();
  $datei = basename($_SERVER['PHP_SELF']);
  $result = $db->query("SELECT beschreibung FROM imt_rechte WHERE dateiname = '$datei'");
  $row = $result->fetch_array();
  $smarty->assign('ausschuss_bearbeitung_titel', "$row[beschreibung]");

    $query = "SELECT a.vid, betreff, date_format(erfass_dat, '%d.%m.%Y %H:%i:%s') erfass_dat_form, vorname, nachname, max(STATUS)status
                FROM imt_vorschlag a, imt_verlauf b, imt_user c
               WHERE a.vid = b.vid
                 AND a.imtuid=c.imtuid
                 AND status < 100
               GROUP BY a.vid
              HAVING max(STATUS) NOT IN (1, 7, 8)
               ORDER BY erfass_dat ASC";
               
  
    $result = $db->query ($query)
              or die ("Cannot execute query");
    
    $table_data1 = array();
      
    while ($row = $result->fetch_array()){
     
      array_push($table_data1, array(  
       'vid' => $row[vid],
       'betreff' => $row[betreff],
       'erfass_dat_form' => $row[erfass_dat_form],
       'vorname' => $row[vorname],
       'nachname' => $row[nachname]
      )
      );
    }
    
    $smarty->assign('table_data1', $table_data1);
    

}





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

?>