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.
164 righe
7.2 KiB
164 righe
7.2 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
include_once "{$beRoot}/layout/top.php"; |
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice)) { |
|
$tokenEsportazione = generateStrongPassword(); |
|
$certificabili = false; |
|
if (isset($_SESSION["ente"])) { |
|
$certificabili = $_SESSION["ente"]->certificazioneManualeUtenti(); |
|
} |
|
|
|
?> |
|
<script> |
|
function showModuliPM(codice) { |
|
if (typeof codice !== "undefinded") { |
|
$("#modPM_details").load("moduliPm.php?codice="+codice,function(){ |
|
f_ready(); |
|
}); |
|
} |
|
} |
|
</script> |
|
<div class="container-fluid pt-5"> |
|
<div class="row"> |
|
<div class="col-12"> |
|
<p class="d-block display-4"> |
|
<?= Modulo::header($radice) ?> |
|
</p> |
|
</div> |
|
</div> |
|
</div> |
|
<div id="commands" class="mb-5"> |
|
<div class="commands container-fluid"> |
|
<div class="row"> |
|
<div class="col-12 text-right"> |
|
<? if (!$_SESSION["utente"]->readOnly) { ?> |
|
<button onClick="showModalWithURL('/backend/utenti/edit.php?codice=0')" class="mr-1 btn btn-primary" title="<?= __('Aggiungi nuovo') ?>"><span class="fa fa-plus-circle mr-2"></span><?= __('Aggiungi nuovo') ?></button> |
|
<? } ?> |
|
<button onclick="showModalWithURL('permessi/listModuli.php');" class="mr-1 btn btn-info" title="<?= __('permessi') ?>"><i class="fa fa-list mr-2"></i><?= __('Permessi') ?></button> |
|
<a href="export_csv.php?codice=<?= base64_encode($tokenEsportazione) ?>" target="_blank" class="btn btn-warning"><span class="fa fa-download"></span> <?= __("Esporta") ?> CSV</a> |
|
<? |
|
if ($_SESSION["utente"]->isSupportoOrRoot()) { |
|
if (!empty($_SESSION["ente"])):?> |
|
<button class="btn btn-warning" onClick="showModalWithURL('/backend/utenti/importa.php'); return false"><span class="fa fa-upload"></span> <?= __("Importa CSV") ?></button> |
|
<button class="btn btn-warning" onClick="showModalWithURL('/backend/utenti/limiti/view.php'); return false"><span class="fa fa-list"></span> <?= __("Limiti") ?></button> |
|
<?endif;?> |
|
<button class="btn btn-warning" onClick="showModalWithURL('/backend/enti/settings.php?gruppo=utenti'); return false"><span class="fa fa-cogs"></span> <?= __("Impostazioni") ?></button> |
|
<? |
|
} |
|
?> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="container-fluid"> |
|
<div class="row"> |
|
<div class="col-12"> |
|
<div class="card"> |
|
<div class="card-body"> |
|
<? |
|
$bind = array(); |
|
$gerarchia_massima = 100; |
|
if (!isset($_SESSION["ente"])) { |
|
$gerarchia_minima = 0; |
|
$sql = "SELECT b_utenti.codice FROM b_utenti WHERE "; |
|
} else { |
|
$gerarchia_minima = 9; |
|
$bind[":codice"] = $_SESSION["ente"]->codice; |
|
$sql = "SELECT b_utenti.codice FROM b_utenti |
|
JOIN r_collaborazioni ON b_utenti.codice = r_collaborazioni.codice_utente |
|
JOIN b_enti ON r_collaborazioni.codice_ente = b_enti.codice "; |
|
if ($_SESSION["utente"]->fromHere()) { |
|
$bind[":codice"] = $_SESSION["ente"]->codice; |
|
$sql .= "WHERE (b_enti.codice = :codice OR b_enti.sua = :codice) AND "; |
|
} else { |
|
$bind[":codice"] = $_SESSION["utente"]->codice_ente; |
|
$sql .= "WHERE (b_enti.codice = :codice) AND "; |
|
} |
|
$sql .= " r_collaborazioni.monitoraggio = 'N' AND "; |
|
} |
|
$i = 0; |
|
$ruoli = utente::ruoli(); |
|
$where = []; |
|
foreach($ruoli AS $id => $ruolo) { |
|
$i++; |
|
if ($ruolo["gerarchia"] > $gerarchia_minima && $ruolo["gerarchia"] < $gerarchia_massima) { |
|
$bind[":ruolo{$i}"] = $id; |
|
$where[] = " b_utenti.ruolo = :ruolo{$i} "; |
|
} |
|
} |
|
if (count($where) > 0) { |
|
$sql .= "(" . implode(" OR ",$where) . ")"; |
|
} |
|
$ris_utenti = $pdo->go($sql,$bind); |
|
if ($ris_utenti->rowCount() > 0) { |
|
?> |
|
<div class="table-responsive"> |
|
<table class="table table-striped table-hover table-condensed" id="utenti" width="100%"> |
|
<thead> |
|
<tr> |
|
<th width="5"></th> |
|
<th width="5">#</th> |
|
<th><?= __("Cognome") ?></th> |
|
<th><?= __("Nome") ?></th> |
|
<th><?= __("E-mail") ?></th> |
|
<th><?= __("Ruolo") ?></th> |
|
<? if ($certificabili) { ?> |
|
<th><?= __("Certificato") ?></th> |
|
<? } ?> |
|
<th width="20"></th> |
|
<? if ($_SESSION["utente"]->isSupportoOrRoot()) { ?><th width="20"></th><th width="20"></th><? } ?> |
|
</tr> |
|
</thead> |
|
<tbody> |
|
</tbody> |
|
</table> |
|
</div> |
|
<script> |
|
utentiTab = $("#utenti").DataTable({ |
|
"processing": true, |
|
"serverSide": true, |
|
"language": { |
|
"url": "/dictionary/datatables/<?= $_SESSION["language"] ?>.lang" |
|
}, |
|
"ajax": { |
|
"url": "table.php", |
|
"data": function(d) { |
|
d.token_esportazione = '<?= base64_encode($tokenEsportazione) ?>' |
|
}, |
|
}, |
|
"order": [[2,'asc']], |
|
"lengthMenu": [[10, 25, 50], [10, 25, 50]], |
|
"pageLength": 25, |
|
"columns": [ |
|
{ "orderable": false }, |
|
null, |
|
null, |
|
null, |
|
null, |
|
<? if ($certificabili) { ?> |
|
{ "orderable": false }, |
|
<? } ?> |
|
{ "orderable": false }, |
|
{ "orderable": false }, |
|
<? if ($_SESSION["utente"]->isSupportoOrRoot()) { ?>{ "orderable": false },{ "orderable": false }<? } ?> |
|
] |
|
}); |
|
</script> |
|
<? |
|
} else { |
|
alertManager::printWarningBox(__("Nessun risultato")); |
|
} |
|
?> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<? |
|
include_once "{$beRoot}/layout/bottom.php"; |
|
} else { |
|
echo '<meta http-equiv="refresh" content="0;URL=/index.php">'; |
|
die(); |
|
} |
|
?>
|
|
|