@@ -49,6 +49,10 @@ public static function getAnalysingOptions() {
49
49
}
50
50
return $ AnalysingOptions ;
51
51
}
52
+ public static function getAnalysingString ($ option ) {
53
+ $ options = Monitor::getAnalysingOptions ();
54
+ return $ options [$ option ];
55
+ }
52
56
53
57
protected static $ AnalysisSourceOptions = null ;
54
58
public static function getAnalysisSourceOptions () {
@@ -84,6 +88,11 @@ public static function getRecordingOptions() {
84
88
return $ RecordingOptions ;
85
89
}
86
90
91
+ public static function getRecordingString ($ option ) {
92
+ $ options = Monitor::getRecordingOptions ();
93
+ return $ options [$ option ];
94
+ }
95
+
87
96
protected static $ RecordingSourceOptions = null ;
88
97
public static function getRecordingSourceOptions () {
89
98
if (!isset ($ RecordingSourceOptions )) {
@@ -114,17 +123,21 @@ public static function getDecodingOptions() {
114
123
public static function getStatuses () {
115
124
if (!isset ($ Statuses )) {
116
125
$ Statuses = array (
117
- -1 => 'Unknown ' ,
118
- 0 => 'Idle ' ,
119
- 1 => 'PreAlarm ' ,
120
- 2 => 'Alarm ' ,
121
- 3 => 'Alert ' ,
122
- 4 => 'Tape '
126
+ 0 => 'Unknown ' ,
127
+ 1 => 'Idle ' ,
128
+ 2 => 'PreAlarm ' ,
129
+ 3 => 'Alarm ' ,
130
+ 4 => 'Alert ' ,
123
131
);
124
132
}
125
133
return $ Statuses ;
126
134
}
127
135
136
+ public static function getStateString ($ option ) {
137
+ $ statuses = Monitor::getStatuses ();
138
+ return $ statuses [$ option ];
139
+ }
140
+
128
141
protected static $ table = 'Monitors ' ;
129
142
130
143
protected $ defaults = array (
@@ -265,6 +278,11 @@ public static function getStatuses() {
265
278
'AnalysisFPS ' => null ,
266
279
'CaptureFPS ' => null ,
267
280
'CaptureBandwidth ' => null ,
281
+ 'Capturing ' => 0 ,
282
+ 'Analysing ' => 0 ,
283
+ 'State ' => 0 ,
284
+ 'LastEventId ' => null ,
285
+ 'EventId ' => null ,
268
286
);
269
287
private $ summary_fields = array (
270
288
'TotalEvents ' => array ('type ' =>'integer ' , 'default ' =>null , 'do_not_update ' =>1 ),
@@ -420,16 +438,8 @@ public function __call($fn, array $args) {
420
438
return $ this ->defaults [$ fn ];
421
439
} else if (array_key_exists ($ fn , $ this ->status_fields )) {
422
440
if ($ this ->Id ()) {
423
- $ sql = 'SELECT * FROM `Monitor_Status` WHERE `MonitorId`=? ' ;
424
- $ row = dbFetchOne ($ sql , NULL , array ($ this ->{'Id ' }));
425
- if (!$ row ) {
426
- Warning ('Unable to load Monitor status record for Id= ' .$ this ->{'Id ' }.' using ' .$ sql );
427
- } else {
428
- foreach ($ row as $ k => $ v ) {
429
- $ this ->{$ k } = $ v ;
430
- }
431
- return $ this ->{$ fn };
432
- }
441
+ $ row = $ this ->Monitor_Status ();
442
+ if ($ row ) return $ row [$ fn ];
433
443
} # end if this->Id
434
444
return null ;
435
445
} else if (array_key_exists ($ fn , $ this ->summary_fields )) {
@@ -452,6 +462,15 @@ public function __call($fn, array $args) {
452
462
}
453
463
}
454
464
465
+ public function Monitor_Status () {
466
+ if (!property_exists ($ this , 'Monitor_Status ' )) {
467
+ $ sql = 'SELECT * FROM `Monitor_Status` WHERE `MonitorId`=? ' ;
468
+ $ row = $ this ->{'Monitor_Status ' } = dbFetchOne ($ sql , NULL , array ($ this ->{'Id ' }));
469
+ if (!$ row ) Warning ('Unable to load Monitor status record for Id= ' .$ this ->{'Id ' }.' using ' .$ sql );
470
+ }
471
+ return $ this ->{'Monitor_Status ' };
472
+ }
473
+
455
474
public function getStreamSrc ($ args , $ querySep ='& ' ) {
456
475
$ streamSrc = $ this ->Server ()->UrlToZMS (
457
476
ZM_MIN_STREAMING_PORT ?
0 commit comments