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.

112 lines
6.3 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. require_once('../php/argus/server.php');
  4. require_once('../php/argus/templates.php');
  5. ob_start();
  6. $UID = intval( $CUser->Data['id'] );
  7. $ACCESS = intval( $CUser->Data['access'] );
  8. if( $UID > 1 ){
  9. $STID = intval( $_POST['STT'] );
  10. $QS = "SELECT * FROM `metro_stations` WHERE `id`={$STID}";
  11. $SR = $DATABASE->Query( $QS, false );
  12. if( count( $SR ) ){
  13. $CR = $SR[0];
  14. $QS = "SELECT count(`id`) cnt FROM `metro_platforms` WHERE `station_id`={$STID}";
  15. $Rt = $DATABASE->Query( $QS, false );
  16. $PCO = $Rt[0]['cnt'];
  17. $NAME =$CR['name'] .'<br/>';
  18. $INFO = '<table width="100%" border=0><tr><td width="130px" align="right">'.$Labels->GetLabel('_LBL_PLATFORMS_').':</td><td>'.$PCO.'</td></tr></table>';
  19. $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`";
  20. $Rz = $DATABASE->Query( $QS, false );
  21. if( count( $Rz ) ){
  22. $LINES='<table><tr>';
  23. 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>";
  24. $LINES.='</tr></table>';
  25. } else {
  26. $LINES=$Labels->GetLabel('_NOBI_LINE_');
  27. };
  28. $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>'}";
  29. $STATAG = createTopLabel( $CR['name'], $Labels->GetLabel('_LBL_PLATFORMS_').':&nbsp;'.$PCO, $LINES );
  30. $Data['status']='ok';
  31. $QS = "SELECT * FROM `metro_platforms` WHERE `station_id`={$STID} AND `status`='E' ORDER BY `index`";
  32. $Result = $DATABASE->Query( $QS, false );
  33. if( count( $Result ) ){
  34. if( count( $Result ) == 1 ){
  35. //Go streight to the platform
  36. $Data['status']='steight';
  37. $Data['next_id']= intval( $Result[0]['id'] );
  38. $Data['messages'] = ob_get_clean();
  39. echo json_encode( $Data );
  40. exit();
  41. };
  42. $MAIN_TPL = str_ireplace( '%%STATION%NAME%%', $CR['name'], $STATION_VIEW_CTX );
  43. $PLAT_IDS = array();
  44. $MODU_IDS = array();
  45. $PLAT_PARTS = array();
  46. $PLAT_PARTS[]=$STATAG;
  47. foreach( $Result as $CR ){
  48. $CTITLE = 'Platform Level: <span class="level_label_title">'.$CR['level'].'</span>';
  49. $PID = intval( $CR['id'] );
  50. $ITEMS = array();
  51. $PLAT_IDS[] = $CID;
  52. $PLO = getPlatformLineInfo( $PID );
  53. if( count( $PLO ) ){
  54. $LINES='<table><tr>';
  55. 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>";
  56. $LINES.='</tr></table>';
  57. } else {
  58. $LINES=$Labels->GetLabel('_NOBI_LINE_');
  59. };
  60. $QS ="SELECT * FROM `metro_tracks` WHERE `platform_id`={$PID}";
  61. $GG = $DATABASE->Query( $QS );
  62. $CAMS = array();
  63. foreach( $GG as $CP ){
  64. if( $CP['side'] == 'U' ){
  65. if( $CP['far_module_id'] > 0 ){
  66. $CAMS[0] = '<div id="mod_vp_'.$CP['far_module_id'].'" style="height: 80px; width: 142px; display: block; background-image: url(/style/assets/no-signal_h.png); text-align: left; v-align: top; padding: 10px; background-size: 100% 100%;"><img width="16px" src="/style/assets/ms_ul.png"></div>';
  67. } else {
  68. $CAMS[0] = '<div style="height: 80px; width: 142px; display: block; background-color: gray; text-align: center; v-align: middle; padding: 10px; color: black; font-size: 14px;">No Module</div>';
  69. };
  70. if( $CP['near_module_id'] > 0 ){
  71. $CAMS[1] = '<div id="mod_vp_'.$CP['near_module_id'].'" style="height: 80px; width: 142px; display: block; background-image: url(/style/assets/no-signal_h.png); text-align: right; v-align: top; padding: 10px; background-size: 100% 100%;"><img width="16px" src="/style/assets/ms_ur.png"></div>';
  72. } else {
  73. $CAMS[1] = '<div style="height: 80px; width: 142px; display: block; background-color: gray; text-align: center; v-align: middle; padding: 10px; color: black; font-size: 14px;">No Module</div>';
  74. };
  75. } else {
  76. if( $CP['near_module_id'] > 0 ){
  77. $CAMS[2] = '<div id="mod_vp_'.$CP['near_module_id'].'" style="height: 80px; width: 142px; display: block; background-image: url(/style/assets/no-signal_h.png); text-align: left; v-align: bottom; padding: 10px; background-size: 100% 100%;"><img width="16px" src="/style/assets/ms_bl.png"></div>';
  78. } else {
  79. $CAMS[2] = '<div style="height: 80px; width: 142px; display: block; background-color: gray; text-align: center; v-align: middle; padding: 10px; color: black; font-size: 14px;">No Module</div>';
  80. };
  81. if( $CP['far_module_id'] > 0 ){
  82. $CAMS[3] = '<div id="mod_vp_'.$CP['far_module_id'].'" style="height: 80px; width: 142px; display: block; background-image: url(/style/assets/no-signal_h.png); text-align: right; v-align: bottom; padding: 10px; background-size: 100% 100%;"><img width="16px" src="/style/assets/ms_br.png"></div>';
  83. } else {
  84. $CAMS[3] = '<div style="height: 80px; width: 142px; display: block; background-color: gray; text-align: center; v-align: middle; padding: 10px; color: black; font-size: 14px;">No Module</div>';
  85. };
  86. };
  87. };
  88. $PLAT_PARTS[] = createChopLabel( $CR['name'], $CTITLE, $LINES, '','active_green', "loadPlatformView({$PID})", $CAMS, 'id="plat_table_'.$PID.'"' );
  89. };
  90. //$TIPTOP = str_ireplace('%%%PLATFORM_IDS%%%', implode( ',',$PLAT_IDS ), $TIPTOP );
  91. $TOP = str_ireplace('%%%PANELS%%%', implode( ",{ xtype:'spacer', height: 2 },",$PLAT_PARTS ), $MAIN_TPL );
  92. } else {
  93. $MAIN_TPL = str_ireplace( '%%STATION%NAME%%', $SR[0]['name'], $STATION_VIEW_CTX );
  94. // No Platforms
  95. $TOP = str_ireplace('%%%PANELS%%%', $STATAG, $MAIN_TPL );
  96. };
  97. $Data['pids'] = $PLAT_IDS;
  98. $Data['content']= $TOP;
  99. } else {
  100. $Data['status']='na';
  101. }
  102. $Data['messages'] = ob_get_clean();
  103. echo json_encode( $Data );
  104. } else {
  105. header('location: /');
  106. };
  107. ?>