|
|
|
@ -132,170 +132,259 @@ _DATA_BOUNDARY; |
|
|
|
$STA = array(); |
|
|
|
$END="]}"; |
|
|
|
$OUT = array(); |
|
|
|
if( $SP['type'] == 1 ) { |
|
|
|
//Metro
|
|
|
|
$STA[0]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[2]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[3]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1"; |
|
|
|
$R = $DATABASE->Query( $QS ); |
|
|
|
$idx = 0; |
|
|
|
if( count( $R ) ){ |
|
|
|
foreach( $R as $DD ){ |
|
|
|
switch( $SP['type'] ){ |
|
|
|
case 1:{ |
|
|
|
//Metro
|
|
|
|
$STA[0]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[2]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[3]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1"; |
|
|
|
$R = $DATABASE->Query( $QS ); |
|
|
|
$idx = 0; |
|
|
|
if( count( $R ) ){ |
|
|
|
foreach( $R as $DD ){ |
|
|
|
if( $idx < 2 ){ |
|
|
|
$TFN = 'report/node_' . $DD['type'] . '.js'; |
|
|
|
if(!file_exists( $TFN )) continue; |
|
|
|
$TPL = file_get_contents( $TFN ); |
|
|
|
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); |
|
|
|
$TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL ); |
|
|
|
$TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL ); |
|
|
|
$OUT[]= $STA[$idx] . $TPL . $END; |
|
|
|
} else break; |
|
|
|
$idx++; |
|
|
|
}; |
|
|
|
if( $idx < 2 ){ |
|
|
|
$TFN = 'report/node_' . $DD['type'] . '.js'; |
|
|
|
if(!file_exists( $TFN )) continue; |
|
|
|
$TPL = file_get_contents( $TFN ); |
|
|
|
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); |
|
|
|
$TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL ); |
|
|
|
$TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL ); |
|
|
|
$OUT[]= $STA[$idx] . $TPL . $END; |
|
|
|
} else break; |
|
|
|
$idx++; |
|
|
|
}; |
|
|
|
if( $idx < 2 ){ |
|
|
|
for( ;$idx<2;$idx++ ){ |
|
|
|
$OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END; |
|
|
|
}; |
|
|
|
}; |
|
|
|
} else { |
|
|
|
for( ;$idx<2;$idx++ ){ |
|
|
|
$OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END; |
|
|
|
}; |
|
|
|
}; |
|
|
|
} else { |
|
|
|
for( ;$idx<2;$idx++ ){ |
|
|
|
$OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END; |
|
|
|
}; |
|
|
|
}; |
|
|
|
$QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1"; |
|
|
|
$R = $DATABASE->Query( $QS ); |
|
|
|
$idx = 0; |
|
|
|
if( count( $R ) ){ |
|
|
|
foreach( $R as $DD ){ |
|
|
|
$QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1"; |
|
|
|
$R = $DATABASE->Query( $QS ); |
|
|
|
$idx = 0; |
|
|
|
if( count( $R ) ){ |
|
|
|
foreach( $R as $DD ){ |
|
|
|
if( $idx < 1 ){ |
|
|
|
$TFN = 'report/node_' . $DD['type'] . '.js'; |
|
|
|
if(!file_exists( $TFN )) continue; |
|
|
|
$TPL = file_get_contents( $TFN ); |
|
|
|
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); |
|
|
|
$TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL ); |
|
|
|
$TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL ); |
|
|
|
$QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}"; |
|
|
|
$Z=$DATABASE->Query( $QS ); |
|
|
|
$QS="SELECT * FROM `module_eve` WHERE `id`=1"; |
|
|
|
$S=$DATABASE->Query( $QS ); |
|
|
|
$MODULE_DATA = $S[0]; |
|
|
|
$TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL ); |
|
|
|
//$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
|
|
|
|
$FU = '/video_feed/stream?id='. $Z[0]['aux_parameter']; |
|
|
|
$CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']'; |
|
|
|
$TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL ); |
|
|
|
$TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL ); |
|
|
|
$TPL = str_replace( '%%%SELURL%%%', $FU, $TPL ); |
|
|
|
$TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL ); |
|
|
|
|
|
|
|
$FK = $MODULE_DATA['height'] /$MODULE_DATA['width']; |
|
|
|
$W = 244; |
|
|
|
$H = $W * $FK; |
|
|
|
|
|
|
|
$TPL = str_replace( '%%%WIDTH%%%', $W, $TPL ); |
|
|
|
$TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL ); |
|
|
|
$OUT[]= $STA[2+$idx] . $TPL . $END; |
|
|
|
} else break; |
|
|
|
$idx++; |
|
|
|
}; |
|
|
|
if( $idx < 1 ){ |
|
|
|
$TFN = 'report/node_' . $DD['type'] . '.js'; |
|
|
|
if(!file_exists( $TFN )) continue; |
|
|
|
$TPL = file_get_contents( $TFN ); |
|
|
|
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); |
|
|
|
$TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL ); |
|
|
|
$TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL ); |
|
|
|
$QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}"; |
|
|
|
$Z=$DATABASE->Query( $QS ); |
|
|
|
$QS="SELECT * FROM `module_eve` WHERE `id`=1"; |
|
|
|
$S=$DATABASE->Query( $QS ); |
|
|
|
$MODULE_DATA = $S[0]; |
|
|
|
$TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL ); |
|
|
|
//$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
|
|
|
|
$FU = '/video_feed/stream?id='. $Z[0]['aux_parameter']; |
|
|
|
$CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']'; |
|
|
|
$TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL ); |
|
|
|
$TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL ); |
|
|
|
$TPL = str_replace( '%%%SELURL%%%', $FU, $TPL ); |
|
|
|
$TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL ); |
|
|
|
|
|
|
|
$FK = $MODULE_DATA['height'] /$MODULE_DATA['width']; |
|
|
|
$W = 244; |
|
|
|
$H = $W * $FK; |
|
|
|
|
|
|
|
$TPL = str_replace( '%%%WIDTH%%%', $W, $TPL ); |
|
|
|
$TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL ); |
|
|
|
$OUT[]= $STA[2+$idx] . $TPL . $END; |
|
|
|
} else break; |
|
|
|
$idx++; |
|
|
|
}; |
|
|
|
if( $idx < 1 ){ |
|
|
|
for( ;$idx<1;$idx++ ){ |
|
|
|
$T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] ); |
|
|
|
$OUT[]= $STA[2+$idx] . $T . $END; |
|
|
|
}; |
|
|
|
}; |
|
|
|
} else { |
|
|
|
for( ;$idx<1;$idx++ ){ |
|
|
|
$T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] ); |
|
|
|
$T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] ); |
|
|
|
$OUT[]= $STA[2+$idx] . $T . $END; |
|
|
|
}; |
|
|
|
}; |
|
|
|
} else { |
|
|
|
for( ;$idx<1;$idx++ ){ |
|
|
|
$T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] ); |
|
|
|
$OUT[]= $STA[2+$idx] . $T . $END; |
|
|
|
}; |
|
|
|
$OUT[]= $STA[3] . $DUMMY['log'] . $END; |
|
|
|
break; |
|
|
|
}; |
|
|
|
$OUT[]= $STA[3] . $DUMMY['log'] . $END; |
|
|
|
} else { |
|
|
|
$STA[0]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[1]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
if( $UP['width'] > 1.6* $UP['height'] ){ |
|
|
|
$STA[2]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[3]="{ columnWidth: .67, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
} else { |
|
|
|
$STA[2]="{ columnWidth: .45, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[3]="{ columnWidth: .55, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
}; |
|
|
|
|
|
|
|
$OUT[]= $STA[0] . $DUMMY['map'] . $END; |
|
|
|
$QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1"; |
|
|
|
$R = $DATABASE->Query( $QS ); |
|
|
|
$idx = 0; |
|
|
|
if( count( $R ) ){ |
|
|
|
foreach( $R as $DD ){ |
|
|
|
if( $idx < 1 ){ |
|
|
|
$TFN = 'report/node_' . $DD['type'] . '.js'; |
|
|
|
if(!file_exists( $TFN )) continue; |
|
|
|
$TPL = file_get_contents( $TFN ); |
|
|
|
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); |
|
|
|
$TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL ); |
|
|
|
$TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL ); |
|
|
|
$QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}"; |
|
|
|
$Z=$DATABASE->Query( $QS ); |
|
|
|
$QS="SELECT * FROM `module_eve` WHERE `id`=1"; |
|
|
|
$S=$DATABASE->Query( $QS ); |
|
|
|
$MODULE_DATA = $S[0]; |
|
|
|
$TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL ); |
|
|
|
//$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
|
|
|
|
$FU = '/video_feed/stream?id='. $Z[0]['aux_parameter']; |
|
|
|
$CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']'; |
|
|
|
$TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL ); |
|
|
|
$TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL ); |
|
|
|
$TPL = str_replace( '%%%SELURL%%%', $FU, $TPL ); |
|
|
|
$TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL ); |
|
|
|
|
|
|
|
$FK = $MODULE_DATA['height'] /$MODULE_DATA['width']; |
|
|
|
$W = 244; |
|
|
|
$H = $W * $FK; |
|
|
|
|
|
|
|
$TPL = str_replace( '%%%WIDTH%%%', $W, $TPL ); |
|
|
|
$TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL ); |
|
|
|
$OUT[]= $STA[1+$idx] . $TPL . $END; |
|
|
|
} else break; |
|
|
|
$idx++; |
|
|
|
case 4:{ |
|
|
|
//Metro
|
|
|
|
$STA[0]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[1]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[2]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[3]="{ columnWidth: .40, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[4]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1"; |
|
|
|
$R = $DATABASE->Query( $QS ); |
|
|
|
$idx = 0; |
|
|
|
if( count( $R ) ){ |
|
|
|
foreach( $R as $DD ){ |
|
|
|
if( $idx < 3 ){ |
|
|
|
$TFN = 'report/node_' . $DD['type'] . '.js'; |
|
|
|
if(!file_exists( $TFN )) continue; |
|
|
|
$TPL = file_get_contents( $TFN ); |
|
|
|
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); |
|
|
|
$TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL ); |
|
|
|
$TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL ); |
|
|
|
$OUT[]= $STA[$idx] . $TPL . $END; |
|
|
|
} else break; |
|
|
|
$idx++; |
|
|
|
}; |
|
|
|
if( $idx < 3 ){ |
|
|
|
for( ;$idx<3;$idx++ ){ |
|
|
|
$OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END; |
|
|
|
}; |
|
|
|
}; |
|
|
|
} else { |
|
|
|
for( ;$idx<3;$idx++ ){ |
|
|
|
$OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END; |
|
|
|
}; |
|
|
|
}; |
|
|
|
if( $idx < 1 ){ |
|
|
|
$QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1"; |
|
|
|
$R = $DATABASE->Query( $QS ); |
|
|
|
$idx = 0; |
|
|
|
if( count( $R ) ){ |
|
|
|
foreach( $R as $DD ){ |
|
|
|
if( $idx < 1 ){ |
|
|
|
$TFN = 'report/node_' . $DD['type'] . '.js'; |
|
|
|
if(!file_exists( $TFN )) continue; |
|
|
|
$TPL = file_get_contents( $TFN ); |
|
|
|
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); |
|
|
|
$TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL ); |
|
|
|
$TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL ); |
|
|
|
$QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}"; |
|
|
|
$Z=$DATABASE->Query( $QS ); |
|
|
|
$QS="SELECT * FROM `module_eve` WHERE `id`=1"; |
|
|
|
$S=$DATABASE->Query( $QS ); |
|
|
|
$MODULE_DATA = $S[0]; |
|
|
|
$TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL ); |
|
|
|
//$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
|
|
|
|
$FU = '/video_feed/stream?id='. $Z[0]['aux_parameter']; |
|
|
|
$CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']'; |
|
|
|
$TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL ); |
|
|
|
$TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL ); |
|
|
|
$TPL = str_replace( '%%%SELURL%%%', $FU, $TPL ); |
|
|
|
$TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL ); |
|
|
|
|
|
|
|
$FK = $MODULE_DATA['height'] /$MODULE_DATA['width']; |
|
|
|
$W = 244; |
|
|
|
$H = $W * $FK; |
|
|
|
|
|
|
|
$TPL = str_replace( '%%%WIDTH%%%', $W, $TPL ); |
|
|
|
$TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL ); |
|
|
|
$OUT[]= $STA[3+$idx] . $TPL . $END; |
|
|
|
} else break; |
|
|
|
$idx++; |
|
|
|
}; |
|
|
|
if( $idx < 1 ){ |
|
|
|
for( ;$idx<1;$idx++ ){ |
|
|
|
$T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] ); |
|
|
|
$OUT[]= $STA[3+$idx] . $T . $END; |
|
|
|
}; |
|
|
|
}; |
|
|
|
} else { |
|
|
|
for( ;$idx<1;$idx++ ){ |
|
|
|
$T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] ); |
|
|
|
$OUT[]= $STA[1+$idx] . $T . $END; |
|
|
|
$T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] ); |
|
|
|
$OUT[]= $STA[2+$idx] . $T . $END; |
|
|
|
}; |
|
|
|
}; |
|
|
|
} else { |
|
|
|
for( ;$idx<1;$idx++ ){ |
|
|
|
$T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] ); |
|
|
|
$OUT[]= $STA[1+$idx] . $T . $END; |
|
|
|
}; |
|
|
|
$OUT[]= $STA[4] . $DUMMY['log'] . $END; |
|
|
|
break; |
|
|
|
}; |
|
|
|
$QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1"; |
|
|
|
$R = $DATABASE->Query( $QS ); |
|
|
|
$idx = 0; |
|
|
|
if( count( $R ) ){ |
|
|
|
foreach( $R as $DD ){ |
|
|
|
if( $idx < 2 ){ |
|
|
|
$TFN = 'report/node_' . $DD['type'] . '.js'; |
|
|
|
if(!file_exists( $TFN )) continue; |
|
|
|
$TPL = file_get_contents( $TFN ); |
|
|
|
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); |
|
|
|
$TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL ); |
|
|
|
$TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL ); |
|
|
|
$OUT[]= $STA[2+$idx] . $TPL . $END; |
|
|
|
} else break; |
|
|
|
$idx++; |
|
|
|
default:{ |
|
|
|
$STA[0]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[1]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
if( $UP['width'] > 1.6* $UP['height'] ){ |
|
|
|
$STA[2]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[3]="{ columnWidth: .67, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
} else { |
|
|
|
$STA[2]="{ columnWidth: .45, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
$STA[3]="{ columnWidth: .55, stylse:'padding:10px 0 10px 10px', items:["; |
|
|
|
}; |
|
|
|
|
|
|
|
} else { |
|
|
|
for( ;$idx<1;$idx++ ){ |
|
|
|
$OUT[]= $STA[2+$idx] . $DUMMY['sensor'] . $END; |
|
|
|
$OUT[]= $STA[0] . $DUMMY['map'] . $END; |
|
|
|
$QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1"; |
|
|
|
$R = $DATABASE->Query( $QS ); |
|
|
|
$idx = 0; |
|
|
|
if( count( $R ) ){ |
|
|
|
foreach( $R as $DD ){ |
|
|
|
if( $idx < 1 ){ |
|
|
|
$TFN = 'report/node_' . $DD['type'] . '.js'; |
|
|
|
if(!file_exists( $TFN )) continue; |
|
|
|
$TPL = file_get_contents( $TFN ); |
|
|
|
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); |
|
|
|
$TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL ); |
|
|
|
$TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL ); |
|
|
|
$QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}"; |
|
|
|
$Z=$DATABASE->Query( $QS ); |
|
|
|
$QS="SELECT * FROM `module_eve` WHERE `id`=1"; |
|
|
|
$S=$DATABASE->Query( $QS ); |
|
|
|
$MODULE_DATA = $S[0]; |
|
|
|
$TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL ); |
|
|
|
//$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
|
|
|
|
$FU = '/video_feed/stream?id='. $Z[0]['aux_parameter']; |
|
|
|
$CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']'; |
|
|
|
$TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL ); |
|
|
|
$TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL ); |
|
|
|
$TPL = str_replace( '%%%SELURL%%%', $FU, $TPL ); |
|
|
|
$TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL ); |
|
|
|
|
|
|
|
$FK = $MODULE_DATA['height'] /$MODULE_DATA['width']; |
|
|
|
$W = 244; |
|
|
|
$H = $W * $FK; |
|
|
|
|
|
|
|
$TPL = str_replace( '%%%WIDTH%%%', $W, $TPL ); |
|
|
|
$TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL ); |
|
|
|
$OUT[]= $STA[1+$idx] . $TPL . $END; |
|
|
|
} else break; |
|
|
|
$idx++; |
|
|
|
}; |
|
|
|
if( $idx < 1 ){ |
|
|
|
for( ;$idx<1;$idx++ ){ |
|
|
|
$T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] ); |
|
|
|
$OUT[]= $STA[1+$idx] . $T . $END; |
|
|
|
}; |
|
|
|
}; |
|
|
|
} else { |
|
|
|
for( ;$idx<1;$idx++ ){ |
|
|
|
$T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] ); |
|
|
|
$OUT[]= $STA[1+$idx] . $T . $END; |
|
|
|
}; |
|
|
|
}; |
|
|
|
$QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1"; |
|
|
|
$R = $DATABASE->Query( $QS ); |
|
|
|
$idx = 0; |
|
|
|
if( count( $R ) ){ |
|
|
|
foreach( $R as $DD ){ |
|
|
|
if( $idx < 2 ){ |
|
|
|
$TFN = 'report/node_' . $DD['type'] . '.js'; |
|
|
|
if(!file_exists( $TFN )) continue; |
|
|
|
$TPL = file_get_contents( $TFN ); |
|
|
|
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); |
|
|
|
$TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL ); |
|
|
|
$TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL ); |
|
|
|
$OUT[]= $STA[2+$idx] . $TPL . $END; |
|
|
|
} else break; |
|
|
|
$idx++; |
|
|
|
}; |
|
|
|
|
|
|
|
} else { |
|
|
|
for( ;$idx<1;$idx++ ){ |
|
|
|
$OUT[]= $STA[2+$idx] . $DUMMY['sensor'] . $END; |
|
|
|
}; |
|
|
|
}; |
|
|
|
$OUT[]= $STA[3] . $DUMMY['log'] . $END; |
|
|
|
break; |
|
|
|
}; |
|
|
|
$OUT[]= $STA[3] . $DUMMY['log'] . $END; |
|
|
|
}; |
|
|
|
$Data = '[' . implode( ',' , $OUT ) . ']'; |
|
|
|
} else { |
|
|
|
|