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.
215 righe
7.6 KiB
215 righe
7.6 KiB
<?php |
|
$data_verifier = new DataVerifier( |
|
$_GET, |
|
[ |
|
"begin.numeric.null.null.none", |
|
"end.numeric.null.null.none", |
|
"page.numeric.null.null.none", |
|
"type.string.null.null.none", |
|
"search.string.null.null.none", |
|
"module.string.null.null.none", |
|
"hierarchy.string.null.null.none" |
|
] |
|
); |
|
if (!$data_verifier->validate()) { |
|
http_response_code(403); |
|
die(); |
|
} |
|
|
|
$args = [ |
|
"page" => 0, |
|
"type" => "ALL", |
|
"search" => "", |
|
"module" => "all", |
|
"hierarchy" => "all", |
|
"begin" => "", |
|
"end" => "", |
|
"command" => null, |
|
"search" => null |
|
]; |
|
|
|
// TODO Validazione specifica per argomento |
|
foreach($args as $arg => $default) { |
|
$$arg = isset($_REQUEST[$arg]) ? $_REQUEST[$arg] : $default; |
|
if ($arg != "begin" && $arg != "end") { |
|
$$arg = sanitize_string($$arg, [], "-", false); |
|
} |
|
} |
|
|
|
|
|
if (empty($command)) { |
|
include_once $root . "/backend/layout/top.php"; |
|
} |
|
if (!empty($_SESSION["utente"])) { |
|
$total_changelogs = $changelog_parser->countAll($type, $search); |
|
if (empty($command)) : |
|
?> |
|
|
|
<div class="container-fluid pt-5 pb-3"> |
|
<div class="row"> |
|
<div class="col-12"> |
|
<h2> |
|
<span class="d-block display-4 mb-0 pb-0"> |
|
<i class="fas fa-fire-alt"></i> |
|
<?=__('Ultime novità')?> |
|
</span> |
|
<p class="mb-0 pb-0 lead"><?= __('Aggiornamenti e ultime modifiche') ?></p> |
|
</h2> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="d-flex justify-content-end"> |
|
<a class="btn btn-primary m-2" data-toggle="collapse" href="#search-container" role="button"><span class="fas fa-search"></span> <?=__('Ricerca')?></a> |
|
</div> |
|
<div id="search-container" class="collapse"> |
|
<div class="container-fluid card my-2"> |
|
|
|
<div class="row pt-2"> |
|
<div class="col-6"> |
|
<div class="form-group"> |
|
<label for="search"><?=__('Ricerca')?>:</label> |
|
<input class="search form-control" name="search" type="text" value="<?= $search ?>"> |
|
</div> |
|
</div> |
|
|
|
<div class="col-6"> |
|
<div class="form-group"> |
|
<label for="type"><?=__('Tipologia')?>:</label> |
|
<select class="search custom-select" name="type"> |
|
<option value="ALL"><?= __('Tutti') ?></option> |
|
<? foreach ($changelog_parser->severities as $key => $value) : ?> |
|
<option value="<?= $key ?>"><?= __($value["label"]) ?></option> |
|
<? endforeach; ?> |
|
</select> |
|
</div> |
|
</div> |
|
|
|
<div class="col-6"> |
|
<div class="form-group"> |
|
<label for="data_inizio"><?=__('Data inizio')?>:</label> |
|
<input class="search form-control datetimepick" name="begin" type="text" value="<?= $begin ?>"> |
|
</div> |
|
</div> |
|
|
|
<div class="col-6"> |
|
<div class="form-group"> |
|
<label for="data_inizio"><?=__('Data fine')?>:</label> |
|
<input class="search form-control datetimepick" name="end" type="text" value="<?= $end ?>"> |
|
</div> |
|
</div> |
|
|
|
|
|
<div class="col-6"> |
|
<div class="form-group"> |
|
<label for="type"><?=__('Modulo')?>:</label> |
|
<select class="search custom-select" name="module"> |
|
<option value="all"><?= __('Tutti') ?></option> |
|
<? foreach ($changelog_parser->modules as $key => $value) : ?> |
|
<option value="<?= $key ?>"><?= __($value) ?></option> |
|
<? endforeach; ?> |
|
</select> |
|
</div> |
|
</div> |
|
|
|
<div class="col-6"> |
|
<div class="form-group"> |
|
<label for="type"><?=__('Gerarchia')?>:</label> |
|
<select class="search custom-select" name="hierarchy"> |
|
<option value="all"><?= __('Tutti') ?></option> |
|
<? foreach ($changelog_parser->hierarchies as $key => $value) : ?> |
|
<option value="<?= $key ?>"><?= __($value) ?></option> |
|
<? endforeach; ?> |
|
</select> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
</div> |
|
</div> |
|
<div class="container-fluid card changelogs-container"> |
|
<?php |
|
endif; |
|
$current_changelogs = $changelog_parser->getAllChangelogs( |
|
$_SESSION["utente"]->codice, |
|
PAGE_SIZE, |
|
$page, |
|
$type, |
|
$search, |
|
$module, |
|
$hierarchy, |
|
$begin, |
|
$end |
|
); |
|
$changelog_parser->templateWrapper->renderChangelogs( |
|
$current_changelogs, |
|
); |
|
if (empty($command)): |
|
?></div><?php |
|
$changelog_parser->templateWrapper->renderScroll( |
|
$page, |
|
$type, |
|
$search, |
|
$module, |
|
$hierarchy, |
|
$begin, |
|
$end |
|
); |
|
endif; |
|
if (empty($command)) : |
|
?> |
|
<style> |
|
#toup { |
|
position: fixed; |
|
padding: 0.4em; |
|
margin: 0.4em; |
|
border-radius: 100%; |
|
width: 54px; |
|
height: 54px; |
|
font-size: 18pt; |
|
bottom: 0px; |
|
right: 0px; |
|
display:flex; |
|
z-index: 10000; |
|
border: 4px solid #007bff; |
|
} |
|
</style> |
|
<a id="toup" class="bg-white text-primary btn" href="javascript:toUp()"> |
|
<i class="fas m-auto fa-chevron-up"></i> |
|
</a> |
|
<script type="text/javascript"> |
|
|
|
$("#toup").fadeOut(0); |
|
function toUp() { |
|
$('main').animate({ scrollTop: 0 }, 'slow'); |
|
$("#toup").fadeOut('slow'); |
|
} |
|
|
|
$('main').on('wheel', function(event) { |
|
if ($('main').scrollTop() > 0) { |
|
$("#toup").fadeIn('slow'); |
|
} else { |
|
$("#toup").fadeOut('slow'); |
|
} |
|
}) |
|
|
|
$(".search").on('change', function() { |
|
let params = ["command=page", "page=0"]; |
|
$(".search").each(function() { |
|
if ($(this).val()) { |
|
window[$(this).attr('name')] = $(this).val() |
|
params.push($(this).attr('name') + "=" + $(this).val()); |
|
} |
|
}) |
|
$(".changelogs-container").html(""); |
|
$.ajax({ |
|
type: "GET", |
|
url: "/backend/changelogs/endpoint.php?" + params.join("&") |
|
}).then(function(response) { |
|
$(".changelogs-container").html(response); |
|
}) |
|
}) |
|
</script> |
|
<?php |
|
include $root . "/backend/layout/bottom.php"; |
|
endif; |
|
}
|
|
|