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.

82 lines
5.5 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. ob_start();
  4. $UID = intval( $CUser->Data['id'] );
  5. $ACCESS = intval( $CUser->Data['access'] );
  6. if( $UID > 1 ){
  7. $Data = array();
  8. $EID = intval( $_POST['OID'] );
  9. if( isset( $_POST['ABQ'] ) ){
  10. if( strlen( $_POST['ABQ'] ) < 3 ){
  11. $Data['status']='na';
  12. } else {
  13. $EABQ = strtolower( $DATABASE->escape( $_POST['ABQ'] ) );
  14. $QS = "SELECT * FROM `metro_stations` WHERE LOWER(`name`) like '%{$EABQ}%' ORDER BY `name`";
  15. $Result = $DATABASE->Query( $QS, false );
  16. if( count( $Result ) ){
  17. $SenPart = array();
  18. foreach( $Result as $R ){
  19. $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>\'}';
  20. };
  21. $Data['status']='ok';
  22. $Data['stations'] = '['.implode( ',', $SenPart ) .']';
  23. } else {
  24. $Data['status']='na';
  25. };
  26. };
  27. } else {
  28. $QS = "SELECT * FROM `metro_stations` WHERE `id`={$EID}";
  29. $Result = $DATABASE->Query( $QS, false );
  30. $CR = $Result[0];
  31. $QS = "SELECT count(`id`) cnt FROM `metro_platforms` WHERE `station_id`={$EID}";
  32. $Rt = $DATABASE->Query( $QS, false );
  33. $PCO = $Rt[0]['cnt'];
  34. $NAME =$CR['name'] .'<br/>';
  35. $INFO = '<table width="100%" border=0><tr><td width="130px" align="right">'.$Labels->GetLabel('_LBL_PLATFORMS_').':</td><td>'.$PCO.'</td></tr></table>';
  36. $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`";
  37. $Rz = $DATABASE->Query( $QS, false );
  38. if( count( $Rz ) ){
  39. $LINES='<table><tr>';
  40. 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>";
  41. $LINES.='</tr></table>';
  42. } else {
  43. $LINES=$Labels->GetLabel('_NOBI_LINE_');
  44. };
  45. //$ITEMS[0]="{ xtype: 'spacer', height: 28 }";
  46. $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/>'}";
  47. $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`";
  48. $QS = "SELECT * FROM `metro_platforms` WHERE `station_id`={$EID}";
  49. $Result = $DATABASE->Query( $QS, false );
  50. if( $TC = count( $Result ) ){
  51. $SenPart = array();
  52. $IDX = 1;
  53. foreach( $Result as $R ){
  54. if( $IDX == 1 ){
  55. if( $TC > 1 ){
  56. $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">&nbsp;</span></td><td width="28px"><span class="sideInfo_item icabod_down_32 active_green" onclick="movePlatform('.$R['id'].', 0);">&nbsp;</span></td></tr></table>\'}';
  57. } else {
  58. $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>\'}';
  59. }
  60. } else if( $IDX == $TC ){
  61. $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);">&nbsp;</span></td><td width="28px"><span class="sideInfo_item bg_green">&nbsp;</span></td></tr></table>\'}';
  62. } else {
  63. $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);">&nbsp;</span></td><td width="28px"><span class="sideInfo_item icabod_down_32 active_green" onclick="movePlatform('.$R['id'].', 0);">&nbsp;</span></td></tr></table>\'}';
  64. };
  65. $IDX++;
  66. };
  67. $Data['status']='ok';
  68. $Data['line_tag'] = $STATAG;
  69. $Data['platforms'] = '['.implode( ',', $SenPart ) .']';
  70. } else {
  71. $Data['status']='ok';
  72. $Data['line_tag'] = $STATAG;
  73. $Data['platforms'] = '[]';
  74. };
  75. };
  76. $Data['messages'] = ob_get_clean();
  77. echo json_encode( $Data );
  78. } else {
  79. header('location: /');
  80. };
  81. ?>