This repository was archived by the owner on Jul 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxml.php
More file actions
51 lines (35 loc) · 1.68 KB
/
xml.php
File metadata and controls
51 lines (35 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
require_once(".classes/clients.php");
require_once(".classes/commandes.php");
require(".data/php/controle.php");
header("Content-type: text/xml");
$xml = new SimpleXMLElement("<nodex/>");
$groupe = $xml->addChild("groupe");
$groupe->addChild("membres", "corentinp, nabilb, clementd, yassinl, walidb, zohral");
$groupe->addChild("name", "Project_J");
$client = $xml->addChild("client");
$client->addChild("prenom", $_SESSION["client"]->getPrenom());
$client->addChild("nom", $_SESSION["client"]->getNom());
$client->addChild("adresse", $_SESSION["client"]->getAdr());
$client->addChild("code-postal", $_SESSION["client"]->getCp());
$client->addChild("location", $_SESSION["client"]->getLoc());
$commandes = $xml->addChild("commandes");
// foreach
foreach($_SESSION["commandes"]->getProduits() as $produits) :
$produit = $commandes->addChild("produit");
$produit->addChild("reference", $produits[0]);
$produit->addChild("matiere", $produits[1]);
$produit->addChild("longueur", $produits[2]);
$produit->addChild("largeur", $produits[3]);
$produit->addChild("epaisseur", $produits[4]);
$produit->addChild("date", time());
$decoupe = $produit->addChild("decoupe");
$decoupe->addChild("coordonees", $_POST["x"] . "-" . $_POST["y"] . ", " . $_POST["y"] . "-" . $_POST["w"] . ", " . $_POST["w"] . "-" . $_POST["h"] . ", " . $_POST["h"] . "-" . $_POST["x"]);
endforeach;
$total = $xml->addChild("total");
$total->addChild("commandes",count($_SESSION["commandes"]));
$total->addChild("prix", $_SESSION["commandes"]->getPrix($_POST));
$xml->saveXML(".data/xml/" . $_SESSION["client"]->getId() . "-" . time() . ".xml");
print($xml->asXML());
unset($_SESSION["commandes"]);
header("Location: ./");