<?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(isset($_GET['id'])){
  $_SESSION["status_id"] = $_GET['id'];
}

if($action == ''){


  
  $db = dbconnect();
    
    $query = "SELECT a.vid, betreff, date_format(a.erfass_dat, '%d.%m.%Y %H:%i:%s') erfass_dat_form, vorname, nachname, date_format(min(frist_datum), '%d.%m.%Y') frist_dat_form
                FROM imt_vorschlag a, imt_gutachter b, imt_user c
               WHERE a.vid = b.vid
                 AND a.imtuid=c.imtuid
                 AND b.gid NOT IN (SELECT gid FROM imt_ausschuss_gutachter_erg WHERE imtuid='$uid')
                 AND b.gid IN (SELECT gid FROM imt_gutachter WHERE frist_datum >= date_format( now( ) , '%Y-%m-%d' ))
               GROUP BY a.vid
               ORDER BY min(frist_datum) 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],
       'frist_dat_form' => $row[frist_dat_form],
       'vorname' => $row[vorname],
       'nachname' => $row[nachname]
      )
      );
    }
    
    $smarty->assign('table_data1', $table_data1);
    

}





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

?>