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.
 
 
 
 

32 lines
1.5 KiB

<?php
require_once('../ajax_asm.php');
ob_start();
if( $CUser->Data['id'] > 1 ){
$Data['status'] = 'na';
$EID = intval( $_POST['PID'] );
$QS = "SELECT * FROM `modbus_modules` WHERE `platform_id`={$EID}";
$Result = $DATABASE->Query( $QS, false );
if( count( $Result ) ){
$QS = "SELECT `left_side`, `right_side` FROM `metro_platforms` WHERE `id`={$EID}";
$ZZ = $DATABASE->Query( $QS, false );
$CP = $ZZ[0];
$SenPart = array();
foreach( $Result as $R ){
$AA = ($R['wm']=='E')?'active_green':'active_gray';
switch( $R['func'] ){
case 1: $IM = '/style/assets/scada_fn_l.png'; $FLAB = $CP['left_side'].' '.$Labels->GetLabel('___SIDE__'); break;
case 2: $IM = '/style/assets/scada_fn_r.png'; $FLAB = $CP['right_side'].' '.$Labels->GetLabel('___SIDE__'); break;
case 3: $IM = '/style/assets/scada_fn_tcc.png'; $FLAB = 'TCC ' . $Labels->GetLabel('___MODULE__'); break;
default: $IM = '/style/assets/scada_fn_na.png'; $FLAB = 'No Func.';break;
};
$SenPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item '.$AA.'" onclick="editScadaModule('.$R['id'].');"><table width="100%"><tr><td>'.$R['ip4'].' '.urldecode($R['label']).' ['.$FLAB.']</td><td width="24px"><img src="'.$IM.'"></td></tr></table></a>\'}';
};
$Data['status']='ok';
$Data['modules'] = '['.implode( ',', $SenPart ) .']';
};
$Data['messages'] = ob_get_clean();
echo json_encode( $Data );
} else {
header('location: /');
};
?>