|
|
<?php require_once('../ajax_asm.php'); require_once('../php/argus/server.php'); if( $CUser->Data['id'] > 1 ){ $EID = intval( $_POST['PID'] ); $QS = "SELECT * FROM `metro_platforms` WHERE `id`={$EID}"; $Result = $DATABASE->Query( $QS, false ); if( count( $Result ) ){ $CR = $Result[0]; $TTPL=<<<JOJOKA { xtype: 'panel', border: false, frame: false, tbar:[{ id: 'btn_del_station', text: '{$Labels->GetLabel('_SMM_DEL_PLATFORM_')}', handler: function(){ Ext.Msg.show({ title:'{$Labels->GetLabel('_REMOVE_MODULE_')}?', msg: '{$Labels->GetLabel('_REMOVE_MODU_QUES_')}?', buttons: Ext.Msg.OKCANCEL, fn: function(btn){ if( btn == 'ok' ){ SelectedModule = 0; doModuleOperation( {$CR['id']}, 200, '', true ); }; }, icon: Ext.MessageBox.QUESTION }); } }], items:[%%%ITEMS%%%] }JOJOKA;
$ITEMS = array(); $QS = "SELECT count(`id`) cnt FROM `metro_tracks` WHERE `platform_id`={$EID}"; $Rt = $DATABASE->Query( $QS, false ); $TCO = $Rt[0]['cnt']; $NAME =$CR['name'] .'<br/>'; $PINFO = getPlatformInfo( $CR['id'] ); $QS = "SELECT * FROM `metro_tracks` WHERE `platform_id`={$CR['id']} ORDER BY `side` ASC"; $TI = $DATABASE->Query( $QS, false ); $TRACKS = ''; if( count( $TI ) ){ $COS = count( $PINFO['PREV'] ); if( $COS ) $COS = "rowspan={$COS} "; else $COS=""; $TRU = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">{$TI[0]['short']}</td>"; $TRACKS = "{ xtype: 'form', border: false, frame: false, labelWidth: 150,labelAlign: 'right',margins: {top:10, right:10, bottom:10, left:10},padding:8,labelAlign:'right', items:[{ xtype: 'panel', bodyCssClass:'_infoPanel', bodyStyle: 'background-color: #000; text-align: center;',html: '".$Labels->GetLabel('_UPPR_TRACK_')."'},{ xtype: 'textfield', fieldLabel:'Name', value: '{$TI[0]['name']}',listeners:{change: function( a, c, b ){doPlatformOperation( {$CR['id']}, 8, c, true );}}},{ xtype: 'textfield', fieldLabel:'Abbreviation', value: '{$TI[0]['short']}',listeners:{change: function( a, c, b ){doPlatformOperation( {$CR['id']}, 9, c, true );}}}]}"; if( count( $TI ) > 1 ){ $COS = count( $PINFO['NEXT'] ); if( $COS ) $COS = "rowspan={$COS} "; else $COS=""; $TRB = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">{$TI[1]['short']}</td>"; $TRACKS .= ",{ xtype: 'form', border: false, frame: false, labelWidth: 150,labelAlign: 'right',margins: {top:10, right:10, bottom:10, left:10},padding:8, labelAlign:'right', items:[{ xtype: 'panel', bodyCssClass:'_infoPanel', bodyStyle: 'background-color: #000; text-align: center;',html: '".$Labels->GetLabel('_BTOM_TRACK_')."'},{ xtype: 'textfield', fieldLabel:'Name', value: '{$TI[1]['name']}',listeners:{change: function( a, c, b ){doPlatformOperation( {$CR['id']}, 10, c, true );}}},{ xtype: 'textfield', fieldLabel:'Abbreviation', value: '{$TI[1]['short']}',listeners:{change: function( a, c, b ){doPlatformOperation( {$CR['id']}, 11, c, true );}}}]}"; }; } else { $COS = count( $PINFO['PREV'] ); if( $COS ) $COS = "rowspan={$COS} "; else $COS=""; $TRU = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\"> </td>"; $COS = count( $PINFO['NEXT'] ); if( $COS ) $COS = "rowspan={$COS} "; else $COS=""; $TRB = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\"> </td>"; }; $INFO = '<table width="100%" border=0><tr><td width="130px" align="right">'.$Labels->GetLabel('_SMM_PAT_LEVEL_').':</td><td><div class="level_label">'.$CR['level'].'</div></td></tr><tr><td width="130px" align="right">'.$Labels->GetLabel('_LBL_TRACKS_').':</td><td>'.$TCO.'</td></tr><tr><td align="right">'.$Labels->GetLabel('_MODULES_').':</td><td>'. ( $TCO * 2 ) .'</td></tr></table>'; $QS = "SELECT `sl`.`line_id`, `ln`.`short`,`ln`.`color`,`ln`.`name`,`sl`.`index` FROM `metro_lines` `ln` LEFT JOIN `metro_stations_2_lines` `sl` ON ( `ln`.`id`=`sl`.`line_id` ) WHERE `sl`.`station_id`={$CR['station_id']} ORDER BY `ln`.`short`"; $Sz = $DATABASE->Query( $QS, false ); if( count( $Sz ) ){ $LINE_COLORS = array(); $QS = "SELECT `ln`.`short`,`ln`.`color` FROM `metro_lines` `ln` LEFT JOIN `metro_platforms_2_lines` `sl` ON ( `ln`.`id`=`sl`.`line_id` ) WHERE `sl`.`platform_id`={$EID} ORDER BY `ln`.`short`"; $Rz = $DATABASE->Query( $QS, false ); if( count( $Rz ) ){ $LINES='<table><tr>'; foreach( $Rz as $Z ){ $LINE_COLORS[$Z['short']] = '#'.$Z['color']; $LINES.="<td><div style=\"border-radius:16px;width:32px;height:32px;background-color:#{$Z['color']};color:#fff;font-size:16px;padding-left:10px;padding-top:6px;\">{$Z['short']}</div></td>"; }; $LINES.='</tr></table>'; }; $ROUTING = "{ xtype:'panel', width: '100%', layout: 'table', defaults: {margins: {top:10, right:10, bottom:10, left:10},padding:8},baseCls: 'x-plain', layoutConfig: {columns: 2},frame: false,border: false,items:[{xtype:'panel',border:false,frame:false,colspan:2,html:'{$Labels->GetLabel('_SMM_MET_ROUTE_')}'}"; foreach( $Sz as $Z ){ $AS = 'false'; for( $idx = 0; $idx < $PINFO['INFO_COUNT']; $idx++){ if( $Z['line_id'] == $PINFO[$idx]['id'] ){ $AS = 'true'; break; }; }; //
$ROUTING .=",{xtype:'panel',width:70, height:60,border:false,frame:false,style:{float:'right'},html: '<div style=\"border-radius:16px;width:32px;height:32px;background-color:#{$Z['color']};color:#fff;font-size:16px;padding-left:10px;padding-top:6px;\">{$Z['short']}</div>'},{ xtype: 'button',enableToggle:true,pressed:{$AS},text:'{$Labels->GetLabel('_ACTIVE_')}',handler:function(b,e){if(b.pressed){ doPlatformOperation({$CR['id']},3,{$Z['line_id']},true);}else{doPlatformOperation({$CR['id']},4,{$Z['line_id']},true);};}}"; }; $ROUTING .= "]}"; } else { $ROUTING = "{xtype:'spacer',height:0}"; }; $TOP ="<td><table width=\"100%\" border=0><tr><td><table border=0 width=\"100%\" style=\"border-collapse: collapse; border-spacing: 5px 5px;\">"; if( $PINFO['PREV_IS_MULTI'] ){ foreach( $PINFO['PREV'] as $P ){ $TOP .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel\" style=\"color:#fff; font-weight: bold;{$PINFO['PREV'][0]['bg_style']}\"><tr><td class=\"ar_to_left\"> </td><td align=\"left\">{$P['name']}</td></tr></table></td></tr>"; } } else { if( count( $PINFO['PREV'] )){ $TOP .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel\" style=\"color:#fff; font-weight: bold;{$PINFO['PREV'][0]['bg_style']}\"><tr><td class=\"ar_to_left\"> </td><td align=\"left\">{$PINFO['PREV'][0]['name']}</td></tr></table></td></tr>"; } else { $TOP .="<tr><td><table border=0 width=\"100%\" class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000;\"><tr><td class=\"ar_to_left\"> </td><td align=\"left\">{$Labels->GetLabel('_SMM_NO_NESTA_')}</td></tr></table></td></tr>"; }; }; $TOP .="</table></td>{$TRU}</tr></table></td>"; $BOTTOM ="<td><table width=\"100%\" border=0><tr>{$TRB}<td><table border=0 width=\"100%\" style=\"border-collapse: collapse; border-spacing: 5px 5px;\">"; if( $PINFO['NEXT_IS_MULTI'] ){ foreach( $PINFO['NEXT'] as $P ){ $BOTTOM .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel\" style=\"color:#fff; font-weight: bold;{$P['bg_style']}\"><tr><td align=\"right\">{$P['name']}</td><td class=\"ar_to_right\"> </td></tr></table></td></tr>"; } } else { if( count( $PINFO['NEXT'] )){ $BOTTOM .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel\" style=\"color:#fff; font-weight: bold;{$PINFO['NEXT'][0]['bg_style']}\"><tr><td align=\"right\">{$PINFO['NEXT'][0]['name']}</td><td class=\"ar_to_right\"> </td></tr></table></td></tr>"; } else { $BOTTOM .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000;\"><tr><td align=\"right\">{$Labels->GetLabel('_SMM_NO_NESTA_')}</td><td class=\"ar_to_right\"> </td></tr></table></td></tr>"; }; }; $BOTTOM .="</table></td></tr></table></td>"; $ITEMS[0]="{ xtype:'panel', border: false, frame: false, html: '<table border=0 width=\"100%\" class=\"setEd_infoPanel\" id=\"SENSOR_N\"><tr><td valign=\"middle\" width=\"100%\" align=\"left\" colspan=3 style=\"padding-left:30px;font-size: 22px; font-weight: bold;\">{$NAME}</td></tr><tr><td colspan=3>{$INFO}</td></tr><tr><td></td>{$TOP}<td></td></tr><tr><td> </td><td width=\"100%\">".createPlatformAnimation( $CR['layout'], array(), $LINE_COLORS )."</td><td> </td></tr><tr><td></td>{$BOTTOM}<td></td></tr></table>'}"; $QS="SELECT * FROM `modbus_modules` WHERE `platform_id`={$CR['id']}"; $JG=$DATABASE->Query( $QS ); if( count( $JG ) ){ $SC=$JG[0]; $CCCV = intval( $SC['values'] ); if( ( $CCCV & 0x01 ) == 0x01 ) $P1 = 'true'; else $P1 = 'false'; if( ( $CCCV & 0x02 ) == 0x02 ) $P2 = 'true'; else $P2 = 'false'; if( ( $CCCV & 0x04 ) == 0x04 ) $P3 = 'true'; else $P3 = 'false'; if( ( $CCCV & 0x08 ) == 0x08 ) $P4 = 'true'; else $P4 = 'false'; $MODBUS=<<<DATA_BOUNDARY{ xtype: 'combo', id: 'sca_ena', fieldLabel: "{$Labels->GetLabel('_STATUS_')}", lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['mode','mode_txt'], data: [ ['D','{$Labels->GetLabel('__DISABLED__')}'], ['E','{$Labels->GetLabel('___ENABLED__')}'] ] }), valueField: 'mode', displayField: 'mode_txt', value: '{$SC['wm']}', width: 200, listeners:{ select: function( a, c, b ){ doPlatformOperation( {$CR['id']}, 12, b, true ); } } },{ xtype: 'textfield', id: 'sca_ip', fieldLabel: '{$Labels->GetLabel('_DEVICE_IP_')}', maxlength: 64, value: '{$SC['ip4']}', listeners:{ change: function( a, c, b ){ doPlatformOperation( {$CR['id']}, 13, c, true ); } } },{ xtype: 'textfield', id: 'sca_port', fieldLabel: '{$Labels->GetLabel('_DEVICE_PORT_')}', maxlength: 2, value: '{$SC['port']}', listeners:{ change: function( a, c, b ){ doPlatformOperation( {$CR['id']}, 14, c, true ); } } },{ xtype: 'panel', layout: 'table', border: false, frame: false, labelWidth: 150, labelAlign: 'right', width: '100%', defaults: { // applied to each contained panel
bodyStyle:'padding:10px; text-align: center;' }, layoutConfig: { // The total column count must be specified here
columns: 4 }, items:[{ xtype: 'panel', bodyCssClass:'_infoPanel', bodyStyle: 'background-color: #000; text-align: center;', html: 'Upper Track' },{ xtype: 'panel', bodyCssClass:'_infoPanel', bodyStyle: 'background-color: #000; text-align: center;', html: 'Bottom Track' },{ xtype: 'panel', bodyCssClass:'_infoPanel', bodyStyle: 'background-color: #000; text-align: center;', html: 'Health Signal' },{ xtype: 'panel', bodyCssClass:'_infoPanel', bodyStyle: 'background-color: #000; text-align: center;', html: 'AUX Signal' },{ xtype: 'combo', fieldLabel: "Upper Track", lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['mode','mode_txt'], data: [ [-1,'{$Labels->GetLabel('__DISABLED__')}'], [0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4'] ] }), valueField: 'mode', displayField: 'mode_txt', value: '{$SC['crossbar_a']}', width: 200, listeners:{ select: function( a, c, b ){ //doPlatformOperation( {$CR['id']}, 12, b, true );
} } },{ xtype: 'combo', fieldLabel: "Upper Track", lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['mode','mode_txt'], data: [ [-1,'{$Labels->GetLabel('__DISABLED__')}'], [0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4'] ] }), valueField: 'mode', displayField: 'mode_txt', value: '{$SC['crossbar_b']}', width: 200, listeners:{ select: function( a, c, b ){ //doPlatformOperation( {$CR['id']}, 12, b, true );
} } },{ xtype: 'combo', fieldLabel: "Upper Track", lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['mode','mode_txt'], data: [ [-1,'{$Labels->GetLabel('__DISABLED__')}'], [0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4'] ] }), valueField: 'mode', displayField: 'mode_txt', value: '{$SC['crossbar_c']}', width: 200, listeners:{ select: function( a, c, b ){ //doPlatformOperation( {$CR['id']}, 12, b, true );
} } },{ xtype: 'combo', fieldLabel: "Upper Track", lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['mode','mode_txt'], data: [ [-1,'{$Labels->GetLabel('__DISABLED__')}'], [0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4'] ] }), valueField: 'mode', displayField: 'mode_txt', value: '{$SC['crossbar_d']}', width: 200, listeners:{ select: function( a, c, b ){ //doPlatformOperation( {$CR['id']}, 12, b, true );
} } },{ xtype: 'spacer', height: 10, colspan: 4 },{ xtype: 'panel', colspan: 4, bodyCssClass:'_infoPanel', bodyStyle: 'background-color: #000; text-align: center;', html: 'TEST MODBUS MODULE COILS' },{ xtype: 'spacer', height: 5, colspan: 4 },{ xtype: 'button', enableToggle: true, allowDepress: true, width: '80%', text: 'Test D1', pressed: {$P1}, handler: function( b, e ){ if( b.pressed ){ doPlatformOperation( {$CR['id']}, 15, ({$CCCV} | 1 ), true ); } else { doPlatformOperation( {$CR['id']}, 15, ({$CCCV} & ( ~1 ) ), true ); }; } },{ xtype: 'button', width: '80%', enableToggle: true, allowDepress: true, text: 'Test D2', pressed: {$P2}, handler: function( b, e ){ if( b.pressed ){ doPlatformOperation( {$CR['id']}, 15, ({$CCCV} | 2 ), true ); } else { doPlatformOperation( {$CR['id']}, 15, ({$CCCV} & ( ~2 ) ), true ); }; } },{ xtype: 'button', enableToggle: true, allowDepress: true, width: '80%', text: 'Test D3', pressed: {$P3}, handler: function( b, e ){ if( b.pressed ){ doPlatformOperation( {$CR['id']}, 15, ({$CCCV} | 4 ), true ); } else { doPlatformOperation( {$CR['id']}, 15, ({$CCCV} & ( ~4 ) ), true ); }; } },{ xtype: 'button', enableToggle: true, allowDepress: true, width: '80%', text: 'Test D4', pressed: {$P4}, handler: function( b, e ){ if( b.pressed ){ doPlatformOperation( {$CR['id']}, 15, ({$CCCV} | 8 ), true ); } else { doPlatformOperation( {$CR['id']}, 15, ({$CCCV} & ( ~8 ) ), true ); }; } }] }DATA_BOUNDARY; } else { $MODBUS=''; }; $ED =<<<kokakskhkajhskr{ xtype: 'tabpanel', border: false, frame: false, height: PanelH - 283, activeTab: 0, items:[{ xtype: 'panel', title: '{$Labels->GetLabel('_GENERAL_')}', items: [{ xtype: 'form', height: PanelH - 283, labelWidth: 150, labelAlign: 'right', margins: {top:10, right:10, bottom:10, left:10}, padding:8, items: [{ xtype: 'combo', id: 'sens_se', fieldLabel: "{$Labels->GetLabel('_STATUS_')}", lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['mode','mode_txt'], data: [ ['D','{$Labels->GetLabel('__DISABLED__')}'], ['E','{$Labels->GetLabel('___ENABLED__')}'] ] }), valueField: 'mode', displayField: 'mode_txt', value: '{$CR['status']}', width: 200, listeners:{ select: function( a, c, b ){ doPlatformOperation( {$CR['id']}, 2, b, true ); } } },{ xtype: 'textfield', id: 'plt_name', fieldLabel: '{$Labels->GetLabel('_SMM_PAT_NAME_')}', maxlength: 64, value: '{$CR['name']}', listeners:{ change: function( a, c, b ){ doPlatformOperation( {$CR['id']}, 6, c, true ); } } },{ xtype: 'textfield', id: 'plt_lvl', fieldLabel: '{$Labels->GetLabel('_SMM_PAT_LEVEL_')}', maxlength: 2, value: '{$CR['level']}', listeners:{ change: function( a, c, b ){ doPlatformOperation( {$CR['id']}, 7, c, true ); } } },{$ROUTING}] }] },{ xtype: 'panel', title: '{$Labels->GetLabel('_LBL_TRACKS_')}', items: [{$TRACKS}] },{ xtype: 'panel', title: '{$Labels->GetLabel('_LBL_SCADA_')}', items: [{ xtype: 'form', height: PanelH - 283, labelWidth: 150, labelAlign: 'right', margins: {top:10, right:10, bottom:10, left:10}, padding:8, items: [{$MODBUS}] }] }],}kokakskhkajhskr; $ITEMS[1] = $ED; $CONTENT = implode(',',$ITEMS); $TTPL = str_ireplace( '%%%ITEMS%%%', $CONTENT, $TTPL ); echo $TTPL; } else { echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}'; }; } else { header('location: /'); };?>
|