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.
193 lines
11 KiB
193 lines
11 KiB
<?php
|
|
require_once('../ajax_asm.php');
|
|
require_once('../php/argus/server.php');
|
|
require_once('../php/argus/templates.php');
|
|
ob_start();
|
|
$UID = intval( $CUser->Data['id'] );
|
|
$ACCESS = intval( $CUser->Data['access'] );
|
|
if( $UID > 1 ){
|
|
$PID = intval( $_POST['PID'] );
|
|
$QS = "SELECT * FROM `metro_platforms` WHERE `id`={$PID}";
|
|
$Result = $DATABASE->Query( $QS, false );
|
|
if( count( $Result ) ){
|
|
$STID = $Result[0]['station_id'];
|
|
$QS = "SELECT * FROM `metro_stations` WHERE `id`={$STID}";
|
|
$SR = $DATABASE->Query( $QS, false );
|
|
if( count( $SR ) ){
|
|
$Data['status']='ok';
|
|
$CR = $Result[0];
|
|
$PLAT_IDS = array();
|
|
$MODU_IDS = array();
|
|
$PLAT_PARTS = array();
|
|
$MAIN_TPL = str_ireplace( '%%STATION%NAME%%', $SR[0]['name'], $PLATFORM_VIEW_CTX );
|
|
$MAIN_TPL = str_ireplace( '%%STATION%ID%%', $STID, $MAIN_TPL );
|
|
$MAIN_TPL = str_ireplace( '%%PLATFORM%NAME%%', $Result[0]['name'], $MAIN_TPL );
|
|
$CTITLE = $CR['name'] . ' <span class="level_label_title">'.$CR['level'].'</span>';
|
|
$PLO = getPlatformLineInfo( $PID );
|
|
if( count( $PLO ) ){
|
|
$LINES='<table><tr>';
|
|
foreach( $PLO as $Z ) $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>';
|
|
} else {
|
|
$LINES=$Labels->GetLabel('_NOBI_LINE_');
|
|
};
|
|
//$PLAT_PARTS[] = '{ xtype:\'spacer\', height: 10 }';
|
|
$PLAT_PARTS[] = createTopLabel( $SR[0]['name'], $Result[0]['name'], $LINES );
|
|
//foreach( $Result as $CR )
|
|
{
|
|
|
|
$CID = intval( $CR['id'] );
|
|
$ITEMS = array();
|
|
$PLAT_IDS[] = $CID;
|
|
$PINFO = getPlatformInfo( $CID );
|
|
$QS = "SELECT * FROM `metro_tracks` WHERE `platform_id`={$CID} ORDER BY `side` ASC";
|
|
$TI = $DATABASE->Query( $QS, false );
|
|
$TCO = count( $TI );
|
|
if( $TCO ){
|
|
$COS = count( $PINFO['PREV'] );
|
|
if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
|
|
$TRU = "<td width=\"120px\" {$COS} onclick=\"loadTrackView({$TI[0]['id']})\" class=\"_infoPanel active_overlay_orange_bl\" style=\"color:#fff; font-weight: bold; text-align: center;\">{$TI[0]['short']}</td>";
|
|
if( count( $TI ) > 1 ){
|
|
$COS = count( $PINFO['NEXT'] );
|
|
if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
|
|
$TRB = "<td width=\"120px\" {$COS} onclick=\"loadTrackView({$TI[1]['id']})\" class=\"_infoPanel active_overlay_orange_bl\" style=\"color:#fff; font-weight: bold; text-align: center;\">{$TI[1]['short']}</td>";
|
|
};
|
|
} 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>";
|
|
};
|
|
$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 ){
|
|
//{$P['bg_style']}
|
|
$TOP .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel active_overlay_orange\" style=\"color:#fff; font-weight: bold;\"><tr><td class=\"ar_to_left\"> </td><td align=\"left\"><span class=\"inline_link\" onclick=\"loadStationView({$P['id']});\">{$P['name']}</span></td></tr></table></td></tr>";
|
|
}
|
|
} else {
|
|
if( count( $PINFO['PREV'] )){
|
|
//{$PINFO['PREV'][0]['bg_style']}
|
|
$TOP .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel active_overlay_orange\" style=\"color:#fff; font-weight: bold;\"><tr><td class=\"ar_to_left\"> </td><td align=\"left\"><span class=\"inline_link\" onclick=\"loadStationView({$PINFO['PREV'][0]['id']});\">{$PINFO['PREV'][0]['name']}</span></td></tr></table></td></tr>";
|
|
} else {
|
|
//background-color:#000;
|
|
$TOP .="<tr><td><table border=0 width=\"100%\" class=\"_infoPanel active_overlay_orange\" style=\"color:#fff; font-weight: bold;\"><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 ){
|
|
//{$P['bg_style']}
|
|
$BOTTOM .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel active_overlay_orange\" style=\"color:#fff; font-weight: bold;\"><tr><td align=\"right\"><span class=\"inline_link\" onclick=\"loadStationView({$P['id']});\">{$P['name']}</span></td><td class=\"ar_to_right\"> </td></tr></table></td></tr>";
|
|
}
|
|
} else {
|
|
if( count( $PINFO['NEXT'] )){
|
|
//{$PINFO['NEXT'][0]['bg_style']}
|
|
$BOTTOM .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel active_overlay_orange\" style=\"color:#fff; font-weight: bold;\"><tr><td align=\"right\"><span class=\"inline_link\" onclick=\"loadStationView({$PINFO['NEXT'][0]['id']});\">{$PINFO['NEXT'][0]['name']}</span></td><td class=\"ar_to_right\"> </td></tr></table></td></tr>";
|
|
} else {
|
|
// background-color:#000;
|
|
$BOTTOM .= "<tr><td><table border=0 width=\"100%\" class=\"_infoPanel active_overlay_orange\" style=\"color:#fff; font-weight: bold;\"><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>";
|
|
$ITEM = str_ireplace( '%%%PLATFORM%TITLE%%%', $CTITLE , $PLATFORM_PLATFORM_CTX );
|
|
$ITEM = str_ireplace( '%%%PLATFORM%ID%%%', $CID , $ITEM );
|
|
$QS = "SELECT * FROM `metro_tracks` WHERE `platform_id`={$CID}";
|
|
$TRES = $DATABASE->Query( $QS );
|
|
$POLKAN = array( "UF"=>false,"UN"=>false,"BF"=>false,"BN"=>false);
|
|
$SCA_UT_TTL = 'Upper Track';
|
|
$SCA_BT_TTL = 'Upper Track';
|
|
if( count( $TRES ) ){
|
|
foreach( $TRES as $CTRK ){
|
|
if( $CTRK['side'] == 'U' ){
|
|
$SCA_UT_TTL = $CTRK['short'];
|
|
$QS = "SELECT * FROM `metro_modules` WHERE `status`='E' AND `track_id`={$CTRK['id']} ORDER BY `side`";
|
|
$MRES = $DATABASE->Query( $QS );
|
|
foreach( $MRES as $MM ){
|
|
$TTL = "{$CTRK['short']}:{$MM['name']}";
|
|
$MDT = array();
|
|
$MDT['id'] = $MM['id'];
|
|
$MDT['name'] = $TTL;
|
|
$MDT['status'] = 0;
|
|
$POLKAN[$CTRK['side'].$MM['side']] = true;
|
|
if( $MM['side']=='F'){
|
|
$MDD[0] = $MDT;
|
|
} else {
|
|
$MDD[1] = $MDT;
|
|
};
|
|
$URL = '/style/assets/no-signal_h.png';
|
|
$CVTPL = str_ireplace( '%%%PLATFORM%ID%%%', $CID, $SIMPLE_VIDEO_CTX );
|
|
$CVTPL = str_ireplace( '%%MID%%', $MM['id'], $CVTPL );
|
|
$CVTPL = str_ireplace( '%%TRACK%ID%%',$CTRK['id'], $CVTPL );
|
|
$CVTPL = str_ireplace( '%%%%TITLE%%%', $TTL, $CVTPL );
|
|
$CVTPL = str_ireplace( '%%%STATUS%CLASS%%', 'aaBB', $CVTPL );
|
|
$CVTPL = str_ireplace( '%%%IMG%URL%%%', $URL, $CVTPL );
|
|
$CVTPL = str_ireplace( '%%MIP%%', $MM['IP4'], $CVTPL );
|
|
$CVTPL = str_ireplace( '%%MCID%%', $MM['cam_id'], $CVTPL );
|
|
$CVTPL = str_ireplace( '%%%STATUS%%%', 'Status', $CVTPL );
|
|
$ITEM = str_ireplace( '%%%VIDEO'.$CTRK['side'].$MM['side'].'%%%', $CVTPL, $ITEM );
|
|
$MODU_IDS[] = $MM['id'];
|
|
};
|
|
} else {
|
|
$SCA_BT_TTL = $CTRK['short'];
|
|
$QS = "SELECT * FROM `metro_modules` WHERE `status`='E' AND `track_id`={$CTRK['id']} ORDER BY `side` DESC ";
|
|
$MRES = $DATABASE->Query( $QS );
|
|
foreach( $MRES as $MM ){
|
|
$TTL = "{$CTRK['short']}:{$MM['name']}";
|
|
$MDT = array();
|
|
$MDT['id'] = $MM['id'];
|
|
$MDT['name'] = $TTL;
|
|
$MDT['status'] = 0;
|
|
$POLKAN[$CTRK['side'].$MM['side']] = true;
|
|
if( $MM['side']=='F'){
|
|
$MDD[2] = $MDT;
|
|
} else {
|
|
$MDD[3] = $MDT;
|
|
};
|
|
$URL = '/style/assets/no-signal_h.png';
|
|
$CVTPL = str_ireplace( '%%%PLATFORM%ID%%%', $CID, $SIMPLE_VIDEO_CTX );
|
|
$CVTPL = str_ireplace( '%%MID%%', $MM['id'], $CVTPL );
|
|
$CVTPL = str_ireplace( '%%TRACK%ID%%', $CTRK['id'], $CVTPL );
|
|
$CVTPL = str_ireplace( '%%%%TITLE%%%', $TTL, $CVTPL );
|
|
$CVTPL = str_ireplace( '%%%STATUS%CLASS%%', 'aaBB', $CVTPL );
|
|
$CVTPL = str_ireplace( '%%%IMG%URL%%%', $URL, $CVTPL );
|
|
$CVTPL = str_ireplace( '%%MIP%%', $MM['IP4'], $CVTPL );
|
|
$CVTPL = str_ireplace( '%%MCID%%', $MM['cam_id'], $CVTPL );
|
|
$CVTPL = str_ireplace( '%%%STATUS%%%', 'Status', $CVTPL );
|
|
$ITEM = str_ireplace( '%%%VIDEO'.$CTRK['side'].$MM['side'].'%%%', $CVTPL, $ITEM );
|
|
$MODU_IDS[] = $MM['id'];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
$vcount = 0;
|
|
foreach( $POLKAN as $Key=>$Value ) if( !$Value ){
|
|
$CVTPL = str_ireplace( '%%%PLATFORM%ID%%%', $CID, $EMPTY_NO_AC_VIDEO_CTX );
|
|
$CVTPL = str_ireplace( '%%MID%%', 'A'.$vcount, $CVTPL );
|
|
$ITEM = str_ireplace( '%%%VIDEO'.$Key.'%%%', $CVTPL, $ITEM );
|
|
$MODU_IDS[] = 0;
|
|
$vcount++;
|
|
};
|
|
$SCADA = "<td class=\"mon_scada_passive_panel\"><b>".$Labels->GetLabel('_SCADA_STATUS_')."</b><hr/><table width=\"100%\"><tr><td>".$Labels->GetLabel('_MOD_STATUS_').":</td><td colspan=4><div id=\"scada_status\" class=\"mon_scada_status_tag_na\">".$Labels->GetLabel('_NOT_ASSIGNED_')."</div></td></tr><tr><td> </td><td id=\"scada_a\" class=\"mon_scada_head\">{$SCA_UT_TTL}</td><td id=\"scada_b\" class=\"mon_scada_head\">{$SCA_BT_TTL}</td><td id=\"scada_c\" class=\"mon_scada_head\">".$Labels->GetLabel('_HEALTH_')."</td><td id=\"scada_d\" class=\"mon_scada_head\">AUX</td></tr><tr><td> </td><td></td><td></td><td></td><td></td></tr></table></td>";
|
|
$ITEM_X="<table border=0 width=\"100%\" id=\"plat_table_{$CID}\"><tr>{$TOP}</tr><tr><td width=\"100%\">".createPlatformBackground( $CR['layout'], $CID, array()/*$MDD*/ )."</td></tr><tr>{$BOTTOM}</tr><tr>{$SCADA}</tr></table>";
|
|
|
|
|
|
$PLAT_PARTS[] = str_ireplace( '%%%PLATFORM%MAP%%%', $ITEM_X, $ITEM );
|
|
};
|
|
//$TIPTOP = str_ireplace('%%%PLATFORM_IDS%%%', implode( ',',$PLAT_IDS ), $TIPTOP );
|
|
$TOP = str_ireplace('%%%PANELS%%%', implode( ",",$PLAT_PARTS ), $MAIN_TPL );
|
|
$Data['pid'] = $PID;
|
|
$Data['content']= $TOP;
|
|
} else {
|
|
$Data['status']='na';
|
|
};
|
|
};
|
|
$Data['messages'] = ob_get_clean();
|
|
echo json_encode( $Data );
|
|
} else {
|
|
header('location: /');
|
|
};
|
|
|
|
?>
|