Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

491 lines
20 KiB

<?php
require_once('../ajax_asm.php');
$UID = intval( $CUser->Data['id'] );
$Data = '';
if( $UID > 1 ){
$QS = "SELECT * FROM `system_props` LIMIT 1";
$SPD = $DATABASE->Query( $QS );
$QS = "SELECT * FROM `users` WHERE `id`={$UID}";
$EPD = $DATABASE->Query( $QS );
if( count( $SPD ) ){
$SP = $SPD[0];
$UP = $EPD[0];
$DUMMY = array();
if( $CUser->Data['access'] > 5 ){
$TABA =<<<_DATA_BOUNDARY
{
xtype: 'panel',
html: '<table id="tbl_ph_ccc_%%ID%%" style="color: black; background-image: url(\'/style/assets/16-9-nocam.png\');" width="100%" border=0><tr><td colspan=3>&nbsp;</td></tr><tr><td>&nbsp;</td><td align="center"><div id="btn_ph_ccc_%%ID%%"></div></td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>',
listeners:{
afterrender : function( ){
var tb = document.getElementById('tbl_ph_ccc_%%ID%%');
var W = tb.offsetWidth;
var H = (W/16)*9;
tb.setAttribute("height", H );
tb.style.backgroundSize=W+"px "+H+"px";
var p = Ext.getCmp('pan_ph_ccc_%%ID%%');
p.setHeight( H+40 );
var jaja = Ext.create({
xtype: 'panel',
title: 'Camera is Not Assigned to the System',
frame: true,
renderTo: 'btn_ph_ccc_%%ID%%',
layout: 'vbox',
width: 500,
height: 120,
items:[{
xtype: 'spacer',
height: 10
},{
width: '100%',
html: '<center>Proceed to Cameras Settings to Assign One</center>'
},{
xtype: 'spacer',
height: 20
},{
xtype: 'button',
width: '100%',
text: 'Open Camera Settings',
handler: function(){
showContent( 2020 );
}
}]
});
jaja.doLayout();
}
}
}
_DATA_BOUNDARY;
$DUMMY['camera']="{xtype:'panel', id:'pan_ph_ccc_%%ID%%', title: 'Camera Placeholder', frame: true, border: true, draggable: false, layouit: 'fit', items:{$TABA}}";
$DUMMY['sensor']="{xtype:'panel', title: 'Sensor Placeholder', frame: true, border: true, draggable: false, html:'NO SENSOR', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 66+W );}}}";
} else {
$DUMMY['camera']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
$DUMMY['sensor']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
$DUMMY['map']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
$DUMMY['log']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
};
$LOGIO=<<<_DATA_BOUNDARY
{
xtype: 'grid',
id: 'rep_grid',
border: false,
frame: false,
autoScroll: true,
//width: '100%',
lazyRender: true,
height: 210,
ds: rep_store,
tbar:[{
text: 'Analyze Bubbles',
handler: doBubbleAnalyze
}],
cm: new Ext.grid.ColumnModel( rep_ColModel_ops ),
sm: new Ext.grid.RowSelectionModel( rep_SelModel_ops ),
viewConfig: {
forceFit: true,
getRowClass: function( record, rowIndex, rowParams, store){
switch( record.get('node_id')%5 ){
case 0: return 'row-level01';
case 1: return 'row-level02';
case 2: return 'row-level03';
case 3: return 'row-level04';
case 4: return 'row-level05';
};
return '';
}
},
listeners:{
afterrender : function( t ){
var papa = Ext.getCmp('segment_portal');
var jj = papa.getComponent( 1 ).getHeight();
var mama = Ext.getCmp('lg_panel');
var R = PanelH - jj - 30;
mama.setHeight( R+40 );
t.setHeight( R );
}
}
}
_DATA_BOUNDARY;
$MAPIO=<<<_DATA_BOUNDARY
{
id: 'report_map',
height: 200,
title: 'Map',
frame: true,
draggable: false,
collapsible: false,
html: '&nbsp;',
listeners:{
afterrender : function( t ){
var papa = Ext.getCmp('segment_portal');
var jj = 9 * papa.getWidth() / 32;//getComponent( 0 ).getHeight();
//alert( jj );
t.setHeight( jj + 30 );
geoMapIsPresent = true;
initMapReporting();
}
}
}
_DATA_BOUNDARY;
//$DUMMY['map']="{xtype:'panel', title: 'Map Placeholder', frame: true, height: 200, border: true, draggable: false, html:'NO MAP'}";
$DUMMY['map']="{xtype:'panel', title: '{$Labels->GetLabel('_MAP_')}', frame: true, border: true, draggable: false, collapsible: false, tools: [{ id:'toggle', handler: function( a, b, p ){ fullScreen( 'report_map' ); }}], items:[{$MAPIO}],listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}} }";
$DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Report Log', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
$STA = array();
$END="]}";
$OUT = array();
//$OUT[] = "{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[{html:'App Type:{$SP['type']}'}]}";
switch( $SP['type'] ){
case 0:{
$STA[0]="{ columnWidth: 1.0, stydle:'padding:10px 0 10px 10px', items:[";
//$STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
//$STA[2]="{ columnWidth: .75, stylse:'padding:10px 0 10px 10px', items:[";
$STA[1]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
$MH = 4;
$DUMMY['map']="{xtype:'panel', title: '{$Labels->GetLabel('_MAP_')}', frame: true, border: true, draggable: false, collapsible: false, tools: [{ id:'toggle', handler: function( a, b, p ){ fullScreen( 'event_map' ); }}], items:[{$MAPIO}],listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*{$MH}); initMapMonitoring();}} }";
$DUMMY['map']="{xtype:'panel', title: '{$Labels->GetLabel('_MAP_')}', frame: true, border: true, draggable: false, collapsible: false, tools: [{ id:'toggle', handler: function( a, b, p ){ fullScreen( 'report_map' ); }}], items:[{$MAPIO}],listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*4);}} }";
$DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: '{$Labels->GetLabel('_EVENT_LOG_')}', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
$OUT[]= $STA[0] . $DUMMY['map'] . $END;
//$OUT[]= $STA[1] . $DUMMY['sensor'] . $END;
$OUT[]= $STA[1] . $DUMMY['log'] . $END;
break;
};
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 ){
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 ){
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` LIMIT 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%%', 4+$idx , $DUMMY['camera'] );
$OUT[]= $STA[2+$idx] . $T . $END;
};
};
$OUT[]= $STA[3] . $DUMMY['log'] . $END;
break;
};
case 2:{
//Muazot A
$STA[0]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
$STA[1]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
$STA[2]="{ columnWidth: .40, stylse:'padding:10px 0 10px 10px', items:[";
$STA[3]="{ columnWidth: .60, stylse:'padding:10px 0 10px 10px', items:[";
$QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 16 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%%%', ''.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` LIMIT 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[$idx] . $TPL . $END;
} else break;
$idx++;
};
if( $idx < 2 ){
for( ;$idx<2;$idx++ ){
$T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
$OUT[]= $STA[$idx] . $T . $END;
};
};
} else {
for( ;$idx<2;$idx++ ){
$T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
$OUT[]= $STA[$idx] . $T . $END;
};
};
$OUT[]= $STA[2] . $DUMMY['map'] . $END;
$OUT[]= $STA[3] . $DUMMY['log'] . $END;
break;
};
case 4:{
//Mekorot
$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;
};
};
$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` LIMIT 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%%', 4+$idx , $DUMMY['camera'] );
$OUT[]= $STA[2+$idx] . $T . $END;
};
};
$OUT[]= $STA[4] . $DUMMY['log'] . $END;
break;
};
case 6:{
$STA[0]="{ columnWidth: 1.0, stydle:'padding:10px 0 10px 10px', items:[";
//$STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
//$STA[2]="{ columnWidth: .75, stylse:'padding:10px 0 10px 10px', items:[";
$STA[1]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
$MH = 4;
$DUMMY['map']="{xtype:'panel', title: '{$Labels->GetLabel('_MAP_')}', frame: true, border: true, draggable: false, collapsible: false, tools: [{ id:'toggle', handler: function( a, b, p ){ fullScreen( 'event_map' ); }}], items:[{$MAPIO}],listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*{$MH}); initMapMonitoring();}} }";
$DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: '{$Labels->GetLabel('_EVENT_LOG_')}', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
$OUT[]= $STA[0] . $DUMMY['map'] . $END;
//$OUT[]= $STA[1] . $DUMMY['sensor'] . $END;
$OUT[]= $STA[1] . $DUMMY['log'] . $END;
break;
};
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:[";
};
$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` LIMIT 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;
};
};
$Data = '[' . implode( ',' , $OUT ) . ']';
} else {
$Data = '[{columnWidth: 1, items:{html:"NO SYSTEM PROPS"}} ]';
};
};
if( $Data != '' ) {
echo $Data;
} else {
echo '[]';
};
?>