Overhaul ADSL traffic reporting/graphing

This commit is contained in:
Deon George
2013-11-14 22:50:35 +11:00
parent 158a4f9e47
commit e01d37244c
33 changed files with 891 additions and 471 deletions

View File

@@ -12,16 +12,16 @@
<tbody>
<?php foreach ($aso->services(TRUE) as $so) : ?>
<?php $p = $so->plugin(); $po = $p->product(); $service_number = $p->service_number; ?>
<?php $p = $so->plugin(); $po = $p->admin_plan(); $service_number = $p->service_number; ?>
<tr class="<?php echo $o->charge($service_number) == $po->adsl_supplier_plan->total() ? '' : 'error'; ?>">
<tr class="<?php echo $o->charge($service_number) == $po->adsl_supplier_plan->display('base_cost') ? '' : 'error'; ?>">
<td><?php echo $service_number; ?></td>
<td><?php echo HTML::anchor(URL::link('user','service/view/'.$so->id),$so->id); ?></td>
<td><?php echo $po->adsl_supplier_plan->name().($p->provided_adsl_plan_id ? '*' : ''); ?></td>
<td><?php echo $p->contract_date_start(TRUE); ?></td>
<td><?php echo $p->contract_date_end(TRUE); ?></td>
<td><?php echo Currency::display($po->adsl_supplier_plan->total()); ?></td>
<td><?php echo $po->adsl_supplier_plan->display('base_cost'); ?></td>
<td><?php echo Currency::display($o->charge($service_number)); ?></td>
<td><?php echo Currency::display($o->excess($service_number)); ?></td>

View File

@@ -4,14 +4,14 @@
<div class="dl-horizontal">
<dt>Speed</dt>
<dd><?php echo $po->adsl_supplier_plan->display('speed'); ?></dd>
<dd><?php echo $o->supplier_plan->display('speed'); ?></dd>
<dt>Peak Downloads Included</dt>
<dd><?php echo $po->base_down_peak/1000; ?> GB, excess <?php echo $po->display('extra_down_peak'); ?>/GB.
<dd><?php echo $o->base_down_peak/1000; ?> GB, excess <?php echo $o->display('extra_down_peak'); ?>/GB.
<?php if ($po->base_down_offpeak OR $po->extra_down_offpeak) : ?>
<?php if ($o->hasOffpeak()) : ?>
<dt>OffPeak Downloads Included</dt>
<dd><?php echo $po->base_down_offpeak/1000; ?> GB, excess <?php echo $po->display('extra_down_offpeak'); ?>/GB.
<dd><?php echo $o->base_down_offpeak/1000; ?> GB, excess <?php echo $o->display('extra_down_offpeak'); ?>/GB.
<?php endif ?>
</div> <!-- /dl-horizontal -->

View File

@@ -1,9 +1,19 @@
<!-- @todo NEEDS TO BE TRANSLATED -->
<table class="box-left">
<?php foreach ($traffic as $metric => $usage) { ?>
<tr>
<td><?php echo $metric; ?></td>
<td class="head"><?php echo $usage; ?></td>
</tr>
<?php } ?>
<table class="table table-striped table-condensed table-hover" id="list-table">
<thead><tr>
<th><?php echo $index; ?></th>
<?php foreach ($th as $i) : ?>
<th><?php echo $o->friendly($i); ?></th>
<?php endforeach ?>
</tr></thead>
<tbody>
<?php foreach ($td as $i => $details) : ?>
<tr>
<td><?php echo $i; ?></td>
<?php foreach ($th as $k) : ?>
<td><?php echo $details[$k]; ?></td>
<?php endforeach ?>
</tr>
<?php endforeach ?>
</tbody>
</table>

View File

@@ -39,22 +39,42 @@
<legend>Traffic Usage</legend>
<div class="dl-horizontal">
<dt>This Month</dt>
<dd>&nbsp;<?php echo $o->traffic_month(NULL); ?></dd>
<dt>Last Month</dt>
<dd>&nbsp;<?php echo $o->traffic_lastmonth(); ?></dd>
<dd>&nbsp;<?php echo $o->traffic_month(strtotime('last month'),TRUE,1000); ?> GB</dd>
<dt>This Month</dt>
<dd>&nbsp;<?php echo $o->traffic_month(strtotime('yesterday'),TRUE,1000); ?> GB</dd>
<dt>Excess Traffic</dt>
<dd>&nbsp;$<?php echo $o->traffic_excess(strtotime('yesterday'),TRUE,TRUE); ?></dd>
</div> <!-- dl-horizontal -->
</fieldset>
<fieldset class="span6">
<table>
<tr>
<td>View Daily Traffic for Month</td>
<td><?php echo Form::open(); echo Form::select('month',array_merge(array(''),$o->get_traffic_months()),(isset($_POST['month']) ? $_POST['month'] : '')); echo Form::submit('submit',_('Show'),array('class'=>'form_button')); echo Form::close(); ?></td>
</tr>
</table>
<form class="form-inline" method="POST">
<div class="dl-horizontal">
<dt>View Traffic for</dt>
<dd><?php echo Form::select('month',array_merge(array(''),$o->get_traffic_months()),(isset($_POST['month']) ? $_POST['month'] : ''),array('class'=>'input-small','nocg'=>TRUE)); ?>
<button type="submit" class="btn btn-mini">Submit</button></dd>
</div> <!-- dl-horizontal -->
</form>
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab1" data-toggle="tab">Graph</a></li>
<li class=""><a href="#tab2" data-toggle="tab">Table</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<?php echo $o->traffic_graph(isset($_POST['month']) ? $_POST['month'] : ''); ?>
</div> <!-- /tab-pane -->
<div class="tab-pane" id="tab2">
<?php echo $o->traffic_table(isset($_POST['month']) ? $_POST['month'] : ''); ?>
</div> <!-- /tab-pane -->
</div> <!-- /tab-content -->
</div> <!-- /tabbable -->
<?php echo $o->graph_traffic(isset($_POST['month']) ? $_POST['month'] : ''); ?><br>
<?php echo $o->table_traffic(isset($_POST['month']) ? $_POST['month'] : ''); ?>
</fieldset>