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.
250 righe
11 KiB
250 righe
11 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$error = true; |
|
if (!empty($_GET) && !empty($_SESSION["utente"]) && $_SESSION["utente"]->gerarchia < 100) { |
|
if (!empty($_GET["modulo"]) && !empty($_GET["codice_elemento"])) { |
|
$manager = new Commissione($_GET["modulo"],$_GET["codice_elemento"],"commissione"); |
|
$query_string = http_build_query($_GET); |
|
if ($manager->checkAdminPermission()) { |
|
$object = $manager->getObject(null); |
|
if (!empty($object)) { |
|
$criteri = []; |
|
$totaleValutazioni = 0; |
|
$continua = true; |
|
if (method_exists($object,"setLotto")) { |
|
$continua = false; |
|
if (!empty($_GET["codice_lotto"]) && $object->setLotto($_GET["codice_lotto"])) { |
|
$continua = true; |
|
} |
|
} |
|
$tmp = $object->getCriteriValutabili(); |
|
$valutazioni = $object->getCoefficientiValutazione(); |
|
if (!empty($continua)) { |
|
foreach($tmp AS $criterio) { |
|
if ($criterio["tipologia"] == "Q") { |
|
$criteri[$criterio["codice"]] = $criterio; |
|
$totaleValutazioni++; |
|
} |
|
} |
|
$partecipanti = $object->getPartecipanti(NULL,TRUE); |
|
if (!empty($criteri) && !empty($partecipanti)) { |
|
ob_start(); |
|
$error = false; |
|
$commissari = $manager->getCommissari($_GET["codice_utente"] ?? NULL); |
|
foreach($partecipanti AS $index => $partecipante) { |
|
$partecipante["codice_partecipante"] = $partecipante["codice"]; |
|
$partecipanti[$index] = $partecipante; |
|
} |
|
if (!empty($commissari)) { |
|
$commissario = $commissari[0]; |
|
?> |
|
<h3><span class="fa fa-user"></span> <?= $commissario["cognome"] . " " .$commissario["nome"] ?></h3> |
|
<div class="card card-body mb-2"> |
|
<div class="table-responsive"> |
|
<table class="table table-striped"> |
|
<thead> |
|
<tr> |
|
<th class="text-center" width="10">#<th> |
|
<th class="text-center"><?= __("Partecipante") ?></th> |
|
</tr> |
|
</thead> |
|
<tbody> |
|
<? |
|
$cont = "A"; |
|
foreach($partecipanti AS $index => $partecipante) { |
|
?> |
|
<tr> |
|
<td><?= $cont ?></td> |
|
<td width="200"> |
|
<?= (!empty($partecipante["partita_iva"])) ? $partecipante["partita_iva"] : $partecipante["codice_fiscale"] ?> |
|
</td> |
|
<td> |
|
<?= $partecipante["ragione_sociale"] ?> |
|
</td> |
|
</tr> |
|
<? |
|
$partecipanti[$index]["id"] = $cont; |
|
$cont++; |
|
} |
|
?> |
|
</tbody> |
|
</table> |
|
</div> |
|
</div> |
|
<? |
|
foreach($criteri AS $criterio) { |
|
?> |
|
<div class="card card-body mb-2"> |
|
<span class="h4"> |
|
<strong><?= $criterio["denominazione"] ?></strong><br> |
|
<small><?= $criterio["descrizione"] ?></small> |
|
</span> |
|
<div class="table-responsive"> |
|
<table class="table table-striped"> |
|
<tr> |
|
<th style="text-align:center" class="etichetta">#</th> |
|
<? |
|
$row = "A"; |
|
$i = 0; |
|
$columns = $partecipanti; |
|
next($columns); |
|
next($columns); |
|
$col = "A"; |
|
foreach($columns AS $part_b) { |
|
if ($col != "A") { |
|
?> |
|
<th style="text-align:center" class="etichetta"><?= $col ?></th> |
|
<? |
|
} |
|
$col++; |
|
} |
|
?> |
|
</tr> |
|
<? |
|
$sql_value = "SELECT * FROM b_confronto_coppie |
|
WHERE codice_commissione = :codice_commissione |
|
AND codice_criterio = :codice_criterio |
|
AND codice_utente = :codice_utente |
|
AND codice_partecipante_1 = :codice_row |
|
AND codice_partecipante_2 = :codice_col "; |
|
$ris_value = $pdo->prepare($sql_value); |
|
$ris_value->bindValue(":codice_commissione",$manager->getInfo()["codice"]); |
|
$ris_value->bindValue(":codice_criterio",$criterio["codice"]); |
|
$ris_value->bindValue(":codice_utente",$commissario["codice_utente"]); |
|
|
|
$last = end($partecipanti); |
|
foreach($partecipanti AS $part_a) { |
|
$ris_value->bindValue(":codice_row",$part_a["codice"]); |
|
reset($columns); |
|
if ($part_a["codice"]!=$last["codice"]) { |
|
?> |
|
<tr> |
|
<th style="text-align:center" class="etichetta"><?= $row ?></th> |
|
<? |
|
$col = "A"; |
|
foreach($columns AS $part_b) { |
|
$ris_value->bindValue(":codice_col",$part_b["codice"]); |
|
$ris_value->execute(); |
|
$val = []; |
|
if ($ris_value->rowCount() == 1) { |
|
$value = $ris_value->fetch(PDO::FETCH_ASSOC); |
|
$val[0] = $value["punteggio_partecipante_1"]; |
|
$val[1] = $value["punteggio_partecipante_2"]; |
|
if (!isset($totali[$commissario["codice"]])) { $totali[$commissario["codice"]] = []; } |
|
if (!isset($totali[$commissario["codice"]][$part_a["codice"]])) { $totali[$commissario["codice"]][$part_a["codice"]] = 0; } |
|
if (!isset($totali[$commissario["codice"]][$part_b["codice"]])) { $totali[$commissario["codice"]][$part_b["codice"]] = 0; } |
|
$totali[$commissario["codice"]][$part_a["codice"]] += $val[0]; |
|
$totali[$commissario["codice"]][$part_b["codice"]] += $val[1]; |
|
} |
|
if ($col != "A") { |
|
if ($col > $row) { |
|
echo "<td style='text-align:center'>"; |
|
if (isset($val[0]) && isset($val[1])) { |
|
if ($val[0] > $val[1]) { |
|
echo $part_a["id"].$val[0]; |
|
} else if ($val[1] > $val[0]) { |
|
echo $part_b["id"].$val[1]; |
|
} else { |
|
echo $part_a["id"].$part_b["id"]."1"; |
|
} |
|
} |
|
} else { |
|
echo "<td class='etichetta'>"; |
|
} |
|
echo "</td>"; |
|
} |
|
$col++; |
|
} |
|
?> |
|
</tr> |
|
<? |
|
$row++; |
|
} |
|
} |
|
?> |
|
</table> |
|
</div> |
|
</div> |
|
<? |
|
} |
|
} |
|
$html = ob_get_clean(); |
|
if (empty($_GET["pdf"])) { |
|
echo $html; |
|
$_GET["pdf"] = true; |
|
$query_string = http_build_query($_GET); |
|
?> |
|
<a target="_blank" href="/backend/common/commissioni/coppie.php?<?= $query_string ?>" class="btn btn-block btn-danger"> |
|
<span class="far fa-file-pdf"></span> <?= __("Esporta PDF") ?> |
|
</a> |
|
<? |
|
} else { |
|
ob_start(); |
|
?> |
|
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> |
|
<title><?= __("Matrice confronto a coppie") ?></title> |
|
<style type="text/css"> |
|
html, body { |
|
margin: 0px; |
|
padding: 0px; |
|
} |
|
body { |
|
font-family: "Helvetica", sans-serif; |
|
font-size: 10pt; |
|
padding-top: 1cm; |
|
} |
|
|
|
.card { |
|
margin:0.1cm 0.5cm; |
|
padding:0.5cm; |
|
border: 1px solid #000; |
|
} |
|
|
|
.text-center { |
|
text-align:center |
|
} |
|
|
|
table { |
|
width: 100%; |
|
border-spacing: 0; |
|
border-collapse: collapse; |
|
} |
|
th { |
|
background-color:#CCC; |
|
} |
|
td,th { |
|
border: 1px solid #666; |
|
margin:0; |
|
padding: 0.2cm; |
|
} |
|
|
|
</style> |
|
</head> |
|
<body> |
|
<h1 style="margin-left:0.5cm"><?= $manager->getInfo()["oggetto"] ?></h1> |
|
<? |
|
$html = ob_get_clean() . $html . "</body></html>"; |
|
$content = documentConverter::getPDFWithDOMPDF($html,"A3","landscape"); |
|
$fileName = 'Matrice-confronto-coppie.pdf'; |
|
if (!empty($content)) { |
|
$error = false; |
|
header("Content-type:application/pdf"); |
|
header("Content-Disposition:attachment;filename={$fileName}"); |
|
echo $content; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?>
|
|
|