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.

167 lines
6.9 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
12 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. $LVID = str_ireplace( '%%MIP%%', $MD['IP4'], $LVID );
  67. $LVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $LVID );
  68. } else {
  69. $LVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX );
  70. $LVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $LVID );
  71. $LVID = str_ireplace( '%%MIP%%', $MD['IP4'], $LVID );
  72. $LVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $LVID );
  73. $LMID = 0;
  74. }
  75. } else {
  76. $LVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX );
  77. $LVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $LVID );
  78. };
  79. if( $RMID ){
  80. $QS = "SELECT * FROM `metro_modules` WHERE `id`={$RMID}";
  81. $DD = $DATABASE->Query( $QS, false );
  82. $MD = $DD[0];
  83. if( $MD['status'] == 'E' ){
  84. $URL = '/style/assets/no-signal_h.png';
  85. $RVID = str_ireplace( '%%MID%%', $RMID, $EXT_VIDEO_CTX );
  86. $RVID = str_ireplace( '%%%TITLE%%%', $MD['name'], $RVID );
  87. $RTitle = $MD['name'];
  88. $RVID = str_ireplace( '%%%SELURL%%%', $URL, $RVID );
  89. $RVID = str_ireplace( '%%%HBTN%%%','&nbsp;', $RVID );
  90. $RVID = str_ireplace( '%%MIP%%', $MD['IP4'], $RVID );
  91. $RVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $RVID );
  92. } else {
  93. $RVID = str_ireplace( '%%MID%%', '1', $EMPTY_VIDEO_CTX );
  94. $RVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $RVID );
  95. $RVID = str_ireplace( '%%MIP%%', $MD['IP4'], $RVID );
  96. $RVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $RVID );
  97. $RMID = 0;
  98. };
  99. } else {
  100. $RVID = str_ireplace( '%%MID%%', '1', $EMPTY_VIDEO_CTX );
  101. $RVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $RVID );
  102. };
  103. $PLO = getPlatformLineInfo( $CPID );
  104. if( count( $PLO ) ){
  105. $LINES='<table><tr>';
  106. 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>";
  107. $LINES.='</tr></table>';
  108. } else {
  109. $LINES=$Labels->GetLabel('_NOBI_LINE_');
  110. };
  111. $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>';
  112. //$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>'}";
  113. $PLAT_PARTS[] = createTopLabel(getStationName( $PLO[0]['station_id'] ), getPlatformName( $CPID ), $LINES, $CTR['short'] );
  114. //$PLAT_PARTS[] = "{html:'Track Nfo'}";//str_ireplace( '%%%MODULE%MAP%%%', $ITEM_X, $ITEM );
  115. //$PLAT_PARTS[] = str_ireplace( '%%MID%%', $MID , $VIDEOJS_CTX );
  116. //$PLAT_PARTS[] = str_ireplace( '%%MID%%', '' , $VIDEOJS_CTX );
  117. $MSVG = createTrackBackground( $CPL['layout'], $CTR['side'], $LTitle, $RTitle );
  118. if( $SESSION_ID ){
  119. $QS = "SELECT * FROM `session_statuses` WHERE `min_access`<={$ACCESS} AND `special`=''";
  120. $SR = $DATABASE->Query( $QS );
  121. $TDS = '';
  122. $PPP = 100.0 / count($SR);
  123. foreach( $SR as $S ){
  124. $FUNC = ($S['special']!='')?$S['special']:'setSessionStatus';
  125. if( $CS['status'] >= $S['lvl'] ){
  126. $TDS .= "<td align=\"center\" width=\"{$PPP}%\"><span class=\"sideInfo_item passive_gray\">{$S['label']}</span></td>";
  127. } else {
  128. $TDS .= "<td align=\"center\" width=\"{$PPP}%\"><span class=\"sideInfo_item {$S['class']}\" onclick=\"{$FUNC}({$SESSION_ID},{$S['lvl']}, false );\" >{$S['label']}</span></td>";
  129. };
  130. };
  131. };
  132. $PLAT_PARTS[] =<<<DATA_BOUNDARY
  133. {
  134. xtype: 'panel',
  135. layout: 'table',
  136. frame: true,
  137. width: '100%',
  138. defaults: {
  139. bodyStyle:'padding:0px'
  140. },
  141. layoutConfig: {
  142. columns: 2
  143. },
  144. items:[{
  145. html: '{$MSVG}',
  146. width: '100%',
  147. colspan: 2
  148. },{$LVID},{$RVID}]
  149. }
  150. DATA_BOUNDARY;
  151. if( $SESSION_ID ) $PLAT_PARTS[] ="{ id:'sets_ui', frame: true, html: '<table width=\"100%\" border=0><tr>{$TDS}</tr></table>'}";
  152. //$TOP = str_ireplace('%%%PANELS%%%', implode( ",{ xtype:'spacer', height: 10 },",$PLAT_PARTS ), $MAIN_TPL );
  153. $TOP = str_ireplace('%%%PANELS%%%', implode( ",",$PLAT_PARTS ), $MAIN_TPL );
  154. $Data['platform_id'] = $CPID;
  155. $Data['station_id'] = $STID;
  156. $Data['content']= $TOP;
  157. $Data['messages'] = ob_get_clean();
  158. echo json_encode( $Data );
  159. } else {
  160. header('location: /');
  161. };
  162. ?>