gestione categorie interne & fix

This commit is contained in:
2025-09-01 12:56:30 +02:00
parent 16ac92a59e
commit f9b01eb01e
40 changed files with 2252 additions and 424 deletions

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<!-- titolo del tipo voce di menu, visibile nel backend -->
<layout title="COM_CIRCOLARI_MENU_CATEGORY" option="com_circolari" />
<!-- campi che finiscono nella query dell'URL -->
<fields name="request">
<fieldset name="request">
<!-- forza la view "category" -->
<field name="view" type="hidden" default="category" />
<!-- scegli la categoria di Joomla (com_content) che fa da base del percorso -->
<field
name="id"
type="category"
extension="com_content"
label="JCATEGORY"
description="Seleziona la categoria di com_content da usare come base del percorso URL."
required="true"
default="11"
/>
</fieldset>
</fields>
<!-- parametri opzionali della voce (non obbligatori) -->
<fields name="params">
<fieldset name="basic" label="JOPTIONS">
<field name="show_category_title" type="radio" label="COM_CIRCOLARI_SHOW_CATEGORY_TITLE" default="0">
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fields>
</metadata>

View File

@ -7,20 +7,20 @@ use Joomla\CMS\Language\Text;
/** @var \Pcrt\Component\Circolari\Site\View\Circolare\HtmlView $this */
$item = $this->item;
?>
<article class="com-content-article item-page">
<header class="page-header">
<h1 class="page-title"><?php echo htmlspecialchars($item->title ?: 'Circolare'); ?></h1>
</header>
<div class="article-body mt-3">
<?php echo $item->description ?: $item->testo ?: $item->descrizione ?: '<em>(Nessun testo)</em>'; ?>
<div class="container my-5 mega-container">
<div class="row mb-4 align-items-end">
<div class="col-md-9 col-12">
<h1 class="h2 mb-1"><?= $this->escape($item->title); ?></h1>
</div>
<div class="col-md-3 col-12 text-md-end mt-2 mt-md-0">
<a href="#" class="small text-decoration-none text-uppercase fw-bold">Condividi</a>
</div>
<div class="article-body mt-3">
<?php echo $item->description ?: $item->testo ?: $item->descrizione ?: '<em>(Nessun testo)</em>'; ?>
</div>
</div>
<?php if (!empty($item->attachment)) : ?>
<p class="mt-3">
<a href="<?php echo htmlspecialchars($item->attachment); ?>" target="_blank" rel="noopener">
<?php echo Text::_('COM_CIRCOLARI_DOWNLOAD_ATTACHMENT') ?: 'Scarica allegato'; ?>
</a>
</p>
<?php endif; ?>
</article>
</div>

View File

@ -0,0 +1,67 @@
<?php
// ... intestazione invariata ...
// $listOrder / $listDirn / $filter già come li hai
$Itemid = (int) ($input->getInt('Itemid') ?: 0);
?>
<form action="<?php echo htmlspecialchars(Uri::getInstance()->toString(), ENT_QUOTES, 'UTF-8'); ?>"
method="post"
name="adminForm"
id="adminForm"
class="com-content-category__articles">
<!-- filtro -->
<!-- (invariato) -->
<!-- Limite per pagina -->
<?php if ($pagination && \method_exists($pagination, 'getLimitBox')) : ?>
<div class="com-content-category__pagination btn-group float-end">
<label for="limit" class="visually-hidden"><?php echo Text::_('JGLOBAL_DISPLAY_NUM'); ?></label>
<?php echo $pagination->getLimitBox(); ?>
</div>
<?php endif; ?>
<!-- tabella -->
<table class="com-content-category__table category table table-striped table-bordered table-hover mt-3">
<thead>
<tr>
<th scope="col" id="circolari_header_title">
<?php echo HTMLHelper::_('grid.sort', 'JGLOBAL_TITLE', 'c.title', $listDirn, $listOrder, null, 'asc', '', 'adminForm'); ?>
</th>
<th scope="col" id="circolari_header_date" class="small">
<?php echo HTMLHelper::_('grid.sort', Text::_('JDATE'), 'c.created', $listDirn, $listOrder, null, 'asc', '', 'adminForm'); ?>
</th>
<th scope="col" id="circolari_header_attachment" class="text-center">
<?php echo Text::_('COM_CIRCOLARI_ATTACHMENT') ?: 'Allegato'; ?>
</th>
<th scope="col" id="circolari_header_hits" class="text-end">
<?php echo HTMLHelper::_('grid.sort', 'JGLOBAL_HITS', 'c.hits', $listDirn, $listOrder, null, 'asc', '', 'adminForm'); ?>
</th>
</tr>
</thead>
<!-- tbody invariato -->
</table>
<!-- paginazione -->
<?php if ($pagination && $pagination->pagesTotal > 1) : ?>
<div class="com-content-category__navigation w-100">
<p class="com-content-category__counter counter float-end pt-3 pe-2">
<?php echo $pagination->getPagesCounter(); ?>
</p>
<div class="com-content-category__pagination">
<?php echo $pagination->getPagesLinks(); ?>
</div>
</div>
<?php endif; ?>
<!-- hidden -->
<div>
<input type="hidden" name="option" value="com_circolari">
<input type="hidden" name="view" value="circolari">
<?php if ($Itemid) : ?><input type="hidden" name="Itemid" value="<?php echo $Itemid; ?>"><?php endif; ?>
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>">
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>">
<input type="hidden" name="limitstart" value="<?php echo (int) ($pagination?->limitstart ?? 0); ?>">
<?php echo HTMLHelper::_('form.token'); ?>
</div>
</form>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CIRCOLARI_MENU_LIST" option="com_circolari" />
<fields name="request">
<fieldset name="request">
<field name="view" type="hidden" default="circolari" />
<field name="categoria_id" type="category" extension="com_content" label="JCATEGORY" required="false" />
</fieldset>
</fields>
</metadata>