147 lines
5.8 KiB
PHP
Executable File
147 lines
5.8 KiB
PHP
Executable File
<?php
|
|
session_start();
|
|
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";
|
|
|
|
require_once("func_verlauf.php");
|
|
require_once("func_mail_einstell.php");
|
|
require_once("func_htmlclean.php");
|
|
|
|
if(isset($_GET['id'])){
|
|
$_SESSION["edit_id"] = $_GET['id'];
|
|
}
|
|
$id = $_SESSION["edit_id"];
|
|
|
|
$action = $_GET['action'];
|
|
|
|
|
|
if($action == ''){
|
|
|
|
if($_GET['error'] == 1){
|
|
$smarty->assign('bewertungsvorschlag_pflichtfelder', "1");
|
|
|
|
$smarty->assign('bewertungsvorschlag_annahme', $_SESSION["bewertungsvorschlag_annahme"]);
|
|
$smarty->assign('bewertungsvorschlag_begruendung', $_SESSION["bewertungsvorschlag_begruendung"]);
|
|
$smarty->assign('bewertungsvorschlag_umsetzung', $_SESSION["bewertungsvorschlag_umsetzung"]);
|
|
$smarty->assign('bewertungsvorschlag_praemierung', $_SESSION["bewertungsvorschlag_praemierung"]);
|
|
|
|
if($_SESSION["bewertungsvorschlag_chk1"] == "" AND $_SESSION["bewertungsvorschlag_chk2"] == "" AND $_SESSION["bewertungsvorschlag_chk3"] == "" AND $_SESSION["bewertungsvorschlag_chk4"] == "" AND $_SESSION["bewertungsvorschlag_chk5"] == ""){$smarty->assign('bewertungsvorschlag_ziel_ico', 1);}
|
|
}else{
|
|
|
|
$db = dbconnect();
|
|
$result = $db->query("SELECT annahme, ziel, begruendung, umsetzung, praemierung
|
|
FROM imt_bew_vorschlag
|
|
WHERE vid = '$id'");
|
|
$row = $result->fetch_array();
|
|
|
|
if(preg_match("/1/",$row['ziel'])){
|
|
$smarty->assign('bewertungsvorschlag_chk1', "Y");
|
|
}else{
|
|
$smarty->assign('bewertungsvorschlag_chk1', "N");
|
|
}
|
|
|
|
if(preg_match("/2/",$row['ziel'])){
|
|
$smarty->assign('bewertungsvorschlag_chk2', "Y");
|
|
}else{
|
|
$smarty->assign('bewertungsvorschlag_chk2', "N");
|
|
}
|
|
|
|
if(preg_match("/3/",$row['ziel'])){
|
|
$smarty->assign('bewertungsvorschlag_chk3', "Y");
|
|
}else{
|
|
$smarty->assign('bewertungsvorschlag_chk3', "N");
|
|
}
|
|
|
|
if(preg_match("/4/",$row['ziel'])){
|
|
$smarty->assign('bewertungsvorschlag_chk4', "Y");
|
|
}else{
|
|
$smarty->assign('bewertungsvorschlag_chk4', "N");
|
|
}
|
|
|
|
if(preg_match("/5/",$row['ziel'])){
|
|
$smarty->assign('bewertungsvorschlag_chk5', "Y");
|
|
}else{
|
|
$smarty->assign('bewertungsvorschlag_chk5', "N");
|
|
}
|
|
|
|
|
|
if($row['annahme'] == ''){
|
|
$smarty->assign('bewertungsvorschlag_annahme', "J");
|
|
}else{
|
|
$smarty->assign('bewertungsvorschlag_annahme', "$row[annahme]");
|
|
}
|
|
|
|
$smarty->assign('bewertungsvorschlag_begruendung', "$row[begruendung]");
|
|
$smarty->assign('bewertungsvorschlag_umsetzung', "$row[umsetzung]");
|
|
$smarty->assign('bewertungsvorschlag_praemierung', "$row[praemierung]");
|
|
}
|
|
|
|
}
|
|
|
|
if($action == 'save'){
|
|
|
|
|
|
|
|
$id = $_SESSION["bearbeiten_id"];
|
|
$bewertungsvorschlag_chk1 = $_POST['chk1'];
|
|
$bewertungsvorschlag_chk2 = $_POST['chk2'];
|
|
$bewertungsvorschlag_chk3 = $_POST['chk3'];
|
|
$bewertungsvorschlag_chk4 = $_POST['chk4'];
|
|
$bewertungsvorschlag_chk5 = $_POST['chk5'];
|
|
$bewertungsvorschlag_annahme = $_POST['bewertungsvorschlag_annahme'];
|
|
$bewertungsvorschlag_begruendung = htmlclean($_POST['bewertungsvorschlag_begruendung']);
|
|
$bewertungsvorschlag_umsetzung = htmlclean($_POST['bewertungsvorschlag_umsetzung']);
|
|
$bewertungsvorschlag_praemierung = htmlclean($_POST['bewertungsvorschlag_praemierung']);
|
|
$aend_dat = date("Y-m-d H:i:s");
|
|
|
|
if($bewertungsvorschlag_chk1 == "" AND $bewertungsvorschlag_chk2 == "" AND $bewertungsvorschlag_chk3 == "" AND $bewertungsvorschlag_chk4 == "" AND $bewertungsvorschlag_chk5 == ""){
|
|
|
|
$_SESSION["bewertungsvorschlag_annahme"] = "$bewertungsvorschlag_annahme";
|
|
$_SESSION["bewertungsvorschlag_begruendung"] = "$bewertungsvorschlag_begruendung";
|
|
$_SESSION["bewertungsvorschlag_umsetzung"] = "$bewertungsvorschlag_umsetzung";
|
|
$_SESSION["bewertungsvorschlag_praemierung"] = "$bewertungsvorschlag_praemierung";
|
|
$smarty->assign('bewertungsvorschlag_save', 0); # Erfolgsmeldung unterdrücken
|
|
|
|
echo "<meta http-equiv=\"refresh\" content=\"0; URL=".$_SERVER['PHP_SELF']."?error=1\">";
|
|
}else{
|
|
$smarty->assign('bewertungsvorschlag_save', 1); # Erfolgsmeldung ausgeben
|
|
$ziel = "$bewertungsvorschlag_chk1$bewertungsvorschlag_chk2$bewertungsvorschlag_chk3$bewertungsvorschlag_chk4$bewertungsvorschlag_chk5";
|
|
|
|
$db = dbconnect();
|
|
$result = $db->query("SELECT count(*) Anz
|
|
FROM imt_bew_vorschlag
|
|
WHERE vid = '$id'");
|
|
$row = $result->fetch_array();
|
|
|
|
if($row[Anz] == 0){
|
|
$sql = $db->query("INSERT INTO imt_bew_vorschlag (vid, datum, ziel, annahme, begruendung, umsetzung, praemierung)
|
|
VALUES ($id, '$aend_dat', '$ziel', '$bewertungsvorschlag_annahme', '$bewertungsvorschlag_begruendung', '$bewertungsvorschlag_umsetzung', '$bewertungsvorschlag_praemierung')");
|
|
}else{
|
|
$sql = $db->query("UPDATE imt_bew_vorschlag
|
|
SET datum='$aend_dat'
|
|
, ziel = '$ziel'
|
|
, annahme='$bewertungsvorschlag_annahme'
|
|
, begruendung='$bewertungsvorschlag_begruendung'
|
|
, umsetzung='$bewertungsvorschlag_umsetzung'
|
|
, praemierung='$bewertungsvorschlag_praemierung'
|
|
WHERE vid = $id
|
|
");
|
|
|
|
}
|
|
|
|
if($sql){
|
|
echo "<meta http-equiv=\"refresh\" content=\"2; URL=".$_SERVER['PHP_SELF']."\">";
|
|
}else{
|
|
echo "Fehler beim Speichern!";
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
$smarty->assign('action', "$action");
|
|
$smarty->display("$template/$templatename");
|
|
?>
|