gestione gare pubbliche
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.
 
 
 
 
 

129 righe
6.0 KiB

<?
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once($configPath);
$error = true;
if (isset($_SESSION["utente"]) && !empty($_GET["sezione"]) && !empty($_GET["codice_elemento"]) && $_SESSION["utente"]->permission($_GET["sezione"],$_GET["codice_elemento"],(!empty($_GET["function"]) ? $_GET["function"] : ""))) {
$utenti = ente::getUtentiFromModulo($_GET["sezione"],$_SESSION["ente"]->codice);
$error = false;
?>
<div class="alert alert-warning text-center">
<span class="fa fa-exclamation-triangle fa-2x"></span><br>
<?= __("Gli utenti di tipologia Amministratore sono automaticamente abilitati") ?>
</div>
<?
if (!empty($utenti)) {
$bind = array();
$utenti = $_SESSION["ente"]->getUtentiFromEnte($utenti,(int) $_GET["ente"]);
if (!empty($utenti)) {
$check = $pdo->prepare("SELECT codice FROM r_permessi WHERE sezione = :sezione AND codice_elemento = :codice_elemento AND codice_gestore = :codice_gestore AND codice_utente = :codice_utente AND funzione = :funzione");
$check->bindValue(":sezione",$_GET["sezione"]);
$check->bindValue(":codice_gestore",$_SESSION["ente"]->codice);
$check->bindValue(":codice_elemento",$_GET["codice_elemento"]);
$funzione = $_GET["function"];
$settings = $_SESSION["utente"]->settings[$_GET["sezione"]] ?? NULL;
if ($funzione !== "0") {
if (!empty($settings["funzioni"])) {
$funct = $settings["funzioni"];
switch($funct["type"]) {
case "json":
$array = jsonToArray($config["jsonFolder"].$funct["path"]);
if (!empty($array)) {
foreach($array AS $value => $tmp) {
$functions[] = [
"titolo"=>$tmp["titolo"],
"descrizione"=>$tmp["descrizione"],
"value"=>$value,
"modulo_riferimento"=>$tmp["modulo_riferimento"]
];
}
}
break;
case "array":
$functions = array_merge($functions,$funct["value"]);
break;
case "script":
$functions = include_once "{$root}/{$funct["path"]}";
break;
}
}
$functions = array_column($functions,null,"value");
$funzione = $functions[$funzione] ?? null;
} else {
$funzione = ["titolo"=>"Generale","descrizione"=>"Il permesso generale abilita l'utente a tutte le funzionalità compatibili con il suo profilo","value"=>0];
}
$getSezione = $_GET["sezione"];
$getCodice_elemento = $_GET["codice_elemento"];
$showAll = true;
if (!empty($funzione)) {
?>
<span class="h3"><?= $funzione["titolo"] ?></span><br>
<small><?= $funzione["descrizione"] ?></small>
<form action="/backend/utenti/permessi/specific/save.php" method="post" rel="validate">
<input id="token" type="hidden" name="token" value="<?= tokenGen() ?>">
<input id="sezione" type="hidden" name="sezione" value="<?= $getSezione ?>">
<input id="codice_elemento" type="hidden" name="codice_elemento" value="<?= $getCodice_elemento ?>">
<input id="funzione" type="hidden" name="funzione" value="<?= $funzione["value"] ?>">
<div class="text-right">
<span class="fa fa-search"></span> <input type="text" onkeyup="filtra($(this).val(),'#permission-table-<?= $funzione["value"] ?>','tr');" class="input-sm" placeholder="<?= __("Cerca") ?>">
</div>
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th><?= __("Nome") ?></th>
<th><?= __("Cognome") ?></th>
<th><?= __("E-mail") ?></th>
<th><?= __("Ente") ?></th>
</tr>
</thead>
<tbody id="permission-table-<?= $funzione["value"] ?>">
<?
foreach($utenti AS $utente) {
$check->bindValue(":funzione",$funzione["value"]);
$check->bindValue(":codice_utente",$utente["codice"]);
$check->execute();
$checked = ($check->rowCount() > 0);
$check->bindValue(":funzione","0");
$check->bindValue(":codice_utente",$utente["codice"]);
$check->execute();
$generale = ($check->rowCount() > 0);
?>
<tr>
<td width="10" class="text-center">
<input type="checkbox"
<?php if ($funzione["value"] != "0") : ?>
<?php if ($generale) : ?> disabled="disabled" <? endif ?>
class="permission-checkbox-<?= $utente["codice"] ?>"
<? endif ?>
name="utenti[]"
value="<?= $utente["codice"] ?>" <?= ($checked || $generale) ? "checked=\"checked\"" : "" ?>>
<?php if ($funzione["value"] != "0" && $generale) : ?>
<small class="alert alert-info p-1"><?= __("Generale") ?>
<? endif ?>
</td>
<td><?= $utente["cognome"] ?></td>
<td><?= $utente["nome"] ?></td>
<td><?= $utente["email"] ?></td>
<td><?= ente::getInfoFromID($utente["codice_ente"])[0]["denominazione"] ?></td>
</tr>
<?
}
?>
</tbody>
</table>
<button class="mt-2 btn btn-block btn-success" onClick="return confirm('<?= __("Sei sicuro di voler procedere?") ?>');">
<span class="fa fa-save"></span> <?= __("Salva") ?>
</button>
</form>
<?
}
}
}
}
if ($error) {
header('HTTP/1.0 403 Forbidden');
die();
}
?>