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.

85 lines
3.9 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. //$PLAT_PARTS[] = '{ xtype:\'spacer\', height: 10 }';
  61. $PLAT_PARTS[] = createChopLabel( $CR['name'], $CTITLE, $LINES, '','active_green', "loadPlatformView({$PID})" );
  62. };
  63. //$TIPTOP = str_ireplace('%%%PLATFORM_IDS%%%', implode( ',',$PLAT_IDS ), $TIPTOP );
  64. $TOP = str_ireplace('%%%PANELS%%%', implode( ",{ xtype:'spacer', height: 2 },",$PLAT_PARTS ), $MAIN_TPL );
  65. } else {
  66. $MAIN_TPL = str_ireplace( '%%STATION%NAME%%', $SR[0]['name'], $STATION_VIEW_CTX );
  67. // No Platforms
  68. $TOP = str_ireplace('%%%PANELS%%%', $STATAG, $MAIN_TPL );
  69. };
  70. $Data['pids'] = $PLAT_IDS;
  71. $Data['content']= $TOP;
  72. } else {
  73. $Data['status']='na';
  74. }
  75. $Data['messages'] = ob_get_clean();
  76. echo json_encode( $Data );
  77. } else {
  78. header('location: /');
  79. };
  80. ?>