This commit is contained in:
Naumann 2020-06-12 08:57:44 +02:00
parent 438122dbc9
commit 560252464b
6 changed files with 152 additions and 130 deletions

View File

@ -81,22 +81,23 @@
"lendTime"=>$_POST["LendTime"],
"lendType"=>$_POST["LendType"]);
$json = json_encode($form);
//echo $form["title"];
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => "Content-type: application/json\r\n",
'method' => "POST",
'content' => $json
)
));
// Send the request
$response= file_get_contents('http://localhost:5000/api/katalog/buch', false, $context);
$response= file_get_contents('http://localhost:5000/api/katalog/buch', true, $context);
echo $response;
// Check for errors
if($response === FALSE){
die('Error');
echo('Error!');
}
// Decode the response
@ -150,16 +151,16 @@
<input type="number" name="Pages" class="input" placeholder="Seiten" min="0">
<input type="number" name="Year" class="input" placeholder="Erscheinungsjahr" min="0">
<select class="input" name="Category">
<option>Book</option>
<option>Magazin</option>
<option>EBook</option>
<option>EPaper</option>
<option value="0">Book</option>
<option value="1">Magazin</option>
<option value="2" >EBook</option>
<option value="3">EPaper</option>
</select>
<input type="url" name="ImageLink" class="input" placeholder="Bild">
<input type="number" name="LendTime" class="input" placeholder="Verteihdauer" min="0">
<select class="input" name="LendType">
<option>Physical</option>
<option>Virtual</option>
<option value="0">Physical</option>
<option value="1">Virtual</option>
</select>
<input type="submit" name="go" id="go">
</form>

View File

@ -1,37 +0,0 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inventar</title>
<link rel="stylesheet" type="text/css" href="scss/style.css" media="screen" />
</head>
<body>
<div class="Titel">
<a href="index.html"><button id= "zurueck">zurück</button></a>
<h1>Inventar</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form action="inventar_search.php">
<input type="number" name="ProductId" class="input" placeholder="Geben Sie die gesuchte Id an" min= "0">
<input type="submit" name="go" id="go">
</form>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
<tr>
<td class ="fix">ItemId</td>
<td></td>
</tr>
<tr>
<td class="fix">BookId</td>
<td></td>
</tr>
</table>
</div>
</body>
</html>

61
findInventar.php Normal file
View File

@ -0,0 +1,61 @@
<?php
if(isset($_POST["go"]))
{
$url = 'localhost:5000/api/inventar';
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST'
),
);
$context = stream_context_create($options);
//echo $context;
$id= $_POST["ItemId"];
$result = file_get_contents('http://localhost:5000/api/inventar/'.$id);
$json= json_decode($result, true);
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inventar</title>
<link rel="stylesheet" type="text/css" href="scss/style.css" media="screen" />
</head>
<body>
<div class="Titel">
<a href="index.html"><button id= "zurueck">zurück</button></a>
<h1>Inventar</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form method="post">
<input type="number" name="ItemId" class="input" placeholder="Geben Sie die gesuchte Id an" min= "1">
<input type="submit" name="go" id="go">
</form>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
<tr>
<td class ="fix">ItemId</td>
<td><?php if(isset($_POST["go"])) echo $json['itemId']; ?></td>
</tr>
<tr>
<td class="fix">BookId</td>
<td><?php if(isset($_POST["go"])) echo $json['bookId']; ?></td>
</tr>
</table>
</div>
</body>
</html>

View File

