mirror of
http://git.frickel.earth/Tysox/BOS-Pinneberg.git
synced 2025-05-21 11:04: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">
|
<main class="mdl-layout__content mdl-color--grey-100">
|
||||||
<div class="mdl-grid demo-content">
|
<div class="mdl-grid demo-content">
|
||||||
<div class="demo-charts mdl-color--white mdl-shadow--2dp mdl-cell mdl-cell--12-col mdl-grid">
|
<div class="demo-charts mdl-color--white mdl-shadow--2dp mdl-cell mdl-cell--12-col mdl-grid">
|
||||||
|
<h3 id="feedback"></h3>
|
||||||
<form>
|
<form>
|
||||||
<div class="mdl-textfield mdl-js-textfield getmdl-select getmdl-select__fix-height">
|
<div class="mdl-textfield mdl-js-textfield getmdl-select getmdl-select__fix-height">
|
||||||
<input class="mdl-textfield__input" value="" id="ort" readonly/>
|
<input class="mdl-textfield__input" value="" id="ort" readonly/>
|
||||||
@ -85,7 +86,7 @@ $header->showHeader("Feuerwehr");?>
|
|||||||
|
|
||||||
<br>
|
<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
|
OK
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@ -216,5 +217,25 @@ $header->showHeader("Feuerwehr");?>
|
|||||||
</defs>
|
</defs>
|
||||||
</svg>
|
</svg>
|
||||||
<script src="https://code.getmdl.io/1.3.0/material.min.js"></script>
|
<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>
|
</body>
|
||||||
</html>
|
</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();
|
$data = new Config();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Create connection
|
// Create connection
|
||||||
$conn = new mysqli($data->getSQLHost(), $data->getSQLUser(), $data->getSQLPassword(), $data->getSQLDatabase());
|
$conn = new mysqli($data->getSQLHost(), $data->getSQLUser(), $data->getSQLPassword(), $data->getSQLDatabase());
|
||||||
mysqli_set_charset($conn, "utf8");
|
mysqli_set_charset($conn, "utf8");
|
||||||
@ -19,35 +18,36 @@ $result = $conn->query("SELECT * FROM `feuerwehr_pi`");
|
|||||||
|
|
||||||
if ($result->num_rows > 0) {
|
if ($result->num_rows > 0) {
|
||||||
// output data of each row
|
// output data of each row
|
||||||
while($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
|
|
||||||
if($row['id'] == 10) {
|
if ($row['id'] == 10) {
|
||||||
echo("<h4>Revier Pinneberg</h4>");
|
echo("<h4>Revier Pinneberg</h4>");
|
||||||
}
|
}
|
||||||
if($row['id'] == 20) {
|
if ($row['id'] == 20) {
|
||||||
echo("<h4>Revier Elmshorn</h4>");
|
echo("<h4>Revier Elmshorn</h4>");
|
||||||
}
|
}
|
||||||
if($row['id'] == 30) {
|
if ($row['id'] == 30) {
|
||||||
echo("<h4>Revier Wedel</h4>");
|
echo("<h4>Revier Wedel</h4>");
|
||||||
}
|
}
|
||||||
if($row['id'] == 40) {
|
if ($row['id'] == 40) {
|
||||||
echo("<h4>Revier Uetersen</h4>");
|
echo("<h4>Revier Uetersen</h4>");
|
||||||
}
|
}
|
||||||
if($row['id'] == 60) {
|
if ($row['id'] == 60) {
|
||||||
echo("<h4>Revier Hörnerkirchen</h4>");
|
echo("<h4>Revier Hörnerkirchen</h4>");
|
||||||
}
|
}
|
||||||
if($row['id'] == 70) {
|
if ($row['id'] == 70) {
|
||||||
echo("<h4>Revier Quickborn</h4>");
|
echo("<h4>Revier Quickborn</h4>");
|
||||||
}
|
}
|
||||||
if($row['id'] == 80) {
|
if ($row['id'] == 80) {
|
||||||
echo("<h4>Revier Barmstedt</h4>");
|
echo("<h4>Revier Barmstedt</h4>");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp">
|
<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 mdl-cell mdl-cell--12-col">
|
||||||
<div class="mdl-card__supporting-text">
|
|
||||||
<h4 style="text-align: center"><?php echo $row['Ort'] ." [". $row['id'];?>]</h4>
|
<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>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="mdl-data-table__cell--non-numeric">Fahrzeugtyp</th>
|
<th class="mdl-data-table__cell--non-numeric">Fahrzeugtyp</th>
|
||||||
@ -55,17 +55,15 @@ if ($result->num_rows > 0) {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
$fahrzeuge = $conn->query("SELECT * FROM `feuerwehr` WHERE OrtID = " . $row['id']);
|
||||||
|
|
||||||
$fahrzeuge = $conn->query("SELECT * FROM `feuerwehr` WHERE OrtID = ". $row['id'] );
|
if ($fahrzeuge->num_rows > 0) {
|
||||||
|
|
||||||
if($fahrzeuge->num_rows > 0) {
|
|
||||||
while ($frow = $fahrzeuge->fetch_assoc()) {
|
while ($frow = $fahrzeuge->fetch_assoc()) {
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="mdl-data-table__cell--non-numeric"><?php echo $frow['Fahrzeugtyp'] ?></td>
|
<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>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
@ -73,6 +71,7 @@ if ($result->num_rows > 0) {
|
|||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
<?php }}?>
|
<?php }
|
||||||
|
} ?>
|
Loading…
x
Reference in New Issue
Block a user