done. xml created and is dispayed. can’t download it. don’t know how.
This commit is contained in:
parent
05eef451e0
commit
d0359a3159
|
@ -31,7 +31,7 @@ CREATE TABLE IF NOT EXISTS `bsldb`.`nachfrager` (
|
|||
`erfassungs_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`benutzer_id` int(11) NOT NULL,
|
||||
`nachfr_typ` varchar(35) NOT NULL,
|
||||
`nachfr_quali` tinyint(2) NOT NULL,
|
||||
`nachfr_quali` tinyint(2) NOT NULL,
|
||||
`nachfr_menge` int(11) NOT NULL,
|
||||
`nachfr_lieferdatum` date,
|
||||
`nachfr_datum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
@ -47,7 +47,8 @@ CREATE TABLE IF NOT EXISTS `bsldb`.`anbieter` (
|
|||
`benutzer_id` int(11) NOT NULL,
|
||||
`erfassungs_id` int(11) NOT NULL,
|
||||
`angebot_preis` DECIMAL(7,2) NOT NULL,
|
||||
`angebot_datum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`angebot_datum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`angebot_file` varchar(63) NOT NULL,
|
||||
PRIMARY KEY (`angebot_id`),
|
||||
FOREIGN KEY (`benutzer_id`) REFERENCES `benutzer` (benutzer_id),
|
||||
FOREIGN KEY (`erfassungs_id`) REFERENCES `nachfrager` (erfassungs_id)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
require_once("session.php");
|
||||
require_once("config.php");
|
||||
require_once("class.user.php");
|
||||
|
@ -11,7 +10,6 @@
|
|||
$stmt->execute(array(":user_id"=>$user_id));
|
||||
|
||||
$userRow=$stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
@ -33,13 +31,13 @@
|
|||
<th>Lieferung</th>
|
||||
<th>Angebot</th>
|
||||
<th colspan="2">Alle Angebote vom Günstigsten zum Teuersten</th>
|
||||
<?php
|
||||
<?php try {
|
||||
foreach ($db->query("
|
||||
SELECT * FROM nachfrager
|
||||
LEFT JOIN anbieter
|
||||
ON nachfrager.erfassungs_id = anbieter.erfassungs_id
|
||||
WHERE nachfrager.benutzer_id = $user_id
|
||||
ORDER BY anbieter.angebot_preis ASC
|
||||
ORDER BY nachfrager.nachfr_typ ASC, anbieter.angebot_preis ASC
|
||||
") as $row) {
|
||||
echo
|
||||
"<tr>" .
|
||||
|
@ -55,20 +53,30 @@
|
|||
}else{echo
|
||||
"k.A." . " " . "</td>";
|
||||
}
|
||||
if (!empty(htmlentities($row['angebot_preis']))) {
|
||||
if (!empty(htmlentities($row['angebot_file']))) {
|
||||
echo
|
||||
"<td>" .
|
||||
"<form method='GET' action='". "xml2.php" ."'>" .
|
||||
"<input type='hidden' name='angebot_id' value='".htmlentities($row['angebot_id'])."'/>" .
|
||||
"<input class='sbtn' type='submit' name='annehmen' value='Angebot annehmen' />" .
|
||||
"<form action='xml/" . htmlentities($row['angebot_file']) . "'>" .
|
||||
"<input class='sbtn' type='submit' value='Download' />" .
|
||||
"</form>" .
|
||||
"</td>" .
|
||||
"</tr>";
|
||||
} else {
|
||||
"<td>" . "" .
|
||||
"</td>" .
|
||||
"</td>";
|
||||
}
|
||||
if (!empty(htmlentities($row['angebot_preis'])) AND empty(htmlentities($row['angebot_file']))) {
|
||||
echo
|
||||
"<td>" .
|
||||
"<form method='GET' action='". "xml2.php" ."'>" .
|
||||
"<input type='hidden' name='angebot_id' value='".htmlentities($row['angebot_id'])."'/>" .
|
||||
"<input class='sbtn' type='submit' name='annehmen' value='Angebot annehmen' />" .
|
||||
"</form>" .
|
||||
"</td>";
|
||||
}
|
||||
"</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
echo $e->getMessage();
|
||||
echo $e;
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
|
|
@ -21,11 +21,11 @@ if (isset($_GET['keywords'])) {
|
|||
WHERE nachfr_typ LIKE '%{$keywords}%'
|
||||
OR nachfr_beschr LIKE '%{$keywords}%'
|
||||
");
|
||||
} else {
|
||||
} else {
|
||||
$query = $db->query("
|
||||
SELECT *
|
||||
FROM nachfrager
|
||||
");
|
||||
");
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -43,9 +43,9 @@ if (isset($_GET['keywords'])) {
|
|||
<p>Suchen Sie ein Teil?
|
||||
</p>
|
||||
<p>grenzen Sie die Liste ein:</p>
|
||||
<form method="GET" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" >
|
||||
<input type="search" name="keywords" autocomplete="off" placeholder="suche" onkeydown="searchq();"/>
|
||||
<input type="submit" value=">>"/>
|
||||
<form method="GET" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" >
|
||||
<input type="search" name="keywords" autocomplete="off" placeholder="suche" onkeydown="searchq();"/>
|
||||
<input type="submit" value=">>"/>
|
||||
</form>
|
||||
</div>
|
||||
<div class="inhalt">
|
||||
|
@ -66,7 +66,12 @@ if (isset($_GET['keywords'])) {
|
|||
"<td>" . htmlentities($row['nachfr_menge']) . " " . "</td>" .
|
||||
"<td>" . htmlentities($row['nachfr_quali']) . " " . "</td>" .
|
||||
"<td>" . htmlentities($row['nachfr_lieferdatum']) . " " . "</td>" .
|
||||
"<td>" . "<a href='angebot.php?id=" . $row['erfassungs_id'] . "'> Details --> </a>" . "</td>" .
|
||||
"<td>" .
|
||||
"<form method='GET' action='angebot.php'>" .
|
||||
"<input class='sbtn' type='submit' value='Details' />" .
|
||||
"<input class='sbtn' type='hidden' name='id' value='".htmlentities($row['erfassungs_id'])."' />" .
|
||||
"</form>" .
|
||||
"</td>" .
|
||||
"</tr>";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,10 @@ if (isset($_GET['angebot_id'])) {
|
|||
echo "ein problem ist aufgetreten.";
|
||||
break;
|
||||
}
|
||||
//filename and path
|
||||
$path="xml/";
|
||||
$file="angebot_" . $_GET['angebot_id'] . ".xml";
|
||||
|
||||
//add root == artikel
|
||||
$artikel = $dom->appendChild($dom->createElement('artikel'));
|
||||
while ($result_array = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
@ -22,7 +26,6 @@ while ($result_array = $query->fetch(PDO::FETCH_ASSOC)) {
|
|||
foreach($result_array as $key => $value) {
|
||||
//$key holds the table column name
|
||||
|
||||
|
||||
//add track element to jukebox
|
||||
$keys = $dom->createElement($key,$value);
|
||||
$artikel->appendChild($keys);
|
||||
|
@ -33,6 +36,29 @@ $dom->formatOutput = true; // set the formatOutput attribute of domDocument to t
|
|||
|
||||
// save XML as string or file
|
||||
$test1 = $dom->saveXML(); // put string in test1
|
||||
echo $test1;
|
||||
//$dom->save('test1.xml'); // save as file
|
||||
//echo $test1;
|
||||
$dom->save($path.$file); // save as file
|
||||
|
||||
// Filepath wird in Datenbank gespeichert
|
||||
if($file=="") {
|
||||
$error[] = "es ist was mit dem Filepath falsch gelaufen.";
|
||||
} else {
|
||||
try{
|
||||
$query = $db->query("
|
||||
UPDATE anbieter
|
||||
SET angebot_file='$file'
|
||||
WHERE angebot_id='$angebot_id'
|
||||
");
|
||||
/*** close the database connection ***/
|
||||
//$db = null;
|
||||
} catch(PDOException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
$error[] = "Ihr Angebot ist nun über den Link nun bereitgestellt";
|
||||
}
|
||||
|
||||
// Redirect to this page.
|
||||
header("Location: " . "profile.php");
|
||||
exit();
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue