Files
pkg_circolari/administrator/tmpl/reportfirme/default.php
2025-09-08 08:48:42 +02:00

90 lines
3.4 KiB
PHP

<?php
\defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Session\Session;
// Load behaviors
HTMLHelper::_('behavior.multiselect');
HTMLHelper::_('bootstrap.tooltip');
// State & ordering
$listOrder = $this->state->get('list.ordering', 'f.data_firma');
$listDirn = $this->state->get('list.direction', 'DESC');
// Prendi il form filtri SENZA accedere a property protette
$filterForm = $this->get('FilterForm');
$activeFilters = $this->get('ActiveFilters');
// URL base della view
$action = Route::_('index.php?option=com_circolari&view=reportfirme');
// Link export CSV (rispetta i filtri correnti mantenendo la query string del form)
$exportLink = Route::_('index.php?option=com_circolari&task=reportfirme.exportCsv&' . Session::getFormToken() . '=1');
?>
<form action="<?php echo $action; ?>" method="post" name="adminForm" id="adminForm">
<div id="j-main-container" class="j-main-container">
<div class="d-flex justify-content-between align-items-center mb-3">
<h2 class="m-0">Report Firme</h2>
<a class="btn btn-outline-secondary btn-sm"
href="<?php echo $exportLink; ?>"
title="Scarica CSV">
Scarica CSV
</a>
</div>
<?php if ($filterForm) : ?>
<?php
// Passa esplicitamente form e activeFilters per evitare accesso a property protette
echo LayoutHelper::render('joomla.searchtools.default', [
'view' => $this,
'form' => $filterForm,
'activeFilters' => $activeFilters,
]);
?>
<?php endif; ?>
<div class="clearfix"></div>
<table class="table table-striped">
<thead>
<tr>
<th><?php echo HTMLHelper::_('grid.sort', 'ID', 'f.id', $listDirn, $listOrder); ?></th>
<th><?php echo HTMLHelper::_('grid.sort', 'Circolare', 'c.title', $listDirn, $listOrder); ?></th>
<th><?php echo HTMLHelper::_('grid.sort', 'Nome', 'u.name', $listDirn, $listOrder); ?></th>
<th>Username</th>
<th>Email</th>
<th><?php echo HTMLHelper::_('grid.sort', 'Scelta', 'scelta_label', $listDirn, $listOrder); ?></th>
<th><?php echo HTMLHelper::_('grid.sort', 'Data firma', 'f.data_firma', $listDirn, $listOrder); ?></th>
</tr>
</thead>
<tbody>
<?php if (empty($this->items)) : ?>
<tr><td colspan="7" class="text-center text-muted">Nessun risultato</td></tr>
<?php else : ?>
<?php foreach ($this->items as $i => $item) : ?>
<tr>
<td><?php echo (int) $item->id; ?></td>
<td><?php echo $this->escape($item->circolare_title); ?></td>
<td><?php echo $this->escape($item->user_name); ?></td>
<td><?php echo $this->escape($item->username); ?></td>
<td><?php echo $this->escape($item->email); ?></td>
<td><span class="badge bg-secondary"><?php echo $this->escape($item->scelta_label); ?></span></td>
<td><?php echo HTMLHelper::_('date', $item->data_firma, 'd/m/Y H:i'); ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
<?php echo $this->pagination->getListFooter(); ?>
<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="0">
<?php echo HTMLHelper::_('form.token'); ?>
</div>
</form>