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.
107 righe
5.2 KiB
107 righe
5.2 KiB
<? |
|
$error = true; |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice) && $_SESSION["utente"]->gerarchia <= 10 && ((!empty($_GET["modulo"]) && !empty($_GET["graph"])) || !empty($_GET["codice"]))) { |
|
$reportManager = new reportManager(); |
|
$reportDisponibili = $reportManager->generalSettings; |
|
if (!empty($reportDisponibili)) { |
|
if (!empty($_GET["codice"])) { |
|
$report = reportManager::getSelfManagedReport($_GET["codice"]); |
|
$report["settings"] = json_decode($report["settings"],true); |
|
$_GET["modulo"] = $report["modulo"]; |
|
$_GET["graph"] = $report["settings"]["type"]; |
|
} |
|
$settings = $reportDisponibili[$_GET["modulo"]]; |
|
if (!empty($settings)) { |
|
$graphType = reportManager::graphTypes()[$_GET["graph"]] ?? null; |
|
if (!empty($graphType)) { |
|
$graphId = purify($_GET["graph"]); |
|
$modulo = Modulo::getInfo($_GET["modulo"]); |
|
if (!isset($report)) { |
|
$report = get_campi("b_report_personalizzati"); |
|
$report["codice_gestore"] = $_SESSION["ente"]->codice ?? 0; |
|
$report["settings"] = ["columns"=>[["name"=>"","operazione"=>""]]]; |
|
} |
|
if (!isset($_SESSION["ente"]) || $_SESSION["ente"]->codice == $report["codice_gestore"]) { |
|
$error = false; |
|
?> |
|
<h2><span class="<?= $graphType["icon"] ?>"></span> <?= $graphType["descrizione"] ?> - <?= __($modulo["titolo"]) ?></h2> |
|
<form action="/backend/report/library/save.php" method="POST" rel="validate"> |
|
<input type="hidden" name="token" value="<?= tokenGen() ?>"> |
|
<input type="hidden" name="codice" value="<?= $report["codice"] ?>"> |
|
<input type="hidden" name="type" value="<?= $graphId ?>"> |
|
<input type="hidden" name="modulo" value="<?= $modulo["id"] ?>"> |
|
<div class="form-group"> |
|
<label for="titolo"><?= __("Titolo") ?>*</label> |
|
<input name="titolo" type="text" class="form-control" rel="S;0;255;A" value="<?= $report["titolo"] ?>" title="<?= __("Titolo") ?>"> |
|
</div> |
|
<div class="form-group"> |
|
<label for="descrizione"><?= __("Descrizione") ?></label> |
|
<textarea name="descrizione" rows="5" class="form-control" rel="N;0;0;A" title="<?= __("Descrizione") ?>"><?= $report["descrizione"] ?></textarea> |
|
</div> |
|
<div class="row"> |
|
<div class="col-12 col-lg-6"> |
|
<div class="card"> |
|
<div class="card-header"> |
|
<span class="card-title"><?= __("Serie") ?></span> |
|
</div> |
|
<div class="card-body" id="serie"> |
|
<? |
|
$serie = $report["settings"]["columns"]; |
|
$id = 0; |
|
foreach($serie AS $colonna) { |
|
include __DIR__ . "/inputs/serie.php"; |
|
} |
|
?> |
|
</div> |
|
<? if ($graphType["serieMultiple"]) { ?> |
|
<div class="card-footer"> |
|
<button type="button" onClick="aggiungi('/backend/report/library/inputs/serie.php?modulo=<?= $modulo["id"] ?>','#serie')" class="btn btn-block btn-info"><span class="fa fa-plus"></span> <?= __("Aggiungi serie") ?></button> |
|
</div> |
|
<? } ?> |
|
</div> |
|
</div> |
|
<div class="col-12 col-lg-6"> |
|
<div class="card"> |
|
<div class="card-header"> |
|
<span class="card-title"><?= __("Raggruppa") ?></span> |
|
</div> |
|
<div class="card-body"> |
|
<? for($i=0;$i<$graphType["maxGroups"];$i++) { ?> |
|
<div class="form-group"> |
|
<label for="group_keys[<?= $i ?>]"><?= __("{$i}° Gruppo") ?></label> |
|
<select name="group_keys[<?= $i ?>]"> |
|
<option value=""><?= __("Default") ?></option> |
|
<? |
|
foreach($settings["fields"] AS $idField => $field) { |
|
if (!empty($field["group_by"])) { |
|
?> |
|
<option value="<?= $idField ?>" <?= (!empty($report["settings"]["group_keys"][$i]) && $report["settings"]["group_keys"][$i] == $idField) ? "selected" : "" ?>><?= $field["label"] ?></option> |
|
<? |
|
} |
|
} |
|
?> |
|
</select> |
|
</div> |
|
<? } ?> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<button type="submit" class="btn btn-success btn-lg btn-block mt-3"> |
|
<span class="fa fa-save"></span> <?= __("Salva") ?> |
|
</button> |
|
</form> |
|
<? |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?>
|