query($query); // Display all documents information // Fini le div et met le bouton uniquement // quand on finit d'itérer un ensemble donné $ens_id = -1; while($row = $result->fetch_assoc()) { if (($row["ensemble_id"] != $ens_id) && ($ens_id != -1) ) { echo "

Valider l'ensemble

"; echo "

Supprimer l'ensemble

"; echo ""; $ens_id = $row["ensemble_id"]; } // initialisation pour la première itération if ($ens_id == -1){ $ens_id = $row["ensemble_id"]; } echo "
"; echo "

{$row['titre']}

"; echo "

Type: {$row['type']}

"; echo "

Upload Path: {$row['upload_path']}

"; echo "

Ensemble ID: {$row['ensemble_id']}

"; generateFileHTML($row); } // complète le formulaire du dernier ensemble itéré echo "

Valider l'ensemble

"; echo "

Supprimer l'ensemble

"; echo "
"; } // Function to handle different file types and generate HTML dynamically function generateFileHTML($row) { // Simulating the switch-case equivalent in PHP using a switch on doc.type $doc_type = $row['type']; // Assuming 'type' is the same as doc.type in JS switch ($doc_type) { case 2: // Image // Create image element echo "\"{$row['titre']}\""; // Create link to view image echo "Voir image"; break; case 3: // PDF // Create embed for PDF echo ""; // Create link to view PDF echo "Voir PDF en grand"; break; case 4: // Video // Create video element with controls echo ""; break; case 5: // HTML // Create iframe for HTML document echo ""; break; case 1: // Plain Text // Fetch content via PHP file_get_contents $text = file_get_contents($row['upload_path']); echo ""; break; default: // Unsupported file type, create link echo "Type de fichier non supporté."; break; } } ?>

Validation des documents

script($context='supprimer_ensemble', $name='jeton_supprimer_ensemble', $declaration='var', $time2Live=-1, $max_hashes=5); echo $csrf->script($context='valider_ensemble', $name='jeton_valider_ensemble', $declaration='var', $time2Live=-1, $max_hashes=5); include "_partials/_footer.php"; ?>