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.
86 lines
3.9 KiB
86 lines
3.9 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 ){
|
|
$STID = intval( $_POST['STT'] );
|
|
$QS = "SELECT * FROM `metro_stations` WHERE `id`={$STID}";
|
|
$SR = $DATABASE->Query( $QS, false );
|
|
if( count( $SR ) ){
|
|
$CR = $SR[0];
|
|
$QS = "SELECT count(`id`) cnt FROM `metro_platforms` WHERE `station_id`={$STID}";
|
|
$Rt = $DATABASE->Query( $QS, false );
|
|
$PCO = $Rt[0]['cnt'];
|
|
$NAME =$CR['name'] .'<br/>';
|
|
$INFO = '<table width="100%" border=0><tr><td width="130px" align="right">'.$Labels->GetLabel('_LBL_PLATFORMS_').':</td><td>'.$PCO.'</td></tr></table>';
|
|
|
|
$QS = "SELECT `ln`.`short`,`ln`.`color`,`ln`.`name` FROM `metro_lines` `ln` LEFT JOIN `metro_stations_2_lines` `sl` ON ( `ln`.`id`=`sl`.`line_id` ) WHERE `sl`.`station_id`={$STID} ORDER BY `ln`.`short`";
|
|
$Rz = $DATABASE->Query( $QS, false );
|
|
if( count( $Rz ) ){
|
|
$LINES='<table><tr>';
|
|
foreach( $Rz 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_');
|
|
};
|
|
$STATAG="{ xtype:'panel', border: false, frame: false, html: '<table border=0 class=\"setEd_infoPanel\" id=\"SENSOR_N\"><tr><td valign=\"middle\" align=\"center\" style=\"padding-left:30px;font-size: 22px; font-weight: bold;\">{$NAME}</td></tr><tr><td>{$INFO}</td></tr><tr><td style=\"padding-left:30px;\">{$LINES}</td></tr></table>'}";
|
|
|
|
$STATAG = createTopLabel( $CR['name'], $Labels->GetLabel('_LBL_PLATFORMS_').': '.$PCO, $LINES );
|
|
|
|
$Data['status']='ok';
|
|
$QS = "SELECT * FROM `metro_platforms` WHERE `station_id`={$STID} AND `status`='E' ORDER BY `index`";
|
|
$Result = $DATABASE->Query( $QS, false );
|
|
if( count( $Result ) ){
|
|
if( count( $Result ) == 1 ){
|
|
//Go streight to the platform
|
|
$Data['status']='steight';
|
|
$Data['next_id']= intval( $Result[0]['id'] );
|
|
$Data['messages'] = ob_get_clean();
|
|
echo json_encode( $Data );
|
|
exit();
|
|
};
|
|
|
|
$MAIN_TPL = str_ireplace( '%%STATION%NAME%%', $CR['name'], $STATION_VIEW_CTX );
|
|
|
|
$PLAT_IDS = array();
|
|
$MODU_IDS = array();
|
|
$PLAT_PARTS = array();
|
|
$PLAT_PARTS[]=$STATAG;
|
|
foreach( $Result as $CR ){
|
|
$CTITLE = 'Platform Level: <span class="level_label_title">'.$CR['level'].'</span>';
|
|
$PID = intval( $CR['id'] );
|
|
$ITEMS = array();
|
|
$PLAT_IDS[] = $CID;
|
|
$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[] = createChopLabel( $CR['name'], $CTITLE, $LINES, '','active_green', "loadPlatformView({$PID})" );
|
|
};
|
|
//$TIPTOP = str_ireplace('%%%PLATFORM_IDS%%%', implode( ',',$PLAT_IDS ), $TIPTOP );
|
|
$TOP = str_ireplace('%%%PANELS%%%', implode( ",{ xtype:'spacer', height: 2 },",$PLAT_PARTS ), $MAIN_TPL );
|
|
} else {
|
|
$MAIN_TPL = str_ireplace( '%%STATION%NAME%%', $SR[0]['name'], $STATION_VIEW_CTX );
|
|
// No Platforms
|
|
$TOP = str_ireplace('%%%PANELS%%%', $STATAG, $MAIN_TPL );
|
|
};
|
|
$Data['pids'] = $PLAT_IDS;
|
|
$Data['content']= $TOP;
|
|
} else {
|
|
$Data['status']='na';
|
|
}
|
|
$Data['messages'] = ob_get_clean();
|
|
echo json_encode( $Data );
|
|
} else {
|
|
header('location: /');
|
|
};
|
|
|
|
?>
|