gestione gare pubbliche
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.
 
 
 
 
 

91 righe
2.9 KiB

<?php
use Studioamica\ChangelogsParser\Core\ChangelogsParser;
use Studioamica\ChangelogsParser\Utils\SQLAdapters\Where;
use Studioamica\ChangelogsParser\Core\ChangelogsBootstrap;
if (!empty($_SESSION["utente"])) {
/**
* Configurazione changelogs
*/
$changelog_parser = ChangelogsParser::getInstance();
$changelog_parser->changelogsTable = $config['db_name'] . ".b_changelogs";
$changelog_parser->relationTable = $config['db_name'] . ".r_viewed_changelog_user";
$changelog_parser->pdo = $pdo;
/**
* Filtra i changelog accessibili in base alla gerarchia dell'utente
*/
$gerarchia = Utente::ruoli()[$_SESSION["utente"]->getInfo()["ruolo"]]["gerarchia"];
$changelog_permessi = [":all" => "all"];
foreach (Utente::ruoli() as $id => $ruolo) {
if ($gerarchia <= $ruolo["gerarchia"]) {
$changelog_permessi[":{$id}"] = $id;
}
}
$changelog_parser->addFilter(
new Where(
"hierarchy IN (".implode(',',array_keys($changelog_permessi)).")",
$changelog_permessi
)
);
if (!empty($_SESSION["ente"])) {
$changelog_parser->addFilter(
new Where(
'(tenant IN (:ente) OR tenant IS NULL)',
[":ente" => $_SESSION["ente"]->codice]
)
);
$changelog_moduli = [];
foreach($_SESSION["utente"]->moduliDisponibili() as $__moduli_disponibili) {
foreach ($__moduli_disponibili as $key => $module) {
$changelog_moduli[":" . str_replace("-","_", $key)] = $key;
}
}
$changelog_parser->addFilter( //WHERE module = gare
new Where(
"module IN (".implode(',', array_keys($changelog_moduli)).", 'all')",
$changelog_moduli
)
);
$changelogs_modules = [];
foreach ($_SESSION["ente"]->moduli as $key => $modulo) {
$changelogs_modules[$key] = $modulo["titolo"];
}
$changelog_parser->setModules($changelogs_modules);
}
$roles = [];
foreach (Utente::ruoli() as $_id => $ruolo) {
$roles[$_id] = __($ruolo["nome"]);
}
$changelog_parser->setHierarchies($roles);
$changelog_parser->overrideSeverities(
[
"minor" => [
"label" => "Cambiamenti minori",
"class" => "badge badge-primary"
],
"info" => [
"label" => "Informativa",
"class" => "badge badge-info"
],
"major" => [
"label" => "Cambiamenti maggiori",
"class" => "badge badge-danger"
]
]
);
$changelog_parser->setTemplate(new ChangelogsBootstrap($changelog_parser, "/backend/changelogs/endpoint.php", __DIR__ . "/../public_html/backend/changelogs/templates"));
$changelog_parser->templateWrapper->setDictionary($_SESSION["language"]);
}