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.
83 lines
5.5 KiB
83 lines
5.5 KiB
<?php
|
|
require_once('../ajax_asm.php');
|
|
ob_start();
|
|
$UID = intval( $CUser->Data['id'] );
|
|
$ACCESS = intval( $CUser->Data['access'] );
|
|
if( $UID > 1 ){
|
|
$Data = array();
|
|
$EID = intval( $_POST['OID'] );
|
|
if( isset( $_POST['ABQ'] ) ){
|
|
if( strlen( $_POST['ABQ'] ) < 3 ){
|
|
$Data['status']='na';
|
|
} else {
|
|
$EABQ = strtolower( $DATABASE->escape( $_POST['ABQ'] ) );
|
|
$QS = "SELECT * FROM `metro_stations` WHERE LOWER(`name`) like '%{$EABQ}%' ORDER BY `name`";
|
|
$Result = $DATABASE->Query( $QS, false );
|
|
if( count( $Result ) ){
|
|
$SenPart = array();
|
|
foreach( $Result as $R ){
|
|
$SenPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="UART_O" style="background-color: #'.$R['color'].';" onclick="bindStationToLine('.$R['id'].');">'.urldecode($R['name']).'</a>\'}';
|
|
};
|
|
$Data['status']='ok';
|
|
$Data['stations'] = '['.implode( ',', $SenPart ) .']';
|
|
} else {
|
|
$Data['status']='na';
|
|
};
|
|
};
|
|
} else {
|
|
$QS = "SELECT * FROM `metro_stations` WHERE `id`={$EID}";
|
|
$Result = $DATABASE->Query( $QS, false );
|
|
$CR = $Result[0];
|
|
$QS = "SELECT count(`id`) cnt FROM `metro_platforms` WHERE `station_id`={$EID}";
|
|
$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`={$EID} 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_');
|
|
};
|
|
//$ITEMS[0]="{ xtype: 'spacer', height: 28 }";
|
|
$STATAG[0]="{ 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><br/>'}";
|
|
$QS = "SELECT `ms`.* FROM `metro_stations_2_lines` `sl` LEFT JOIN `metro_stations` `ms` ON ( `ms`.`id`=`sl`.`station_id`) WHERE `sl`.`line_id`={$EID} ORDER BY `sl`.`index`";
|
|
$QS = "SELECT * FROM `metro_platforms` WHERE `station_id`={$EID}";
|
|
$Result = $DATABASE->Query( $QS, false );
|
|
if( $TC = count( $Result ) ){
|
|
$SenPart = array();
|
|
$IDX = 1;
|
|
foreach( $Result as $R ){
|
|
if( $IDX == 1 ){
|
|
if( $TC > 1 ){
|
|
$SenPart[] = '{ xtype: \'panel\', border: false, frame: false, html: \'<table width="100%" border=0><tr><td><span class="sideInfo_item active_green" id="PLATFORM_TAG_'.$R['id'].'" onclick="editPlatform('.$R['id'].');"><table width="100%" border=0><tr><td width="32px"><div class="level_label">'.$R['level'].'</div></td><td>'.urldecode($R['name']).'</td></tr></table></span></td><td width="28px"><span class="sideInfo_item bg_green"> </span></td><td width="28px"><span class="sideInfo_item icabod_down_32 active_green" onclick="movePlatform('.$R['id'].', 0);"> </span></td></tr></table>\'}';
|
|
} else {
|
|
$SenPart[] = '{ xtype: \'panel\', border: false, frame: false, html: \'<table width="100%" border=0><tr><td><span class="sideInfo_item active_green" id="PLATFORM_TAG_'.$R['id'].'" onclick="editPlatform('.$R['id'].');"><table width="100%" border=0><tr><td width="32px"><div class="level_label">'.$R['level'].'</div></td><td>'.urldecode($R['name']).'</td></tr></table></span></td></tr></table>\'}';
|
|
}
|
|
} else if( $IDX == $TC ){
|
|
$SenPart[] = '{ xtype: \'panel\', border: false, frame: false, html: \'<table width="100%" border=0><tr><td><span class="sideInfo_item active_green" id="PLATFORM_TAG_'.$R['id'].'" onclick="editPlatform('.$R['id'].');"><table width="100%" border=0><tr><td width="32px"><div class="level_label">'.$R['level'].'</div></td><td>'.urldecode($R['name']).'</td></tr></table></span></td><td width="28px"><span class="sideInfo_item active_green icabod_up_32" onclick="movePlatform('.$R['id'].', 1);"> </span></td><td width="28px"><span class="sideInfo_item bg_green"> </span></td></tr></table>\'}';
|
|
} else {
|
|
$SenPart[] = '{ xtype: \'panel\', border: false, frame: false, html: \'<table width="100%" border=0><tr><td><span class="sideInfo_item active_green" id="PLATFORM_TAG_'.$R['id'].'" onclick="editPlatform('.$R['id'].');"><table width="100%" border=0><tr><td width="32px"><div class="level_label">'.$R['level'].'</div></td><td>'.urldecode($R['name']).'</td></tr></table></span></td><td width="28px"><span class="sideInfo_item active_green icabod_up_32" onclick="movePlatform('.$R['id'].', 1);"> </span></td><td width="28px"><span class="sideInfo_item icabod_down_32 active_green" onclick="movePlatform('.$R['id'].', 0);"> </span></td></tr></table>\'}';
|
|
};
|
|
$IDX++;
|
|
};
|
|
$Data['status']='ok';
|
|
$Data['line_tag'] = $STATAG;
|
|
$Data['platforms'] = '['.implode( ',', $SenPart ) .']';
|
|
} else {
|
|
$Data['status']='ok';
|
|
$Data['line_tag'] = $STATAG;
|
|
$Data['platforms'] = '[]';
|
|
};
|
|
};
|
|
$Data['messages'] = ob_get_clean();
|
|
echo json_encode( $Data );
|
|
} else {
|
|
header('location: /');
|
|
};
|
|
|
|
|
|
?>
|