English
Spanish
French
0
Notifications
0 Non lues
Aucune notification
Voir toutes
Aucune nouvelle notification
Raccourcis
Tableau de bord
Profil
Paramètres
Voir toutes les apps
Utilisateur
Utilisateur
Profil
Messages
25
Paramètres
Solde
$47.12
Support
Se déconnecter
Dashboard
Dashboard
Éditer analyse_projet/index.php
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Analyse Projet</title> <style> body { font-family: Arial, sans-serif; padding: 20px; background: #f9f9f9; } h1 { margin-bottom: 10px; } .folder-block { background: white; margin-bottom: 10px; border: 1px solid #ddd; border-radius: 6px; } .folder-header { padding: 10px; cursor: pointer; background: #3498db; color: white; font-weight: bold; border-radius: 6px 6px 0 0; } .folder-content { display: none; padding: 10px; } table { width: 100%; border-collapse: collapse; background: #fff; margin-bottom: 15px; } th, td { border: 1px solid #ccc; padding: 8px; text-align: left; } th { background: #2c3e50; color: white; } button { cursor: pointer; padding: 5px 8px; border: none; border-radius: 4px; background: #3498db; color: white; margin: 0 5px; } .close-btn { background: #e74c3c !important; } /* Modal */ .modal { display: none; position: fixed; top: 5%; left: 50%; transform: translateX(-50%); width: 70%; max-height: 80%; overflow-y: auto; background: white; padding: 20px; z-index: 9999; box-shadow: 0 2px 10px rgba(0,0,0,0.3); border-radius: 8px; } .overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9998; } .form-container { border: 1px solid #ddd; margin-top: 10px; padding: 10px; border-radius: 6px; } .response-box { margin-top: 10px; padding: 10px; background: #f2f2f2; border: 1px solid #ccc; min-height: 50px; } </style> </head> <body> <h1>Analyse du projet - Vue générale</h1> <!-- SECTION 1 : ARBORESCENCE DES VUES --> <h2>Arborescence des vues</h2> <?php if (empty($viewsHierarchy)): ?> <p>Aucune vue trouvée.</p> <?php else: ?> <?php foreach ($viewsHierarchy as $folder => $files): ?> <div class="folder-block"> <div class="folder-header" onclick="toggleFolder(this)"> Dossier : <?= esc($folder) ?> </div> <div class="folder-content"> <table> <thead> <tr> <th>Fichier</th> <th>Formulaires détectés</th> </tr> </thead> <tbody> <?php foreach ($files as $file): ?> <?php // Chemin "folder/file.php" ou juste "index.php" $fullRelativePath = ($folder === '(Racine)') ? $file : $folder . '/' . $file; $hasForms = !empty($interactions[$fullRelativePath]); ?> <tr> <td><?= esc($file) ?></td> <td> <?php if ($hasForms): ?> <button onclick="openModal('<?= $fullRelativePath ?>')"> Voir (<?= count($interactions[$fullRelativePath]) ?>) </button> <?php else: ?> - <?php endif; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> <?php endforeach; ?> <?php endif; ?> <!-- SECTION 2 : CONTROLEURS --> <h2>Contrôleurs</h2> <?php if (empty($controllersList)): ?> <p>Aucun contrôleur trouvé.</p> <?php else: ?> <table> <thead> <tr> <th>Fichier Contrôleur</th> <th>Méthodes (optionnel)</th> </tr> </thead> <tbody> <?php foreach ($controllersList as $ctrlFile): ?> <tr> <td><?= esc($ctrlFile) ?></td> <td> <?php // Si tu utilises scanControllerMethods, tu peux afficher ici if (!empty($controllersMethods[$ctrlFile])) { echo implode(', ', $controllersMethods[$ctrlFile]); } else { echo '-'; } ?> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php endif; ?> <!-- SECTION 3 : Modèles --> <h2>Modèles</h2> <?php if (empty($modelsList)): ?> <p>Aucun modèle trouvé.</p> <?php else: ?> <ul> <?php foreach ($modelsList as $mdl): ?> <li><?= esc($mdl) ?></li> <?php endforeach; ?> </ul> <?php endif; ?> <!-- MODAL D'INTERACTIONS/FORMULAIRES --> <div id="overlay" class="overlay" onclick="closeModal()"></div> <div id="modal" class="modal"></div> <script> // Données envoyées par PHP : tous les formulaires détectés, indexés par "folder/file.php" const allInteractions = <?= json_encode($interactions) ?>; // Pour déplier/replier un dossier function toggleFolder(headerDiv) { const contentDiv = headerDiv.nextElementSibling; if (contentDiv.style.display === 'block') { contentDiv.style.display = 'none'; } else { contentDiv.style.display = 'block'; } } // Ouvrir la modale pour un fichier de vue précis function openModal(relativePath) { const modal = document.getElementById('modal'); const overlay = document.getElementById('overlay'); overlay.style.display = 'block'; modal.style.display = 'block'; // Générer le contenu HTML let html = `<h2>Formulaires de la vue : ${relativePath}</h2>`; const forms = allInteractions[relativePath] || []; if (forms.length === 0) { html += `<p>Aucun formulaire détecté.</p>`; } else { forms.forEach((f, i) => { html += renderFormBlock(f, i); }); } html += `<button class="close-btn" onclick="closeModal()">Fermer</button>`; modal.innerHTML = html; } function closeModal() { document.getElementById('modal').style.display = 'none'; document.getElementById('overlay').style.display = 'none'; } // Génère le bloc pour tester un formulaire function renderFormBlock(formInfo, index) { // formInfo = { action, method, fields: [...] } let html = `<div class="form-container">`; html += `<h3>Formulaire #${index+1} - [${formInfo.method}] ${formInfo.action}</h3>`; // Générer des inputs pour tester html += `<div id="test-form-${index}">`; formInfo.fields.forEach(field => { if (field.tag === 'input') { html += ` <div> <label>${field.name} (${field.type})</label> <input type="${field.type}" name="${field.name}" value="${field.value}" /> </div> `; } else if (field.tag === 'textarea') { html += ` <div> <label>${field.name} (textarea)</label> <textarea name="${field.name}">${field.value}</textarea> </div> `; } else if (field.tag === 'select') { html += ` <div> <label>${field.name} (select)</label> <select name="${field.name}"> `; field.options.forEach(opt => { html += `<option value="${opt.value}">${opt.text}</option>`; }); html += `</select></div>`; } }); html += `</div>`; // Fin du div test-form-X // Bouton pour envoyer en AJAX html += ` <button onclick="submitTestForm(${index}, '${formInfo.action}', '${formInfo.method}')"> Tester ce formulaire </button> <div id="response-${index}" class="response-box"></div> `; html += `</div>`; return html; } // Envoi en AJAX function submitTestForm(index, action, method) { const formDiv = document.getElementById('test-form-' + index); const inputs = formDiv.querySelectorAll('input, textarea, select'); let formData = new FormData(); inputs.forEach(el => { formData.append(el.name, el.value); }); let fetchOptions = { method: method }; let finalUrl = action; if (method.toUpperCase() === 'POST') { fetchOptions.body = formData; } else { // GET const params = new URLSearchParams(); inputs.forEach(el => { params.append(el.name, el.value); }); finalUrl += '?' + params.toString(); } fetch(finalUrl, fetchOptions) .then(res => res.text()) .then(resText => { document.getElementById('response-' + index).innerHTML = ` <h4>Réponse :</h4> <pre>${escapeHtml(resText)}</pre> `; }) .catch(err => { document.getElementById('response-' + index).innerHTML = ` <h4>Erreur :</h4> <p>${err}</p> `; }); } // Pour éviter l'exécution de code HTML dans l'affichage function escapeHtml(text) { const div = document.createElement('div'); div.innerText = text; return div.innerHTML; } </script> </body> </html>
Annuler
Enregistrer
Switcher
Theme Styles
Theme Colors
Theme Color Mode:
Light
Dark
Menu Colors: