bieng porpre :DD
This commit is contained in:
parent
6a5945aa2c
commit
466ce8756e
7 changed files with 230 additions and 19 deletions
67
css/ens.css
67
css/ens.css
|
@ -0,0 +1,67 @@
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 8px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:nth-child(even) {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:hover {
|
||||||
|
background-color: #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add some spacing around the table */
|
||||||
|
#data-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gros-titre {
|
||||||
|
font-size: larger;
|
||||||
|
font-weight: bolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulle-rouge{
|
||||||
|
width: fit-content;
|
||||||
|
padding-top: 5px;
|
||||||
|
padding-left: 5px;
|
||||||
|
padding-right: 5px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
background-color: rgba(255, 0, 0, 0.283);
|
||||||
|
border-radius: 5px;
|
||||||
|
border-width: 2px;
|
||||||
|
border-color: rgba(255, 0, 0, 0.283);
|
||||||
|
}
|
||||||
|
.centre-txt{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-red-tr{
|
||||||
|
background-color: rgba(224, 54, 54, 0.482);
|
||||||
|
border-color: rgba(224, 54, 54, 0.482);
|
||||||
|
}
|
||||||
|
.centre-horizontal{
|
||||||
|
margin: auto;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
12
ens.php
12
ens.php
|
@ -5,9 +5,19 @@
|
||||||
include "_partials/_head.php";
|
include "_partials/_head.php";
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
|
<div class="centre-horizontal bulle-rouge" id="titre">
|
||||||
|
<pre class="centre-txt gros-titre">
|
||||||
|
__ ____ ___ _ _ /'/ ____ _ _ ___ __
|
||||||
|
/__\ ( _ \ / __)( )_( ) (_ _)( \( )/ __) /__\
|
||||||
|
/(__)\ ) /( (__ ) _ ( _)(_ ) ( \__ \ /(__)\
|
||||||
|
(__)(__)(_)\_) \___)(_) (_) (____)(_)\_)(___/(__)(__)
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="data-container"></div>
|
||||||
</body>
|
</body>
|
||||||
<?php
|
<?php
|
||||||
include "_partials/footer.php";
|
include "_partials/_footer.php";
|
||||||
?>
|
?>
|
||||||
</html>
|
</html>
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="centre-horizontal bulle-rouge">
|
<div class="centre-horizontal bulle-rouge" id="titre">
|
||||||
<pre class="centre-txt gros-titre">
|
<pre class="centre-txt gros-titre">
|
||||||
__ ____ ___ _ _ /'/ ____ _ _ ___ __
|
__ ____ ___ _ _ /'/ ____ _ _ ___ __
|
||||||
/__\ ( _ \ / __)( )_( ) (_ _)( \( )/ __) /__\
|
/__\ ( _ \ / __)( )_( ) (_ _)( \( )/ __) /__\
|
||||||
|
|
148
js/ens.js
148
js/ens.js
|
@ -1,5 +1,4 @@
|
||||||
|
/*
|
||||||
/*
|
|
||||||
|
|
||||||
pour les docs afficher un truc du même acabit que la php :
|
pour les docs afficher un truc du même acabit que la php :
|
||||||
if (strtolower($extension) === 'pdf'):
|
if (strtolower($extension) === 'pdf'):
|
||||||
|
@ -11,22 +10,149 @@
|
||||||
endif;
|
endif;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// fetch l'api et afficher tout ce qu'elle nous rend
|
// fetch l'api et afficher tout ce qu'elle nous rend
|
||||||
function querystring(key) {
|
function querystring(key) {
|
||||||
var re=new RegExp('(?:\\?|&)'+key+'=(.*?)(?=&|$)','gi');
|
var re = new RegExp("(?:\\?|&)" + key + "=(.*?)(?=&|$)", "gi");
|
||||||
var r=[], m;
|
var r = [],
|
||||||
while ((m=re.exec(document.location.search)) != null) r[r.length]=m[1];
|
m;
|
||||||
|
while ((m = re.exec(document.location.search)) != null) r[r.length] = m[1];
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function gen_contenu(){
|
async function gen_contenu() {
|
||||||
resp = await fetch("/annales/api.php/decomposer_ensemble?ensemble_id="+querystring("ensemble_id"));
|
try {
|
||||||
data = await resp.json();
|
const response = await fetch('api.php/decomposer_ensemble?ensemble_id='+querystring("ensemble_id"));
|
||||||
|
const data = await response.json();
|
||||||
if(data["status"] == 1){
|
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
|
if (data.status === "1" && data.msg.documents.length > 0) {
|
||||||
|
const table = document.createElement('table');
|
||||||
|
const thead = document.createElement('thead');
|
||||||
|
const tbody = document.createElement('tbody');
|
||||||
|
|
||||||
|
const headerRow = document.createElement('tr');
|
||||||
|
const idHeader = document.createElement('th');
|
||||||
|
idHeader.textContent = 'ID';
|
||||||
|
const titreHeader = document.createElement('th');
|
||||||
|
titreHeader.textContent = 'Titre';
|
||||||
|
const typeHeader = document.createElement('th');
|
||||||
|
typeHeader.textContent = 'Type';
|
||||||
|
const uploadPathHeader = document.createElement('th');
|
||||||
|
uploadPathHeader.textContent = 'Upload Path';
|
||||||
|
const previewHeader = document.createElement('th');
|
||||||
|
previewHeader.textContent = 'Preview';
|
||||||
|
const commentaireHeader = document.createElement('th');
|
||||||
|
commentaireHeader.textContent = 'Commentaire Auteur';
|
||||||
|
const exerciceHeader = document.createElement('th');
|
||||||
|
exerciceHeader.textContent = 'Exercices';
|
||||||
|
|
||||||
|
headerRow.appendChild(idHeader);
|
||||||
|
headerRow.appendChild(titreHeader);
|
||||||
|
headerRow.appendChild(typeHeader);
|
||||||
|
headerRow.appendChild(uploadPathHeader);
|
||||||
|
headerRow.appendChild(previewHeader);
|
||||||
|
headerRow.appendChild(commentaireHeader);
|
||||||
|
headerRow.appendChild(exerciceHeader);
|
||||||
|
|
||||||
|
thead.appendChild(headerRow);
|
||||||
|
|
||||||
|
data.msg.documents.forEach(doc => {
|
||||||
|
const row = document.createElement('tr');
|
||||||
|
const idCell = document.createElement('td');
|
||||||
|
idCell.textContent = doc.id;
|
||||||
|
const titreCell = document.createElement('td');
|
||||||
|
titreCell.textContent = doc.titre;
|
||||||
|
const typeCell = document.createElement('td');
|
||||||
|
typeCell.textContent = doc.type;
|
||||||
|
const uploadPathCell = document.createElement('td');
|
||||||
|
uploadPathCell.textContent = doc.upload_path;
|
||||||
|
|
||||||
|
let previewCell;
|
||||||
|
let ext = doc.upload_path.toString().split(".").pop();
|
||||||
|
|
||||||
|
switch (ext) {
|
||||||
|
case "jpg": // image
|
||||||
|
previewCell = document.createElement('td');
|
||||||
|
const img = document.createElement('img');
|
||||||
|
img.src = doc.upload_path;
|
||||||
|
img.alt = doc.titre;
|
||||||
|
previewCell.appendChild(img);
|
||||||
|
break;
|
||||||
|
case "pdf": // pdf
|
||||||
|
previewCell = document.createElement('td');
|
||||||
|
const pdfLink = document.createElement('a');
|
||||||
|
pdfLink.href = doc.upload_path;
|
||||||
|
pdfLink.textContent = 'View PDF';
|
||||||
|
pdfLink.target = '_blank';
|
||||||
|
previewCell.appendChild(pdfLink);
|
||||||
|
break;
|
||||||
|
case "mp4": // video
|
||||||
|
previewCell = document.createElement('td');
|
||||||
|
const video = document.createElement('video');
|
||||||
|
video.src = doc.upload_path;
|
||||||
|
video.controls = true;
|
||||||
|
previewCell.appendChild(video);
|
||||||
|
break;
|
||||||
|
default: // link
|
||||||
|
previewCell = document.createElement('td');
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = doc.upload_path;
|
||||||
|
link.textContent = doc.titre;
|
||||||
|
link.target = '_blank';
|
||||||
|
previewCell.appendChild(link);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const commentaireCell = document.createElement('td');
|
||||||
|
commentaireCell.textContent = data.msg.commentaire_auteur || '';
|
||||||
|
|
||||||
|
const exerciceCell = document.createElement('td');
|
||||||
|
if (doc.exercices && doc.exercices.length > 0) {
|
||||||
|
const exerciceList = document.createElement('ul');
|
||||||
|
doc.exercices.forEach(exercice => {
|
||||||
|
const exerciceItem = document.createElement('li');
|
||||||
|
exerciceItem.textContent = `Exo n°${exercice.id} ${exercice.commentaire_auteur}, Duree: ${exercice.duree}`;
|
||||||
|
exerciceList.appendChild(exerciceItem);
|
||||||
|
});
|
||||||
|
exerciceCell.appendChild(exerciceList);
|
||||||
|
} else {
|
||||||
|
exerciceCell.textContent = 'Pas de détails sur les exercices';
|
||||||
|
}
|
||||||
|
|
||||||
|
row.appendChild(idCell);
|
||||||
|
row.appendChild(titreCell);
|
||||||
|
row.appendChild(typeCell);
|
||||||
|
row.appendChild(uploadPathCell);
|
||||||
|
row.appendChild(previewCell);
|
||||||
|
row.appendChild(commentaireCell);
|
||||||
|
row.appendChild(exerciceCell);
|
||||||
|
|
||||||
|
tbody.appendChild(row);
|
||||||
|
});
|
||||||
|
|
||||||
|
table.appendChild(thead);
|
||||||
|
table.appendChild(tbody);
|
||||||
|
|
||||||
|
const dataContainer = document.getElementById('data-container');
|
||||||
|
dataContainer.appendChild(table);
|
||||||
|
} else {
|
||||||
|
const dataContainer = document.getElementById('data-container');
|
||||||
|
dataContainer.textContent = data.msg;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
alert(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", (event)=>{
|
||||||
|
|
||||||
|
gen_contenu();
|
||||||
|
|
||||||
|
document.getElementById("titre").addEventListener("click", (event) => {
|
||||||
|
window.location.pathname = "/archinsa";
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
|
@ -178,5 +178,9 @@ document.addEventListener("DOMContentLoaded", (event)=>{
|
||||||
unauthenticate_user();
|
unauthenticate_user();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.getElementById("titre").addEventListener("click", (event) => {
|
||||||
|
window.location.pathname = "/archinsa";
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -269,5 +269,9 @@ document.addEventListener("DOMContentLoaded", (event) => {
|
||||||
ajouter_details_exo();
|
ajouter_details_exo();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.getElementById("titre").addEventListener("click", (event) => {
|
||||||
|
window.location.pathname = "/archinsa";
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ include('php-csrf.php');
|
||||||
$csrf = new CSRF();
|
$csrf = new CSRF();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="centre-horizontal bulle-rouge">
|
<div class="centre-horizontal bulle-rouge" id="titre">
|
||||||
<pre class="centre-txt gros-titre">
|
<pre class="centre-txt gros-titre">
|
||||||
__ ____ ___ _ _ /'/ ____ _ _ ___ __
|
__ ____ ___ _ _ /'/ ____ _ _ ___ __
|
||||||
/__\ ( _ \ / __)( )_( ) (_ _)( \( )/ __) /__\
|
/__\ ( _ \ / __)( )_( ) (_ _)( \( )/ __) /__\
|
||||||
|
|
Loading…
Reference in a new issue