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.

159 lines
6.4 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( isset($_POST['SESSION']) ) {
  9. $SESSION_ID = intval( $_POST['SESSION'] );
  10. $QS = "SELECT `status`, `track_id` FROM `sessions` WHERE `id`={$SESSION_ID}";
  11. $Result = $DATABASE->Query( $QS, false );
  12. if( count( $Result ) ){
  13. $CS = $Result[0];
  14. $CTID = intval( $CS['track_id'] );
  15. } else {
  16. $CTID = 0;
  17. };
  18. } else {
  19. $SESSION_ID = 0;
  20. if( isset($_POST['TID']) ) $CTID = intval( $_POST['TID'] ); else $CTID = 0;
  21. };
  22. if( $UID > 1 && $CTID ){
  23. $QS = "SELECT * FROM `metro_tracks` WHERE `id`={$CTID}";
  24. $Result = $DATABASE->Query( $QS, false );
  25. $CTR = $Result[0];
  26. $CPID = intval( $CTR['platform_id'] );
  27. $QS = "SELECT * FROM `metro_platforms` WHERE `id`={$CPID}";
  28. $Result = $DATABASE->Query( $QS, false );
  29. $CPL = $Result[0];
  30. $STID = $CPL['station_id'];
  31. $QS = "SELECT * FROM `metro_stations` WHERE `id`={$STID}";
  32. $Result = $DATABASE->Query( $QS, false );
  33. $CST = $Result[0];
  34. $Data['status']='ok';
  35. $Data['track_id']=$CTID;
  36. $CTITLE = $CPL['name'] . ' <span class="level_label_title">'.$CPL['level'].'</span>';
  37. if( $CTR['name']!=''){
  38. $TNAME = $CTR['name'] . ':' . $CTR['short'] ;
  39. } else {
  40. $TNAME = $CTR['short'] ;
  41. };
  42. $MAIN_TPL = str_ireplace( '%%STATION%NAME%%', $CST['name'], $TRACK_VIEW_CTX );
  43. $MAIN_TPL = str_ireplace( '%%STATION%ID%%', $STID, $MAIN_TPL );
  44. $MAIN_TPL = str_ireplace( '%%PLATFORM%NAME%%', $CPL['name'], $MAIN_TPL );
  45. $MAIN_TPL = str_ireplace( '%%PLATFORM%ID%%', $CPID, $MAIN_TPL );
  46. $MAIN_TPL = str_ireplace( '%%PLATFORM%TITLE%%', $CTITLE, $MAIN_TPL );
  47. $MAIN_TPL = str_ireplace( '%%TRACK%NAME%%', $TNAME, $MAIN_TPL );
  48. if( $CTR['side'] == 'U' ){
  49. $LMID = intval( $CTR['far_module_id'] );
  50. $RMID = intval( $CTR['near_module_id'] );
  51. } else {
  52. $RMID = intval( $CTR['far_module_id'] );
  53. $LMID = intval( $CTR['near_module_id'] );
  54. };
  55. if( $LMID ){
  56. $QS = "SELECT * FROM `metro_modules` WHERE `id`={$LMID}";
  57. $DD = $DATABASE->Query( $QS, false );
  58. $MD = $DD[0];
  59. if( $MD['status'] == 'E' ){
  60. $URL = '/style/assets/no-signal_h.png';
  61. $LVID = str_ireplace( '%%MID%%', $LMID, $EXT_VIDEO_CTX );
  62. $LVID = str_ireplace( '%%%TITLE%%%', $MD['name'], $LVID );
  63. $LTitle = $MD['name'];
  64. $LVID = str_ireplace( '%%%SELURL%%%', $URL, $LVID );
  65. $LVID = str_ireplace( '%%%HBTN%%%','&nbsp;', $LVID );
  66. } else {
  67. $LVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX );
  68. $LVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $LVID );
  69. $LMID = 0;
  70. }
  71. } else {
  72. $LVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX );
  73. $LVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $LVID );
  74. };
  75. if( $RMID ){
  76. $QS = "SELECT * FROM `metro_modules` WHERE `id`={$RMID}";
  77. $DD = $DATABASE->Query( $QS, false );
  78. $MD = $DD[0];
  79. if( $MD['status'] == 'E' ){
  80. $URL = '/style/assets/no-signal_h.png';
  81. $RVID = str_ireplace( '%%MID%%', $RMID, $EXT_VIDEO_CTX );
  82. $RVID = str_ireplace( '%%%TITLE%%%', $MD['name'], $RVID );
  83. $RTitle = $MD['name'];
  84. $RVID = str_ireplace( '%%%SELURL%%%', $URL, $RVID );
  85. $RVID = str_ireplace( '%%%HBTN%%%','&nbsp;', $RVID );
  86. } else {
  87. $RVID = str_ireplace( '%%MID%%', '1', $EMPTY_VIDEO_CTX );
  88. $RVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $RVID );
  89. $RMID = 0;
  90. };
  91. } else {
  92. $RVID = str_ireplace( '%%MID%%', '1', $EMPTY_VIDEO_CTX );
  93. $RVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $RVID );
  94. };
  95. $PLO = getPlatformLineInfo( $CPID );
  96. if( count( $PLO ) ){
  97. $LINES='<table><tr>';
  98. 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>";
  99. $LINES.='</tr></table>';
  100. } else {
  101. $LINES=$Labels->GetLabel('_NOBI_LINE_');
  102. };
  103. $NAME = '<table border=0><tr><td colspan=2>'.getStationName( $PLO[0]['station_id'] ).'</td></tr><tr><td><span class="level_label_title_2">B2</span>&nbsp;'.getPlatformName( $CPID ) . '</td><td>'.$LINES.'</td></tr></table>';
  104. //$PLAT_PARTS[] = "{ xtype:'panel', border: false, frame: false, html: '<table border=0 width=\"100%\" class=\"setEd_infoPanel\"><tr><td valign=\"middle\" align=\"left\" style=\"padding-left:30px;font-size: 22px; font-weight: bold;\">{$NAME}</td><td width=\"100%\" class=\"setEd_infoPanel track_short_big\">{$CTR['short']}</td></tr></table>'}";
  105. $PLAT_PARTS[] = createTopLabel(getStationName( $PLO[0]['station_id'] ), getPlatformName( $CPID ), $LINES, $CTR['short'] );
  106. //$PLAT_PARTS[] = "{html:'Track Nfo'}";//str_ireplace( '%%%MODULE%MAP%%%', $ITEM_X, $ITEM );
  107. //$PLAT_PARTS[] = str_ireplace( '%%MID%%', $MID , $VIDEOJS_CTX );
  108. //$PLAT_PARTS[] = str_ireplace( '%%MID%%', '' , $VIDEOJS_CTX );
  109. $MSVG = createTrackBackground( $CPL['layout'], $CTR['side'], $LTitle, $RTitle );
  110. if( $SESSION_ID ){
  111. $QS = "SELECT * FROM `session_statuses` WHERE `min_access`<={$ACCESS} AND `special`=''";
  112. $SR = $DATABASE->Query( $QS );
  113. $TDS = '';
  114. $PPP = 100.0 / count($SR);
  115. foreach( $SR as $S ){
  116. $FUNC = ($S['special']!='')?$S['special']:'setSessionStatus';
  117. if( $CS['status'] >= $S['lvl'] ){
  118. $TDS .= "<td align=\"center\" width=\"{$PPP}%\"><span class=\"sideInfo_item passive_gray\">{$S['label']}</span></td>";
  119. } else {
  120. $TDS .= "<td align=\"center\" width=\"{$PPP}%\"><span class=\"sideInfo_item {$S['class']}\" onclick=\"{$FUNC}({$SESSION_ID},{$S['lvl']});\" >{$S['label']}</span></td>";
  121. };
  122. };
  123. };
  124. $PLAT_PARTS[] =<<<DATA_BOUNDARY
  125. {
  126. xtype: 'panel',
  127. layout: 'table',
  128. frame: true,
  129. width: '100%',
  130. defaults: {
  131. bodyStyle:'padding:0px'
  132. },
  133. layoutConfig: {
  134. columns: 2
  135. },
  136. items:[{
  137. html: '{$MSVG}',
  138. width: '100%',
  139. colspan: 2
  140. },{$LVID},{$RVID}]
  141. }
  142. DATA_BOUNDARY;
  143. if( $SESSION_ID ) $PLAT_PARTS[] ="{ id:'sets_ui', frame: true, html: '<table width=\"100%\" border=0><tr>{$TDS}</tr></table>'}";
  144. //$TOP = str_ireplace('%%%PANELS%%%', implode( ",{ xtype:'spacer', height: 10 },",$PLAT_PARTS ), $MAIN_TPL );
  145. $TOP = str_ireplace('%%%PANELS%%%', implode( ",",$PLAT_PARTS ), $MAIN_TPL );
  146. $Data['platform_id'] = $CPID;
  147. $Data['station_id'] = $STID;
  148. $Data['content']= $TOP;
  149. $Data['messages'] = ob_get_clean();
  150. echo json_encode( $Data );
  151. } else {
  152. header('location: /');
  153. };
  154. ?>