2018-08-21 14:34:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2018-09-13 23:06:13 +00:00
|
|
|
* Generate html for displaying data usage.
|
2018-08-21 14:34:01 +00:00
|
|
|
*/
|
2018-09-13 23:06:13 +00:00
|
|
|
function DisplayDataUsage(&$extraFooterScripts)
|
2018-08-21 14:34:01 +00:00
|
|
|
{
|
|
|
|
?>
|
|
|
|
<div class="row">
|
2018-09-10 14:53:05 +00:00
|
|
|
<div class="col-lg-12">
|
|
|
|
<div class="panel panel-primary">
|
2018-09-13 23:06:13 +00:00
|
|
|
<div class="panel-heading"><i class="fa fa-bar-chart fa-fw"></i> <?php echo _("Data usage monitoring"); ?></div>
|
2018-09-10 14:53:05 +00:00
|
|
|
<div class="panel-body">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-body">
|
|
|
|
<ul id="tabbarBandwidth" class="nav nav-tabs" role="tablist">
|
|
|
|
<li role="presentation" class="active"><a href="#daily" aria-controls="daily" role="tab" data-toggle="tab"><?php echo _("Daily"); ?></a></li>
|
|
|
|
<li role="presentation" class=""><a href="#monthly" aria-controls="monthly" role="tab" data-toggle="tab"><?php echo _("Monthly"); ?></a></li>
|
|
|
|
</ul>
|
|
|
|
<div id="tabsBandwidth" class="tabcontenttraffic tab-content">
|
2018-09-10 19:41:35 +00:00
|
|
|
<div role="tabpanel" class="tab-pane active fade in" id="daily">
|
2018-09-10 14:53:05 +00:00
|
|
|
<div class="row">
|
2018-09-10 19:41:35 +00:00
|
|
|
<div class="col-lg-12">
|
2018-09-10 14:53:05 +00:00
|
|
|
<h4><?php echo _('Daily traffic amount'); ?></h4>
|
2018-09-11 19:00:23 +00:00
|
|
|
<label for="cbxInterfacedaily"><?php echo _('interface'); ?></label>
|
|
|
|
<select id="cbxInterfacedaily" class="form-control" name="interfacedaily">
|
2018-08-21 14:34:01 +00:00
|
|
|
<?php
|
2018-09-10 14:53:05 +00:00
|
|
|
exec("ip -o link show | awk -F ': ' '{print $2}' | grep -v lo ", $interfacesWlo);
|
|
|
|
foreach ($interfacesWlo as $interface) {
|
2018-09-10 19:41:35 +00:00
|
|
|
echo ' <option value="' , htmlentities($interface, ENT_QUOTES) , '">' ,
|
2018-09-10 14:53:05 +00:00
|
|
|
htmlentities($interface, ENT_QUOTES) , '</option>' , PHP_EOL;
|
2018-08-21 14:34:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
2018-09-10 14:53:05 +00:00
|
|
|
</select>
|
2018-09-11 19:00:23 +00:00
|
|
|
<div class="hidden alert alert-info" id="divLoaderBandwidthdaily"><?php
|
|
|
|
echo sprintf(_("Loading %s bandwidth chart"), _('daily')); ?></div>
|
2018-09-10 19:41:35 +00:00
|
|
|
<div id="divChartBandwidthdaily"></div>
|
|
|
|
<div id="divTableBandwidthdaily"></div>
|
2018-09-10 14:53:05 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-09-10 19:41:35 +00:00
|
|
|
</div><!-- /.tab-pane -->
|
|
|
|
<div role="tabpanel" class="tab-pane fade" id="monthly">
|
2018-09-10 14:53:05 +00:00
|
|
|
<div class="row">
|
2018-09-10 19:41:35 +00:00
|
|
|
<div class="col-lg-12">
|
|
|
|
<h4><?php echo _("Monthly traffic amount"); ?></h4>
|
2018-09-11 19:00:23 +00:00
|
|
|
<label for="cbxInterfacemonthly"><?php echo _('interface'); ?></label>
|
|
|
|
<select id="cbxInterfacemonthly" class="form-control" name="interfacemonthly">
|
2018-08-21 14:34:01 +00:00
|
|
|
<?php
|
2018-09-10 14:53:05 +00:00
|
|
|
foreach ($interfacesWlo as $interface) {
|
2018-09-10 19:41:35 +00:00
|
|
|
echo ' <option value="' , htmlentities($interface, ENT_QUOTES) , '">' ,
|
2018-09-10 14:53:05 +00:00
|
|
|
htmlentities($interface, ENT_QUOTES) , '</option>' , PHP_EOL;
|
2018-08-21 14:34:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
2018-09-10 19:41:35 +00:00
|
|
|
</select>
|
2018-09-10 14:53:05 +00:00
|
|
|
<div class="hidden alert alert-info" id="divLoaderBandwidthmonthly">
|
|
|
|
<?php echo sprintf(_("Loading %s bandwidth chart"), _('monthly')); ?>
|
|
|
|
</div>
|
2018-09-10 19:41:35 +00:00
|
|
|
<div id="divChartBandwidthmonthly"></div>
|
|
|
|
<div id="divTableBandwidthmonthly"></div>
|
|
|
|
</div>
|
2018-09-10 14:53:05 +00:00
|
|
|
</div>
|
2018-09-10 19:41:35 +00:00
|
|
|
</div><!-- /.tab-pane -->
|
|
|
|
</div><!-- /.tabsBandwidth -->
|
|
|
|
</div><!-- /.panel-default -->
|
|
|
|
</div><!-- /.col-md-6 -->
|
|
|
|
</div><!-- /.row -->
|
2018-09-10 14:53:05 +00:00
|
|
|
</div><!-- /.panel-body -->
|
|
|
|
</div><!-- /.panel-primary -->
|
|
|
|
<div class="panel-footer"><?php echo _("Information provided by vnstat"); ?></div>
|
|
|
|
</div><!-- /.panel-primary -->
|
|
|
|
</div><!-- /.col-lg-12 -->
|
2018-08-21 14:34:01 +00:00
|
|
|
</div><!-- /.row -->
|
2018-09-11 19:00:23 +00:00
|
|
|
<script type="text/javascript"<?php //echo ' nonce="'.$csp_page_nonce.'"'; ?>>
|
|
|
|
// js translations:
|
|
|
|
var t = new Array();
|
|
|
|
t['send'] = '<?php echo addslashes(_('Send')); ?>';
|
|
|
|
t['receive'] = '<?php echo addslashes(_('Receive')); ?>';
|
|
|
|
</script>
|
2018-08-21 14:34:01 +00:00
|
|
|
<?php
|
2018-09-11 19:00:23 +00:00
|
|
|
|
2018-09-10 14:53:05 +00:00
|
|
|
$extraFooterScripts[] = array('src'=>'vendor/raphael/raphael.min.js',
|
|
|
|
'defer'=>false);
|
|
|
|
$extraFooterScripts[] = array('src'=>'vendor/morrisjs/morris.min.js', 'defer'=>false);
|
|
|
|
$extraFooterScripts[] = array('src'=>'vendor/datatables/js/jquery.dataTables.min.js', 'defer'=>false);
|
|
|
|
$extraFooterScripts[] = array('src'=>'js/bandwidthcharts.js', 'defer'=>false);
|
2018-08-21 14:34:01 +00:00
|
|
|
}
|
|
|
|
|