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.
240 righe
12 KiB
240 righe
12 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$error = true; |
|
if (!empty($_SESSION["utente"])) { |
|
$manager = new richiesteOE($_GET["modulo"],$_GET["codice_elemento"],$_GET["sub"]); |
|
if ($manager->checkAdminPermission()) { |
|
$infoModulo = richiesteOE::moduliAbilitati()[$manager->getModuloRiferimento()] ?? null; |
|
$infoUtente = (!empty($infoModulo["riferimento_partecipante"]) && $infoModulo["riferimento_partecipante"] == "utente"); |
|
$tipologie = $manager->tipologie(); |
|
if (!empty($_GET["codice"])) { |
|
$tmp = $manager->getRichieste("N",["codice"=>$_GET["codice"]]); |
|
if (!empty($tmp)) { |
|
$richiesta = $tmp[0]; |
|
} |
|
} else { |
|
$richiesta = get_campi("b_richieste_oe"); |
|
if (!empty($_GET["codice_derivazione"])) { |
|
$derivazione = $manager->getRichieste("N",["codice"=>$_GET["codice_derivazione"]])[0] ?? false; |
|
if (!empty($derivazione)) { |
|
$richiesta["codice_derivazione"] = $derivazione["codice"]; |
|
$richiesta["tipologia"] = $derivazione["tipologia"]; |
|
$richiesta["firma"] = $derivazione["firma"]; |
|
$richiesta["titolo"] = $derivazione["titolo"]; |
|
$richiesta["testo"] = $derivazione["testo"]; |
|
$richiesta["scadenza"] = date("Y-m-d",strtotime("+10 days")) . " 14:00:00"; |
|
} |
|
} else { |
|
$suggestion = $manager->getObject()->info["oggetto"] ?? ""; |
|
$richiesta["scadenza"] = date("Y-m-d",strtotime("+10 days")) . " 14:00:00"; |
|
} |
|
if (!empty($_GET["quickCreate"])) { |
|
if (!empty($_GET["tipologia"])) { |
|
if (isset($tipologie[$_GET["tipologia"]])) { |
|
$richiesta["tipologia"] = $_GET["tipologia"]; |
|
} |
|
} |
|
if (!empty($_GET["codice_operatore"])) { |
|
$quickOperatore = $_GET["codice_operatore"]; |
|
} |
|
} |
|
} |
|
if (!empty($richiesta) && !empty($manager->partecipanti)) { |
|
$error = false; |
|
?> |
|
<script> |
|
if (typeof _suggestRequestObject !== "function") { |
|
function _suggestRequestObject(sel) { |
|
$("#titolo").val(sel.options[sel.selectedIndex].text + " - <?= str_replace('"',"",$suggestion??"") ?>"); |
|
} |
|
} |
|
</script> |
|
<form rel="validate" method="post" action="/backend/common/richiesteOE/save.php" id="submit-richiesta-form"> |
|
<input id="token" type="hidden" name="token" value="<?= tokenGen() ?>"> |
|
<input id="modulo" type="hidden" name="modulo" value="<?= $manager->modulo ?>"> |
|
<input id="elemento" type="hidden" name="codice_elemento" value="<?= $manager->elemento ?>"> |
|
<input id="subElemento" type="hidden" name="sub" value="<?= $manager->sub ?>"> |
|
<input id="codice" type="hidden" name="codice" value="<?= $richiesta["codice"] ?>"> |
|
<input id="codice_derivazione" type="hidden" name="codice_derivazione" value="<?= $richiesta["codice_derivazione"] ?>"> |
|
<input id="stato-richiesta" type="hidden" name="attivo" value="N"> |
|
<div class="card my-2"> |
|
<div class="card-header"> |
|
<h3 class="card-title m-0"><?= __("Info") ?></h3> |
|
</div> |
|
<div class="card-body"> |
|
<div class="row"> |
|
<div class="col-12 col-lg-3"> |
|
<div class="form-group"> |
|
<label for="tipologia"><?= __("tipo") ?></label> |
|
<select id="tipologia" class="form-control" onchange="_suggestRequestObject(this)" name="tipologia" title="<?= __("tipo") ?>" rel="S;0;0;A"> |
|
<option value=""><?= __("Seleziona") ?>...</option> |
|
<? |
|
foreach ($tipologie AS $key => $tipologia) { |
|
?> |
|
<option value="<?= $key ?>" <?= ($key == $richiesta["tipologia"]) ? "selected" : "" ?>><?= __($tipologia) ?></option> |
|
<? |
|
} |
|
?> |
|
</select> |
|
</div> |
|
</div> |
|
<div class="col-12 col-lg-3"> |
|
<div class="form-group"> |
|
<label for="scadenza"><?= __("Scadenza") ?>*</label> |
|
<input type="text" id="scadenza" class="form-control datetimepick" name="scadenza" title="<?= __("Scadenza") ?>" rel="S;16;16;DT;<?= date('d/m/Y H:i:s') ?>;>" value="<?= mysql2datetime($richiesta["scadenza"]) ?>"> |
|
</div> |
|
</div> |
|
<div class="col-12 col-lg-3"> |
|
<div class="form-group"> |
|
<label for="apertura"><?= __("apertura") ?></label> |
|
<input type="text" id="apertura" class="form-control datetimepick" name="apertura" title="<?= __("apertura") ?>" rel="N;16;16;DT;scadenza;>" value="<?= mysql2datetime($richiesta["apertura"]) ?>"> |
|
</div> |
|
</div> |
|
<div class="col-12 col-lg-3"> |
|
<div class="form-group"> |
|
<label for="firma"><?= __("Richiedi firma digitale") ?>*</label> |
|
<? if ($manager->modulo != "concorsi") { ?> |
|
<select id="firma" class="form-control" name="firma" title="<?= __("Richiedi firma digitale") ?>" rel="S;0;0;A"> |
|
<option value=""><?= __("Seleziona") ?>...</option> |
|
<option value="S" <?= ($richiesta["firma"] == "S") ? "selected" : "" ?>><?= __("Si") ?></option> |
|
<option value="N" <?= ($richiesta["firma"] == "N") ? "selected" : "" ?>><?= __("No") ?></option> |
|
</select> |
|
<? } else { ?> |
|
<input id="firma" type="hidden" class="form-control" name="firma" title="<?= __("Richiedi firma digitale") ?>" value="N"> |
|
<br><?= __("No") ?> |
|
<? } ?> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="card my-2"> |
|
<div class="card-header"> |
|
<h3 class="card-title m-0" data-target="#corpo-richiesta"><?= __("Richiesta") ?></h3> |
|
</div> |
|
<div class="card-body" id="corpo-richiesta"> |
|
<div class="form-group"> |
|
<label for="titolo"><?= __("oggetto") ?>*</label> |
|
<input rel="S;1;0;A" type="text" class="form-control input-lg" title="<?= __("oggetto") ?>" name="titolo" id="titolo" value="<?= strip_tags($richiesta["titolo"]) ?>"> |
|
</div> |
|
<div class="form-group"> |
|
<label for="testo"><?= __("Testo") ?>*</label> |
|
<textarea title="<?= __("Testo") ?>" rel="S;1;0;A" class="ckeditor_simple" name="testo" id="testo"> |
|
<?= $richiesta["testo"] ?> |
|
</textarea> |
|
</div> |
|
<div id="file-richiesta"> |
|
<label><?= __("Allegati") ?></label> |
|
<div> |
|
<? |
|
if (!empty($richiesta["codice"])) { |
|
filesManager::printList($richiesta["codice"],"richieste","A",0,true); |
|
} |
|
?> |
|
</div> |
|
<div> |
|
<? |
|
filesManager::printForm("richiesta"); |
|
?> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="card my-2"> |
|
<div class="card-header"> |
|
<h3 class="card-title m-0" data-target="#destinatari-richiesta"><?= __("Destinatari") ?></h3> |
|
</div> |
|
<div class="card-body" id="destinatari-richiesta"> |
|
<div class="text-right mb-1"> |
|
<span class="fa fa-search"></span> <input type="text" onkeyup="filtra($(this).val(),'#richiesta-table','tr');" class="input-sm" placeholder="<?= __("Cerca") ?>"> |
|
</div> |
|
<table class="table table-striped" width="100%"> |
|
<thead> |
|
<tr> |
|
<? if ($infoUtente) { ?> |
|
<th width="10"><?= __("Codice fiscale") ?></th> |
|
<th><?= __("Nominativo") ?></th> |
|
<? } else if ($manager->modulo != "concorsi") { ?> |
|
<th width="10"><?= __("Partita IVA") ?></th> |
|
<th><?= __("Ragione Sociale") ?></th> |
|
<? } else { ?> |
|
<th><?= __("Partecipante") ?></th> |
|
<? } ?> |
|
<th width="20%"></th> |
|
</tr> |
|
</thead> |
|
<tbody id="richiesta-table"> |
|
<? foreach($manager->partecipanti AS $partecipante) { |
|
|
|
if ($infoUtente) { |
|
$info = utente::getInfoFromID($partecipante["codice_operatore"]); |
|
} else { |
|
$info = oeManager::getOE($partecipante["codice_operatore"]); |
|
} |
|
?> |
|
<tr> |
|
<? if ($infoUtente) { ?> |
|
<td width="120"><?= $info["cf"] ?></td> |
|
<td> |
|
<strong> |
|
<?= $info["cognome"] . " " . $info["nome"] ?> |
|
</strong> |
|
</td> |
|
<? } else if ($manager->modulo != "concorsi") { ?> |
|
<td width="120"><?= (!empty($info["partita_iva"])) ? $info["partita_iva"] : $info["codice_fiscale_impresa"] ?></td> |
|
<td> |
|
<a href="#" title="<?= __("visualizza") ?>" onclick="showCompany(<?= $partecipante["codice_operatore"] ?>); return false"> |
|
<strong> |
|
<?= $info["ragione_sociale"] ?> |
|
</strong> |
|
</a> |
|
</td> |
|
<? } else { ?> |
|
<td><?= $partecipante["id"] ?></td> |
|
<? } ?> |
|
<td class="text-right"> |
|
<? |
|
$add = true; |
|
if (!empty($richiesta["codice"])) { |
|
$sql = "SELECT codice FROM r_richieste_oe WHERE codice_richiesta = :codice AND codice_operatore = :codice_operatore "; |
|
$ris_richiesta = $pdo->go($sql,array(":codice"=>$richiesta["codice"],":codice_operatore"=>$partecipante["codice_operatore"])); |
|
if ($ris_richiesta->rowCount() > 0) { |
|
$add = false; |
|
} |
|
} |
|
if ($add) { |
|
?> |
|
<div class="form-check"> |
|
<input <?= (count($manager->partecipanti) === 1 || (!empty($quickOperatore) && $partecipante["codice_operatore"] == $quickOperatore)) ? "checked" : "" ?> autocomplete="off" class="form-check-input big-checkbox" type="checkbox" name="destinatari[]" value="<?= $partecipante["codice_operatore"] ?>"> |
|
</div> |
|
<? |
|
} else { |
|
echo __("Già selezionato"); |
|
} |
|
?> |
|
</td> |
|
</tr> |
|
<? |
|
} |
|
?> |
|
</tbody> |
|
</table> |
|
</div> |
|
</div> |
|
<div class="btn-group btn-block"> |
|
<? if ($richiesta["attivo"] != "S") { ?> |
|
<button type="button" onClick="confirmSubmitRichiesta('N')" class="btn btn-warning btn-block mt-2"><span class="fa fa-save"></span> <?= __("Salva bozza") ?></button> |
|
<? } ?> |
|
<button type="button" onClick="confirmSubmitRichiesta('S')" class="btn btn-info btn-block mt-2"><span class="fa fa-paper-plane"></span> <?= __("Salva e invia") ?></button> |
|
</div> |
|
</form> |
|
<? |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?>
|
|
|