Load Controls if appropriate

pull/1088/head
Isaac Connor 2015-09-17 15:34:09 -04:00
parent 52cdb8a05a
commit 13327b7651
1 changed files with 13 additions and 7 deletions

View File

@ -5,14 +5,20 @@ require_once( 'Server.php' );
class Monitor {
public function __construct( $id ) {
if ( $id ) {
$s = dbFetchOne( 'SELECT * FROM Monitors WHERE Id=?', NULL, array( $id ) );
if ( $s ) {
foreach ($s as $k => $v) {
$this->{$k} = $v;
$s = dbFetchOne( 'SELECT * FROM Monitors WHERE Id=?', NULL, array( $id ) );
if ( $s ) {
foreach ($s as $k => $v) {
$this->{$k} = $v;
}
if ( $this->{'Controllable'} ) {
$s = dbFetchOne( 'SELECT * FROM Controls WHERE Id=?', NULL, array( $this->{'ControlId'} ) );
foreach ($s as $k => $v) {
$this->{$k} = $v;
}
}
} else {
Error("Unable to load Monitor record for Id=" . $id );
}
} else {
Error("Unable to load Monitor record for Id=" . $id );
}
} else {
}