1
0

1 Commits

Author SHA1 Message Date
mberard
ea34094d41 Reverse anim plane 2021-11-01 20:12:31 +01:00
9 changed files with 156 additions and 132 deletions

View File

@@ -1,31 +1,37 @@
<?php <?php
require_once 'session_init.php'; require_once 'session_init.php';
require_once 'config.inc.php'; require_once 'config.inc.php';
require_once 'db.class.php'; require_once 'db.class.php';
require_once 'log.php'; require_once 'log.php';
require_once 'fonctions.inc.php'; require_once 'fonctions.inc.php';
$table = array("message", "expeMail", "expeKnown", "expeLang", "destLang", "startLat", "startLon", "startName", "startTime", "startTZ", "destMail", "destLat", "destLon", "destName", "public", "color", "deliveryTime", "deliveryTZ", "deliveryTimeServer", "deliveryMethod"); $table=array("message", "expeMail", "expeKnown", "expeLang", "destLang", "startLat", "startLon", "startName", "startTime", "startTZ", "destMail", "destLat", "destLon", "destName", "public", "color", "deliveryTime", "deliveryTZ", "deliveryTimeServer", "deliveryMethod");
$db = new db(); $db = new db();
//$db->open(); //$db->open();
foreach ($table as $var) { foreach ($table as $var)
if (getpost($var) != null) { {
$r = getpost($var); if ( getpost( $var ) != null )
/*if ( $r == "true") {
$r = getpost( $var );
/*if ( $r == "true")
{ {
$r = 1; $r = 1;
}elseif( $r ="false")*/ }elseif( $r ="false")*/
$db->$var = trim($r, ' \"'); $db->$var = trim($r, ' \"');
} else { }else
$erreur[] = $var; {
$erreur[] = $var;
}
} }
} if (!empty ($erreur))
if (!empty($erreur)) { {
echo json_encode($erreur); echo json_encode($erreur);
log_error("erreur lors de l'acquisition des données:" . EOLH . print_r($erreur, true)); log_error("erreur lors de l'acquisition des données:" . EOLH . print_r($erreur, true));
} else { }else
$db->newPlane(); {
} $db->newPlane();
$db->close(); }
$db->close();
?>

View File

@@ -197,3 +197,4 @@
} }
} }
$db->close(); $db->close();
?>

View File

@@ -165,7 +165,7 @@ class db
function getCurrentPlanes() function getCurrentPlanes()
{ {
$query = "SELECT idAvion as uid, UNIX_TIMESTAMP(deliveryTime) as deliveryTime, deliveryTZ, destLat, destLon, destName, UNIX_TIMESTAMP(startTime) as startTime, startTZ, startLon, startLat, startName, color FROM avionpoeme WHERE deliveryTimeServer>NOW()"; $query = "SELECT idAvion as uid, UNIX_TIMESTAMP(deliveryTime) as deliveryTime, deliveryTZ, destLat, destLon, destName, message, UNIX_TIMESTAMP(startTime) as startTime, startTZ, startLon, startLat, startName, color, message FROM avionpoeme WHERE deliveryTimeServer>NOW()";
$this->query($query); $this->query($query);
$planes = $this->result->fetch_all(MYSQLI_ASSOC); $planes = $this->result->fetch_all(MYSQLI_ASSOC);
print json_encode($planes); print json_encode($planes);
@@ -234,6 +234,3 @@ class db
return $this->avionJournalier; return $this->avionJournalier;
} }
} }
?>

View File

