1<?php
2namespace ZM;
3require_once('database.php');
4require_once('Object.php');
5
6
7class Zone extends ZM_Object {
8  protected static $table = 'Zones';
9
10	protected $defaults = array(
11			'Id'                  => null,
12      'MonitorId'           => null,
13			'Name'                => '',
14			'Type' => 'Active',
15			'Units' => 'Pixels',
16			'CheckMethod' => 'Blobs',
17			'MinPixelThreshold' => null,
18			'MaxPixelThreshold' => null,
19			'MinAlarmPixels' => null,
20			'MaxAlarmPixels' => null,
21			'FilterX' => null,
22			'FilterY' => null,
23			'MinFilterPixels' => null,
24			'MaxFilterPixels' => null,
25			'MinBlobPixels' => null,
26			'MaxBlobPixels' => null,
27			'MinBlobs' => null,
28			'MaxBlobs' => null,
29			'OverloadFrames' => 0,
30			'ExtendAlarmFrames' => 0,
31			);
32
33  public static function find( $parameters = array(), $options = array() ) {
34    return ZM_Object::_find(get_class(), $parameters, $options);
35  }
36
37  public static function find_one( $parameters = array(), $options = array() ) {
38    return ZM_Object::_find_one(get_class(), $parameters, $options);
39  }
40  public function Monitor() {
41    if ( isset($this->{'MonitorId'}) ) {
42      $Monitor = Monitor::find_one(array('Id'=>$this->{'MonitorId'}));
43      if ( $Monitor )
44        return $Monitor;
45    }
46    return new Monitor();
47  }
48
49} # end class Zone
50?>
51