<?php
$user_admin=$_COOKIE["user_admin"];
$jahrgang=$_COOKIE["jahrgang"];

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


if(isset($_GET['action'])){
  $action = $_GET['action'];
}else{
  $action = '';
}

if($action == ''){

  #$db = dbconnect();

  $query = $db->query("SELECT min(jahr) jahr
                         FROM `prog_vergaberahmen`
                      ");
  $row = $query->fetch_array();
   
  $query2 = $db->query("SELECT min(date_format(zugang,'%Y')) zugang,  max(date_format(weggang,'%Y'))+1 weggang
                         FROM `prog_professor`
                      ");
  $row2 = $query2->fetch_array();
  
  $smarty->assign('jahrgang_min', $row['jahr']);
  $smarty->assign('jahrgang_weggang', $row2['weggang']);
  $smarty->assign('jahrgang_cur_jahrgang', $jahrgang);
  
}

if($action == 'jahr'){
  setcookie("jahrgang","");
  setcookie("jahrgang",$_POST['jahr']);
  echo "<meta http-equiv=\"refresh\" content=\"0; URL=hauptframe.php\">";
} // Ende Action script

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