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

@@ -10,6 +10,8 @@
* @license http://dev.osbill.net/license.html
*/
class Company {
public static $instance = array();
// Our Company Setup object
private $so;
@@ -23,7 +25,12 @@ class Company {
}
public static function instance() {
return new Company(ORM::factory('Setup',array('url'=>URL::base('http'))));
$x = URL::base('http');
if (! isset(Company::$instance[$x]))
Company::$instance[$x] = new Company(ORM::factory('Setup',array('url'=>$x)));
return Company::$instance[$x];
}
public function admin() {

View File

@@ -136,9 +136,8 @@ abstract class ORM_OSB extends ORM {
else
$array[$k] = $x;
} else
if (! $v)
unset($array[$k]);
} elseif (! $v AND $v !== 0 AND $v !== '0')
unset($array[$k]);
}
@@ -207,15 +206,6 @@ abstract class ORM_OSB extends ORM {
// Find any fields that have changed, and process them.
if ($this->_changed)
foreach ($this->_changed as $c) {
// Convert to NULL
if (in_array($c,$this->_nullifempty)) {
if (is_array($this->_object[$c]))
$this->_object[$c] = $this->_nullifempty($this->_object[$c]);
elseif (! $this->_object[$c])
$this->_object[$c] = NULL;
}
// Any fields that are blobs, and encode them.
if (! is_null($this->_object[$c]) AND $this->_table_columns[$c]['data_type'] == 'blob') {
$this->_object[$c] = $this->_blob($this->_object[$c],TRUE);
@@ -246,6 +236,24 @@ abstract class ORM_OSB extends ORM {
return TRUE;
}
/**
* Override the Kohana processing so we can null values if required.
*/
public function values(array $values,array $expected=NULL) {
foreach ($values as $k=>$v) {
// Convert to NULL
if (in_array($k,$this->_nullifempty)) {
if (is_array($v))
$values[$k] = $this->_nullifempty($v);
elseif (! $v AND $v !== 0 AND $v !== '0')
$values[$k] = NULL;
}
}
return parent::values($values,$expected);
}
/**
* Function help to find records that are active
*/