okay il manque plus que la page ensemble
This commit is contained in:
parent
17115415b0
commit
6a5945aa2c
4 changed files with 41 additions and 11 deletions
9
bdd.php
9
bdd.php
|
@ -122,9 +122,7 @@ function saveFilesFromPost($postData,$id_ensemble) {
|
|||
fclose($f);
|
||||
|
||||
|
||||
if (move_uploaded_file($file['tmp_name'], $filePath)) {
|
||||
echo(json_encode(["status"=>"1","msg" =>"File '$uniqueFileName' has been saved successfully."]));
|
||||
} else {
|
||||
if (!move_uploaded_file($file['tmp_name'], $filePath)) {
|
||||
echo(json_encode(["status"=>"0","msg"=>"Error saving file '$uniqueFileName'"]));
|
||||
exit;
|
||||
|
||||
|
@ -187,7 +185,7 @@ function saveFilesFromPost($postData,$id_ensemble) {
|
|||
$row = mysqli_fetch_assoc($result);
|
||||
$id_theme = $row["id"];
|
||||
}else{
|
||||
echo("creation d'un theme");
|
||||
//echo("creation d'un theme");
|
||||
$sql = "INSERT INTO themes (name) VALUES(?)";
|
||||
$conn->execute_query($sql,array($theme));
|
||||
|
||||
|
@ -198,7 +196,7 @@ function saveFilesFromPost($postData,$id_ensemble) {
|
|||
// ensuite, on enregistre les qui lui sont associés
|
||||
$sql= 'INSERT INTO exercices_themes (exercice_id,ensemble_id,theme_id) VALUES(?,?,?)';
|
||||
$result = $conn->execute_query($sql,array($id_exo,$id_ensemble,$id_theme));
|
||||
echo("enregistrement d'un exercice");
|
||||
//echo("enregistrement d'un exercice");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,6 +209,7 @@ function saveFilesFromPost($postData,$id_ensemble) {
|
|||
}
|
||||
|
||||
|
||||
echo(json_encode(["status"=>"1","msg" =>"Files has/have been saved successfully."]));
|
||||
|
||||
|
||||
} else {
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
</pre></a>
|
||||
|
||||
|
||||
<div id="liste_resultats">
|
||||
<div id="liste_resultats" class="centre-txt">
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
|
|
@ -26,13 +26,13 @@ async function unauthenticate_user(){
|
|||
|
||||
|
||||
async function rechercher(){
|
||||
var req = document.body.getElementById("recherche_input").value;
|
||||
var req = document.getElementById("recherche_input").value;
|
||||
var themes = [];
|
||||
Array.from(document.body.getElementsByClassName("theme")).forEach(function (el) {
|
||||
Array.from(document.getElementsByClassName("theme")).forEach(function (el) {
|
||||
// on encode en url pour pouvoir le passer dans la requete GET
|
||||
themes.push(encodeURIComponent(el.innerText));
|
||||
});
|
||||
var duree =document.body.getElementById("duree_input").value
|
||||
var duree =document.getElementById("duree_input").value
|
||||
|
||||
|
||||
var url = "api.php/rechercher?req="+req;
|
||||
|
@ -51,7 +51,7 @@ async function rechercher(){
|
|||
data = await resp.json();
|
||||
|
||||
// vide d'abord les éléments présents dans la liste sur la page
|
||||
document.body.getElementById("liste_resultats").innerHTML = "";
|
||||
document.getElementById("liste_resultats").innerHTML = "";
|
||||
|
||||
if(data.status == 1){
|
||||
data.resultats.forEach(doc => {
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
var camera_open = false;
|
||||
var video;
|
||||
|
||||
|
||||
|
||||
function televerser_fichiers() {
|
||||
const fileInput = document.getElementById('fileInput');
|
||||
|
||||
// Create FormData object to append files
|
||||
const formData = new FormData();
|
||||
|
||||
|
||||
formData.append("type",document.getElementById("select_type").value);
|
||||
formData.append("titre",document.getElementById("titre").value);
|
||||
formData.append("commentaire_auteur",document.getElementById("commentaire_auteur").value);
|
||||
|
@ -64,6 +70,7 @@ function televerser_fichiers() {
|
|||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
//console.log(data);
|
||||
if(data.status == 1){
|
||||
alert("le document a bien été envoyé ! Merci de votre participation :D")
|
||||
}else{
|
||||
|
@ -76,13 +83,35 @@ function televerser_fichiers() {
|
|||
}
|
||||
|
||||
function ouvrir_camera() {
|
||||
// test if camera is already open, in that case juste take a regular picture
|
||||
if(camera_open){
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = video.videoWidth;
|
||||
canvas.height = video.videoHeight;
|
||||
const context = canvas.getContext('2d');
|
||||
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
||||
|
||||
// Convert the canvas content to a data URL
|
||||
const imageDataUrl = canvas.toDataURL('image/jpeg');
|
||||
|
||||
// Display the captured image
|
||||
const img = document.createElement('img');
|
||||
img.src = imageDataUrl;
|
||||
img.style.maxWidth = '100px';
|
||||
document.getElementById('selectedImages').appendChild(img);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Open the camera and take pictures
|
||||
// You can use the MediaDevices API to access the camera
|
||||
navigator.mediaDevices.getUserMedia({ video: true })
|
||||
.then(mediaStream => {
|
||||
const video = document.createElement('video');
|
||||
video = document.createElement('video');
|
||||
document.body.appendChild(video);
|
||||
|
||||
camera_open = true;
|
||||
|
||||
// Display the camera stream in a video element
|
||||
video.srcObject = mediaStream;
|
||||
video.play();
|
||||
|
@ -221,6 +250,8 @@ function init_date(){
|
|||
|
||||
|
||||
document.addEventListener("DOMContentLoaded", (event) => {
|
||||
|
||||
|
||||
init_date();
|
||||
document.getElementById("select_type").addEventListener("change", (event) => {
|
||||
changer_mode();
|
||||
|
|
Loading…
Reference in a new issue