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.
 
 
 
 
 

168 righe
6.4 KiB

<?
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once($configPath);
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice)) {
include_once ($beRoot."/layout/top.php");
$enti = $_SESSION["utente"]->getEntiBeneficiari(false);
$bind = array(":codice_ente"=>(!empty($_SESSION["utente"]->codice_ente)) ? $_SESSION["utente"]->codice_ente : $_SESSION["ente"]->codice);
$sql = "SELECT b_concorsi.codice
FROM b_concorsi
JOIN (SELECT MAX(codice) AS last_round, codice_concorso, scadenza FROM b_concorsi_round GROUP BY codice_concorso) AS last_concorso_round ON b_concorsi.codice = last_concorso_round.codice_concorso
JOIN b_concorsi_round ON last_concorso_round.last_round = b_concorsi_round.codice
WHERE b_concorsi_round.scadenza < NOW() AND b_concorsi_round.scadenza > 0 AND b_concorsi.stato = 20";
$scadute = $pdo->go($sql);
if ($scadute->rowCount() > 0) {
while ($scaduta = $scadute->fetch(PDO::FETCH_ASSOC)) {
$pdo->go("UPDATE b_concorsi SET stato = 21 WHERE stato = 20 AND codice = :codice",[":codice"=>$scaduta["codice"]]);
}
}
?>
<div class="container-fluid pt-5 pb-3">
<div class="row">
<div class="col-12">
<h2>
<?= Modulo::header($radice) ?>
</h2>
</div>
</div>
</div>
<?
$proceed = $_SESSION["ente"]->checkLimite($radice,true);
if ($proceed) {
if (!$_SESSION["utente"]->readOnly) {
$proceed = $_SESSION["utente"]->permission("concorsi");
} else {
$proceed = false;
}
}
$bind = [":codice_gestore"=>$_SESSION["ente"]->codice];
$sql = "SELECT codice FROM b_concorsi WHERE codice > 0 ";
if ($_SESSION["utente"]->gerarchia > 10) {
$ids = Utente::getPermissionsInModulo($_SESSION["ente"]->codice,$_SESSION["utente"]->codice,"concorsi");
$ids = implode(",",$ids);
$sql .= " AND codice IN ({$ids}) ";
}
if (!$_SESSION["utente"]->fromHere()) {
$sql .= " AND codice_ente = :codice_ente ";
$bind[":codice_ente"] = $_SESSION["utente"]->codice_ente;
}
$risultato = $pdo->go($sql,$bind);
if ($proceed || ($risultato->rowCount() > 0 && !empty($enti))) {
$stati = concorso::getStati();
?>
<div id="commands" class="mb-5">
<div class="commands container-fluid">
<div class="text-right">
<? if ($proceed) { ?>
<a href="/backend/<?= $radice ?>/edit.php?codice=0" class="btn btn-success" title="<?= __('Aggiungi nuovo') ?>"><span class="fa fa-plus-circle"></span> <?= __('Aggiungi nuovo') ?></a>
<? } ?>
</div>
<div class="row justify-content-between">
<? $col = "col-xl-6" ?>
<? if (!empty($enti)) {
$col = "col-xl-6"; ?>
<div class="col-12 <?= $col ?>">
<label><?= __("Ente beneficiario") ?></label>
<select id="filtroBeneficiario" onChange="table.draw();">
<option value=""><?= __("Tutti") ?></option>
<? foreach($enti AS $ente) {?>
<option value="<?= $ente["codice"] ?>"><?= $ente["denominazione"] ?></option>
<? } ?>
</select>
</div>
<? } ?>
<div class="col-12 <?= $col ?>">
<label><?= __("Stato") ?></label>
<select name="status" id="filtroStatus" onChange="table.draw();">
<option value=""><?= __("Tutti") ?></option>
<?
foreach($stati AS $stat => $stato) {
if ($stat >= 20) {
?>
<option style="border-left: 5px solid <?= $stato["color"] ?>" value="<?= $stat ?>">
<?= __($stato["titolo"]) ?>
</option>
<?
}
}
?>
</select>
</div>
</div>
</div>
</div>
<? } ?>
<? if ($risultato->rowCount() > 0) {
?>
<div class="card mb-2">
<div class="card-body">
<div class="table-responsive">
<h2 id="table-title"></h2>
<table class="table table-striped table-hover" id="tab-data" width="100%">
<thead>
<tr>
<th width="10"></th>
<th width="10"></th>
<th width="10"><?= __("ID") ?></th>
<th width="10"><?= __("CIG") ?></th>
<th width="10"></th>
<th><?= __("Oggetto") ?></th>
<th width="250"><?= __("Valore") ?></th>
<?
if (!empty($enti)) {
?>
<th><?= __("Beneficiario") ?></th>
<?
}
?>
<th width="5"></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<script>
var table = $("#tab-data").DataTable({
"processing": true,
"serverSide": true,
"language": {
"url": "/dictionary/datatables/<?= $_SESSION["language"] ?>.lang"
},
"ajax": {
"url": "table.php",
"data": function (d) {
d.stato = $('#filtroStatus').val();
<? if (!empty($enti)) { ?>d.ente = $('#filtroBeneficiario').val();<? } ?>
}
},
"order": [[2,'desc']],
"lengthMenu": [[25, 50, -1], [25, 50, '<?= __("tutti") ?>']],
"columns": [
{ "orderable": false },
{ "orderable": false },
null,
{ "orderable": false },
null,
null,
null,
<? if (!empty($enti)) { ?>{ "orderable": false },<? } ?>{ "orderable": false }
]
});
</script>
<?
} else {
alertManager::printWarningBox(__("Nessun risultato"));
}
include_once ($beRoot."/layout/bottom.php");
} else {
echo '<meta http-equiv="refresh" content="0;URL=/index.php">';
die();
}
?>