mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-27 00:38:30 -04:00
Add MonitorId to Zone fields and add Monitor() method
This commit is contained in:
1 parent
42dc4e46b1
commit
1701089211
1 file changed
+11
-2
+11
-2
@@ -8,8 +8,9 @@ class Zone extends ZM_Object {
|
||||
protected static $table = 'Zones';
|
||||
|
||||
protected $defaults = array(
|
||||
'Id' => null,
|
||||
'Name' => '',
|
||||
'Id' => null,
|
||||
'MonitorId' => null,
|
||||
'Name' => '',
|
||||
'Type' => 'Active',
|
||||
'Units' => 'Pixels',
|
||||
'CheckMethod' => 'Blobs',
|
||||
@@ -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
|
||||
?>
|
||||
Reference in new issue
Block a user