openstamanager/include/top.php

381 lines
14 KiB
PHP
Raw Normal View History

<?php
include_once __DIR__.'/../core.php';
$paths = App::getPaths();
$user = Auth::user();
2019-01-11 12:02:11 +01:00
$pageTitle = !empty($pageTitle) ? $pageTitle : $structure->title;
2018-09-19 10:44:32 +02:00
2018-07-19 17:29:21 +02:00
$messages = flash()->getMessages();
2018-02-04 17:31:33 +01:00
echo '<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>'.$pageTitle.' - '.tr('OpenSTAManager').'</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
2018-06-28 15:52:56 +02:00
<meta name="robots" content="noindex,nofollow">
<link href="'.$paths['img'].'/favicon.png" rel="icon" type="image/x-icon" />';
2018-06-23 15:41:32 +02:00
// CSS
foreach (App::getAssets()['css'] as $style) {
echo '
<link rel="stylesheet" type="text/css" media="all" href="'.$style.'"/>';
}
2018-06-23 15:41:32 +02:00
// Print CSS
foreach (App::getAssets()['print'] as $style) {
echo '
2018-06-23 15:41:32 +02:00
<link rel="stylesheet" type="text/css" media="print" href="'.$style.'"/>';
}
if (Auth::check()) {
echo '
<script>
search = []';
$array = $_SESSION['module_'.$id_module];
if (!empty($array)) {
foreach ($array as $field => $value) {
if (!empty($value) && starts_with($field, 'search_')) {
$field_name = str_replace('search_', '', $field);
echo '
search.push("search_'.$field_name.'");
search["search_'.$field_name.'"] = "'.$value.'";';
}
}
}
echo '
translations = {';
$translations = [
'day' => tr('Giorno'),
'week' => tr('Settimana'),
'month' => tr('Mese'),
'today' => tr('Oggi'),
'firstThreemester' => tr('I trimestre'),
'secondThreemester' => tr('II trimestre'),
'thirdThreemester' => tr('III trimestre'),
'fourthThreemester' => tr('IV trimestre'),
'firstSemester' => tr('I semestre'),
'secondSemester' => tr('II semestre'),
'thisMonth' => tr('Questo mese'),
'lastMonth' => tr('Mese scorso'),
'thisYear' => tr("Quest'anno"),
'lastYear' => tr('Anno scorso'),
'apply' => tr('Applica'),
'cancel' => tr('Annulla'),
'from' => tr('Da'),
'to' => tr('A'),
'custom' => tr('Personalizzato'),
'delete' => tr('Elimina'),
'deleteTitle' => tr('Sei sicuro?'),
'deleteMessage' => tr('Eliminare questo elemento?'),
2018-08-31 18:06:44 +02:00
'errorTitle' => tr('Errore'),
'errorMessage' => tr("Si è verificato un errore nell'esecuzione dell'operazione richiesta"),
'close' => tr('Chiudi'),
'filter' => tr('Filtra'),
'long' => tr('La ricerca potrebbe richiedere del tempo'),
'details' => tr('Dettagli'),
'waiting' => tr('Impossibile procedere'),
'waiting_msg' => tr('Prima di proseguire devi selezionare alcuni elementi!'),
];
foreach ($translations as $key => $value) {
echo '
'.$key.': \''.addslashes($value).'\',';
}
echo '
};
globals = {
2018-02-23 09:49:31 +01:00
rootdir: \''.$rootdir.'\',
js: \''.$paths['js'].'\',
css: \''.$paths['css'].'\',
img: \''.$paths['img'].'\',
id_module: \''.$id_module.'\',
id_record: \''.$id_record.'\',
2018-02-23 09:49:31 +01:00
2019-05-04 02:03:42 +02:00
order_manager_id: \''.($dbo->isInstalled() ? Modules::get('Stato dei serivizi')['id'] : '').'\',
2018-02-23 09:49:31 +01:00
2018-07-08 18:11:17 +02:00
cifre_decimali: '.setting('Cifre decimali per importi').',
2018-02-23 09:49:31 +01:00
2018-09-20 12:05:22 +02:00
decimals: "'.formatter()->getNumberSeparators()['decimals'].'",
thousands: "'.formatter()->getNumberSeparators()['thousands'].'",
currency: "'.currency().'",
2018-02-23 09:49:31 +01:00
search: search,
translations: translations,
2018-02-23 09:49:31 +01:00
locale: \''.$lang.'\',
2018-04-15 14:46:33 +02:00
full_locale: \''.$lang.'_'.strtoupper($lang).'\',
2018-02-23 09:49:31 +01:00
start_date: \''.Translator::dateToLocale($_SESSION['period_start']).'\',
end_date: \''.Translator::dateToLocale($_SESSION['period_end']).'\',
2018-02-23 09:49:31 +01:00
ckeditorToolbar: [
2018-11-20 21:30:58 +01:00
["Undo","Redo","-","Cut","Copy","Paste","PasteText","PasteFromWord","-","Scayt", "-","Link","Unlink","-","Bold","Italic","Underline","Superscript","SpecialChar","HorizontalRule","-","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock","-","NumberedList","BulletedList","Outdent","Indent","Blockquote","-","Styles","Format","Image","Table", "TextColor", "BGColor" ],
2018-02-23 09:49:31 +01:00
],
2018-07-02 16:56:00 +02:00
2018-07-08 18:11:17 +02:00
tempo_attesa_ricerche: '.setting('Tempo di attesa ricerche in secondi').',
};
</script>';
} else {
echo '
2018-07-09 10:44:54 +02:00
<script>
globals = {
locale: \''.$lang.'\',
full_locale: \''.$lang.'_'.strtoupper($lang).'\',
};
</script>';
}
2018-06-23 15:41:32 +02:00
// JS
foreach (App::getAssets()['js'] as $js) {
echo '
<script type="text/javascript" charset="utf-8" src="'.$js.'"></script>';
}
// Impostazioni di default per gli alert
echo '
<script>
swal.setDefaults({
buttonsStyling: false,
confirmButtonClass: "btn btn-lg btn-primary",
cancelButtonClass: "btn btn-lg",
cancelButtonText: "'.tr('Annulla').'",
});
</script>';
2018-07-02 16:56:00 +02:00
if (Auth::check()) {
2018-07-03 15:39:29 +02:00
// Barra di debug
if (App::debug()) {
$debugbarRenderer = $debugbar->getJavascriptRenderer();
$debugbarRenderer->setIncludeVendors(false);
$debugbarRenderer->setBaseUrl($paths['assets'].'/php-debugbar');
2018-07-02 16:56:00 +02:00
echo $debugbarRenderer->renderHead();
}
2018-07-09 10:44:54 +02:00
if (setting('Abilita esportazione Excel e PDF')) {
2018-07-02 16:56:00 +02:00
echo '
<script type="text/javascript" charset="utf-8" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" charset="utf-8" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
<script type="text/javascript" charset="utf-8" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>';
}
}
2018-07-09 10:44:54 +02:00
$hide_sidebar = Auth::check() && setting('Nascondere la barra sinistra di default');
echo '
</head>
<body class="skin-'.$theme.(!empty($hide_sidebar) ? ' sidebar-collapse' : '').(!Auth::check() ? ' hold-transition login-page' : '').'">
<div class="'.(!Auth::check() ? '' : 'wrapper').'">';
if (Auth::check()) {
$calendar = ($_SESSION['period_start'] != date('Y').'-01-01' || $_SESSION['period_end'] != date('Y').'-12-31') ? 'red' : 'white';
echo '
<!-- Loader principale -->
<div id="main_loading">
<div>
<i class="fa fa-cog fa-spin text-danger"></i>
</div>
</div>
<!-- Loader secondario -->
<div id="mini-loader" style="display:none;">
<div></div>
</div>
<!-- Loader senza overlay -->
<div id="tiny-loader" style="display:none;"></div>
<header class="main-header">
2019-05-10 06:32:06 +02:00
<a href="https://www.openstamanager.com" class="logo" title="'.tr("Il gestionale open source per l'assistenza tecnica e la fatturazione").'" target="_blank">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini">'.tr('OSM').'</span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg">'.tr('OpenSTAManager').'</span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
2018-05-05 14:54:47 +02:00
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
<span class="sr-only">'.tr('Mostra/nascondi menu').'</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
2019-05-11 05:35:00 +02:00
<!-- Navbar Left Menu -->
<div class="navbar-left" class="hidden-xs">
<ul class="nav navbar-nav" class="hidden-xs">
<li><a href="#" id="daterange" style="color:'.$calendar.';background:inherit">
<i class="fa fa-calendar" style="color:inherit"></i> <i class="fa fa-caret-down" style="color:inherit"></i>
</a></li>
<li><a href="#" style="color:'.$calendar.';background:inherit">
'.Translator::dateToLocale($_SESSION['period_start']).' - '.Translator::dateToLocale($_SESSION['period_end']).'
</a></li>
</ul>
</div>
2019-05-10 06:32:06 +02:00
2019-05-11 05:35:00 +02:00
<!-- Navbar Right Menu -->
<div class="navbar-custom-menu">
2019-05-10 06:32:06 +02:00
<ul class="nav navbar-nav">
2019-05-16 16:19:55 +02:00
<li class="dropdown notifications-menu" >
<a href="#" class="dropdown-toggle btn-github disabled">
2019-05-10 06:32:06 +02:00
<i class="fa fa-bell-o"></i>
2019-05-10 17:14:34 +02:00
<span class="label label-warning">
<span id="hooks-loading"><i class="fa fa-spinner fa-spin"></i></span>
<span id="hooks-count"></span>
</span>
2019-05-10 06:32:06 +02:00
</a>
<ul class="dropdown-menu">
2019-05-16 16:19:55 +02:00
<li class="header" id="hooks-header" ></li>
2019-05-10 06:32:06 +02:00
<li><ul class="menu" id="hooks">
</ul></li>
</ul>
</li>
2019-05-11 05:35:00 +02:00
<li><a href="#" onclick="window.print()" class="btn-github tip" style="background-color:#5bc0de!important" title="'.tr('Stampa').'">
2019-05-10 06:32:06 +02:00
<i class="fa fa-print"></i>
</a></li>
<li><a href="'.$rootdir.'/bug.php" class="btn-github tip" title="'.tr('Segnalazione bug').'">
<i class="fa fa-bug"></i>
</a></li>
<li><a href="'.$rootdir.'/log.php" class="btn-github tip" title="'.tr('Log accessi').'">
<i class="fa fa-book"></i>
</a></li>
<li><a href="'.$rootdir.'/info.php" class="btn-github tip" title="'.tr('Informazioni').'">
<i class="fa fa-info"></i>
</a></li>
2019-05-11 05:35:00 +02:00
<li><a href="'.$rootdir.'/index.php?op=logout" class="btn-github tip" style="background-color:#dd4b39!important" title="'.tr('Esci').'">
2019-05-10 06:32:06 +02:00
<i class="fa fa-power-off"></i>
</a></li>
</ul>
</div>
</nav>
2019-05-10 06:32:06 +02:00
</header>
<aside class="main-sidebar">
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel text-center info">
<div class="info">
<p><a href="'.$rootdir.'/modules/utenti/info.php">
<i class="fa fa-user"></i>
'.$user['username'].'
</a></p>
<p id="datetime"></p>
</div>
<div class="image">
<img src="'.$paths['img'].'/logo.png" class="img-circle img-responsive" alt="'.tr('OpenSTAManager').'" />
</div>
</div>
<!-- search form -->
<div class="sidebar-form">
<div class="input-group">
<input type="text" name="q" class="form-control" id="supersearch" placeholder="'.tr('Cerca').'..."/>
<span class="input-group-btn">
<button class="btn btn-flat" id="search-btn" name="search" type="submit" ><i class="fa fa-search"></i>
</button>
</span>
</div>
</div>
<!-- /.search form -->
<ul class="sidebar-menu">';
echo Modules::getMainMenu();
echo '
</ul>
</section>
<!-- /.sidebar -->
</aside>
<!-- Right side column. Contains the navbar and content of the page -->
<aside class="content-wrapper">
<!-- Main content -->
<section class="content">
<div class="row">';
if (str_contains($_SERVER['SCRIPT_FILENAME'], 'editor.php')) {
$location = 'editor_right';
} elseif (str_contains($_SERVER['SCRIPT_FILENAME'], 'controller.php')) {
$location = 'controller_right';
}
echo '
<div class="col-md-12">';
// Eventuale messaggio personalizzato per l'installazione corrente
include_once App::filepath('include/custom/extra', 'extra.php');
} else {
// Eventuale messaggio personalizzato per l'installazione corrente
include_once App::filepath('include/custom/extra', 'login.php');
if (!empty($messages['info']) || !empty($messages['warning']) || !empty($messages['error'])) {
echo '
<div class="box box-warning box-center">
<div class="box-header with-border text-center">
<h3 class="box-title">'.tr('Informazioni').'</h3>
</div>
<div class="box-body">';
}
}
2018-07-19 12:47:28 +02:00
// Infomazioni
2018-07-19 12:47:28 +02:00
if (!empty($messages['info'])) {
foreach ($messages['info'] as $value) {
echo '
<div class="alert alert-success push">
<i class="fa fa-check"></i> '.$value.'
</div>';
2018-07-19 12:47:28 +02:00
}
}
// Errori
2018-07-19 12:47:28 +02:00
if (!empty($messages['error'])) {
foreach ($messages['error'] as $value) {
echo '
<div class="alert alert-danger push">
<i class="fa fa-times"></i> '.$value.'
</div>';
2018-07-19 12:47:28 +02:00
}
}
// Avvisi
2018-07-19 12:47:28 +02:00
if (!empty($messages['warning'])) {
foreach ($messages['warning'] as $value) {
echo '
<div class="alert alert-warning push">
<i class="fa fa-warning"></i>
'.$value.'
</div>';
2018-07-19 12:47:28 +02:00
}
}
if (!Auth::check() && (!empty($messages['info']) || !empty($messages['warning']) || !empty($messages['error']))) {
echo '
</div>
</div>';
}