mirror of
http://git.frickel.earth/Tysox/BOS-Pinneberg.git
synced 2025-05-21 06:14:30 +02:00
added adding in Admin Panel
This commit is contained in:
parent
dc1bfa4ccf
commit
051b49bb43
@ -42,6 +42,7 @@ $header->showHeader("Feuerwehr");?>
|
||||
<main class="mdl-layout__content mdl-color--grey-100">
|
||||
<div class="mdl-grid demo-content">
|
||||
<div class="demo-charts mdl-color--white mdl-shadow--2dp mdl-cell mdl-cell--12-col mdl-grid">
|
||||
<h3 id="feedback"></h3>
|
||||
<form>
|
||||
<div class="mdl-textfield mdl-js-textfield getmdl-select getmdl-select__fix-height">
|
||||
<input class="mdl-textfield__input" value="" id="ort" readonly/>
|
||||
@ -85,7 +86,7 @@ $header->showHeader("Feuerwehr");?>
|
||||
|
||||
<br>
|
||||
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored">
|
||||
<button onclick="addVehicle()" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored">
|
||||
OK
|
||||
</button>
|
||||
</form>
|
||||
@ -216,5 +217,25 @@ $header->showHeader("Feuerwehr");?>
|
||||
</defs>
|
||||
</svg>
|
||||
<script src="https://code.getmdl.io/1.3.0/material.min.js"></script>
|
||||
<script src="../style/js/jQuery.js"></script>
|
||||
<script>
|
||||
|
||||
function addVehicle() {
|
||||
var ort;
|
||||
var name;
|
||||
var number;
|
||||
var type;
|
||||
$.ajax({
|
||||
url: "../scripts/vehicles.php"
|
||||
type: "POST"
|
||||
data: "org=ff&ort"+ort+"&name="+name+"&number="+number+"&type="+type
|
||||
success: function (resp) {
|
||||
$("#feedback").html(resp);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
77
admin/scripts/vehicle.php
Normal file
77
admin/scripts/vehicle.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (empty($_SESSION['status'])) {
|
||||
if (!file_exists('config/config.inc.php')) {
|
||||
$_SESSION['status'] = 'error';
|
||||
} else {
|
||||
$_SESSION['status'] = 'login';
|
||||
}
|
||||
}
|
||||
|
||||
if ($_SESSION['status'] == "login") {
|
||||
echo "<html>
|
||||
<head>
|
||||
<script>
|
||||
setTimeout(\"window.location.href='../login.php'\", 0);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>";
|
||||
return;
|
||||
}
|
||||
|
||||
include '../config/config.inc.php';
|
||||
$data = new Config();
|
||||
|
||||
try {
|
||||
$pdo = new PDO('mysql:host=' . $data->getSQLHost() . ';dbname=' . $data->getSQLDatabase() . ';charset=utf8mb4', $data->getSQLUser(), $data->getSQLPassword());
|
||||
} catch (PDOException $exception) {
|
||||
echo "Fehler: " . $exception->getMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($_POST) {
|
||||
|
||||
if (isset($_POST['org'])) {
|
||||
|
||||
if(strcmp($_POST['org'], "ff")) {
|
||||
if (isset($_POST['ort']) && isset($_POST['name']) && isset($_POST['number']) && isset($_POST['type'])) {
|
||||
$insert = $pdo->prepare("INSERT INTO feuerwehr (id, OrtID, Organistationskennung, Fahrzeugkennung, Fahrzeugtyp) VALUES (?,?,?,?,?)");
|
||||
|
||||
$select = $pdo->prepare("SELECT COUNT(OrtID) FROM feuerwehr WHERE OrtID = ?");
|
||||
if ($select->execute(array($_POST ['ort']))) {
|
||||
$count = $select->fetch();
|
||||
|
||||
if ($count <= 9) {
|
||||
$count = $_POST['ort'] . "0" . $count;
|
||||
} else {
|
||||
$count = $_POST['ort'] . $count;
|
||||
}
|
||||
}
|
||||
$insert->bindParam(1, $count);
|
||||
$insert->bindParam(2, $_POST['ort']);
|
||||
$insert->bindParam(3, $_POST['name']);
|
||||
$insert->bindParam(4, $_POST['number']);
|
||||
$insert->bindParam(5, $_POST['type']);
|
||||
$insert->execute();
|
||||
echo "Eintrag vom Fahrzeug erfolgreich";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(strcmp($_POST['org'], "pol")) {
|
||||
|
||||
}
|
||||
|
||||
if(strcmp($_POST['org'], "rt")) {
|
||||
|
||||
}
|
||||
|
||||
if(strcmp($_POST['org'], "thw")) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -3,7 +3,6 @@ include 'admin/config/config.inc.php';
|
||||
$data = new Config();
|
||||
|
||||
|
||||
|
||||
// Create connection
|
||||
$conn = new mysqli($data->getSQLHost(), $data->getSQLUser(), $data->getSQLPassword(), $data->getSQLDatabase());
|
||||
mysqli_set_charset($conn, "utf8");
|
||||
@ -45,9 +44,10 @@ if ($result->num_rows > 0) {
|
||||
?>
|
||||
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp">
|
||||
<div class="mdl-card mdl-cell mdl-cell--12-col">
|
||||
<div class="mdl-card__supporting-text">
|
||||
|
||||
<h4 style="text-align: center"><?php echo $row['Ort'] . " [" . $row['id']; ?>]</h4>
|
||||
<table style="margin-left: auto; margin-right: auto" class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
|
||||
<table style="margin-left: auto; margin-right: auto"
|
||||
class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="mdl-data-table__cell--non-numeric">Fahrzeugtyp</th>
|
||||
@ -55,9 +55,7 @@ if ($result->num_rows > 0) {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
|
||||
$fahrzeuge = $conn->query("SELECT * FROM `feuerwehr` WHERE OrtID = " . $row['id']);
|
||||
|
||||
if ($fahrzeuge->num_rows > 0) {
|
||||
@ -65,7 +63,7 @@ if ($result->num_rows > 0) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric"><?php echo $frow['Fahrzeugtyp'] ?></td>
|
||||
<td><?php echo $frow['Organistationskennung'] . " " . $row['id'] . "-" . $frow['Fahrzeugkennung'] ?></td>
|
||||
<td class="mdl-data-table__cell--non-numeric"><?php echo $frow['Organistationskennung'] . " " . $row['id'] . "-" . $frow['Fahrzeugkennung'] ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
@ -73,6 +71,7 @@ if ($result->num_rows > 0) {
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
<?php }}?>
|
||||
<?php }
|
||||
} ?>
|
Loading…
x
Reference in New Issue
Block a user