148 lines
5.3 KiB
PHP
148 lines
5.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @version CVS: 1.0.0
|
|
* @package Com_Circolari
|
|
* @author Tommaso Cippitelli <tommaso.cippitelli@protocollicreativi.it>
|
|
* @copyright 2025 Tommaso Cippitelli
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
*/
|
|
|
|
// No direct access
|
|
defined('_JEXEC') or die;
|
|
|
|
|
|
use \Joomla\CMS\HTML\HTMLHelper;
|
|
use \Joomla\CMS\Factory;
|
|
use \Joomla\CMS\Uri\Uri;
|
|
use \Joomla\CMS\Router\Route;
|
|
use \Joomla\CMS\Layout\LayoutHelper;
|
|
use \Joomla\CMS\Language\Text;
|
|
use Joomla\CMS\Session\Session;
|
|
|
|
HTMLHelper::_('bootstrap.tooltip');
|
|
HTMLHelper::_('behavior.multiselect');
|
|
|
|
// Import CSS
|
|
$wa = $this->document->getWebAssetManager();
|
|
$wa->useStyle('com_circolari.admin')
|
|
->useScript('com_circolari.admin');
|
|
|
|
$user = Factory::getApplication()->getIdentity();
|
|
$userId = $user->get('id');
|
|
$listOrder = $this->state->get('list.ordering');
|
|
$listDirn = $this->state->get('list.direction');
|
|
$canOrder = $user->authorise('core.edit.state', 'com_circolari');
|
|
|
|
$saveOrder = $listOrder == 'a.ordering';
|
|
|
|
if (!empty($saveOrder)) {
|
|
$saveOrderingUrl = 'index.php?option=com_circolari&task=circolares.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';
|
|
HTMLHelper::_('draggablelist.draggable');
|
|
}
|
|
|
|
?>
|
|
|
|
<form action="<?php echo Route::_('index.php?option=com_circolari&view=circolares'); ?>" method="post"
|
|
name="adminForm" id="adminForm">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div id="j-main-container" class="j-main-container">
|
|
<?php echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
|
|
|
|
<div class="clearfix"></div>
|
|
<table class="table table-striped" id="circolareList">
|
|
<thead>
|
|
<tr>
|
|
<th class="w-1 text-center">
|
|
<input type="checkbox" autocomplete="off" class="form-check-input" name="checkall-toggle" value=""
|
|
title="<?php echo Text::_('JGLOBAL_CHECK_ALL'); ?>" onclick="Joomla.checkAll(this)" />
|
|
</th>
|
|
<th>
|
|
<?php echo HTMLHelper::_('searchtools.sort', 'Titolo', 'a.title', $listDirn, $listOrder); ?>
|
|
</th>
|
|
<th><?php echo Text::_("COM_CIRCOLARI_FIELD_TIPOLOGIA_FIRMA_LABEL"); ?></th>
|
|
<th> <?php echo HTMLHelper::_('searchtools.sort', 'Firma Obbligatoria', 'a.firma_obbligatoria', $listDirn, $listOrder); ?>
|
|
</th>
|
|
<th>Scadenza</th>
|
|
|
|
<?php if (isset($this->items[0]->ordering)): ?>
|
|
<th scope="col" class="w-1 text-center d-none d-md-table-cell">
|
|
|
|
<?php echo HTMLHelper::_('searchtools.sort', '', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
|
|
|
|
</th>
|
|
<?php endif; ?>
|
|
|
|
|
|
<th scope="col" class="w-1 text-center">
|
|
<?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
|
|
</th>
|
|
|
|
|
|
<th scope="col" class="w-3 d-none d-lg-table-cell">
|
|
|
|
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?> </th>
|
|
</tr>
|
|
</thead>
|
|
<tfoot>
|
|
<tr>
|
|
<td colspan="<?php echo isset($this->items[0]) ? count(get_object_vars($this->items[0])) : 10; ?>">
|
|
<?php echo $this->pagination->getListFooter(); ?>
|
|
</td>
|
|
</tr>
|
|
</tfoot>
|
|
<tbody>
|
|
|
|
<?php foreach ($this->items as $i => $item) :
|
|
$canEdit = $user->authorise('core.edit', 'com_circolari');
|
|
$canChange = $user->authorise('core.edit.state', 'com_circolari');
|
|
?>
|
|
<tr class="row<?php echo $i % 2; ?>" data-draggable-group="1">
|
|
<td class="text-center">
|
|
<?php echo HTMLHelper::_('grid.id', $i, $item->id); ?>
|
|
</td>
|
|
<td>
|
|
<a href="<?php echo Route::_('index.php?option=com_circolari&task=circolare.edit&id=' . (int) $item->id); ?>">
|
|
<?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?>
|
|
</a>
|
|
</td>
|
|
<td><?php echo htmlspecialchars($item->tipologia_firma_id, ENT_QUOTES, "UTF-8"); ?></td>
|
|
<td><?php echo $item->firma_obbligatoria ? 'Sì' : 'No'; ?></td>
|
|
<td><?php echo $item->scadenza; ?></td>
|
|
<?php if (isset($this->items[0]->ordering)) : ?>
|
|
|
|
<td class="text-center d-none d-md-table-cell">
|
|
|
|
<?php
|
|
|
|
$iconClass = '';
|
|
|
|
if (!$canChange) {
|
|
$iconClass = ' inactive';
|
|
} elseif (!$saveOrder) {
|
|
$iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
|
|
} ?> <span class="sortable-handler<?php echo $iconClass ?>">
|
|
<span class="icon-ellipsis-v" aria-hidden="true"></span>
|
|
</span>
|
|
<?php if ($canChange && $saveOrder) : ?>
|
|
<input type="text" name="order[]" size="5" value="<?php echo $item->ordering; ?>" class="width-20 text-area-order hidden">
|
|
<?php endif; ?>
|
|
</td>
|
|
<?php endif; ?>
|
|
<td class="text-center"><?php echo HTMLHelper::_('jgrid.published', $item->state, $i, 'circolares.', $canChange, 'cb'); ?></td>
|
|
<td class="text-center"><?php echo (int) $item->id; ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
<input type="hidden" name="task" value="" />
|
|
<input type="hidden" name="boxchecked" value="0" />
|
|
<input type="hidden" name="list[fullorder]" value="<?php echo $listOrder; ?> <?php echo $listDirn; ?>" />
|
|
<?php echo HTMLHelper::_('form.token'); ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|