<?php require_once('Connections/ktseelzedb.php'); ?>
<?php require_once('Connections/ktseelzedb.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE betriebstagebuch SET t_datum=%s, bearbeiter=%s, t_info=%s, zustand=%s WHERE id=%s",
GetSQLValueString($_POST['t_datum'], "date"),
GetSQLValueString($_POST['bearbeiter'], "text"),
GetSQLValueString($_POST['t_info'], "text"),
GetSQLValueString($_POST['zustand'], "text"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_ktseelzedb, $ktseelzedb);
$Result1 = mysql_query($updateSQL, $ktseelzedb) or die(mysql_error());
$updateGoTo = "btb_eintrag_ok.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_ktseelzedb, $ktseelzedb);
$query_btb_auswahl = "SELECT id, datum, titel FROM betriebstagebuch ORDER BY id DESC";
$btb_auswahl = mysql_query($query_btb_auswahl, $ktseelzedb) or die(mysql_error());
$row_btb_auswahl = mysql_fetch_assoc($btb_auswahl);
$totalRows_btb_auswahl = mysql_num_rows($btb_auswahl);
$colname_btb_edit = "-1";
if (isset($_GET['btb_auswahl'])) {
$colname_btb_edit = $_GET['btb_auswahl'];
}
mysql_select_db($database_ktseelzedb, $ktseelzedb);
$query_btb_edit = sprintf("SELECT * FROM betriebstagebuch WHERE id = %s", GetSQLValueString($colname_btb_edit, "int"));
$btb_edit = mysql_query($query_btb_edit, $ktseelzedb) or die(mysql_error());
$row_btb_edit = mysql_fetch_assoc($btb_edit);
$totalRows_btb_edit = mysql_num_rows($btb_edit);
mysql_select_db($database_ktseelzedb, $ktseelzedb);
$query_tecnik_name = "SELECT * FROM namen_technik ORDER BY id ASC";
$tecnik_name = mysql_query($query_tecnik_name, $ktseelzedb) or die(mysql_error());
$row_tecnik_name = mysql_fetch_assoc($tecnik_name);
$totalRows_tecnik_name = mysql_num_rows($tecnik_name);
?>
<!DOCTYPE html>
<html lang="de">
<head class="html5">
<meta charset="utf-8">
<title>Mitarbeiter Formulare</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="menue.css">
<link rel="stylesheet" href="btb.css">
<script src="script/SpryValidationTextField.js" type="text/javascript"></script>
<script src="script/SpryValidationSelect.js" type="text/javascript"></script>
<script src="script/SpryValidationTextarea.js" type="text/javascript"></script>
<script src="script/SpryValidationRadio.js" type="text/javascript"></script>
<link href="script/SpryValidationTextField.css" rel="stylesheet" type="text/css">
<link href="script/SpryValidationSelect.css" rel="stylesheet" type="text/css">
<link href="script/SpryValidationTextarea.css" rel="stylesheet" type="text/css">
<link href="script/SpryValidationRadio.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="site"><!--Site Beginn-->
<div id="header">
<p>Mitarbeiter Formulare</p>
</div>
<div id="cssmenu"><!--Menü Beginn-->
<ul>
<li><a href="index.php"><span>Home</span></a></li>
<li><a href="wasserwerte.php"><span>Wasserwerte</span></a></li>
<li><a href="reinigung.php"><span>Reinigung</span></a></li>
<li class="active"><a href="#"><span>Betriebstagebuch</span></a>
<ul>
<li><a href="btb_ansicht.php"><span>ansehen</span></a></li>
<li><a href="btb_eintragen.php"><span>eintragen</span></a></li>
<li><a href="btb_bearbeiten.php"><span>Status ändern</span></a></li>
</ul>
</li>
</ul>
</div>
<!--Menü Ende-->
<div id="content"><!--Content Beginn-->
<div id="btb_auswahl"><!--Auswahl Beginn-->
<form name="btb_auswahl" method="get" action="btb_bearbeiten.php">
<div id="auswahl_menue"><strong>Meldung auswählen:</strong>
<select name="btb_auswahl" id="btb_auswahl2">
<?php
do {
?>
<option value="<?php echo $row_btb_auswahl['id']?>">(<?php echo $row_btb_auswahl['datum']?>) <?php echo $row_btb_auswahl['titel']?></option>
<?php
} while ($row_btb_auswahl = mysql_fetch_assoc($btb_auswahl));
$rows = mysql_num_rows($btb_auswahl);
if($rows > 0) {
mysql_data_seek($btb_auswahl, 0);
$row_btb_auswahl = mysql_fetch_assoc($btb_auswahl);
}
?>
</select>
</div>
<div id="button">
<input class="btn" type="submit" name="button" value="Ok">
</div>
</form>
<hr></div>
<!--Auswahl Ende-->
<div id="btb_anzeigen"><!--BTB anzeigen Beginn-->
<strong>Datum:</strong> <?php echo $row_btb_edit['datum']; ?><strong> | Name:</strong> <?php echo $row_btb_edit['meldender']; ?><br>
<strong>Titel:</strong> <?php echo $row_btb_edit['titel']; ?><br>
<strong>Meldung:</strong> <?php echo $row_btb_edit['meldung']; ?><br>
<br>
<br>
<strong>Datum:</strong> <?php echo $row_btb_edit['t_datum']; ?><strong> | Bearbeitet von:</strong> <?php echo $row_btb_bearbeiten['bearbeiter']; ?><br>
<strong>Kommentar:</strong> <?php echo $row_btb_edit['t_datum']; ?><br>
<strong>Zustand:</strong> <?php echo $row_btb_edit['zustand']; ?> </div>
<!--BTB anzeigen Ende-->
<div id="btb_edit"><!--Edit Beginn-->
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table width="75%" align="left" cellspacing="10">
<tr valign="baseline">
<td align="left" valign="top" nowrap><strong>Datum:</strong></td>
<td><span id="sprytextfield1">
<input type="text" name="t_datum" value="<?php echo htmlentities($row_btb_edit['t_datum'], ENT_COMPAT, ''); ?>" size="15">
<span class="textfieldRequiredMsg">Es muss ein Wert angegeben werden.</span><span class="textfieldInvalidFormatMsg">Ungültiges Format (Bsp: 01.01.2012</span></span></td>
</tr>
<tr valign="baseline">
<td align="left" valign="top" nowrap><strong>Bearbeiter:</strong></td>
<td><span id="spryselect1">
<select name="bearbeiter" id="select1">
<?php
do {
?>
<option value="<?php echo $row_tecnik_name['name']?>"><?php echo $row_tecnik_name['name']?></option>
<?php
} while ($row_tecnik_name = mysql_fetch_assoc($tecnik_name));
$rows = mysql_num_rows($tecnik_name);
if($rows > 0) {
mysql_data_seek($tecnik_name, 0);
$row_tecnik_name = mysql_fetch_assoc($tecnik_name);
}
?>
</select>
<span class="selectRequiredMsg">Wählen Sie ein Element aus.</span></span></td>
</tr>
<tr align="left" valign="top">
<td nowrap><strong>Info:</strong></td>
<td><span id="sprytextarea1">
<textarea name="t_info" cols="75" rows="10"><?php echo htmlentities($row_btb_edit['t_info'], ENT_COMPAT, ''); ?></textarea><br>
<span class="textareaRequiredMsg">Es muss ein Wert angegeben werden.</span><span class="textareaMinCharsMsg">Die mindestens erforderliche Zeichenanzahl wurde unterschritten.</span></span></td>
</tr>
<tr valign="baseline">
<td align="left" valign="top" nowrap><strong>Zustand:</strong></td>
<td valign="baseline"><span id="spryradio1">
<label>
<input type="radio" name="zustand" value="i.B." id="zustand_0">
in Bearbeitung</label>
<br>
<label>
<input type="radio" name="zustand" value="i.O." id="zustand_1">
in Ordnung</label>
<br>
<span class="radioRequiredMsg">Nehmen Sie eine Auswahl vor.</span></span></td>
</tr>
<tr valign="baseline">
<td colspan="2" align="center" nowrap><input type="submit" class="btn" value="Meldung aktualisieren"></td>
</tr>
</table>
<input type="hidden" name="id" value="<?php echo $row_btb_edit['id']; ?>">
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="id" value="<?php echo $row_btb_edit['id']; ?>">
</form>
<p> </p>
</div>
<!--Edit Ende-->
</div>
<!--Content Ende-->
<div id="footer"><!--Footer Beginn-->
<p>© René Lohmann 2012</p>
</div>
<!--Footer Ende-->
</div>
<!--Site Ende-->
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "date", {format:"dd.mm.yyyy", hint:"01.01.2012"});
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
var sprytextarea1 = new Spry.Widget.ValidationTextarea("sprytextarea1", {minChars:5});
var spryradio1 = new Spry.Widget.ValidationRadio("spryradio1");
</script>
</body>
</html>
<?php
mysql_free_result($btb_auswahl);
mysql_free_result($btb_edit);
mysql_free_result($tecnik_name);
?>