-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5eb298
commit e7260fb
Showing
8 changed files
with
275 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="css.css" /> | ||
<title>SmartReveil</title> | ||
<meta charset="UTF-8" /> | ||
<script type="text/javascript" src="js/FileSaver.js"></script> | ||
</head> | ||
<body> | ||
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script> | ||
<?php | ||
$content= file_get_contents("./yey.txt",FILE_USE_INCLUDE_PATH); | ||
echo $content; | ||
?> | ||
<script src="./js.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
function Setup(){ | ||
//met a jour les presets | ||
$.ajax({ | ||
type: "POST", | ||
url: "ajax.php", | ||
data:{ | ||
mathieu: "start", | ||
aaa: "data" | ||
}, | ||
dataType: "json", | ||
success: function (response){ | ||
console.log(response); | ||
var dataa = JSON.parse(JSON.stringify(response.message)); | ||
console.log(dataa); | ||
name_div = dataa.split(' ')[0].split('=')[1]; | ||
nb = dataa.split(' ')[1].split('=')[1]; | ||
nameLine = dataa.split(' ')[2].split('=')[1]; | ||
console.log("OK !"); | ||
} | ||
|
||
}); | ||
console.log("ntm"); | ||
} | ||
|
||
|
||
function duplicate() { | ||
|
||
var original_ADD = document.getElementById('ADD'); | ||
var original_preset = document.getElementById('Preset0'); | ||
var original_line = document.getElementById("Line" + nameLine); | ||
|
||
|
||
var width = document.getElementById('Preset0').clientWidth; | ||
original_ADD.style.width = width; | ||
|
||
if (nb < 2) { | ||
|
||
nb++; | ||
//alert(nb); | ||
var clone_preset = original_preset.cloneNode(false); // "deep" clone | ||
clone_preset.id = "Preset" + ++name_div; // there can only be one element with an ID | ||
var h = document.createElement("h1") | ||
var t = document.createTextNode("replace"); | ||
clone_preset.appendChild(h); | ||
h.appendChild(t); | ||
|
||
//clone_preset.onclick = duplicate; // event handlers are not cloned | ||
|
||
|
||
//original_line.replaceChild(clone_preset, original_ADD); | ||
original_line.removeChild(original_ADD) | ||
original_line.appendChild(clone_preset) | ||
original_line.appendChild(original_ADD) | ||
}else{ | ||
nameLine++; | ||
nb = 0; | ||
|
||
var clone_preset = original_preset.cloneNode(false); // "deep" clone | ||
clone_preset.id = "Preset" + ++name_div; // there can only be one element with an ID | ||
var h = document.createElement("h1") | ||
var t = document.createTextNode("replace"); | ||
clone_preset.appendChild(h); | ||
h.appendChild(t); | ||
//clone_preset.onclick = duplicate; // event handlers are not cloned | ||
|
||
original_line.removeChild(original_ADD); | ||
original_line.appendChild(clone_preset) | ||
|
||
|
||
var new_line = original_line.cloneNode(false); | ||
new_line.id = "Line" + nameLine; | ||
original_line.parentNode.appendChild(new_line); | ||
|
||
|
||
new_line.appendChild(original_ADD); | ||
} | ||
Serveur_post(); | ||
|
||
} | ||
|
||
function Serveur_post(){ | ||
$.ajax({ | ||
type: "POST", | ||
url: "ajax.php", | ||
data:{ | ||
mathieu: "genie", | ||
variable: "name_div="+name_div+" nb="+nb+" nameLine="+nameLine, | ||
content: $("#all_preset").prop('outerHTML') | ||
}, | ||
dataType: "json", | ||
success: function (response){ | ||
//console.log(response) | ||
console.log("YEY !"); | ||
location.replace("http://localhost/smartreveil/add_page.php"); | ||
} | ||
|
||
}); | ||
} | ||
|
||
function modify(clicked_id){ | ||
a = clicked_id; | ||
a = a.split('Preset'); | ||
alert(a[1]); | ||
location.replace("http://localhost/smartreveil/modify_page.php?name_nb=" + a[1]); | ||
} | ||
|
||
|
||
Setup(); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
function main(){ | ||
var day_array = []; | ||
var time_array = []; | ||
var name_preset = ""; | ||
|
||
var original_name = document.getElementById('original_name').innerHTML; | ||
var day = document.getElementsByClassName('day_check'); | ||
var time = document.getElementsByClassName('timer'); | ||
var name_preset = document.getElementById('name').value; | ||
|
||
for (var i = 0; i < day.length; i++) { | ||
day_array.push(day[i].checked); | ||
} | ||
|
||
for (var i = 0; i < time.length; i++) { | ||
time_array.push(time[i].value); | ||
} | ||
|
||
console.log(name_preset, day_array, time_array); | ||
if(name_preset == ""){ | ||
alert("tu n'a pas donnee de nom "); | ||
}else{ | ||
send_data_to_server(name_preset, day_array, time_array,original_name); | ||
} | ||
|
||
} | ||
|
||
function add(){ | ||
var input = document.createElement('input'); | ||
document.getElementById("timer_div").appendChild(input); | ||
input.type = "time"; | ||
input.className = "timer"; | ||
var br = document.createElement('br'); | ||
document.getElementById("timer_div").appendChild(br); | ||
|
||
} | ||
|
||
function send_data_to_server(name_preset, day_array, time_array, original_name){ | ||
$.ajax({ | ||
type: "POST", | ||
url: "ajax.php", | ||
data:{ | ||
mathieu: "modify_data", | ||
original_name: original_name, | ||
name: name_preset, | ||
day: day_array, | ||
timing: time_array | ||
}, | ||
dataType: "json", | ||
success: function (response){ | ||
console.log("YEY !"); | ||
console.log(response); | ||
location.replace("http://localhost/smartreveil/index.php"); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="add_page.css" /> | ||
<title>ADD Page</title> | ||
</head> | ||
<body> | ||
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script> | ||
<center> | ||
<?php | ||
$nb = $_GET['name_nb']; | ||
$file = file_get_contents("./preset/data_preset_" . $nb . ".txt",FILE_USE_INCLUDE_PATH); | ||
$file = explode("|", $file); | ||
$name = $file[0]; | ||
$day = explode("-", $file[1]); | ||
$houre = explode("-", $file[2]); | ||
|
||
$day_array = []; | ||
for($i = 0; $i <= count($day)-1; $i++){ | ||
if($day[$i] == "true"){ | ||
array_push($day_array, "checked"); | ||
}else{ | ||
array_push($day_array, " "); | ||
} | ||
} | ||
|
||
echo "<h1>Preset Info</h1> | ||
<div> | ||
<p id= \"original_name\" > ".$name."</p> | ||
<h2 >Le nom de ton preset</h2> | ||
<input type=\"text\" name=\"name\" id=\"name\" value= ". $name ."> | ||
</div> | ||
<div> | ||
<h2>Coche les jours Actif</h2> | ||
<input type=\"checkbox\" name=\"day\" class=\"day_check\" $day_array[0]> | ||
Lundi<br> | ||
<input type=\"checkbox\" name=\"day\" class=\"day_check\" $day_array[1]> | ||
Mardi<br> | ||
<input type=\"checkbox\" name=\"day\" class=\"day_check\" $day_array[2]> | ||
Mercredi<br> | ||
<input type=\"checkbox\" name=\"day\" class=\"day_check\" $day_array[3]> | ||
Jeudi<br> | ||
<input type=\"checkbox\" name=\"day\" class=\"day_check\" $day_array[4]> | ||
Vendredi<br> | ||
<input type=\"checkbox\" name=\"day\" class=\"day_check\" $day_array[5]> | ||
Samedi<br> | ||
<input type=\"checkbox\" name=\"day\" class=\"day_check\" $day_array[6]> | ||
Dimanche<br> | ||
</div> | ||
<div id=\"timer_div\"> | ||
<h2>Choisis les horaires</h2>"; | ||
|
||
$type = "<input type=\"time\" name=\"time\" class=\"timer\" "; | ||
for($i = 0; $i <= count($houre)-1; $i++){ | ||
echo $type . "value=". $houre[$i] . "><br>"; | ||
} | ||
echo "</div>" | ||
|
||
?> | ||
|
||
|
||
<button id="button_add" onclick="add()">ADD Timer</button><br> | ||
<button id="button_submit" onclick="main()">Submit</button> | ||
</center> | ||
<script type="text/javascript" src="modify_page.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name_div=0 nb=1 nameLine=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name_div=3 nb=1 nameLine=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div class="all_preset" id="all_preset"> | ||
<div class="line" id="Line0"> | ||
<div class="glass" id="Preset0" onclick="modify(this.id)"> | ||
<h1>preset</h1> | ||
|
||
</div> | ||
|
||
<div class="ADD" id="ADD" onclick="duplicate()"> | ||
<img src="./image/croix.gif"> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="all_preset" id="all_preset"> | ||
<div class="line" id="Line0"> | ||
<div class="glass" id="Preset0" onclick="modify(this.id)"> | ||
<h1>preset</h1> | ||
|
||
</div> | ||
|
||
<script src="./js.js"></script> | ||
|
||
<div class="glass" id="Preset1" onclick="modify(this.id)"><h1>basouaimec</h1></div><div class="glass" id="Preset2" onclick="modify(this.id)"><h1>basouaimec</h1></div></div><div class="line" id="Line1"><div class="glass" id="Preset3" onclick="modify(this.id)"><h1>yey p</h1></div><div class="ADD" id="ADD" onclick="duplicate()"> | ||
<img src="./image/croix.gif"> | ||
</div></div></div> |