More fixes to work with KH 3.3
This commit is contained in:
parent
6db02ae77d
commit
19411b6352
@ -92,7 +92,7 @@ class Kohana_Minion_CLI {
|
|||||||
{
|
{
|
||||||
foreach ($values as $opt => $value)
|
foreach ($values as $opt => $value)
|
||||||
{
|
{
|
||||||
if ( ! in_array($opt, $options))
|
if ( ! in_array($opt, $options, TRUE))
|
||||||
{
|
{
|
||||||
// Set the given value
|
// Set the given value
|
||||||
unset($values[$opt]);
|
unset($values[$opt]);
|
||||||
|
@ -246,11 +246,11 @@ class Model_Service_Plugin_ADSL extends Model_Service_Plugin {
|
|||||||
->title(sprintf('DSL traffic usage as at %s',Config::date($date)));
|
->title(sprintf('DSL traffic usage as at %s',Config::date($date)));
|
||||||
|
|
||||||
foreach ($traffic_data as $k => $details)
|
foreach ($traffic_data as $k => $details)
|
||||||
$google->data(array('yl'=>($x=isset($friendly[$k]) ? $friendly[$k] : $k)),array($x=>$traffic_data[$k]));
|
$google->sdata(array('yl'=>($x=isset($friendly[$k]) ? $friendly[$k] : $k)),array($x=>$traffic_data[$k]));
|
||||||
|
|
||||||
// Work out comulative numbers
|
// Work out comulative numbers
|
||||||
foreach ($traffic_data as $k => $details)
|
foreach ($traffic_data as $k => $details)
|
||||||
$google->data(array('yr'=>($x=isset($friendly['cumulative'.$k]) ? $friendly['cumulative'.$k] : 'cumulative'.$k)),array($x=>$this->cumulative($traffic_data[$k])));
|
$google->sdata(array('yr'=>($x=isset($friendly['cumulative'.$k]) ? $friendly['cumulative'.$k] : 'cumulative'.$k)),array($x=>$this->cumulative($traffic_data[$k])));
|
||||||
|
|
||||||
foreach ($array as $item) {
|
foreach ($array as $item) {
|
||||||
switch ($item) {
|
switch ($item) {
|
||||||
@ -371,10 +371,10 @@ class Model_Service_Plugin_ADSL extends Model_Service_Plugin {
|
|||||||
$traffic_data = $this->get_traffic_data_daily(strtotime($_POST['month'].'-01'));
|
$traffic_data = $this->get_traffic_data_daily(strtotime($_POST['month'].'-01'));
|
||||||
|
|
||||||
foreach ($traffic_data as $k => $details)
|
foreach ($traffic_data as $k => $details)
|
||||||
$google->data(array('yl'=>($x=isset($friendly[$k]) ? $friendly[$k] : $k)),array($x=>$traffic_data[$k]));
|
$google->sdata(array('yl'=>($x=isset($friendly[$k]) ? $friendly[$k] : $k)),array($x=>$traffic_data[$k]));
|
||||||
|
|
||||||
foreach ($traffic_data as $k => $details)
|
foreach ($traffic_data as $k => $details)
|
||||||
$google->data(array('yr'=>($x=isset($friendly['cumulative'.$k]) ? $friendly['cumulative'.$k] : 'cumulative'.$k)),array($x=>$this->cumulative($traffic_data[$k])));
|
$google->sdata(array('yr'=>($x=isset($friendly['cumulative'.$k]) ? $friendly['cumulative'.$k] : 'cumulative'.$k)),array($x=>$this->cumulative($traffic_data[$k])));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// @todo Change the date to the last record date
|
// @todo Change the date to the last record date
|
||||||
@ -382,7 +382,7 @@ class Model_Service_Plugin_ADSL extends Model_Service_Plugin {
|
|||||||
$traffic_data = $this->get_traffic_data_monthly();
|
$traffic_data = $this->get_traffic_data_monthly();
|
||||||
|
|
||||||
foreach ($traffic_data as $k => $details)
|
foreach ($traffic_data as $k => $details)
|
||||||
$google->data(array('yl'=>($x=isset($friendly[$k]) ? $friendly[$k] : $k)),array($x=>$traffic_data[$k]));
|
$google->sdata(array('yl'=>($x=isset($friendly[$k]) ? $friendly[$k] : $k)),array($x=>$traffic_data[$k]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (string)$google;
|
return (string)$google;
|
||||||
|
@ -81,7 +81,7 @@ class Model_Service_Plugin_DOMAIN extends Model_Service_Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function manage_dns_button() {
|
public function manage_dns_button() {
|
||||||
return $this->service_plugin_host->manage_button('service_plugin_host');
|
return $this->service_plugin_HOST->manage_button('service_plugin_host');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -19,7 +19,7 @@ abstract class GoogleChart implements Iterator,Countable {
|
|||||||
// Chart title
|
// Chart title
|
||||||
protected $_title = '';
|
protected $_title = '';
|
||||||
protected $_dataurl = '';
|
protected $_dataurl = '';
|
||||||
protected $_divname = '';
|
protected $_divname = 'gchart';
|
||||||
// Default chart size.
|
// Default chart size.
|
||||||
protected $_height = '200';
|
protected $_height = '200';
|
||||||
protected $_width = '700';
|
protected $_width = '700';
|
||||||
|
@ -99,36 +99,51 @@ class GoogleChart_ComboChart extends GoogleChart {
|
|||||||
Script::add(array(
|
Script::add(array(
|
||||||
'type'=>'stdin',
|
'type'=>'stdin',
|
||||||
'data'=>"
|
'data'=>"
|
||||||
function drawChart".$this->_divname."() {
|
function drawChart_".$this->_divname."() {
|
||||||
var jsonData = $.ajax({
|
div = document.getElementById('".$this->_divname."');
|
||||||
url: '".$this->_dataurl."',
|
|
||||||
dataType:'json',
|
|
||||||
async: false,
|
|
||||||
}).responseText;
|
|
||||||
|
|
||||||
var x = JSON.parse(jsonData);
|
if (! div) {
|
||||||
for(var key in x) {
|
alert(\"Unable to render chart, DIV ['".$this->_divname."'] doesnt exist.\");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '".$this->_dataurl."',
|
||||||
|
dataType: 'json',
|
||||||
|
async: true,
|
||||||
|
timeout: 10000,
|
||||||
|
success: function(jsonData) {
|
||||||
|
for(var key in jsonData) {
|
||||||
if (key == 'data')
|
if (key == 'data')
|
||||||
data = x[key];
|
data = jsonData[key];
|
||||||
else if (key == 'options')
|
else if (key == 'options')
|
||||||
options = x[key];
|
options = jsonData[key];
|
||||||
else
|
else
|
||||||
alert('UNKNOWN Key: '+key);
|
alert('UNKNOWN Key: '+key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create our data table out of JSON data loaded from server.
|
// Create our data table out of JSON data loaded from server.
|
||||||
var data = new google.visualization.DataTable(data);
|
var x = new google.visualization.DataTable(data);
|
||||||
|
|
||||||
// Instantiate and draw our chart, passing in some options.
|
// Instantiate and draw our chart, passing in some options.
|
||||||
var chart = new google.visualization.ComboChart(document.getElementById('".$this->_divname."'));
|
var chart = new google.visualization.ComboChart(document.getElementById('".$this->_divname."'));
|
||||||
chart.draw(data, options);
|
chart.draw(x, options);
|
||||||
|
},
|
||||||
|
error: function(x, t, m) {
|
||||||
|
if (t==='timeout') {
|
||||||
|
alert('got timeout');
|
||||||
|
} else {
|
||||||
|
alert('t is: '+t+', X: '+x+', M: '+m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
));
|
));
|
||||||
|
|
||||||
Script::add(array(
|
Script::add(array(
|
||||||
'type'=>'stdin',
|
'type'=>'stdin',
|
||||||
'data'=>'google.setOnLoadCallback(drawChart'.$this->_divname.');',
|
'data'=>'$(document).ready(function() {google.setOnLoadCallback(drawChart_'.$this->_divname.'); });',
|
||||||
));
|
));
|
||||||
|
|
||||||
return sprintf('<div id="%s" style="width: %spx; height: %spx;"></div>',$this->_divname,$this->_width,$this->_height);
|
return sprintf('<div id="%s" style="width: %spx; height: %spx;"></div>',$this->_divname,$this->_width,$this->_height);
|
||||||
|
@ -105,8 +105,8 @@ class Controller_User_Invoice extends Controller_TemplateDefault_User {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
left:350px;
|
left:250px;
|
||||||
top:-200px;
|
top:-20px;
|
||||||
}
|
}
|
||||||
'));
|
'));
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
|||||||
$google = GoogleChart::factory('ComboChart');
|
$google = GoogleChart::factory('ComboChart');
|
||||||
|
|
||||||
foreach ($data['data'] as $key => $values)
|
foreach ($data['data'] as $key => $values)
|
||||||
$google->data(array('yl'=>$key),array($key=>$values));
|
$google->sdata(array('yl'=>$key),array($key=>$values));
|
||||||
|
|
||||||
$google->data(array('yr'=>'services'),array('services'=>$data['svs']));
|
$google->sdata(array('yr'=>'services'),array('services'=>$data['svs']));
|
||||||
|
|
||||||
$this->auto_render = FALSE;
|
$this->auto_render = FALSE;
|
||||||
$this->response->headers('Content-Type','application/json');
|
$this->response->headers('Content-Type','application/json');
|
||||||
@ -195,16 +195,11 @@ class Controller_Admin_Service extends Controller_TemplateDefault_Admin {
|
|||||||
|
|
||||||
public function action_listadslservices() {
|
public function action_listadslservices() {
|
||||||
$svs = ORM::factory('Service')->list_bylistgroup('ADSL');
|
$svs = ORM::factory('Service')->list_bylistgroup('ADSL');
|
||||||
$data = $this->consoltraffic($svs,time());
|
|
||||||
|
|
||||||
$google = GoogleChart::factory('ComboChart')
|
$google = GoogleChart::factory('ComboChart')
|
||||||
|
->dataurl(URL::site('admin/service/ajaxjson_traffic'))
|
||||||
->title(sprintf('ADSL traffic as at %s',date('Y-m-d',strtotime('yesterday'))));
|
->title(sprintf('ADSL traffic as at %s',date('Y-m-d',strtotime('yesterday'))));
|
||||||
|
|
||||||
foreach ($data['data'] as $key => $values)
|
|
||||||
$google->data(array('yl'=>$key),array($key=>$values));
|
|
||||||
|
|
||||||
$google->data(array('yr'=>'services'),array('services'=>$data['svs']));
|
|
||||||
|
|
||||||
Block::add(array('body'=>(string)$google));
|
Block::add(array('body'=>(string)$google));
|
||||||
|
|
||||||
Block::add(array(
|
Block::add(array(
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* @copyright (c) 2010 Open Source Billing
|
* @copyright (c) 2010 Open Source Billing
|
||||||
* @license http://dev.osbill.net/license.html
|
* @license http://dev.osbill.net/license.html
|
||||||
*/
|
*/
|
||||||
class Task_Task_ListActive extends Task {
|
class Task_Task_Listactive extends Task {
|
||||||
protected function _execute(array $params) {
|
protected function _execute(array $params) {
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
Reference in New Issue
Block a user