SSL, Google Chart updates, lnAPP improvements

This commit is contained in:
Deon George
2012-12-11 08:48:30 +11:00
parent c4e760fa21
commit 6588de4f7f
67 changed files with 940 additions and 539 deletions

View File

@@ -10,7 +10,7 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_ADSL_Plan extends ORMOSB {
class Model_ADSL_Plan extends ORM_OSB {
// Relationships
// @todo This model should probably be joined with product_plugin_adsl
protected $_belongs_to = array(

View File

@@ -10,7 +10,7 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_ADSL_Supplier extends ORMOSB {
class Model_ADSL_Supplier extends ORM_OSB {
// Relationships
protected $_has_many = array(
'adsl_supplier_plan'=>array('foreign_key'=>'supplier_id','far_key'=>'id'),

View File

@@ -10,7 +10,7 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_ADSL_Supplier_Plan extends ORMOSB {
class Model_ADSL_Supplier_Plan extends ORM_OSB {
// Relationships
protected $_has_many = array(
'adsl_plan'=>array('far_key'=>'id'),

View File

@@ -241,26 +241,21 @@ class Model_Service_Plugin_ADSL extends Model_Service_Plugin {
$date = mktime(0,0,0,date('n',$period),$day,date('Y',$period));
$daysleft = date('d',strtotime('last day of',$date))-$day;
$google = GoogleChart::factory('vertical_bar');
$google->title = sprintf('DSL traffic usage as at %s',Config::date($date));
$google = GoogleChart::factory('Legacy')
->type('vertical_bar')
->title(sprintf('DSL traffic usage as at %s',Config::date($date)));
foreach ($traffic_data as $k => $details)
$google->series(array(
'title'=>array((isset($friendly[$k]) ? $friendly[$k] : $k)),
'axis'=>'x',
'data'=>array((isset($friendly[$k]) ? $friendly[$k] : $k)=>$traffic_data[$k])));
$google->data(array('yl'=>($x=isset($friendly[$k]) ? $friendly[$k] : $k)),array($x=>$traffic_data[$k]));
// Work out comulative numbers
foreach ($traffic_data as $k => $details)
$google->series(array(
'title'=>array((isset($friendly['cumulative_'.$k]) ? $friendly['cumulative_'.$k] : 'cumulative_'.$k)),
'axis'=>'r',
'data'=>array((isset($friendly['cumulative_'.$k]) ? $friendly['cumulative_'.$k] : 'cumulative_'.$k)=>$this->cumulative($traffic_data[$k]))));
$google->data(array('yr'=>($x=isset($friendly['cumulative'.$k]) ? $friendly['cumulative'.$k] : 'cumulative'.$k)),array($x=>$this->cumulative($traffic_data[$k])));
foreach ($array as $item) {
switch ($item) {
case 'MONTH_GRAPH': $value = (string)$google; break;
case 'MONTH_TABLE': $value = $google->html_table(FALSE,array(
case 'MONTH_TABLE': $value = $google->table(FALSE,array(
'table'=>'style="border: 1px solid #bebcb7; padding: 5px 5px; background: none repeat scroll 0% 0% #f8f7f5; font-size: 70%;"',
)); break;
@@ -367,35 +362,27 @@ class Model_Service_Plugin_ADSL extends Model_Service_Plugin {
* Render a google chart of traffic
*/
public function graph_traffic($month=NULL) {
$google = GoogleChart::factory('vertical_bar');
$google = GoogleChart::factory('Legacy')
->type('vertical_bar');
// If we came in via a post to show a particular month, then show that, otherwise show the yearly result
if (! is_null($month) AND trim($month)) {
$google->title = sprintf('DSL traffic usage for %s',$_POST['month']);
$google->title(sprintf('DSL traffic usage for %s',$_POST['month']));
$traffic_data = $this->get_traffic_data_daily(strtotime($_POST['month'].'-01'));
foreach ($traffic_data as $k => $details)
$google->series(array(
'title'=>array((isset($friendly[$k]) ? $friendly[$k] : $k)),
'axis'=>'x',
'data'=>array((isset($friendly[$k]) ? $friendly[$k] : $k)=>$traffic_data[$k])));
$google->data(array('yl'=>($x=isset($friendly[$k]) ? $friendly[$k] : $k)),array($x=>$traffic_data[$k]));
foreach ($traffic_data as $k => $details)
$google->series(array(
'title'=>array((isset($friendly['cumulative'.$k]) ? $friendly['cumulative'.$k] : 'cumulative'.$k)),
'axis'=>'r',
'data'=>array((isset($friendly['cumulative'.$k]) ? $friendly['cumulative'.$k] : 'cumulative'.$k)=>$this->cumulative($traffic_data[$k]))));
$google->data(array('yr'=>($x=isset($friendly['cumulative'.$k]) ? $friendly['cumulative'.$k] : 'cumulative'.$k)),array($x=>$this->cumulative($traffic_data[$k])));
} else {
// @todo Change the date to the last record date
$google->title = sprintf('Monthly DSL traffic usage as at %s',Config::date(strtotime('yesterday')));
$google->title(sprintf('Monthly DSL traffic usage as at %s',Config::date(strtotime('yesterday'))));
$traffic_data = $this->get_traffic_data_monthly();
foreach ($traffic_data as $k => $details)
$google->series(array(
'title'=>array((isset($friendly[$k]) ? $friendly[$k] : $k)),
'axis'=>'x',
'data'=>array((isset($friendly[$k]) ? $friendly[$k] : $k)=>$traffic_data[$k])));
$google->data(array('yl'=>($x=isset($friendly[$k]) ? $friendly[$k] : $k)),array($x=>$traffic_data[$k]));
}
return (string)$google;

View File

@@ -10,7 +10,7 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Service_Plugin_ADSL_Traffic extends ORMOSB {
class Model_Service_Plugin_ADSL_Traffic extends ORM_OSB {
protected $_table_name = 'service__adsl_traffic';
protected $_primary_key = 'service';
protected $_disable_wild_select = TRUE;