@@ -13,19 +13,46 @@
<canvas id="blankCanvas2" width="400" height="400" style="border:1px solid #d3d3d3; display:none"></canvas> <canvas id="blankCanvas2" width="400" height="400" style="border:1px solid #d3d3d3; display:none"></canvas>
<img style="display:none;" id="front" src="src/img/front.jpg" /> <img style="display:none;" id="front" src="src/img/front.jpg" />
<img style="display:none;" id="back" src="src/img/back-FF5555.jpg" /> <img style="display:none;" id="back" src="src/img/back-FF5555.jpg" />
<script id="planeFoldScript.txt" type="not-javascript"> <!-- From https://github.com/RemiKoutcherawy/OriSim3D-JS was fun to code --> <?php
d -200 200 -200 -200 200 -200 200 200 if (isset($_GET['avionpoeme']) && $_GET['avionpoeme'] !== '') { ?>
c 0 1 c 0 3 c 0 2 c 1 3 <script id="planeFoldScript.txt" type="not-javascript"> <!-- From https://github.com/RemiKoutcherawy/OriSim3D-JS was fun to code -->
c 0 8 c 8 3 c 0 4 c 4 1 d -200 200 -200 -200 200 -200 200 200
c 6 0 c 6 1 c 6 2 c 6 3 c 0 1 c 0 3 c 0 2 c 1 3
iad t 1200 ty 6 tx -3) c 0 8 c 8 3 c 0 4 c 4 1
t 750 r 48 -179.99 21 0 10 r 55 -179.99 17 3 19 ) c 6 0 c 6 1 c 6 2 c 6 3
t 750 r 43 160 1 4 0 21 24 12 11 13 9 10) iad t 0 ty 6 tx -3)
t 700 ty -80 tx -60) t 0 r 48 -179.99 21 0 10 r 55 -179.99 17 3 19 )
t 500 r 27 -80 3 19 5 22 2 a 3 ) t 0 r 43 160 1 4 0 21 24 12 11 13 9 10)
t 500 r 23 -80 0 21 4 24 1 a 0) t 0 ty -80)
t 1000 tx -35 z 0 0 0 il 100 100) t 0 tx -60)
</script> t 0 r 27 -80 3 19 5 22 2 a 3)
t 0 r 23 -80 0 21 4 24 1 a 0)
t 500 r 23 80 0 21 4 24 1 a 0)
t 0 r 23 -90 0 a 0)
t 500 r 27 80 3 19 5 22 2 a 3)
t 0 r 27 -90 3 a 3)
t 700 tx 60)
t 700 ty 80)
t 750 r 43 -160 1 4 0 21 24 12 11 13 9 10)
t 750 r 48 179.99 21 0 10 r 55 179.99 17 3 19 )
iad t 1200 ty -6 tx 3)
</script>
<?php } else { ?>
<script id="planeFoldScript.txt" type="not-javascript"> <!-- From https://github.com/RemiKoutcherawy/OriSim3D-JS was fun to code -->
d -200 200 -200 -200 200 -200 200 200
c 0 1 c 0 3 c 0 2 c 1 3
c 0 8 c 8 3 c 0 4 c 4 1
c 6 0 c 6 1 c 6 2 c 6 3
iad t 1200 ty 6 tx -3)
t 750 r 48 -179.99 21 0 10 r 55 -179.99 17 3 19 )
t 750 r 43 160 1 4 0 21 24 12 11 13 9 10)
t 700 ty -80 tx -60)
t 500 r 27 -80 3 19 5 22 2 a 3 )
t 500 r 23 -80 0 21 4 24 1 a 0)
t 1000 tx -35 z 0 0 0 il 100 100)
</script>
<?php }
?>
<!-- Modal new plane--> <!-- Modal new plane-->
<div class="modal fade" id="newPlaneModal" tabindex="-1" role="dialog" aria-labelledby="newPlaneModal" aria-hidden="true"> <div class="modal fade" id="newPlaneModal" tabindex="-1" role="dialog" aria-labelledby="newPlaneModal" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document"> <div class="modal-dialog modal-lg" role="document">
@@ -54,13 +81,6 @@
<br> <br>
<div class="form-control rounded-0" id="messageTextArea"></div> <div class="form-control rounded-0" id="messageTextArea"></div>
</div> </div>
<div class="form-group">
<label class="bold">Ajouter une piève jointe</label>
<div class="custom-file">
<input type="file" class="custom-file-input" id="attachmentPlane" aria-describedby="inputGroupFileAddon01">
<label class="custom-file-label" for="attachmentPlane"></label>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="bold" for="selectTime" id="flightTime">Temps de vol</label> <label class="bold" for="selectTime" id="flightTime">Temps de vol</label>
<select class="form-control" id="selectTime"> <select class="form-control" id="selectTime">

View File

