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.
199 righe
9.1 KiB
199 righe
9.1 KiB
<? if (isset($criterio) && isset($data) && isset($bozza) && isset($attachID) && isset($dataSql)) { ?> |
|
<div class="card mb-2"> |
|
<div class="card-header"> |
|
<strong class="card-title"> |
|
<? |
|
if (!empty($criterio["codice_padre"])) { |
|
$padre = $this->getCriteri($criterio["codice_padre"])[0]; |
|
?> |
|
<small><?= $padre["denominazione"] ?></small><br> |
|
<? |
|
} |
|
?> |
|
<?= $criterio["denominazione"] ?> |
|
</strong> |
|
</div> |
|
<div class="card-body"> |
|
<? |
|
foreach ($form AS $input) { |
|
$name = "criterio-form-input[". $input["codice"] . "]"; |
|
$value = ""; |
|
if (!empty($data)) { |
|
if (is_numeric($data)) { |
|
$content = $this->db->go($dataSql,[":input"=>$input["codice"],":offerta"=>$data])->fetch(PDO::FETCH_ASSOC); |
|
if (!empty($content)) { |
|
if (!empty($content["content"]) || $content["content"] == "0") { |
|
$value = $content["content"]; |
|
if($input["tipo"] == "file" || $input["tipo"] == "image") { |
|
$value = json_decode($value,true); |
|
$value["codice"] = $content["codice"]; |
|
$value = json_encode($value); |
|
} |
|
} |
|
} |
|
} else if (is_array($data)) { |
|
$value = $data[$input["codice"]] ?? ""; |
|
} |
|
} |
|
?> |
|
<div class="card card-body my-1"> |
|
<label <?= (!$edit) ? 'class="value-label"' : "" ?> for="<?= $name ?>"> |
|
<strong class="h5"><?= $input["titolo"] ?> <? if ($input["obbligatorio"]=="S") echo "*" ?></strong><br> |
|
<?= $input["descrizione"] ?> |
|
</label> |
|
<? |
|
filesManager::printList($input["codice"],$attachID,"A",0,false); |
|
if ($bozza) { $input["obbligatorio"] = "N"; } |
|
if (!$edit) { |
|
?><div class="value-container"><? |
|
switch ($input["tipo"]) { |
|
case "image": |
|
case "file": |
|
if (!empty($value)) { |
|
$file = json_decode($value,true); |
|
$link = (!empty($file["codice"])) ? "{$viewFormAttachPath}?codice={$file["codice"]}" : ""; |
|
if (!empty($this->commissario) && !empty($link)) { |
|
$link .= "&valutatore=1"; |
|
} |
|
if (!empty($file)) { |
|
?> |
|
<div class="text-center"> |
|
<? |
|
if ($input["tipo"] == "file") { |
|
addBypassCheckURL($link); |
|
if (!empty($link)) { ?><a target="_blank" href="<?= $link ?>"><? } ?> |
|
<span class="far fa-file"></span> |
|
<strong class="h4"><?= $file["filename"] ?></strong><br> |
|
<? if (!empty($link)) { ?></a><? } ?> |
|
<br>SHA256: <?= $file["sha256"] ?> |
|
<? } else { |
|
$file["content"] = simple_decrypt($file["content"],$config["simple_encrypt"]["offer"]); ?> |
|
<img class="img-fluid" src="data:<?= $file["mime"] ?>;base64,<?= base64_encode($file["content"]) ?>"> |
|
<? } ?> |
|
</div> |
|
<? |
|
$input["obbligatorio"] = "N"; |
|
} |
|
} |
|
break; |
|
case "select_json": |
|
$sources = json_decode($input["opzioni"]); |
|
$options = array(); |
|
foreach($sources AS $source) { |
|
$source = sanitize_string($source); |
|
if (file_exists($this->root."/form/json/".$source)) { |
|
$tmp = json_decode(file_get_contents($this->root."/form/json/".$source),true); |
|
foreach ($tmp AS $op_value => $op_label) { |
|
$options[$op_value] = (!empty($op_label)) ? $op_label : $op_label; |
|
} |
|
} |
|
} |
|
if (!empty($options[$value])) { echo $options[$value]; } |
|
break; |
|
case "valuta": |
|
if (is_numeric($value)) { |
|
echo number_format($value,$criterio["decimali"] ?? 2,",","."); |
|
} |
|
break; |
|
default: |
|
echo $value; |
|
break; |
|
} |
|
?></div><? |
|
} else { ?> |
|
<div class="form-group"> |
|
<? |
|
$nameAppend = ""; |
|
switch ($input["tipo"]) { |
|
case "blob": |
|
?> |
|
<textarea rows="5" rel="<?= $input["obbligatorio"] ?>;0;0;A" class="criterio-input ckeditor_simple form-control" title="<?= $input["titolo"] ?>" name="<?= $name ?>[value]"><?= $value ?></textarea> |
|
<? |
|
break; |
|
case "multiple": |
|
$nameAppend = "[]"; |
|
$value = json_decode($value,true); |
|
case "select": |
|
$options = json_decode($input["opzioni"]); |
|
?> |
|
<select rel="<?= $input["obbligatorio"] ?>;0;0;A" <?= !empty($nameAppend) ? "multiple" : "" ?> class="criterio-input form-control" title="<?= $input["titolo"] ?>" name="<?= $name ?>[value]<?= $nameAppend ?>"> |
|
<option value="">Seleziona...</option> |
|
<? |
|
if (!is_array($value)) { $value = [$value]; } |
|
foreach($options AS $option) { |
|
$selected = ""; |
|
if (in_array($option,$value) !== false) { $selected = "selected"; } |
|
?><option <?= $selected ?>><?= $option ?></option><? |
|
} |
|
?> |
|
</select> |
|
<? |
|
break; |
|
case "image": |
|
case "file": |
|
if (!empty($value)) { |
|
$file = json_decode($value,true); |
|
$link = (!empty($file["codice"])) ? "{$viewFormAttachPath}?codice={$file["codice"]}" : ""; |
|
if (!empty($this->commissario) && !empty($link)) { |
|
$link .= "&valutatore=1"; |
|
} |
|
if (!empty($file)) { |
|
?> |
|
<div class="p-3 mb-3"> |
|
<span id="old-label-<?= $input["codice"] ?>"> |
|
<? if (!empty($link)) { ?><a target="_blank" href="<?= $link ?>"><? } ?> |
|
<span class="far fa-file"></span> |
|
<strong><?= $file["filename"] ?></strong><br> |
|
SHA256: <?= $file["sha256"] ?> |
|
<? if (!empty($link)) { ?></a><? } |
|
$input["obbligatorio"] = "N"; |
|
?> |
|
</span> |
|
<button class="float-right btn btn-sm btn-danger" onclick='$("#old-<?= $input["codice"] ?>").val("");$("#old-label-<?= $input["codice"] ?>").remove(); <? if ($input["obbligatorio"] == "S") { ?>$("#file-<?= $input["codice"] ?>").attr("rel","S;1;0;A");<?}?>return false;'><span class="fa fa-times"></span><span class="sr-only"><?= __('Elimina') ?></span></button> |
|
<div class="clearfix"></div> |
|
</div> |
|
<input type="hidden" id="old-<?= $input["codice"] ?>" class="criterio-input" name="<?= $name ?>[value]" value="<?= htmlentities($value) ?>"> |
|
<? |
|
$input["obbligatorio"] = "N"; |
|
} |
|
} |
|
?> |
|
<input type="hidden" rel="<?= $input["obbligatorio"] ?>;1;0;A" class="criterio-input" title="<?= $input["titolo"] ?>" name="<?= $name ?>[file]" value="" id="file-<?= $input["codice"] ?>"> |
|
<? |
|
$options = ["maxNumberOfFiles"=>1,"maxFileSize"=>10485760,"onFileAddScript"=>'$("#file-'.$input["codice"].'").val("");']; |
|
if (isset($parentAllowedTypes)) { |
|
$options["allowedTypes"] = $parentAllowedTypes; |
|
} |
|
if ($input["tipo"] != "file") { |
|
$options["allowedTypes"] = [ |
|
".jpeg", |
|
".jpg", |
|
".png", |
|
".gif" |
|
]; |
|
} |
|
filesManager::insertUploadForm('$("#file-'.$input["codice"].'").val(file.name);',"inputFormUpload-{$input["codice"]}",$options); |
|
break; |
|
default: |
|
$type = "A"; |
|
if (in_array($input["tipo"], array("number","valuta"))!==false) { $type = "N"; } |
|
if ($input["tipo"]=="link") { $type = "L"; } |
|
if ($input["tipo"]=="date") { $type = "D"; } |
|
if (!empty($input["tipoRel"])) { $type = $input["tipoRel"]; } |
|
?> |
|
<input type="text" rel="<?= $input["obbligatorio"] ?>;0;0;<?= $type ?>" class="criterio-input form-control <?= ($input["tipo"]=="date") ? "datepick" : "" ?>" title="<?= $input["titolo"] ?>" name="<?= $name ?>[value]" value="<?= $value ?>"> |
|
<? |
|
break; |
|
} |
|
?> |
|
</div> |
|
<? |
|
} |
|
?> |
|
</div> |
|
<? |
|
} |
|
?> |
|
</div> |
|
</div> |
|
<? } ?>
|