Add MonitorId to Zone fields and add Monitor() method
This commit is contained in:
parent
42dc4e46b1
commit
1701089211
|
@ -8,8 +8,9 @@ class Zone extends ZM_Object {
|
||||||
protected static $table = 'Zones';
|
protected static $table = 'Zones';
|
||||||
|
|
||||||
protected $defaults = array(
|
protected $defaults = array(
|
||||||
'Id' => null,
|
'Id' => null,
|
||||||
'Name' => '',
|
'MonitorId' => null,
|
||||||
|
'Name' => '',
|
||||||
'Type' => 'Active',
|
'Type' => 'Active',
|
||||||
'Units' => 'Pixels',
|
'Units' => 'Pixels',
|
||||||
'CheckMethod' => 'Blobs',
|
'CheckMethod' => 'Blobs',
|
||||||
|
@ -36,6 +37,14 @@ class Zone extends ZM_Object {
|
||||||
public static function find_one( $parameters = array(), $options = array() ) {
|
public static function find_one( $parameters = array(), $options = array() ) {
|
||||||
return ZM_Object::_find_one(get_class(), $parameters, $options);
|
return ZM_Object::_find_one(get_class(), $parameters, $options);
|
||||||
}
|
}
|
||||||
|
public function Monitor() {
|
||||||
|
if ( isset($this->{'MonitorId'}) ) {
|
||||||
|
$Monitor = Monitor::find_one(array('Id'=>$this->{'MonitorId'}));
|
||||||
|
if ( $Monitor )
|
||||||
|
return $Monitor;
|
||||||
|
}
|
||||||
|
return new Monitor();
|
||||||
|
}
|
||||||
|
|
||||||
} # end class Zone
|
} # end class Zone
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue