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.
125 righe
4.7 KiB
125 righe
4.7 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
|
|
if (isset($_GET["draw"]) && !empty($_SESSION["utente"]->oe) && $_SESSION['ente']->hasModulo('contratti.documentale')) { |
|
$return = array(); |
|
$return["draw"] = (int)$_GET["draw"]; |
|
$return["recordsTotal"] = (int)0; |
|
$return["recordsFiltered"] = (int)0; |
|
|
|
$contratto = publicStipula::init($_GET['codice_contratto']); |
|
$managerRichieste = RichiestaDocumentale::init($contratto); |
|
|
|
if(!empty($contratto) && !empty($managerRichieste)){ |
|
|
|
$filters = [ |
|
'codice_oe' => $_SESSION["utente"]->oe['codice'], |
|
'codice_contratto' => $contratto->info['codice'], |
|
'bozza' => 'N' |
|
]; |
|
|
|
switch($_GET["order"][0]["column"]) { |
|
case "0": |
|
null ; |
|
break; |
|
case "1": |
|
null; |
|
break; |
|
case "2": |
|
null; |
|
break; |
|
case "3": |
|
null; |
|
break; |
|
case "4": |
|
$orderKey = "timestamp_creazione"; |
|
break; |
|
} |
|
|
|
if ($_GET["order"][0]["dir"] == "desc") { |
|
$order[$orderKey] = "DESC"; |
|
} else { |
|
$order[$orderKey] = "ASC"; |
|
} |
|
|
|
$richieste = $managerRichieste->getRichieste($filters, $order); |
|
|
|
$return["recordsTotal"] = (int)0; |
|
$return["recordsFiltered"] = (int)0; |
|
|
|
if (!empty($richieste)) { |
|
$return["recordsTotal"] = (int)count($richieste); |
|
$richieste = publicRispostaDocumentale::getBadge($contratto->info['codice'], $richieste, "oe"); |
|
|
|
$countRecordFiltered = 0; |
|
foreach ($richieste as $richiesta) { |
|
|
|
$documentale = ContrattoDocumentale::getInfo($richiesta['codice_classe_documentale']); |
|
|
|
$row = array(); |
|
|
|
$row[] = "<span class='pr-2 float-right'><span class='fa fa-circle ". richiestaDocumentale::getBadgeGruppoColore($richiesta)."'></span></span>"; |
|
|
|
if( |
|
(!empty($richiesta['statoLabel']) && !empty(array_intersect($richiesta['statoLabel'], array('20', '25', '30'))) ) |
|
|| |
|
(!empty($richiesta['statoBadges']) && ($richiesta['statoBadges'][20]['contatori'] > 0 || $richiesta['statoBadges'][25]['contatori'] > 0 || $richiesta['statoBadges'][30]['contatori'] > 0)) |
|
){ |
|
$row[] = "<a class='fa fa-exclamation-triangle text-danger' type='button' class='btn btn-secondary' data-toggle='tooltip' data-placement='top' title='". __('Aggiornamento stato di una risposta, si prega di verificare'). "'></a>"; |
|
}else{ |
|
$row[] = ""; |
|
} |
|
|
|
$row[] = $documentale->info['titolo'] ?? null; |
|
$row[] = $richiesta['bloccante'] == 'S' ? __('Si') : __('No') ; |
|
$row[] = mysql2date($richiesta["timestamp_creazione"]); |
|
|
|
|
|
if (!empty($richiesta['statoLabel'])) { |
|
$row[] = "<span class='text-". $richiesta['statoLabel']['class'] ."' >". __($richiesta['statoLabel']['titolo']) . "</span>"; |
|
}elseif(!empty($richiesta['statoBadges'])){ |
|
|
|
ob_start(); |
|
foreach ($richiesta['statoBadges'] as $stat => $value) { |
|
?> |
|
<a href="javascript:void(0)" class="text-decoration-none" title='<?= $value['titolo'] ?>'> |
|
<span class="mr-1 badge badge-<?= $value['class']?> " style="font-size:1em"> <?= (!empty($value['contatori'])) ? $value['contatori'] : 0 ?></span> |
|
</a> |
|
<? |
|
} |
|
$row[] = ob_get_clean(); |
|
|
|
}else{ |
|
$row[] = "<span class='text-warning'>". __('Errore visualizzazione Stati')."</span>"; |
|
} |
|
|
|
|
|
$row[] = "<button type='button' onclick='showModalWithURL(\"/contratti/documentale/gestioneRisposte/managerRisposte.php?codice_contratto={$contratto->info['codice']}&codice_richiesta={$richiesta["codice"]}\")' class='btn btn-primary btn-sm'><span class='fa fa-search'></span></button>"; |
|
|
|
if(!empty($_GET['stato'])){ |
|
|
|
if (!empty($richiesta['statoLabel']) && $richiesta['statoLabel']['key'] == $_GET['stato'] ) { |
|
$countRecordFiltered++; |
|
$return["data"][] = $row; |
|
}elseif(!empty($richiesta['statoBadges']) && $richiesta['statoBadges'][$_GET['stato']]['contatori'] > 0){ |
|
$countRecordFiltered++; |
|
$return["data"][] = $row; |
|
} |
|
}else{ |
|
$countRecordFiltered++; |
|
$return["data"][] = $row; |
|
} |
|
} |
|
$return["recordsFiltered"] = (int)$countRecordFiltered; |
|
} else { |
|
$return["data"] = array(); |
|
} |
|
|
|
}else{ |
|
$return["data"] = array(); |
|
} |
|
|
|
echo json_encode($return); |
|
} |
|
?>
|
|
|