Add MonitorId to Zone fields and add Monitor() method
This commit is contained in:
parent
42dc4e46b1
commit
1701089211
|
@ -9,6 +9,7 @@ class Zone extends ZM_Object {
|
|||
|
||||
protected $defaults = array(
|
||||
'Id' => null,
|
||||
'MonitorId' => null,
|
||||
'Name' => '',
|
||||
'Type' => 'Active',
|
||||
'Units' => 'Pixels',
|
||||
|
@ -36,6 +37,14 @@ class Zone extends ZM_Object {
|
|||
public static function find_one( $parameters = array(), $options = array() ) {
|
||||
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
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue