mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
Aggiunta Stato dei servizi
This commit is contained in:
@@ -30,12 +30,14 @@ Il formato utilizzato è basato sulle linee guida di [Keep a Changelog](http://k
|
|||||||
- Aggiunto export massivo XML fatture
|
- Aggiunto export massivo XML fatture
|
||||||
- Aggiunte le impostazioni "Riferimento dei documenti nelle stampe" e "Riferimento dei documenti in Fattura Elettronica" per permettere l'inclusione o meno delle relative diciture in stampe e Fattura Elettronica
|
- Aggiunte le impostazioni "Riferimento dei documenti nelle stampe" e "Riferimento dei documenti in Fattura Elettronica" per permettere l'inclusione o meno delle relative diciture in stampe e Fattura Elettronica
|
||||||
- Aggiunto supporto all'importazione delle Fatture Elettroniche Semplificate
|
- Aggiunto supporto all'importazione delle Fatture Elettroniche Semplificate
|
||||||
|
- Aggiunto modulo **Stato dei servizi** per la gestione di widget e moduli, e la visualizzazione dello spazione occupato
|
||||||
|
|
||||||
### Modificato (Changed)
|
### Modificato (Changed)
|
||||||
|
|
||||||
- Corretto calcolo marca da bollo contemplando solo le righe con esenzione iva da natura N1 a N4
|
- Corretto calcolo marca da bollo contemplando solo le righe con esenzione iva da natura N1 a N4
|
||||||
- Aggiornati stylesheet per le notifiche fattura elettronica
|
- Aggiornati stylesheet per le notifiche fattura elettronica
|
||||||
- Possibilità di ricercare per valori maggiori/uguali o minori/uguali sui campi delle tabelle (importi)
|
- Possibilità di ricercare per valori maggiori/uguali o minori/uguali sui campi delle tabelle (importi)
|
||||||
|
- Spostamento della gestione di widget e moduli da **Aggiornamenti** al modulo **Stato dei servizi**
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ if (Auth::check()) {
|
|||||||
id_module: \''.$id_module.'\',
|
id_module: \''.$id_module.'\',
|
||||||
id_record: \''.$id_record.'\',
|
id_record: \''.$id_record.'\',
|
||||||
|
|
||||||
aggiornamenti_id: \''.($dbo->isInstalled() ? Modules::get('Aggiornamenti')['id'] : '').'\',
|
order_manager_id: \''.($dbo->isInstalled() ? Modules::get('Stato dei serivizi')['id'] : '').'\',
|
||||||
|
|
||||||
cifre_decimali: '.setting('Cifre decimali per importi').',
|
cifre_decimali: '.setting('Cifre decimali per importi').',
|
||||||
|
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ $(document).ready(function () {
|
|||||||
stop: function (event, ui) {
|
stop: function (event, ui) {
|
||||||
var order = $(this).sortable('toArray').toString();
|
var order = $(this).sortable('toArray').toString();
|
||||||
|
|
||||||
$.post(globals.rootdir + "/actions.php?id_module=" + globals.aggiornamenti_id, {
|
$.post(globals.rootdir + "/actions.php?id_module=" + globals.order_manager_id, {
|
||||||
op: 'sortmodules',
|
op: 'sortmodules',
|
||||||
ids: order
|
ids: order
|
||||||
});
|
});
|
||||||
@@ -419,7 +419,7 @@ function start_widgets($widgets) {
|
|||||||
var new_class = "";
|
var new_class = "";
|
||||||
|
|
||||||
var order = $(this).sortable('toArray').toString();
|
var order = $(this).sortable('toArray').toString();
|
||||||
$.post(globals.rootdir + "/actions.php?id_module=" + globals.aggiornamenti_id, {
|
$.post(globals.rootdir + "/actions.php?id_module=" + globals.order_manager_id, {
|
||||||
op: 'updatewidget',
|
op: 'updatewidget',
|
||||||
location: dst_list,
|
location: dst_list,
|
||||||
id_module: globals.id_module,
|
id_module: globals.id_module,
|
||||||
@@ -428,7 +428,7 @@ function start_widgets($widgets) {
|
|||||||
id: ui.item.attr('id')
|
id: ui.item.attr('id')
|
||||||
});
|
});
|
||||||
|
|
||||||
$.post(globals.rootdir + "/actions.php?id_module=" + globals.aggiornamenti_id, {
|
$.post(globals.rootdir + "/actions.php?id_module=" + globals.order_manager_id, {
|
||||||
op: 'sortwidget',
|
op: 'sortwidget',
|
||||||
location: dst_list,
|
location: dst_list,
|
||||||
ids: order,
|
ids: order,
|
||||||
|
|||||||
@@ -20,167 +20,7 @@ switch (filter('op')) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'upload':
|
case 'upload':
|
||||||
include $docroot.'/modules/aggiornamenti/upload_modules.php';
|
include DOCROOT.'/modules/aggiornamenti/upload_modules.php';
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'uninstall':
|
|
||||||
if (!empty($id)) {
|
|
||||||
// Leggo l'id del modulo
|
|
||||||
$rs = $dbo->fetchArray('SELECT id, name, directory FROM zz_modules WHERE id='.prepare($id).' AND `default`=0');
|
|
||||||
$modulo = $rs[0]['title'];
|
|
||||||
$module_dir = $rs[0]['directory'];
|
|
||||||
|
|
||||||
if (count($rs) == 1) {
|
|
||||||
// Elimino il modulo dal menu
|
|
||||||
$dbo->query('DELETE FROM zz_modules WHERE id='.prepare($id).' OR parent='.prepare($id));
|
|
||||||
|
|
||||||
$uninstall_script = $docroot.'/modules/'.$module_dir.'/update/uninstall.php';
|
|
||||||
|
|
||||||
if (file_exists($uninstall_script)) {
|
|
||||||
include_once $uninstall_script;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete($docroot.'/modules/'.$module_dir.'/');
|
|
||||||
|
|
||||||
flash()->info(tr('Modulo _MODULE_ disinstallato!', [
|
|
||||||
'_MODULE_' => '"'.$modulo.'"',
|
|
||||||
]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'disable':
|
|
||||||
$dbo->query('UPDATE `zz_modules` SET `enabled` = 0 WHERE (`id` = '.prepare($id).' OR `parent` = '.prepare($id).') AND `id` != '.prepare(Modules::get('Aggiornamenti')['id']));
|
|
||||||
|
|
||||||
flash()->info(tr('Modulo _MODULE_ disabilitato!', [
|
|
||||||
'_MODULE_' => '"'.Modules::get($id)['title'].'"',
|
|
||||||
]));
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'enable':
|
|
||||||
$dbo->query('UPDATE `zz_modules` SET `enabled` = 1 WHERE `id` = '.prepare($id).' OR `parent` = '.prepare($id));
|
|
||||||
|
|
||||||
flash()->info(tr('Modulo _MODULE_ abilitato!', [
|
|
||||||
'_MODULE_' => '"'.Modules::get($id)['title'].'"',
|
|
||||||
]));
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'disable_widget':
|
|
||||||
$dbo->query('UPDATE zz_widgets SET enabled = 0 WHERE id = '.prepare($id));
|
|
||||||
|
|
||||||
$rs = $dbo->fetchArray('SELECT id, name FROM zz_widgets WHERE id='.prepare($id));
|
|
||||||
$widget = $rs[0]['name'];
|
|
||||||
|
|
||||||
flash()->info(tr('Widget _WIDGET_ disabilitato!', [
|
|
||||||
'_WIDGET_' => '"'.$widget.'"',
|
|
||||||
]));
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'enable_widget':
|
|
||||||
$dbo->query('UPDATE zz_widgets SET enabled=1 WHERE id='.prepare($id));
|
|
||||||
|
|
||||||
$rs = $dbo->fetchArray('SELECT id, name FROM zz_widgets WHERE id='.prepare($id));
|
|
||||||
$widget = $rs[0]['name'];
|
|
||||||
|
|
||||||
flash()->info(tr('Widget _WIDGET_ abilitato!', [
|
|
||||||
'_WIDGET_' => '"'.$widget.'"',
|
|
||||||
]));
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'change_position_widget_top':
|
|
||||||
$dbo->query("UPDATE zz_widgets SET location='controller_top' WHERE id=".prepare($id));
|
|
||||||
|
|
||||||
$rs = $dbo->fetchArray('SELECT id, name FROM zz_widgets WHERE id='.prepare($id));
|
|
||||||
$widget = $rs[0]['name'];
|
|
||||||
|
|
||||||
flash()->info(tr('Posizione del widget _WIDGET_ aggiornata!', [
|
|
||||||
'_WIDGET_' => '"'.$widget.'"',
|
|
||||||
]));
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'change_position_widget_right':
|
|
||||||
$dbo->query("UPDATE zz_widgets SET location='controller_right' WHERE id=".prepare($id));
|
|
||||||
|
|
||||||
$rs = $dbo->fetchArray('SELECT id, name FROM zz_widgets WHERE id='.prepare($id));
|
|
||||||
$widget = $rs[0]['name'];
|
|
||||||
|
|
||||||
flash()->info(tr('Posizione del widget _WIDGET_ aggiornata!', [
|
|
||||||
'_WIDGET_' => '"'.$widget.'"',
|
|
||||||
]));
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Ordinamento moduli di primo livello
|
|
||||||
case 'sortmodules':
|
|
||||||
$rs = $dbo->fetchArray('SELECT id FROM zz_modules WHERE enabled = 1 AND parent IS NULL ORDER BY `order` ASC');
|
|
||||||
|
|
||||||
if ($_POST['ids'] != implode(',', array_column($rs, 'id'))) {
|
|
||||||
$ids = explode(',', $_POST['ids']);
|
|
||||||
|
|
||||||
for ($i = 0; $i < count($ids); ++$i) {
|
|
||||||
$dbo->query('UPDATE zz_modules SET `order`='.prepare($i).' WHERE id='.prepare($ids[$i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
flash()->info(tr('Posizione voci di menù aggiornate!'));
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'sortwidget':
|
|
||||||
$location = post('location');
|
|
||||||
|
|
||||||
$location = empty($id_record) ? 'controller_'.$location : 'editor_'.$location;
|
|
||||||
|
|
||||||
$rs = $dbo->fetchArray("SELECT CONCAT('widget_', id) AS id FROM zz_widgets WHERE enabled = 1 AND location = ".prepare($location).' AND id_module = '.prepare($id_module).' ORDER BY `order` ASC');
|
|
||||||
|
|
||||||
if ($_POST['ids'] != implode(',', array_column($rs, 'id'))) {
|
|
||||||
$ids = explode(',', $_POST['ids']);
|
|
||||||
|
|
||||||
for ($i = 0; $i < count($ids); ++$i) {
|
|
||||||
$id = explode('_', $ids[$i]);
|
|
||||||
$dbo->query('UPDATE zz_widgets SET `order`='.prepare($i).' WHERE id='.prepare($id[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
flash()->info(tr('Posizioni widgets aggiornate!'));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'updatewidget':
|
|
||||||
$location = post('location');
|
|
||||||
$class = post('class');
|
|
||||||
$id = explode('_', post('id'));
|
|
||||||
|
|
||||||
$location = empty($id_record) ? 'controller_'.$location : 'editor_'.$location;
|
|
||||||
|
|
||||||
if (!empty($class)) {
|
|
||||||
$dbo->query('UPDATE zz_widgets SET class='.prepare($class).' WHERE id='.prepare($id[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'size':
|
|
||||||
|
|
||||||
$folder = filter('folder');
|
|
||||||
|
|
||||||
if (!empty($folder)){
|
|
||||||
if ($folder=='backup')
|
|
||||||
$folder = App::getConfig()['backup_dir'];
|
|
||||||
else if ($folder=='files')
|
|
||||||
$folder = DOCROOT.'/files/';
|
|
||||||
else if ($folder=='logs')
|
|
||||||
$folder = DOCROOT.'/logs/';
|
|
||||||
}else{
|
|
||||||
$folder = DOCROOT.'/';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo Util\FileSystem::size($folder);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,102 +186,6 @@ function search(button) {
|
|||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Elenco moduli installati
|
|
||||||
echo '
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12 col-lg-6">
|
|
||||||
<h3>'.tr('Moduli installati').'</h3>
|
|
||||||
<table class="table table-hover table-bordered table-condensed">
|
|
||||||
<tr>
|
|
||||||
<th>'.tr('Nome').'</th>
|
|
||||||
<th width="50">'.tr('Versione').'</th>
|
|
||||||
<th width="30">'.tr('Stato').'</th>
|
|
||||||
<th width="30">'.tr('Compatibilità').'</th>
|
|
||||||
<th width="20">'.tr('Opzioni').'</th>
|
|
||||||
</tr>';
|
|
||||||
|
|
||||||
$modules = Modules::getHierarchy();
|
|
||||||
|
|
||||||
$osm_version = Update::getVersion();
|
|
||||||
|
|
||||||
echo submodules($modules);
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</table>
|
|
||||||
</div>';
|
|
||||||
|
|
||||||
// Widgets
|
|
||||||
echo '
|
|
||||||
<div class="col-md-12 col-lg-6">
|
|
||||||
<h3>'.tr('Widgets').'</h3>
|
|
||||||
<table class="table table-hover table-bordered table-condensed">
|
|
||||||
<tr>
|
|
||||||
<th>'.tr('Nome').'</th>
|
|
||||||
<th width="200">'.tr('Posizione').'</th>
|
|
||||||
<th width="30">'.tr('Stato').'</th>
|
|
||||||
<th width="30">'.tr('Posizione').'</th>
|
|
||||||
</tr>';
|
|
||||||
|
|
||||||
$widgets = $dbo->fetchArray('SELECT zz_widgets.id, zz_widgets.name AS widget_name, zz_modules.name AS module_name, zz_widgets.enabled AS enabled, location FROM zz_widgets INNER JOIN zz_modules ON zz_widgets.id_module=zz_modules.id ORDER BY `id_module` ASC, `zz_widgets`.`order` ASC');
|
|
||||||
|
|
||||||
$previous = '';
|
|
||||||
|
|
||||||
foreach ($widgets as $widget) {
|
|
||||||
// Nome modulo come titolo sezione
|
|
||||||
if ($widget['module_name'] != $previous) {
|
|
||||||
echo '
|
|
||||||
<tr>
|
|
||||||
<th colspan="4">'.$widget['module_name'].'</th>
|
|
||||||
</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// STATO
|
|
||||||
if ($widget['enabled']) {
|
|
||||||
$stato = '<i class="fa fa-cog fa-spin text-success" data-toggle="tooltip" title="'.tr('Abilitato').'. '.tr('Clicca per disabilitarlo').'..."></i>';
|
|
||||||
$class = 'success';
|
|
||||||
} else {
|
|
||||||
$stato = '<i class="fa fa-cog text-warning" data-toggle="tooltip" title="'.tr('Non abilitato').'"></i>';
|
|
||||||
$class = 'warning';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Possibilità di disabilitare o abilitare i moduli tranne quello degli aggiornamenti
|
|
||||||
if ($widget['enabled']) {
|
|
||||||
$stato = "<a href='javascript:;' onclick=\"if( confirm('".tr('Disabilitare questo widget?')."') ){ $.post( '".ROOTDIR.'/actions.php?id_module='.$id_module."', { op: 'disable_widget', id: '".$widget['id']."' }, function(response){ location.href='".ROOTDIR.'/controller.php?id_module='.$id_module."'; }); }\">".$stato."</a>\n";
|
|
||||||
} else {
|
|
||||||
$stato = "<a href='javascript:;' onclick=\"if( confirm('".tr('Abilitare questo widget?')."') ){ $.post( '".ROOTDIR.'/actions.php?id_module='.$id_module."', { op: 'enable_widget', id: '".$widget['id']."' }, function(response){ location.href='".ROOTDIR.'/controller.php?id_module='.$id_module."'; }); }\"\">".$stato."</a>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// POSIZIONE
|
|
||||||
if ($widget['location'] == 'controller_top') {
|
|
||||||
$location = tr('Schermata modulo in alto');
|
|
||||||
} elseif ($widget['location'] == 'controller_right') {
|
|
||||||
$location = tr('Schermata modulo a destra');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($widget['location'] == 'controller_right') {
|
|
||||||
$posizione = "<i class='fa fa-arrow-up text-warning' data-toggle='tooltip' title=\"".tr('Clicca per cambiare la posizione...')."\"></i> <i class='fa fa-arrow-right text-success' data-toggle='tooltip' title=\"\"></i>";
|
|
||||||
$posizione = "<a href='javascript:;' onclick=\"if( confirm('".tr('Cambiare la posizione di questo widget?')."') ){ $.post( '".ROOTDIR.'/actions.php?id_module='.$id_module."', { op: 'change_position_widget_top', id: '".$widget['id']."' }, function(response){ location.href='".ROOTDIR.'/controller.php?id_module='.$id_module."'; }); }\"\">".$posizione."</a>\n";
|
|
||||||
} elseif ($widget['location'] == 'controller_top') {
|
|
||||||
$posizione = "<i class='fa fa-arrow-up text-success' data-toggle='tooltip' title=\"\"></i> <i class='fa fa-arrow-right text-warning' data-toggle='tooltip' title=\"".tr('Clicca per cambiare la posizione...').'"></i></i>';
|
|
||||||
$posizione = "<a href='javascript:;' onclick=\"if( confirm('".tr('Cambiare la posizione di questo widget?')."') ){ $.post( '".ROOTDIR.'/actions.php?id_module='.$id_module."', { op: 'change_position_widget_right', id: '".$widget['id']."' }, function(response){ location.href='".ROOTDIR.'/controller.php?id_module='.$id_module."'; }); }\"\">".$posizione."</a>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<tr class="'.$class.'">
|
|
||||||
<td>'.$widget['widget_name'].'</td>
|
|
||||||
<td align="right"><small>'.$location.'</small></td>
|
|
||||||
<td align="center">'.$stato.'</td>
|
|
||||||
<td align="center">'.$posizione.'</td>
|
|
||||||
</tr>';
|
|
||||||
|
|
||||||
$previous = $widget['module_name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>';
|
|
||||||
|
|
||||||
// Requisiti
|
// Requisiti
|
||||||
echo '
|
echo '
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@@ -1,83 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function submodules($list, $depth = 0)
|
|
||||||
{
|
|
||||||
$osm_version = Update::getVersion();
|
|
||||||
|
|
||||||
$id_module = Modules::getCurrent()['id'];
|
|
||||||
|
|
||||||
$result = '';
|
|
||||||
|
|
||||||
foreach ($list as $sub) {
|
|
||||||
// STATO
|
|
||||||
if (!empty($sub['enabled'])) {
|
|
||||||
$text = tr('Abilitato');
|
|
||||||
$text .= ($sub['id'] != $id_module) ? '. '.tr('Clicca per disabilitarlo').'...' : '';
|
|
||||||
$stato = '<i class="fa fa-cog fa-spin text-success" data-toggle="tooltip" title="'.$text.'"></i>';
|
|
||||||
} else {
|
|
||||||
$stato = '<i class="fa fa-cog text-warning" data-toggle="tooltip" title="'.tr('Non abilitato').'"></i>';
|
|
||||||
$class = 'warning';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Possibilità di disabilitare o abilitare i moduli tranne quello degli aggiornamenti
|
|
||||||
if ($sub['id'] != $id_module) {
|
|
||||||
if ($sub['enabled']) {
|
|
||||||
$stato = "<a href='javascript:;' onclick=\"if( confirm('".tr('Disabilitare questo modulo?')."') ){ $.post( '".ROOTDIR.'/actions.php?id_module='.$id_module."', { op: 'disable', id: '".$sub['id']."' }, function(response){ location.href='".ROOTDIR.'/controller.php?id_module='.$id_module."'; }); }\">".$stato."</a>\n";
|
|
||||||
} else {
|
|
||||||
$stato = "<a href='javascript:;' onclick=\"if( confirm('".tr('Abilitare questo modulo?')."') ){ $.post( '".ROOTDIR.'/actions.php?id_module='.$id_module."', { op: 'enable', id: '".$sub['id']."' }, function(response){ location.href='".ROOTDIR.'/controller.php?id_module='.$id_module."'; }); }\"\">".$stato."</a>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// COMPATIBILITA'
|
|
||||||
// Controllo per ogni versione se la regexp combacia per dire che è compatibile o meno
|
|
||||||
$compatibilities = explode(',', $sub['compatibility']);
|
|
||||||
|
|
||||||
$comp = false;
|
|
||||||
foreach ($compatibilities as $compatibility) {
|
|
||||||
$comp = (preg_match('/'.$compatibility.'/', $osm_version)) ? true : $comp;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($comp) {
|
|
||||||
$compatible = '<i class="fa fa-check-circle text-success" data-toggle="tooltip" title="'.tr('Compatibile').'"></i>';
|
|
||||||
($sub['enabled']) ? $class = 'success' : $class = 'warning';
|
|
||||||
} else {
|
|
||||||
$compatible = '<i class="fa fa-warning text-danger" data-toggle="tooltip" title="'.tr('Non compatibile!').tr('Questo modulo è compatibile solo con le versioni').': '.$sub['compatibility'].'"></i>';
|
|
||||||
$class = 'danger';
|
|
||||||
}
|
|
||||||
|
|
||||||
$result .= '
|
|
||||||
<tr class="'.$class.'">
|
|
||||||
<td><small>'.str_repeat(' ', $depth * 4).'- '.$sub['title'].'</small></td>
|
|
||||||
<td align="right">'.$sub['version'].'</td>
|
|
||||||
<td align="center">'.$stato.'</td>
|
|
||||||
<td align="center">'.$compatible.'</td>';
|
|
||||||
|
|
||||||
$result .= '
|
|
||||||
<td>';
|
|
||||||
|
|
||||||
// Possibilità di disinstallare solo se il modulo non è tra quelli predefiniti
|
|
||||||
if (empty($sub['default'])) {
|
|
||||||
$result .= "
|
|
||||||
<a href=\"javascript:;\" data-toggle='tooltip' title=\"".tr('Disinstalla')."...\" onclick=\"if( confirm('".tr('Vuoi disinstallare questo modulo?').' '.tr('Tutti i dati salvati andranno persi!')."') ){ if( confirm('".tr('Sei veramente sicuro?')."') ){ $.post( '".ROOTDIR.'/actions.php?id_module='.$id_module."', { op: 'uninstall', id: '".$sub['id']."' }, function(response){ location.href='".ROOTDIR.'/controller.php?id_module='.$id_module."'; }); } }\">
|
|
||||||
<i class='fa fa-trash'></i>
|
|
||||||
</a>";
|
|
||||||
} else {
|
|
||||||
$result .= "
|
|
||||||
<a class='disabled text-muted'>
|
|
||||||
<i class='fa fa-trash'></i>
|
|
||||||
</a>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$result .= '
|
|
||||||
</td>
|
|
||||||
</tr>';
|
|
||||||
|
|
||||||
$result .= submodules($sub['all_children'], $depth + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controlla se il database presenta alcune sezioni personalizzate.
|
* Controlla se il database presenta alcune sezioni personalizzate.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,119 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
include_once __DIR__.'/../../../core.php';
|
|
||||||
echo '
|
|
||||||
<script src="'.ROOTDIR.'/assets/dist/js/chartjs/Chart.min.js"></script>';
|
|
||||||
|
|
||||||
// Operazioni JavaScript
|
|
||||||
echo '
|
|
||||||
<script>
|
|
||||||
|
|
||||||
var valori = [];
|
|
||||||
|
|
||||||
function loadSize(name, id){
|
|
||||||
|
|
||||||
$("#" + id).html("'.tr('Calcolo in corso').'...");
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: globals.rootdir + "/actions.php",
|
|
||||||
type: "get",
|
|
||||||
data: {
|
|
||||||
id_module: globals.id_module,
|
|
||||||
op: "size",
|
|
||||||
folder: name,
|
|
||||||
},
|
|
||||||
success: function(data) {
|
|
||||||
$("#" + id).html(data);
|
|
||||||
valori.push(data);
|
|
||||||
|
|
||||||
//if (valori.length == 3)
|
|
||||||
//crea_grafico(valori);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function crea_grafico (valori){
|
|
||||||
|
|
||||||
var ctx = $("#chart");
|
|
||||||
|
|
||||||
options = {
|
|
||||||
legend: {
|
|
||||||
display: true,
|
|
||||||
position: "right"
|
|
||||||
},
|
|
||||||
legendCallback: function(chart) {
|
|
||||||
|
|
||||||
},
|
|
||||||
animation:{
|
|
||||||
animateScale: true,
|
|
||||||
animateRotate: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
data = {
|
|
||||||
datasets: [{
|
|
||||||
data: [parseFloat(valori[0]), parseFloat(valori[1]), parseFloat(valori[2])],
|
|
||||||
backgroundColor: [
|
|
||||||
"rgba(255, 99, 132, 0.2)",
|
|
||||||
"rgba(54, 162, 235, 0.2)",
|
|
||||||
"rgba(255, 206, 86, 0.2)",
|
|
||||||
],
|
|
||||||
borderColor: [
|
|
||||||
"rgba(255, 99, 132, 1)",
|
|
||||||
"rgba(54, 162, 235, 1)",
|
|
||||||
"rgba(255, 206, 86, 1)",
|
|
||||||
]
|
|
||||||
}],
|
|
||||||
|
|
||||||
|
|
||||||
labels: [
|
|
||||||
"Backup ("+valori[0]+")",
|
|
||||||
"Allegati ("+valori[1]+")",
|
|
||||||
"Logs ("+valori[2]+")"
|
|
||||||
]
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
var myPieChart = new Chart(ctx, {
|
|
||||||
type: "pie",
|
|
||||||
data: data,
|
|
||||||
options: options
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>';
|
|
||||||
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<div class="col-md-6">
|
|
||||||
|
|
||||||
<span class="label label-info hide">'.tr('SPAZIO UTILIZZATO: _SPAZIO_', [
|
|
||||||
'_SPAZIO_' => '<i id="total_size"></i>',
|
|
||||||
]).'<br></span>
|
|
||||||
<span class="label label-danger"><i class="fa fa-archive" aria-hidden="true"></i> '.tr('BACKUP: _SPAZIO_BACKUP_', [
|
|
||||||
'_SPAZIO_BACKUP_' => '<i id="backup_size"></i>',
|
|
||||||
]).'<br></span>
|
|
||||||
<span class="label label-primary"><i class="fa fa-paperclip" aria-hidden="true"></i> '.tr('ALLEGATI: _SPAZIO_FILES_', [
|
|
||||||
'_SPAZIO_FILES_' => '<i id="files_size"></i>',
|
|
||||||
]).'<br></span>
|
|
||||||
<span class="label label-warning"><i class="fa fa-file-text" aria-hidden="true"></i> '.tr('LOGS: _SPAZIO_LOGS_', [
|
|
||||||
'_SPAZIO_LOGS_' => '<i id="logs_size"></i>',
|
|
||||||
]).'</span>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<canvas id="chart"></canvas>
|
|
||||||
<!--div class="chart-container" style="position: relative; width:9vw">
|
|
||||||
|
|
||||||
</div-->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
//loadSize("", "total_size");
|
|
||||||
loadSize("backup", "backup_size");
|
|
||||||
loadSize("files", "files_size");
|
|
||||||
loadSize("logs", "logs_size");
|
|
||||||
</script>';
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
174
modules/stato_servizi/actions.php
Normal file
174
modules/stato_servizi/actions.php
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
|
use Util\FileSystem;
|
||||||
|
|
||||||
|
$id = post('id');
|
||||||
|
|
||||||
|
switch (filter('op')) {
|
||||||
|
case 'uninstall':
|
||||||
|
if (!empty($id)) {
|
||||||
|
// Leggo l'id del modulo
|
||||||
|
$rs = $dbo->fetchArray('SELECT id, name, directory FROM zz_modules WHERE id='.prepare($id).' AND `default`=0');
|
||||||
|
$modulo = $rs[0]['title'];
|
||||||
|
$module_dir = $rs[0]['directory'];
|
||||||
|
|
||||||
|
if (count($rs) == 1) {
|
||||||
|
// Elimino il modulo dal menu
|
||||||
|
$dbo->query('DELETE FROM zz_modules WHERE id='.prepare($id).' OR parent='.prepare($id));
|
||||||
|
|
||||||
|
$uninstall_script = DOCROOT.'/modules/'.$module_dir.'/update/uninstall.php';
|
||||||
|
|
||||||
|
if (file_exists($uninstall_script)) {
|
||||||
|
include_once $uninstall_script;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(DOCROOT.'/modules/'.$module_dir.'/');
|
||||||
|
|
||||||
|
flash()->info(tr('Modulo "_MODULE_" disinstallato!', [
|
||||||
|
'_MODULE_' => $modulo,
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'disable':
|
||||||
|
$dbo->query('UPDATE `zz_modules` SET `enabled` = 0 WHERE (`id` = '.prepare($id).' OR `parent` = '.prepare($id).') AND `id` != '.prepare(Modules::get('Stato dei servizi')['id']));
|
||||||
|
|
||||||
|
flash()->info(tr('Modulo "_MODULE_" disabilitato!', [
|
||||||
|
'_MODULE_' => Modules::get($id)['title'],
|
||||||
|
]));
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'enable':
|
||||||
|
$dbo->query('UPDATE `zz_modules` SET `enabled` = 1 WHERE `id` = '.prepare($id).' OR `parent` = '.prepare($id));
|
||||||
|
|
||||||
|
flash()->info(tr('Modulo "_MODULE_" abilitato!', [
|
||||||
|
'_MODULE_' => Modules::get($id)['title'],
|
||||||
|
]));
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'disable_widget':
|
||||||
|
$dbo->query('UPDATE zz_widgets SET enabled = 0 WHERE id = '.prepare($id));
|
||||||
|
|
||||||
|
$rs = $dbo->fetchArray('SELECT id, name FROM zz_widgets WHERE id='.prepare($id));
|
||||||
|
$widget = $rs[0]['name'];
|
||||||
|
|
||||||
|
flash()->info(tr('Widget "_WIDGET_" disabilitato!', [
|
||||||
|
'_WIDGET_' => $widget,
|
||||||
|
]));
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'enable_widget':
|
||||||
|
$dbo->query('UPDATE zz_widgets SET enabled=1 WHERE id='.prepare($id));
|
||||||
|
|
||||||
|
$rs = $dbo->fetchArray('SELECT id, name FROM zz_widgets WHERE id='.prepare($id));
|
||||||
|
$widget = $rs[0]['name'];
|
||||||
|
|
||||||
|
flash()->info(tr('Widget "_WIDGET_" abilitato!', [
|
||||||
|
'_WIDGET_' => $widget,
|
||||||
|
]));
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'change_position_widget_top':
|
||||||
|
$dbo->query("UPDATE zz_widgets SET location='controller_top' WHERE id=".prepare($id));
|
||||||
|
|
||||||
|
$rs = $dbo->fetchArray('SELECT id, name FROM zz_widgets WHERE id='.prepare($id));
|
||||||
|
$widget = $rs[0]['name'];
|
||||||
|
|
||||||
|
flash()->info(tr('Posizione del widget "_WIDGET_" aggiornata!', [
|
||||||
|
'_WIDGET_' => $widget,
|
||||||
|
]));
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'change_position_widget_right':
|
||||||
|
$dbo->query("UPDATE zz_widgets SET location='controller_right' WHERE id=".prepare($id));
|
||||||
|
|
||||||
|
$rs = $dbo->fetchArray('SELECT id, name FROM zz_widgets WHERE id='.prepare($id));
|
||||||
|
$widget = $rs[0]['name'];
|
||||||
|
|
||||||
|
flash()->info(tr('Posizione del widget "_WIDGET_" aggiornata!', [
|
||||||
|
'_WIDGET_' => $widget,
|
||||||
|
]));
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Ordinamento moduli di primo livello
|
||||||
|
case 'sortmodules':
|
||||||
|
$rs = $dbo->fetchArray('SELECT id FROM zz_modules WHERE enabled = 1 AND parent IS NULL ORDER BY `order` ASC');
|
||||||
|
|
||||||
|
if ($_POST['ids'] != implode(',', array_column($rs, 'id'))) {
|
||||||
|
$ids = explode(',', $_POST['ids']);
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($ids); ++$i) {
|
||||||
|
$dbo->query('UPDATE zz_modules SET `order`='.prepare($i).' WHERE id='.prepare($ids[$i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
flash()->info(tr('Posizione delle voci di menù aggiornata!'));
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'sortwidget':
|
||||||
|
$location = post('location');
|
||||||
|
|
||||||
|
$location = empty($id_record) ? 'controller_'.$location : 'editor_'.$location;
|
||||||
|
|
||||||
|
$rs = $dbo->fetchArray("SELECT CONCAT('widget_', id) AS id FROM zz_widgets WHERE enabled = 1 AND location = ".prepare($location).' AND id_module = '.prepare($id_module).' ORDER BY `order` ASC');
|
||||||
|
|
||||||
|
if ($_POST['ids'] != implode(',', array_column($rs, 'id'))) {
|
||||||
|
$ids = explode(',', $_POST['ids']);
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($ids); ++$i) {
|
||||||
|
$id = explode('_', $ids[$i]);
|
||||||
|
$dbo->query('UPDATE zz_widgets SET `order`='.prepare($i).' WHERE id='.prepare($id[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
flash()->info(tr('Posizioni widgets aggiornate!'));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'updatewidget':
|
||||||
|
$location = post('location');
|
||||||
|
$class = post('class');
|
||||||
|
$id = explode('_', post('id'));
|
||||||
|
|
||||||
|
$location = empty($id_record) ? 'controller_'.$location : 'editor_'.$location;
|
||||||
|
|
||||||
|
if (!empty($class)) {
|
||||||
|
$dbo->query('UPDATE zz_widgets SET class='.prepare($class).' WHERE id='.prepare($id[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'sizes':
|
||||||
|
$results = [];
|
||||||
|
|
||||||
|
$backup_dir = App::getConfig()['backup_dir'];
|
||||||
|
|
||||||
|
$dirs = [
|
||||||
|
$backup_dir => tr('Backup'),
|
||||||
|
'files' => tr('Allegati'),
|
||||||
|
'logs' => tr('Logs'),
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($dirs as $dir => $description) {
|
||||||
|
$size = FileSystem::folderSize($dir);
|
||||||
|
$results[] = [
|
||||||
|
'description' => $description,
|
||||||
|
'size' => $size,
|
||||||
|
'formattedSize' => FileSystem::formatBytes($size),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($results);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
97
modules/stato_servizi/edit.php
Normal file
97
modules/stato_servizi/edit.php
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// Elenco moduli installati
|
||||||
|
echo '
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 col-lg-6">
|
||||||
|
<h3>'.tr('Moduli installati').'</h3>
|
||||||
|
<table class="table table-hover table-bordered table-condensed">
|
||||||
|
<tr>
|
||||||
|
<th>'.tr('Nome').'</th>
|
||||||
|
<th width="50">'.tr('Versione').'</th>
|
||||||
|
<th width="30">'.tr('Stato').'</th>
|
||||||
|
<th width="30">'.tr('Compatibilità').'</th>
|
||||||
|
<th width="20">'.tr('Opzioni').'</th>
|
||||||
|
</tr>';
|
||||||
|
|
||||||
|
$modules = Modules::getHierarchy();
|
||||||
|
|
||||||
|
$osm_version = Update::getVersion();
|
||||||
|
|
||||||
|
echo submodules($modules);
|
||||||
|
|
||||||
|
echo '
|
||||||
|
</table>
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
// Widgets
|
||||||
|
echo '
|
||||||
|
<div class="col-md-12 col-lg-6">
|
||||||
|
<h3>'.tr('Widgets').'</h3>
|
||||||
|
<table class="table table-hover table-bordered table-condensed">
|
||||||
|
<tr>
|
||||||
|
<th>'.tr('Nome').'</th>
|
||||||
|
<th width="200">'.tr('Posizione').'</th>
|
||||||
|
<th width="30">'.tr('Stato').'</th>
|
||||||
|
<th width="30">'.tr('Posizione').'</th>
|
||||||
|
</tr>';
|
||||||
|
|
||||||
|
$widgets = $dbo->fetchArray('SELECT zz_widgets.id, zz_widgets.name AS widget_name, zz_modules.name AS module_name, zz_widgets.enabled AS enabled, location FROM zz_widgets INNER JOIN zz_modules ON zz_widgets.id_module=zz_modules.id ORDER BY `id_module` ASC, `zz_widgets`.`order` ASC');
|
||||||
|
|
||||||
|
$previous = '';
|
||||||
|
|
||||||
|
foreach ($widgets as $widget) {
|
||||||
|
// Nome modulo come titolo sezione
|
||||||
|
if ($widget['module_name'] != $previous) {
|
||||||
|
echo '
|
||||||
|
<tr>
|
||||||
|
<th colspan="4">'.$widget['module_name'].'</th>
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// STATO
|
||||||
|
if ($widget['enabled']) {
|
||||||
|
$stato = '<i class="fa fa-cog fa-spin text-success" data-toggle="tooltip" title="'.tr('Abilitato').'. '.tr('Clicca per disabilitarlo').'..."></i>';
|
||||||
|
$class = 'success';
|
||||||
|
} else {
|
||||||
|
$stato = '<i class="fa fa-cog text-warning" data-toggle="tooltip" title="'.tr('Non abilitato').'"></i>';
|
||||||
|
$class = 'warning';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Possibilità di disabilitare o abilitare i moduli tranne quello degli aggiornamenti
|
||||||
|
if ($widget['enabled']) {
|
||||||
|
$stato = "<a href='javascript:;' onclick=\"if( confirm('".tr('Disabilitare questo widget?')."') ){ $.post( '".ROOTDIR.'/actions.php?id_module='.$id_module."', { op: 'disable_widget', id: '".$widget['id']."' }, function(response){ location.href='".ROOTDIR.'/controller.php?id_module='.$id_module."'; }); }\">".$stato."</a>\n";
|
||||||
|
} else {
|
||||||
|
$stato = "<a href='javascript:;' onclick=\"if( confirm('".tr('Abilitare questo widget?')."') ){ $.post( '".ROOTDIR.'/actions.php?id_module='.$id_module."', { op: 'enable_widget', id: '".$widget['id']."' }, function(response){ location.href='".ROOTDIR.'/controller.php?id_module='.$id_module."'; }); }\"\">".$stato."</a>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// POSIZIONE
|
||||||
|
if ($widget['location'] == 'controller_top') {
|
||||||
|
$location = tr('Schermata modulo in alto');
|
||||||
|
} elseif ($widget['location'] == 'controller_right') {
|
||||||
|
$location = tr('Schermata modulo a destra');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($widget['location'] == 'controller_right') {
|
||||||
|
$posizione = "<i class='fa fa-arrow-up text-warning' data-toggle='tooltip' title=\"".tr('Clicca per cambiare la posizione...')."\"></i> <i class='fa fa-arrow-right text-success' data-toggle='tooltip' title=\"\"></i>";
|
||||||
|
$posizione = "<a href='javascript:;' onclick=\"if( confirm('".tr('Cambiare la posizione di questo widget?')."') ){ $.post( '".ROOTDIR.'/actions.php?id_module='.$id_module."', { op: 'change_position_widget_top', id: '".$widget['id']."' }, function(response){ location.href='".ROOTDIR.'/controller.php?id_module='.$id_module."'; }); }\"\">".$posizione."</a>\n";
|
||||||
|
} elseif ($widget['location'] == 'controller_top') {
|
||||||
|
$posizione = "<i class='fa fa-arrow-up text-success' data-toggle='tooltip' title=\"\"></i> <i class='fa fa-arrow-right text-warning' data-toggle='tooltip' title=\"".tr('Clicca per cambiare la posizione...').'"></i></i>';
|
||||||
|
$posizione = "<a href='javascript:;' onclick=\"if( confirm('".tr('Cambiare la posizione di questo widget?')."') ){ $.post( '".ROOTDIR.'/actions.php?id_module='.$id_module."', { op: 'change_position_widget_right', id: '".$widget['id']."' }, function(response){ location.href='".ROOTDIR.'/controller.php?id_module='.$id_module."'; }); }\"\">".$posizione."</a>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<tr class="'.$class.'">
|
||||||
|
<td>'.$widget['widget_name'].'</td>
|
||||||
|
<td align="right"><small>'.$location.'</small></td>
|
||||||
|
<td align="center">'.$stato.'</td>
|
||||||
|
<td align="center">'.$posizione.'</td>
|
||||||
|
</tr>';
|
||||||
|
|
||||||
|
$previous = $widget['module_name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>';
|
||||||
79
modules/stato_servizi/modutil.php
Normal file
79
modules/stato_servizi/modutil.php
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function submodules($list, $depth = 0)
|
||||||
|
{
|
||||||
|
$osm_version = Update::getVersion();
|
||||||
|
|
||||||
|
$id_module = Modules::getCurrent()['id'];
|
||||||
|
|
||||||
|
$result = '';
|
||||||
|
|
||||||
|
foreach ($list as $sub) {
|
||||||
|
// STATO
|
||||||
|
if (!empty($sub['enabled'])) {
|
||||||
|
$text = tr('Abilitato');
|
||||||
|
$text .= ($sub['id'] != $id_module) ? '. '.tr('Clicca per disabilitarlo').'...' : '';
|
||||||
|
$stato = '<i class="fa fa-cog fa-spin text-success" data-toggle="tooltip" title="'.$text.'"></i>';
|
||||||
|
} else {
|
||||||
|
$stato = '<i class="fa fa-cog text-warning" data-toggle="tooltip" title="'.tr('Non abilitato').'"></i>';
|
||||||
|
$class = 'warning';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Possibilità di disabilitare o abilitare i moduli tranne quello degli aggiornamenti
|
||||||
|
if ($sub['id'] != $id_module) {
|
||||||
|
if ($sub['enabled']) {
|
||||||
|
$stato = "<a href='javascript:;' onclick=\"if( confirm('".tr('Disabilitare questo modulo?')."') ){ $.post( '".ROOTDIR.'/actions.php?id_module='.$id_module."', { op: 'disable', id: '".$sub['id']."' }, function(response){ location.href='".ROOTDIR.'/controller.php?id_module='.$id_module."'; }); }\">".$stato."</a>\n";
|
||||||
|
} else {
|
||||||
|
$stato = "<a href='javascript:;' onclick=\"if( confirm('".tr('Abilitare questo modulo?')."') ){ $.post( '".ROOTDIR.'/actions.php?id_module='.$id_module."', { op: 'enable', id: '".$sub['id']."' }, function(response){ location.href='".ROOTDIR.'/controller.php?id_module='.$id_module."'; }); }\"\">".$stato."</a>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// COMPATIBILITA'
|
||||||
|
// Controllo per ogni versione se la regexp combacia per dire che è compatibile o meno
|
||||||
|
$compatibilities = explode(',', $sub['compatibility']);
|
||||||
|
|
||||||
|
$comp = false;
|
||||||
|
foreach ($compatibilities as $compatibility) {
|
||||||
|
$comp = (preg_match('/'.$compatibility.'/', $osm_version)) ? true : $comp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($comp) {
|
||||||
|
$compatible = '<i class="fa fa-check-circle text-success" data-toggle="tooltip" title="'.tr('Compatibile').'"></i>';
|
||||||
|
($sub['enabled']) ? $class = 'success' : $class = 'warning';
|
||||||
|
} else {
|
||||||
|
$compatible = '<i class="fa fa-warning text-danger" data-toggle="tooltip" title="'.tr('Non compatibile!').tr('Questo modulo è compatibile solo con le versioni').': '.$sub['compatibility'].'"></i>';
|
||||||
|
$class = 'danger';
|
||||||
|
}
|
||||||
|
|
||||||
|
$result .= '
|
||||||
|
<tr class="'.$class.'">
|
||||||
|
<td><small>'.str_repeat(' ', $depth * 4).'- '.$sub['title'].'</small></td>
|
||||||
|
<td align="right">'.$sub['version'].'</td>
|
||||||
|
<td align="center">'.$stato.'</td>
|
||||||
|
<td align="center">'.$compatible.'</td>';
|
||||||
|
|
||||||
|
$result .= '
|
||||||
|
<td>';
|
||||||
|
|
||||||
|
// Possibilità di disinstallare solo se il modulo non è tra quelli predefiniti
|
||||||
|
if (empty($sub['default'])) {
|
||||||
|
$result .= "
|
||||||
|
<a href=\"javascript:;\" data-toggle='tooltip' title=\"".tr('Disinstalla')."...\" onclick=\"if( confirm('".tr('Vuoi disinstallare questo modulo?').' '.tr('Tutti i dati salvati andranno persi!')."') ){ if( confirm('".tr('Sei veramente sicuro?')."') ){ $.post( '".ROOTDIR.'/actions.php?id_module='.$id_module."', { op: 'uninstall', id: '".$sub['id']."' }, function(response){ location.href='".ROOTDIR.'/controller.php?id_module='.$id_module."'; }); } }\">
|
||||||
|
<i class='fa fa-trash'></i>
|
||||||
|
</a>";
|
||||||
|
} else {
|
||||||
|
$result .= "
|
||||||
|
<a class='disabled text-muted'>
|
||||||
|
<i class='fa fa-trash'></i>
|
||||||
|
</a>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$result .= '
|
||||||
|
</td>
|
||||||
|
</tr>';
|
||||||
|
|
||||||
|
$result .= submodules($sub['all_children'], $depth + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
86
modules/stato_servizi/widgets/spazio_utilizzato.php
Normal file
86
modules/stato_servizi/widgets/spazio_utilizzato.php
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
include_once __DIR__.'/../../../core.php';
|
||||||
|
|
||||||
|
$module = Modules::get('Stato dei servizi');
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<script src="'.ROOTDIR.'/assets/dist/js/chartjs/Chart.min.js"></script>';
|
||||||
|
|
||||||
|
// Operazioni JavaScript
|
||||||
|
echo '
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$.ajax({
|
||||||
|
url: globals.rootdir + "/actions.php",
|
||||||
|
type: "get",
|
||||||
|
data: {
|
||||||
|
id_module: '.$module->id.',
|
||||||
|
op: "sizes",
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
|
||||||
|
crea_grafico(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function crea_grafico(values){
|
||||||
|
var ctx = $("#chart");
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$labels = [];
|
||||||
|
values.forEach(function(element) {
|
||||||
|
$data.push(element.size);
|
||||||
|
|
||||||
|
$labels.push(element.description + " (" + element.formattedSize + ")")
|
||||||
|
});
|
||||||
|
|
||||||
|
options = {
|
||||||
|
legend: {
|
||||||
|
display: true,
|
||||||
|
position: "right"
|
||||||
|
},
|
||||||
|
animation:{
|
||||||
|
animateScale: true,
|
||||||
|
animateRotate: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
data = {
|
||||||
|
datasets: [{
|
||||||
|
data: $data,
|
||||||
|
backgroundColor: [
|
||||||
|
\'rgba(255, 99, 132, 0.2)\',
|
||||||
|
\'rgba(54, 162, 235, 0.2)\',
|
||||||
|
\'rgba(255, 206, 86, 0.2)\',
|
||||||
|
\'rgba(75, 192, 192, 0.2)\',
|
||||||
|
\'rgba(153, 102, 255, 0.2)\',
|
||||||
|
\'rgba(255, 159, 64, 0.2)\'
|
||||||
|
],
|
||||||
|
borderColor: [
|
||||||
|
\'rgba(255, 99, 132, 1)\',
|
||||||
|
\'rgba(54, 162, 235, 1)\',
|
||||||
|
\'rgba(255, 206, 86, 1)\',
|
||||||
|
\'rgba(75, 192, 192, 1)\',
|
||||||
|
\'rgba(153, 102, 255, 1)\',
|
||||||
|
\'rgba(255, 159, 64, 1)\'
|
||||||
|
],
|
||||||
|
}],
|
||||||
|
|
||||||
|
labels: $labels,
|
||||||
|
};
|
||||||
|
|
||||||
|
var chart = new Chart(ctx, {
|
||||||
|
type: "pie",
|
||||||
|
data: data,
|
||||||
|
options: options
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="chart-container" style="width:20vw">
|
||||||
|
<canvas id="chart"></canvas>
|
||||||
|
</div>';
|
||||||
@@ -59,6 +59,11 @@ class WidgetManager implements ManagerInterface
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static function getModule()
|
||||||
|
{
|
||||||
|
return \Modules::get('Stato dei servizi');
|
||||||
|
}
|
||||||
|
|
||||||
protected function prints($widget)
|
protected function prints($widget)
|
||||||
{
|
{
|
||||||
return $this->stats($widget);
|
return $this->stats($widget);
|
||||||
@@ -88,7 +93,7 @@ class WidgetManager implements ManagerInterface
|
|||||||
|
|
||||||
// Generazione del codice HTML
|
// Generazione del codice HTML
|
||||||
$result = '
|
$result = '
|
||||||
<button type="button" class="close" onclick="if(confirm(\'Disabilitare questo widget?\')) { $.post( \''.ROOTDIR.'/modules/aggiornamenti/actions.php?id_module='.$widget['id_module'].'\', { op: \'disable_widget\', id: \''.$widget['id'].'\' }, function(response){ location.reload(); }); };" >
|
<button type="button" class="close" onclick="if(confirm(\'Disabilitare questo widget?\')) { $.post( \''.ROOTDIR.'/actions.php?id_module='.self::getModule()->id.'\', { op: \'disable_widget\', id: \''.$widget['id'].'\' }, function(response){ location.reload(); }); };" >
|
||||||
<span aria-hidden="true">×</span><span class="sr-only">'.tr('Chiudi').'</span>
|
<span aria-hidden="true">×</span><span class="sr-only">'.tr('Chiudi').'</span>
|
||||||
</button>';
|
</button>';
|
||||||
|
|
||||||
@@ -153,7 +158,7 @@ class WidgetManager implements ManagerInterface
|
|||||||
protected function custom($widget)
|
protected function custom($widget)
|
||||||
{
|
{
|
||||||
$result = '
|
$result = '
|
||||||
<button type="button" class="close" onclick="if(confirm(\'Disabilitare questo widget?\')) { $.post( \''.ROOTDIR.'/modules/aggiornamenti/actions.php?id_module='.$widget['id_module'].'\', { op: \'disable_widget\', id: \''.$widget['id'].'\' }, function(response){ location.reload(); }); };" >
|
<button type="button" class="close" onclick="if(confirm(\'Disabilitare questo widget?\')) { $.post( \''.ROOTDIR.'/actions.php?id_module='.self::getModule()->id.'\', { op: \'disable_widget\', id: \''.$widget['id'].'\' }, function(response){ location.reload(); }); };" >
|
||||||
<span aria-hidden="true">×</span><span class="sr-only">'.tr('Chiudi').'</span>
|
<span aria-hidden="true">×</span><span class="sr-only">'.tr('Chiudi').'</span>
|
||||||
</button>';
|
</button>';
|
||||||
|
|
||||||
|
|||||||
@@ -295,6 +295,9 @@ INSERT INTO `zz_widgets` (`id`, `name`, `type`, `id_module`, `location`, `class`
|
|||||||
-- Aggiunta ore rimanenti nel contratto per preavviso rinnovo
|
-- Aggiunta ore rimanenti nel contratto per preavviso rinnovo
|
||||||
ALTER TABLE `co_contratti` ADD `ore_preavviso_rinnovo` INT(11) NULL AFTER `giorni_preavviso_rinnovo`;
|
ALTER TABLE `co_contratti` ADD `ore_preavviso_rinnovo` INT(11) NULL AFTER `giorni_preavviso_rinnovo`;
|
||||||
|
|
||||||
|
-- Moduli Stato dei servizi
|
||||||
|
INSERT INTO `zz_modules` (`id`, `name`, `title`, `directory`, `options`, `options2`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`) VALUES (NULL, 'Stato dei servizi', 'Stato dei servizi', 'stato_servizi', 'custom', '', 'fa fa-clock-o', '2.4.9', '2.4.9', '1', NULL, '1', '1');
|
||||||
|
UPDATE `zz_modules` `t1` INNER JOIN `zz_modules` `t2` ON (`t1`.`name` = 'Stato dei servizi' AND `t2`.`name` = 'Strumenti') SET `t1`.`parent` = `t2`.`id`;
|
||||||
|
|
||||||
-- Widget spazio utilizzato
|
-- Widget spazio utilizzato
|
||||||
INSERT INTO `zz_widgets` (`id`, `name`, `type`, `id_module`, `location`, `class`, `query`, `bgcolor`, `icon`, `print_link`, `more_link`, `more_link_type`, `php_include`, `text`, `enabled`, `order`, `help`) VALUES (NULL, 'Spazio utilizzato', 'chart', (SELECT id FROM zz_modules WHERE name = 'Aggiornamenti'), 'controller_right', 'col-md-12', NULL, '#4ccc4c', 'fa fa-hdd-o', '', '', NULL, './modules/aggiornamenti/widgets/spazio_utilizzato.php', 'Spazio utilizzato', '1', '1', NULL);
|
INSERT INTO `zz_widgets` (`id`, `name`, `type`, `id_module`, `location`, `class`, `query`, `bgcolor`, `icon`, `print_link`, `more_link`, `more_link_type`, `php_include`, `text`, `enabled`, `order`, `help`) VALUES (NULL, 'Spazio utilizzato', 'chart', (SELECT id FROM zz_modules WHERE name = 'Stato dei servizi'), 'controller_right', 'col-md-12', NULL, '#4ccc4c', 'fa fa-hdd-o', '', '', NULL, './modules/stato_servizi/widgets/spazio_utilizzato.php', 'Spazio utilizzato', '1', '1', NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user