Predisposizione lista circolari
This commit is contained in:
43
site/tmpl/circolari/default.php
Normal file
43
site/tmpl/circolari/default.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Factory;
|
||||
|
||||
$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);
|
||||
}));
|
||||
|
||||
$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>
|
||||
10
site/tmpl/circolari/default.xml
Normal file
10
site/tmpl/circolari/default.xml
Normal 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="catid" type="category" extension="com_content" label="JCATEGORY" required="false" />
|
||||
</fieldset>
|
||||
</fields>
|
||||
</metadata>
|
||||
Reference in New Issue
Block a user