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'ensembre

"; 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']}

"; $extension = pathinfo($row['upload_path'], PATHINFO_EXTENSION); if (strtolower($extension) === 'pdf'): echo ""; elseif (in_array(strtolower($extension), ['jpg', 'jpeg', 'png', 'gif'])): echo ""; else: echo "

Unsupported file type

".$row['upload_path']; endif; echo "

Theme ID: {$row['theme_id']}

"; } // complète le formulaire du dernier ensemble itéré echo "

Valider l'ensembre

"; echo "
"; } // Function to validate documents in an ensemble function valider_ensemble($ensembleId) { // Update the "valide" status in the "ensembles" table // You need to customize the SQL query based on your actual database structure $updateQuery = "UPDATE ensembles SET valide = 1 WHERE id = $ensembleId"; // Execute the update query global $conn; $conn->execute_query($updateQuery); } // Check if the form is submitted for ensemble validation if (isset($_POST['ensemble_id'])) { $ensembleId = $_POST['ensemble_id']; valider_ensemble($ensembleId); } // Include your HTML, CSS, and JavaScript for the frontend ?> Document Validation Dashboard

Document Validation Dashboard