@@ -336,7 +336,3 @@ a#navbarDropdownLang.nav-link.dropdown-toggle::after {
text-align: center; text-align: center;
} }
} }
.custom-file-label::after {
content: "Parcourir";
}

View File

@@ -18,12 +18,6 @@ $("#destMail").change(function() {
checkFormValid() checkFormValid()
}) })
document.querySelector('.custom-file-input').addEventListener('change',function(e){
var fileName = document.getElementById("attachmentPlane").files[0].name;
var nextSibling = e.target.nextElementSibling
nextSibling.innerText = fileName
})
function checkFormValid(){ function checkFormValid(){
if(validExpeMail && validExpeLoc && validDestMail && validDestLoc){ if(validExpeMail && validExpeLoc && validDestMail && validDestLoc){
$('#sendNewPlane').prop("disabled", false) $('#sendNewPlane').prop("disabled", false)

View File

@@ -303,12 +303,23 @@ loader.load(function(loader, resources) {
var queryString = window.location.search; var queryString = window.location.search;
queryString = queryString.split('=')[1] queryString = queryString.split('=')[1]
if(Number(queryString)==data.uid){ if(Number(queryString)==data.uid){
setTimeout( /*
function() Activate anim place reverse
{ $("#back").attr("src","src/img/back-"+data.color+".jpg");
map.setView([data.currentPosition.geometry.coordinates[1],data.currentPosition.geometry.coordinates[0]], 15); html = data.message;
openPopup(marker) var canvas1 = document.getElementById("blankCanvas1");
}, 100); rasterizeHTML.drawHTML(html, canvas1,{zoom:0.7}).then(function success(renderResult) {
var canvas2 = document.getElementById("blankCanvas2");
var ctx = canvas2.getContext("2d");
ctx.fillStyle = "#" + data.color;
ctx.fillRect(0,0,400,400);
ctx.drawImage(canvas1, 0, 0,400,400)
ctx.font = "9px Courier";
$("#front").attr('src',document.getElementById("blankCanvas2").toDataURL())
$("#canvas3d").css('display','block')
animePlane();
})
*/
} }
} }

View File

@@ -108,30 +108,8 @@ $("#sendNewPlane").on('click',function(){
var message = quill.root.innerHTML var message = quill.root.innerHTML
var randomColor = getRandomColor() var randomColor = getRandomColor()
var formData = new FormData() console.log(message)
var attachment = $("#attachmentPlane").prop('files')[0];
formData.append('file', attachment);
formData.append('message', encodeURIComponent(message));
formData.append('expeMail', $("#expeMail").val());
formData.append('expeKnown', expeKnown);
formData.append('expeLang', lang);
formData.append('destLang', $("#selectDestLang").val());
formData.append('startLat', expeLoc.center[1]);
formData.append('startLon', expeLoc.center[0]);
formData.append('startName', expeLoc.name);
formData.append('startTime', sentDate);
formData.append('startTZ', expeTimezone);
formData.append('destMail', $("#destMail").val());
formData.append('destLat', destLoc.center[1]);
formData.append('destLon', destLoc.center[0]);
formData.append('destName', destLoc.name);
formData.append('public', publicMessage, );
formData.append('color', randomColor);
formData.append('deliveryTime', deliveryDate);
formData.append('deliveryTZ', destTimezone);
formData.append('deliveryTimeServer', deliverySecondsServer);
formData.append('deliveryMethod', $("#selectTime").val());
var data = { var data = {
'message':encodeURIComponent(message), 'message':encodeURIComponent(message),
@@ -153,56 +131,76 @@ $("#sendNewPlane").on('click',function(){
'deliveryTime':deliveryDate, 'deliveryTime':deliveryDate,
'deliveryTZ':destTimezone, 'deliveryTZ':destTimezone,
'deliveryTimeServer':deliverySecondsServer, 'deliveryTimeServer':deliverySecondsServer,
'deliveryMethod':$("#selectTime").val(), 'deliveryMethod':$("#selectTime").val()
} }
var query = 'avionpoeme.php?'+
'message='+data.message+'&'+
'expeMail='+data.expeMail+'&'+
'expeKnown='+data.expeKnown+'&'+
'expeLang='+data.expeLang+'&'+
'destLang='+data.destLang+'&'+
'startLat='+data.startLat+'&'+
'startLon='+data.startLon+'&'+
'startName='+data.startName+'&'+
'startTime='+data.startTime+'&'+
'startTZ='+data.startTZ+'&'+
'destMail='+data.destMail+'&'+
'destLat='+data.destLat+'&'+
'destLon='+data.destLon+'&'+
'destName='+data.destName+'&'+
'public='+data.public+'&'+
'color='+data.color+'&'+
'deliveryTime='+data.deliveryTime+'&'+
'deliveryTZ='+data.deliveryTZ+'&'+
'deliveryTimeServer='+data.deliveryTimeServer+'&'+
'deliveryMethod='+data.deliveryMethod+'';
$.ajax({ $.post(query, function(result) {
url: 'avionpoeme.php', result = result.replace(/'/g, '"');
data: formData, console.log(result)
processData: false, result = $.parseJSON(result)
contentType: false, var planeId = Number(result.uid);
cache : false, //selecting proper color for back
type: 'POST', $("#back").attr("src","src/img/back-"+data.color+".jpg");
success: function(result){
result = result.replace(/'/g, '"'); // creating image for plane, need to link it to the inputs tog et entered values.
result = $.parseJSON(result) var message = quill.root.innerHTML
var planeId = Number(result.uid);
//selecting proper color for back var canvas1 = document.getElementById("blankCanvas1"),
$("#back").attr("src","src/img/back-"+randomColor+".jpg"); html = quill.root.innerHTML;
rasterizeHTML.drawHTML(html, canvas1,{zoom:0.7}).then(function success(renderResult) {
// creating image for plane, need to link it to the inputs tog et entered values. var canvas2 = document.getElementById("blankCanvas2");
var message = quill.root.innerHTML var ctx = canvas2.getContext("2d");
ctx.fillStyle = "#"+data.color;
ctx.fillRect(0,0,400,400);
ctx.drawImage(canvas1, 0, 0,400,400)
ctx.fillStyle = "rgb(0,0,0)";
ctx.font = "9px Courier";
$("#front").attr('src',document.getElementById("blankCanvas2").toDataURL())
//display and animate plane
$("#canvas3d").css('display','block')
animePlane()
var canvas1 = document.getElementById("blankCanvas1"),
html = quill.root.innerHTML;
rasterizeHTML.drawHTML(html, canvas1,{zoom:0.7}).then(function success(renderResult) { //moving plane at the end
setInterval(function(){
var canvas2 = document.getElementById("blankCanvas2"); $("#canvas3d").css('transition','transform 2500ms ease-in-out')
var ctx = canvas2.getContext("2d"); $("#canvas3d").css('transform','translate(50vw, -150vh)')
ctx.fillStyle = "#"+data.color; },4400);
ctx.fillRect(0,0,400,400); //reloading page (to change)
ctx.drawImage(canvas1, 0, 0,400,400) setInterval(function(){
ctx.fillStyle = "rgb(0,0,0)"; window.location.href ='https://avion-poe.me?avion='+planeId+'';
ctx.font = "9px Courier"; },5500);
$("#front").attr('src',document.getElementById("blankCanvas2").toDataURL()) })
//display and animate plane })
$("#canvas3d").css('display','block')
animePlane()
//moving plane at the end
setInterval(function(){
$("#canvas3d").css('transition','transform 2500ms ease-in-out')
$("#canvas3d").css('transform','translate(50vw, -150vh)')
},4400);
//reloading page (to change)
setInterval(function(){
window.location.href ='https://www.avion-poe.me/?avion='+planeId+'';
},5500);
})
}
});
}) })
}); });

View File

@@ -46,6 +46,7 @@ var dictionnary = []
function translateUI(l){ function translateUI(l){
$.getJSON("lang/"+l+"", function(s){ $.getJSON("lang/"+l+"", function(s){
console.log(s)
dictionnary = s dictionnary = s
//if arabic : display left to right (ltr) + troubleshooting a lot of individual elements //if arabic : display left to right (ltr) + troubleshooting a lot of individual elements
if (lang == "ar"){ if (lang == "ar"){