@ -1,76 +0,0 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Verleih</title>
<link rel="stylesheet" type="text/css" href="scss/style.css" media="screen" />
</head>
<body>
<div class="Titel">
<a href="index.html"><button id= "zurueck">zurück</button></a>
<h1>Verleih</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form action="lend_search.php">
<input type="number" name="VerleihId" class="input" placeholder="Geben sie die gesuchte VerleihId an" min= "0">
<input type="submit" name="go" id="go">
</form>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
<tr>
<td class ="fix">ProductId</td>
<td></td>
</tr>
<tr>
<td class="fix">Titel</td>
<td></td>
</tr>
<tr>
<td class="fix">Autor</td>
<td></td>
</tr>
<tr>
<td class="fix">Erscheinungsland</td>
<td></td>
</tr>
<tr>
<td class="fix">Link</td>
<td></td>
</tr>
<tr>
<td class="fix">Sprache</td>
<td></td>
</tr>
<tr>
<td class="fix">Seitenzahl</td>
<td></td>
</tr>
<tr>
<td class="fix">Erscheinungsjahr</td>
<td></td>
</tr>
<tr>
<td class="fix">Kategorie</td>
<td></td>
</tr>
<tr>
<td class="fix">Bildlink</td>
<td></td>
</tr>
<tr>
<td class="fix">Verleihdauer</td>
<td></td>
</tr>
<tr>
<td class="fix">Verleihtyp</td>
<td></td>
</tr>
</table>
</div>
</body>
</html>

73
findVerleih.php Normal file
View File

@ -0,0 +1,73 @@
<?php
if(isset($_POST["go"]))
{
$url = 'localhost:5000/api/leihvorgang';
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST'
),
);
$context = stream_context_create($options);
//echo $context;
$id= $_POST["id"];
$result = file_get_contents('http://localhost:5000/api/leihvorgang/'.$id);
//echo $result;
$json= json_decode($result, true);
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Verleih</title>
<link rel="stylesheet" type="text/css" href="scss/style.css" media="screen" />
</head>
<body>
<div class="Titel">
<a href="index.html"><button id= "zurueck">zurück</button></a>
<h1>Verleih</h1>
</div>
<div class="Eingabe">
<h2>Eingabe</h2>
<form methode="post">
<input type="number" name="id" class="input" placeholder="Geben sie die gesuchte VerleihId an" min= "0">
<input type="submit" name="go" id="go">
</form>
</div>
<div class="Ausgabe">
<h2>Ausgabe</h2>
<table>
<tr>
<td class ="fix">Id</td>
<td><?php if(isset($_POST["go"])) echo $json['id']; ?></td>
</tr>
<tr>
<td class="fix">ItemId</td>
<td><?php if(isset($_POST["go"])) echo $json['itemId']; ?></td>
</tr>
<tr>
<td class="fix">ReturnDate</td>
<td><?php if(isset($_POST["go"])) echo $json['returnDate']; ?></td>
</tr>
<tr>
<td class="fix">Customer</td>
<td><?php if(isset($_POST["go"])) echo $json['customer']; ?></td>
</tr>
<tr>
<td class="fix">Returned</td>
<td><?php if(isset($_POST["go"])) echo $json['returned']; ?></td>
</tr>
</table>
</div>
</body>
</html>

View File

@ -21,8 +21,8 @@
<option></option>
<option value=findKatalog.php>Finden</option>
<Option value="addKatalog.php">Hinzufügen</Option>
<option value="changeKatalog.htm">Bearbeiten</option>
<option value="deleteKatalog.htm">Löschen</option>
<option value="changeKatalog.php">Bearbeiten</option>
<option value="deleteKatalog.php">Löschen</option>
</select>
</dd>
<dt>
@ -32,9 +32,9 @@
<select name="selection" id="selection" onchange="location.assign(this.value);">
<option></option>
<option value=findInventar.htm>Finden</option>
<Option value="addInventar.htm">Hinzufügen</Option>
<option value="deleteInventar.htm">Löschen</option>
<option value=findInventar.php>Finden</option>
<Option value="addInventar.php">Hinzufügen</Option>
<option value="deleteInventar.php">Löschen</option>
</select>
</dd>
<dt>
@ -44,9 +44,9 @@
<select name="selection" id="selection" onchange="location.assign(this.value);">
<option></option>
<option value=findVerleih.htm>Finden</option>
<Option value="addVerleih.htm">Hinzufügen</Option>
<option value="changeVerleih.htm">Bearbeiten</option>
<option value=findVerleih.php>Finden</option>
<Option value="addVerleih.php">Hinzufügen</Option>
<option value="changeVerleih.php">Bearbeiten</option>
</select>
</dd>
</form>