Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

119 righe
5.5 KiB

<style>
td a {
display: block;
}
a.rows {
color: #797979;
}
</style>
<script>
$(document).ready(function() {
$('.relevant-popover').popover({container : 'body', trigger : 'hover'});
$('.attachment-preview-popover').popover({
trigger: 'manual',
container : 'body',
}).on("mouseenter", function () {
if($(document).innerWidth() < 768)
{
return;
}
var _this = this;
$(this).popover("show");
$('#' + $(this).attr('aria-describedby')).on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide");
}
}, 200);
});
});
</script>
<?php use Cake\I18n\DateTime; ?>
<div class="card card-primary card-outline">
<div class="card-header d-sm-flex">
<h2 class="card-title">
<?= (isset($numberOfAttachments) && $numberOfAttachments > 0) ? __('Allegati presenti: {0}', $numberOfAttachments) : __('Nessun Allegato presente') ?>
</h2>
</div>
<div class="card-body table-responsive p-0">
<table class="table table-hover text-nowrap">
<thead>
<tr>
<?php
if($showPrivateColumn):
?>
<th><span class="hidden-print"><?= $this->Paginator->sort('Attachments.private', '<i class="fa fa-fw fa-lock fa-lg"></i>', ['escape' => false]) ?></span><span class='visible-print-block'><?= '<i class="fa fa-fw fa-lock fa-lg"></i>';?></span></th>
<?php
endif;
?>
<th scope="col"><?= $this->Paginator->sort('Attachments.original_file_name', __('Nome')) ?></th>
<th scope="col"><?= $this->Paginator->sort('Attachments.relevant', '<i class="fa fa-fw fa-star fa-lg"></i>', ['escape' => false]) ?></th>
<th scope="col"><?= $this->Paginator->sort('Attachments.original_file_size', __('Dimensione')) ?></th>
<th scope="col"><?= $this->Paginator->sort('Attachments.mimetype', __('Tipo')) ?></th>
<th scope="col"><?= $this->Paginator->sort('Attachments.upload_date', __('Caricato il')) ?></th>
<th scope="col"><?= $this->Paginator->sort('Creator.surname', __('Da')) ?></th>
<th scope="col" class="actions text-center"><?= __('Azioni') ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($attachments as $attachment):
$rowStyle = (new DateTime($attachment->controllable_object->modified))->wasWithinLast('5 minutes') ? "font-weight: bold;background-color:#f8d716" : "";
?>
<tr style="<?= $rowStyle;?>">
<?php
if($showPrivateColumn):
$htmlCode = '<i style="color: red;" class="fa fa-fw fa-unlock fa-lg" title="'.__('File pubblico').'"></i>';
if($attachment->private)
{
$htmlCode = '<i style="color: red;" class="fa fa-fw fa-lock fa-lg" title="'.__('File privato').'"></i>';
}
?>
<td><a class="rows hidden-print"><?= $htmlCode ?></a><span class='visible-print-block'><?= $htmlCode;?></span></td>
<?php
endif;
?>
<td><?= h($attachment->original_file_name) ?></td>
<td><?= $attachment->relevant ? '<i style="color: red; cursor:pointer" class="fa fa-fw fa-star fa-lg relevant-popover" data-toggle="popover" title="<b>Segnato rilevante da</b>" data-html="true" data-content="' . h($attachment->controllable_object->modifier) . ' il ' . $attachment->controllable_object->modified . '"></i>' : '' ?></td>
<td><?= h($attachment->human_original_file_size) ?></td>
<td><?= h($attachment->mimetype) ?></td>
<td><?= h($attachment->upload_date) ?></td>
<td><?= h($attachment->controllable_object->creator) ?></td>
<td class="actions text-right">
<?php
echo $this->Html->link(__('Visualizza'), ['controller' => 'attachments', 'action' => 'view', $attachment->file_name], ['target' => '_blank', 'class' => 'btn btn-info btn-xs', 'style' => 'margin-right: 5px;', 'data-mimetype' => $attachment->mimetype]);
if (isset($removecurrentfiles) && $removecurrentfiles == "true") {
echo $this->Html->link(__('Segna da eliminare'), ['controller' => 'attachments', 'action' => 'markAsDeleted', $attachment->controllable_object_id], ['target' => '_blank', 'class' => 'btn btn-danger btn-xs', 'style' => 'margin-right: 5px;']);
} else {
echo $this->Html->link($attachment->relevant ? __('Segna come non rilevante') : __('Segna come rilevante'), ['controller' => 'attachments', 'action' => 'markAsRelevant', $attachment->file_name], ['id' => $attachment->controllable_object_id, 'target' => '_blank', 'class' => 'btn btn-warning btn-xs', 'style' => 'margin-right: 5px;']);
}
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="card-footer d-md-flex paginator">
<div class="mr-auto" style="font-size:.8rem">
<?= $this->Paginator->counter(__('Pagina {{page}} di {{pages}}, visualizzati {{current}} record(s) di {{count}} totali')) ?>
</div>
<ul class="pagination pagination-sm">
<?= $this->Paginator->first('<i class="fas fa-angle-double-left"></i>', ['escape' => false]) ?>
<?= $this->Paginator->prev('<i class="fas fa-angle-left"></i>', ['escape' => false]) ?>
<?= $this->Paginator->numbers() ?>
<?= $this->Paginator->next('<i class="fas fa-angle-right"></i>', ['escape' => false]) ?>
<?= $this->Paginator->last('<i class="fas fa-angle-double-right"></i>', ['escape' => false]) ?>
</ul>
</div>
</div>