add event file system path to API (#2639)
This commit is contained in:
parent
695bdfc1c6
commit
2d5f84cd22
|
@ -35,6 +35,7 @@ class EventsController extends AppController {
|
||||||
$this->Event->recursive = -1;
|
$this->Event->recursive = -1;
|
||||||
|
|
||||||
global $user;
|
global $user;
|
||||||
|
require_once __DIR__ .'/../../../includes/Event.php';
|
||||||
$allowedMonitors = $user ? preg_split('@,@', $user['MonitorIds'], NULL, PREG_SPLIT_NO_EMPTY) : null;
|
$allowedMonitors = $user ? preg_split('@,@', $user['MonitorIds'], NULL, PREG_SPLIT_NO_EMPTY) : null;
|
||||||
|
|
||||||
if ( $allowedMonitors ) {
|
if ( $allowedMonitors ) {
|
||||||
|
@ -87,9 +88,13 @@ class EventsController extends AppController {
|
||||||
$events = $this->Paginator->paginate('Event');
|
$events = $this->Paginator->paginate('Event');
|
||||||
|
|
||||||
// For each event, get the frameID which has the largest score
|
// For each event, get the frameID which has the largest score
|
||||||
|
// also add FS path
|
||||||
|
|
||||||
foreach ( $events as $key => $value ) {
|
foreach ( $events as $key => $value ) {
|
||||||
|
$EventObj = new ZM\Event($value['Event']['Id']);
|
||||||
$maxScoreFrameId = $this->getMaxScoreAlarmFrameId($value['Event']['Id']);
|
$maxScoreFrameId = $this->getMaxScoreAlarmFrameId($value['Event']['Id']);
|
||||||
$events[$key]['Event']['MaxScoreFrameId'] = $maxScoreFrameId;
|
$events[$key]['Event']['MaxScoreFrameId'] = $maxScoreFrameId;
|
||||||
|
$events[$key]['Event']['FileSystemPath'] = $EventObj->Path();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->set(compact('events'));
|
$this->set(compact('events'));
|
||||||
|
@ -131,6 +136,9 @@ class EventsController extends AppController {
|
||||||
$event['Event']['fileExists'] = $this->Event->fileExists($event['Event']);
|
$event['Event']['fileExists'] = $this->Event->fileExists($event['Event']);
|
||||||
$event['Event']['fileSize'] = $this->Event->fileSize($event['Event']);
|
$event['Event']['fileSize'] = $this->Event->fileSize($event['Event']);
|
||||||
|
|
||||||
|
$EventObj = new ZM\Event($id);
|
||||||
|
$event['Event']['FileSystemPath'] = $EventObj->Path();
|
||||||
|
|
||||||
# Also get the previous and next events for the same monitor
|
# Also get the previous and next events for the same monitor
|
||||||
$event_monitor_neighbors = $this->Event->find('neighbors', array(
|
$event_monitor_neighbors = $this->Event->find('neighbors', array(
|
||||||
'conditions'=>array('Event.MonitorId'=>$event['Event']['MonitorId'])
|
'conditions'=>array('Event.MonitorId'=>$event['Event']['MonitorId'])
|
||||||
|
|
Loading…
Reference in New Issue