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.
 
 
 
 
 

273 righe
11 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();
$bind = array(":codice_ente"=>(!empty($_SESSION["utente"]->codice_ente)) ? $_SESSION["utente"]->codice_ente : $_SESSION["ente"]->codice);
$sql = "SELECT b_gare.codice
FROM b_gare
JOIN (SELECT MAX(codice) AS last_round, codice_gara, scadenza FROM b_gare_round GROUP BY codice_gara) AS last_gara_round ON b_gare.codice = last_gara_round.codice_gara
JOIN b_gare_round ON last_gara_round.last_round = b_gare_round.codice
WHERE b_gare_round.scadenza < NOW() AND b_gare_round.scadenza > 0 AND b_gare.stato = 20";
$scadute = $pdo->go($sql);
if ($scadute->rowCount() > 0) {
while ($scaduta = $scadute->fetch(PDO::FETCH_ASSOC)) {
$pdo->go("UPDATE b_gare 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("gare.insert");
} else {
$proceed = false;
}
}
$bind = [":codice_gestore"=>$_SESSION["ente"]->codice];
$sql = "SELECT utente_creazione FROM b_gare WHERE codice > 0 ";
if ($_SESSION["utente"]->gerarchia > 10) {
$ids = Utente::getPermissionsInModulo($_SESSION["ente"]->codice,$_SESSION["utente"]->codice,"gare");
$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 = gara::getStati();
$utenti = Utente::getInfoFromID(array_unique($risultato->fetchAll(PDO::FETCH_COLUMN)));
if(!empty($utenti)){
usort($utenti, function($a,$b) {
return $a["cognome"] > $b["cognome"];
});
}
?>
<div id="commands" class="mb-5">
<div class="commands container-fluid">
<div class="text-right">
<?php if (!empty(accordiQuadro::getList())) : ?>
<a href="/backend/<?= $radice ?>/accordi_quadro/index.php" class="btn btn-info" title="<?= __('Accordi quadro') ?>"><span class="fa fa-chart-pie"></span> <?= __('Accordi quadro') ?></a>
<?php endif; ?>
<?php 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>
<?php if($_SESSION["ente"]->hasModulo('rda')) :
$rda = rda::getList(['codice_stato' => 10]);
if(!empty($rda)) :
?>
<a class="btn btn-success" onClick="showModalWithURL('/backend/gare/rda/show.php')">
<i class="fa fa-plus-circle"></i>
<?= __('Crea Gara da RDA') ?>
</a>
<?php
endif;
endif;
?>
<?php if (settingsManager::getValue("rdaEsterne") == "S") : ?>
<a class="btn btn-primary" onClick="showModalWithURL('/backend/gare/rda/remote/list.php')">
<i class="fa fa-plus-circle"></i>
<?= __('Crea Gara da RDA') ?>
</a>
<? endif ?>
<?php endif; ?>
<? if ($_SESSION["utente"]->isSupportoOrRoot()) : ?>
<button class="btn btn-warning" onClick="showModalWithURL('/backend/enti/settings.php?gruppo=gare'); return false">
<span class="fa fa-cogs"></span> <?= __("Impostazioni") ?>
</button>
<?php endif; ?>
<?php if( $_SESSION["utente"]->permission("npa-import")) : ?>
<button
onclick="showModalWithURL('/backend/npa/ajax/import.php?modulo_riferimento=gare')"
class="btn btn-primary">
<i class="fas fa-download"></i>
<?=__('Importa da NPA')?>
</button>
<?php endif; ?>
</div>
<div class="d-none d-md-flex mt-3">
<? $col = "col" ?>
<?php if ($risultato->rowCount() > 0 && !empty($enti)) : ?>
<div class="<?= $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>
<?php endif ?>
<?php if (is_array($utenti) && count($utenti) > 1) : ?>
<div class="<?= $col ?>">
<label><?= __("Utente creatore") ?></label>
<select id="filtroCreatore" onChange="table.draw();">
<option value=""><?= __("Tutti") ?></option>
<? foreach($utenti AS $utente) {?>
<option value="<?= $utente["codice"] ?>"><?= $utente["cognome"] . " " . $utente["nome"] ?></option>
<? } ?>
</select>
</div>
<?php endif ?>
<div class="<?= $col ?>">
<label><?= __("Modalità") ?></label>
<select name="modalita" id="filtroModalita" onChange="table.draw();">
<option value=""><?= __("Tutte") ?></option>
<?
foreach(getModalita() AS $stat => $stato) {
?>
<option value="<?= $stat ?>">
<?= __($stato["titolo"]) ?>
</option>
<?
}
?>
</select>
</div>
<div class="<?= $col ?>">
<label><?= __("Tipologia") ?></label>
<select name="tipologia" id="filtroTipologia" onChange="table.draw();">
<option value=""><?= __("Tutte") ?></option>
<?
foreach(getTipologieAffidamento() AS $stat => $stato) {
?>
<option value="<?= $stat ?>">
<?= __($stato["titolo"]) ?>
</option>
<?
}
?>
</select>
</div>
<div class="<?= $col ?>">
<label><?= __("Procedura") ?></label>
<select name="procedura" id="filtroProcedura" onChange="table.draw();">
<option value=""><?= __("Tutte") ?></option>
<?
foreach(getProcedure() AS $stat => $stato) {
?>
<option value="<?= $stat ?>">
<?= __($stato["titolo"]) ?>
</option>
<?
}
?>
</select>
</div>
<div class="<?= $col ?>">
<label><?= __("Stato") ?></label>
<select name="status" id="filtroStatus" onChange="table.draw();">
<option value=""><?= __("Tutti") ?></option>
<?
foreach($stati AS $stat => $stato) {
?>
<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 width="10"><?= __("Tipologia") ?></th>
<th width="10"><?= __("Procedura") ?></th>
<th><?= __("Oggetto") ?></th>
<th width="250"><?= __("Valore totale") ?></th>
<?
if (!empty($enti)) {
?>
<th><?= __("Beneficiario") ?></th>
<?
}
?>
<th><?= __("Utente creatore") ?></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();
d.procedura = $('#filtroProcedura').val();
d.tipologia = $('#filtroTipologia').val();
d.modalita = $('#filtroModalita').val();
<?php if (count($utenti) > 1) : ?>d.creatore = $('#filtroCreatore').val();<?php endif ?>
<?php if (!empty($enti)) : ?>d.ente = $('#filtroBeneficiario').val();<?php endif ?>
}
},
"order": [[2,'desc']],
"lengthMenu": [[25, 50, -1], [25, 50, '<?= __("tutti") ?>']],
"columns": [
{ "orderable": false },
{ "orderable": false },
null,
{ "orderable": false },
null,
null,
null,
null,
null,
{ "orderable": false },
<? 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();
}
?>