fixed tags and added phginx

This commit is contained in:
2026-09-21 11:22:45 +02:00
parent 9241e177ac
commit 624d94742a
5 changed files with 870 additions and 45 deletions
+17 -19
View File
@@ -21,7 +21,7 @@ while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
}
// Imposta lo slug predefinito
$docpage = isset($_GET['docpage']) ? $_GET['docpage'] : 'legal';
$docpage = isset($_GET['docpage']) ? $_GET['docpage'] : '';
// Recupera tutti i tag disponibili
$stmt = $pdo->query("SELECT tag_id, tag_name FROM tags ORDER BY tag_name");
@@ -95,7 +95,7 @@ $allTags = $stmt->fetchAll(PDO::FETCH_ASSOC);
<div class="col-md-6 position-relative mt-3">
<label class="form-label mb-1 fw-bold">Filtra per tag:</label>
<div class="dropdown">
<button class="btn btn-outline-secondary dropdown-toggle w-100" type="button" id="tagDropdown" data-bs-toggle="dropdown" aria-expanded="false">
<button class="btn btn-outline-secondary dropdown-toggle w-100" type="button" id="tagDropdown" data-toggle="dropdown" aria-expanded="false">
Seleziona tag...
</button>
<div class="dropdown-menu w-100" aria-labelledby="tagDropdown">
@@ -408,11 +408,9 @@ $allTags = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Gestione del checkbox "Solo obbligatori"
$("#showOnlyRequired").on('change', function() {
if (currentSection) {
const sectionName = $('.section-icon.active .section-name').text();
$('.document-preloader').show();
loadDocuments(currentCategory, currentSection, sectionName);
}
const sectionName = $('.section-icon.active .section-name').text() || null;
$('.document-preloader').show();
loadDocuments(currentCategory, currentSection, sectionName);
});
// Carica le sezioni per una categoria
@@ -531,11 +529,9 @@ $allTags = $stmt->fetchAll(PDO::FETCH_ASSOC);
name: tagName
});
updateSelectedTags();
if (currentSection) {
const sectionName = $('.section-icon.active .section-name').text();
$('.document-preloader').show();
loadDocuments(currentCategory, currentSection, sectionName);
}
$('#documentSections').empty();
$('.document-preloader').show();
loadDocuments(currentCategory, null, null);
}
});
@@ -555,11 +551,9 @@ $allTags = $stmt->fetchAll(PDO::FETCH_ASSOC);
const tagId = $(this).data('tag-id');
selectedTags = selectedTags.filter(t => t.id !== tagId);
updateSelectedTags();
if (currentSection) {
const sectionName = $('.section-icon.active .section-name').text();
$('.document-preloader').show();
loadDocuments(currentCategory, currentSection, sectionName);
}
$('#documentSections').empty();
$('.document-preloader').show();
loadDocuments(currentCategory, null, null);
});
}
@@ -620,8 +614,12 @@ $allTags = $stmt->fetchAll(PDO::FETCH_ASSOC);
html += `
<div class="accordion-item">
<h2 class="accordion-header" id="heading-${md5(sectionKey)}"></h2>
<div id="collapse-${md5(sectionKey)}" class="accordion-collapse collapse" aria-labelledby="heading-${md5(sectionKey)}" data-parent="#documentSections">
<h2 class="accordion-header" id="heading-${md5(sectionKey)}">
<button class="btn btn-link text-start w-100 fw-bold text-decoration-none" type="button" data-toggle="collapse" data-target="#collapse-${md5(sectionKey)}" aria-expanded="true">
${displaySectionName}
</button>
</h2>
<div id="collapse-${md5(sectionKey)}" class="accordion-collapse collapse show" aria-labelledby="heading-${md5(sectionKey)}" data-parent="#documentSections">
<div class="accordion-body">
`;