Merge branch 'add_monitor_status_to_api' into storageareas

This commit is contained in:
Isaac Connor 2018-10-31 14:47:52 -04:00
commit 48c9c2b6c0
2 changed files with 67 additions and 1 deletions

View File

@ -116,8 +116,15 @@ class Monitor extends AppModel {
'OutputCodec' => array('h264','mjpeg','mpeg1','mpeg2'), 'OutputCodec' => array('h264','mjpeg','mpeg1','mpeg2'),
'OutputContainer' => array('auto','mp4','mkv'), 'OutputContainer' => array('auto','mp4','mkv'),
'DefaultView' => array('Events','Control'), 'DefaultView' => array('Events','Control'),
'Status' => array('Unknown','NotRunning','Running','NoSignal','Signal'), #'Status' => array('Unknown','NotRunning','Running','NoSignal','Signal'),
) )
); );
public $hasOne = array(
'Monitor_Status' => array(
'className' => 'Monitor_Status',
'foreignKey' => 'MonitorId',
'joinTable' => 'Monitor_Status',
)
);
} }

View File

@ -0,0 +1,59 @@
<?php
App::uses('AppModel', 'Model');
/**
* Monitor_Status Model
*
* @property Event $Event
* @property Zone $Zone
*/
class Monitor_Status extends AppModel {
/**
* Use table
*
* @var mixed False or table name
*/
public $useTable = 'Monitor_Status';
/**
* Primary key field
*
* @var string
*/
public $primaryKey = 'MonitorId';
/**
* Display field
*
* @var string
*/
public $displayField = 'Status';
public $recursive = -1;
/**
* Validation rules
*
* @var array
*/
public $validate = array(
'MonitorId' => array(
'numeric' => array(
'rule' => array('numeric'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
);
public $actsAs = array(
'CakePHP-Enum-Behavior.Enum' => array(
'Status' => array('Unknown','NotRunning','Running','NoSignal','Signal'),
)
);
//The Associations below have been created with all possible keys, those that are not needed can be removed
}