-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdashboard.php
More file actions
110 lines (88 loc) · 3.67 KB
/
dashboard.php
File metadata and controls
110 lines (88 loc) · 3.67 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
session_start();
$id = filter_input(INPUT_GET, "id", FILTER_VALIDATE_INT);
if(!isset($_SESSION["user"])) { // !isset - Variable non déclarée et est null
http_response_code(302);
header('Location: index.php');
exit();
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Paint</title>
<link rel="stylesheet" href="Paint.css">
<?php
require_once('sauvegarde.php');
require_once('load_canvas.php');
?>
</head>
<body class="light">
<div class="page">
<div id="download">
<form method="POST" id ="form">
<button type="submit" onclick="save()">Sauvegarder</button>
<canvas id="canvas" width="1000" height="500">Hello There</canvas>
</form></div>
<div class="menu_bar">
<button id ="choix" name="choix">Choisir</button>
<button id ="load" name="load" onclick="load()">Charger</button>
<button onclick="capture()">Export as png</button>
<button id="btn">Export as pdf</button>
<button onclick="efface()">Clear</button>
<button><a href="deconnexion.php">Quitter</a></button>
</div>
<div class="left_column">
<button onclick="rectangle()"> <img src="img/rectangle.svg" alt="rectangle"> </button>
<button onclick="circle()"> <img src="img/round.svg" alt="round"> </button>
<button onclick="triangle()"> <img src="img/triangle.svg" alt="triangle"> </button>
<button onclick="rubberStart()"> <img src="img/rubber.svg" alt="rubber"> </button>
<button onclick="writetext()"> <img src="img/text.svg" alt="text"> </button>
<select id="m1" name="style-police" onchange="fontfamilySelection()">
<option value="serif">Style police 1</option>
<option value="Helvetica">Style police 2</option>
<option value="Segoe Print">Style police 3</option>
</select>
<button onclick="colorBlue()" id="blue"></button>
<button onclick="colorOrange()" id="orange"></button>
<button onclick="colorYellow()" id="yellow"></button>
<button onclick="blueStroke()" id="blueborder"></button>
<button onclick="orangeStroke()" id="orangeborder"></button>
<button onclick="yellowStroke()" id="yellowborder"></button>
</div>
</div>
</div>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
<script src="https://unpkg.com/jspdf@latest/dist/jspdf.umd.min.js"></script>
<script src="Paint.js"></script>
<script>
function save(){
for(let i=0;i<shapes.length;i++){
saveTab.push(shapes[i])
}
let formData = new FormData();
formData.append("saveTab", JSON.stringify(saveTab))
// VALUE saveTab, qu'on stringify avant insertion bdd.
// form = id de mon formulaire
form.onsubmit = async(e)=>{
e.preventDefault()
let response = await fetch("sauvegarde.php",{
method: "POST",
body:formData,
// CREATION D'UNE FORMDATA
});
};
}
</script>
<script>
function load(){
saveTab = <?= $row["liste"]; ?>;
shapes = saveTab;
drawAll()
}
</script>
</body>
</html>