ottimizzazione Visualizzazione lista e singoli
This commit is contained in:
@ -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>
|
||||
@ -1,43 +1,16 @@
|
||||
<?php
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
|
||||
$rows = $this->items ?? [];
|
||||
if (!is_array($rows)) $rows = (array) $rows;
|
||||
$rows = array_values(array_filter($rows, static function ($it) {
|
||||
return is_object($it) && !empty($it->id);
|
||||
}));
|
||||
// posizione dove pubblichi il tuo modulo (es. mod_circolari)
|
||||
$position = 'circolari-list';
|
||||
|
||||
$Itemid = (int) (Factory::getApplication()->input->getInt('Itemid') ?: 0);
|
||||
?>
|
||||
<div class="circolari-list">
|
||||
<?php if (!count($rows)) : ?>
|
||||
<p><?php echo htmlspecialchars(Text::_('COM_CIRCOLARI_NO_ITEMS') ?: 'Nessuna circolare', ENT_QUOTES, 'UTF-8'); ?></p>
|
||||
<?php else : ?>
|
||||
<ul class="circolari-list__ul">
|
||||
<?php foreach ($rows as $item) : ?>
|
||||
<?php
|
||||
$url = Route::_(
|
||||
'index.php?option=com_circolari&view=circolare'
|
||||
. '&id=' . (int) $item->id
|
||||
. '&catid=' . (int) ($item->catid ?? 0)
|
||||
. ($Itemid ? '&Itemid=' . $Itemid : '')
|
||||
);
|
||||
?>
|
||||
<li class="circolari-list__li">
|
||||
<a href="<?php echo $url; ?>">
|
||||
<?php echo htmlspecialchars($item->title ?? ('#' . (int) $item->id), ENT_QUOTES, 'UTF-8'); ?>
|
||||
</a>
|
||||
<?php if (!empty($item->attachment)) : ?>
|
||||
<small> — <a href="<?php echo htmlspecialchars($item->attachment, ENT_QUOTES, 'UTF-8'); ?>" target="_blank" rel="noopener">
|
||||
<?php echo Text::_('COM_CIRCOLARI_READ_PDF') ?: 'PDF'; ?>
|
||||
</a></small>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
$modules = ModuleHelper::getModules($position); // rispetta l'assegnazione alla voce di menu attiva
|
||||
if (empty($modules)) {
|
||||
echo '<div class="alert alert-warning">Nessun modulo assegnato alla posizione "' . htmlspecialchars($position) . '".</div>';
|
||||
} else {
|
||||
foreach ($modules as $module) {
|
||||
echo ModuleHelper::renderModule($module, ['style' => 'xhtml']); // oppure 'none', 'html5', ecc.
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user