Data['id'] ); $Data = ''; if( $UID > 1 ){ $QS = "SELECT * FROM `system_props` LIMIT 1"; $SPD = $DATABASE->Query( $QS ); if( count( $SPD ) ){ $SP = $SPD[0]; $DUMM = array(); $DUMM['camera']="{xtype:'panel',html:'NO CAMERA'}"; $DUMM['sensor']="{xtype:'panel',html:'NO SENSOR'}"; $DUMM['map']="{xtype:'panel',html:'NO MAP'}"; $DUMM['log']="{xtype:'panel',html:'NO LOG'}"; $STA = array(); $END="]}"; $STA[0]="{ columnWidth: 1, style:'padding:10px 0 10px 10px', items:["; $STA[1]="{ columnWidth: 0.5, style:'padding:10px 0 10px 10px', items:["; $STA[2]="{ columnWidth: 0.5, style:'padding:10px 0 10px 10px', items:["; $STA[3]="{ columnWidth: 0.25, style:'padding:10px 0 10px 10px', items:["; $STA[4]="{ columnWidth: 0.25, style:'padding:10px 0 10px 10px', items:["; $STA[5]="{ columnWidth: 0.25, style:'padding:10px 0 10px 10px', items:["; $STA[6]="{ columnWidth: 0.25, style:'padding:10px 0 10px 10px', items:["; $MCOL = 7; $P1="{ columnWidth: .25, style:'padding:10px 0 10px 10px', items:["; $P2="]}"; $QS = "SELECT * FROM nodes WHERE `type`> 0 "; $result = $DATABASE->Query( $QS, false ); if( count( $result ) > 0 ){ $QS = "SELECT * FROM users_dash_layout WHERE user_id={$UID} ORDER BY x,y"; $Lay = $DATABASE->Query( $QS, false ); $AL = array(); foreach( $Lay as $L ){ $AL[$L['node_id']]=$L; }; $COLS = array(); $Z = array(); foreach( $result as $R ){ if( isset( $AL[$R['id']] ) ){ $COLS[intval($AL[$R['id']]['x'])][intval($AL[$R['id']]['y'])] = $R; } else { $Z[] = $R; }; }; if( count( $Z ) ) foreach( $Z as $z ) $COLS[$MCOL-1][]=$z; $STOL = array(); for( $i=0; $i < $MCOL; $i++ ){ $index = 0; $TPL = array(); $STOL[] = array(); if( isset( $COLS[$i] ) ){ foreach( $COLS[$i] as $R ){ $TFN = 'dash/node_' . $R['type'] . '.js'; if(!file_exists( $TFN )) continue; $TPL[$index] = file_get_contents( $TFN ); $TPL[$index] = str_replace('%%%NODEID%%%', ''.$R['id'] , $TPL[$index] ); $TPL[$index] = str_replace('%%%NODENAME%%%', ''.$R['name'] , $TPL[$index] ); switch( $R['type'] ){ case ARGUS_SERVER:{ $TPL[$index] = str_replace('%%%SYSSERVERNAME%%%', $Labels->getLabel( 'SYS_SERVNAME' ), $TPL[$index] ); if( $R['online']== 1 ){ $TPL[$index] = str_replace('%%%SERVERSTATUS%%%', $Labels->getLabel('SRV_STATUS_ON') , $TPL[$index]); $TPL[$index] = str_replace('%%%SERVERSTATUSIMG%%%', 'accept.png' , $TPL[$index]); } else { $TPL[$index] = str_replace('%%%SERVERSTATUS%%%', $Labels->getLabel('SRV_STATUS_OFF') , $TPL[$index]); $TPL[$index] = str_replace('%%%SERVERSTATUSIMG%%%', 'stop.png' , $TPL[$index]); }; $QS="SELECT * FROM `server_modules` WHERE `server_id`={$R['aux_id']}"; $Z=$DATABASE->Query($QS); $MODULES = array(); if(count($Z)){ foreach( $Z as $mod ){ $QS="SELECT * FROM server_module_types WHERE id={$mod['type']}"; $mtt=$DATABASE->Query( $QS ); $CM['xtype'] = 'panel'; if( $mod['enabled'] == 1 ){ $CM['html'] = '
'.$Labels->getLabel( $mtt[0]['name'] ).' |
'.$Labels->getLabel( $mtt[0]['name'] ).' |
Server
\'}]}'; $STOL[$i] = $STA[$i] . implode( ',', $TPL ) . $END; }; //$STOL[] = "{ columnWidth: 0.5, style:'padding:10px 0 10px 10px', items:[]}"; //$STOL[] = "{ columnWidth: 0.5, style:'padding:10px 0 10px 10px', items:[]}"; //$STOL[] = "{ columnWidth: 1, style:'padding:10px 0 10px 10px', items:[]}"; $Data = '[' . implode( ',' , $STOL ) . ']'; }; } else { $Data = '[{columnWidth: 1, items:{html:"NO SYSTEM PROPS"}} ]'; }; }; if( $Data != '' ) { echo $Data; } else { echo '[]'; }; ?>