Web Interface For Lite Argus Control modules
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.

460 lines
18 KiB

4 years ago
​
​
​
​
​
​
​
4 years ago
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
4 years ago
4 years ago
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. $UID = intval( $CUser->Data['id'] );
  4. $Data = '';
  5. if( $UID > 1 ){
  6. $QS = "SELECT * FROM `system_props` LIMIT 1";
  7. $SPD = $DATABASE->Query( $QS );
  8. $QS = "SELECT * FROM `users` WHERE `id`={$UID}";
  9. $EPD = $DATABASE->Query( $QS );
  10. if( count( $SPD ) ){
  11. $SP = $SPD[0];
  12. $UP = $EPD[0];
  13. $DUMMY = array();
  14. if( $CUser->Data['access'] > 5 ){
  15. $TABA =<<<_DATA_BOUNDARY
  16. {
  17. xtype: 'panel',
  18. html: '<table id="tbl_ph_ccc_%%ID%%" style="color: black; background-image: url(\'/style/assets/16-9-nocam.png\');" width="100%" border=0><tr><td colspan=3>&nbsp;</td></tr><tr><td>&nbsp;</td><td align="center"><div id="btn_ph_ccc_%%ID%%"></div></td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>',
  19. listeners:{
  20. afterrender : function( ){
  21. var tb = document.getElementById('tbl_ph_ccc_%%ID%%');
  22. var W = tb.offsetWidth;
  23. var H = (W/16)*9;
  24. tb.setAttribute("height", H );
  25. tb.style.backgroundSize=W+"px "+H+"px";
  26. var p = Ext.getCmp('pan_ph_ccc_%%ID%%');
  27. p.setHeight( H+40 );
  28. var jaja = Ext.create({
  29. xtype: 'panel',
  30. title: 'Camera is Not Assigned to the System',
  31. frame: true,
  32. renderTo: 'btn_ph_ccc_%%ID%%',
  33. layout: 'vbox',
  34. width: 500,
  35. height: 120,
  36. items:[{
  37. xtype: 'spacer',
  38. height: 10
  39. },{
  40. width: '100%',
  41. html: '<center>Proceed to Cameras Settings to Assign One</center>'
  42. },{
  43. xtype: 'spacer',
  44. height: 20
  45. },{
  46. xtype: 'button',
  47. width: '100%',
  48. text: 'Open Camera Settings',
  49. handler: function(){
  50. showContent( 2020 );
  51. }
  52. }]
  53. });
  54. jaja.doLayout();
  55. }
  56. }
  57. }
  58. _DATA_BOUNDARY;
  59. $DUMMY['camera']="{xtype:'panel', id:'pan_ph_ccc_%%ID%%', title: 'Camera Placeholder', frame: true, border: true, draggable: false, layouit: 'fit', items:{$TABA}}";
  60. $DUMMY['sensor']="{xtype:'panel', title: 'Sensor Placeholder', frame: true, border: true, draggable: false, html:'NO SENSOR', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 66+W );}}}";
  61. } else {
  62. $DUMMY['camera']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
  63. $DUMMY['sensor']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
  64. $DUMMY['map']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
  65. $DUMMY['log']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
  66. };
  67. $LOGIO=<<<_DATA_BOUNDARY
  68. {
  69. xtype: 'grid',
  70. id: 'rep_grid',
  71. border: false,
  72. frame: false,
  73. autoScroll: true,
  74. //width: '100%',
  75. lazyRender: true,
  76. height: 210,
  77. ds: rep_store,
  78. tbar:[{
  79. text: 'Analyze Bubbles',
  80. handler: doBubbleAnalyze
  81. }],
  82. cm: new Ext.grid.ColumnModel( rep_ColModel_ops ),
  83. sm: new Ext.grid.RowSelectionModel( rep_SelModel_ops ),
  84. viewConfig: {
  85. forceFit: true,
  86. getRowClass: function( record, rowIndex, rowParams, store){
  87. switch( record.get('node_id')%5 ){
  88. case 0: return 'row-level01';
  89. case 1: return 'row-level02';
  90. case 2: return 'row-level03';
  91. case 3: return 'row-level04';
  92. case 4: return 'row-level05';
  93. };
  94. return '';
  95. }
  96. },
  97. listeners:{
  98. afterrender : function( t ){
  99. var papa = Ext.getCmp('segment_portal');
  100. var jj = papa.getComponent( 1 ).getHeight();
  101. var mama = Ext.getCmp('lg_panel');
  102. var R = PanelH - jj - 30;
  103. mama.setHeight( R+40 );
  104. t.setHeight( R );
  105. }
  106. }
  107. }
  108. _DATA_BOUNDARY;
  109. $MAPIO=<<<_DATA_BOUNDARY
  110. {
  111. id: 'report_map',
  112. height: 200,
  113. title: 'Map',
  114. frame: true,
  115. draggable: false,
  116. collapsible: false,
  117. html: '&nbsp;',
  118. listeners:{
  119. afterrender : function( t ){
  120. var papa = Ext.getCmp('segment_portal');
  121. var jj = 9 * papa.getWidth() / 32;//getComponent( 0 ).getHeight();
  122. //alert( jj );
  123. t.setHeight( jj + 30 );
  124. geoMapIsPresent = true;
  125. initMapReporting();
  126. }
  127. }
  128. }
  129. _DATA_BOUNDARY;
  130. //$DUMMY['map']="{xtype:'panel', title: 'Map Placeholder', frame: true, height: 200, border: true, draggable: false, html:'NO MAP'}";
  131. $DUMMY['map']="{xtype:'panel', title: '{$Labels->GetLabel('_MAP_')}', frame: true, border: true, draggable: false, collapsible: false, tools: [{ id:'toggle', handler: function( a, b, p ){ fullScreen( 'report_map' ); }}], items:[{$MAPIO}],listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}} }";
  132. $DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Report Log', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
  133. $STA = array();
  134. $END="]}";
  135. $OUT = array();
  136. switch( $SP['type'] ){
  137. case 1:{
  138. //Metro
  139. $STA[0]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  140. $STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  141. $STA[2]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  142. $STA[3]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  143. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  144. $R = $DATABASE->Query( $QS );
  145. $idx = 0;
  146. if( count( $R ) ){
  147. foreach( $R as $DD ){
  148. if( $idx < 2 ){
  149. $TFN = 'report/node_' . $DD['type'] . '.js';
  150. if(!file_exists( $TFN )) continue;
  151. $TPL = file_get_contents( $TFN );
  152. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  153. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  154. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  155. $OUT[]= $STA[$idx] . $TPL . $END;
  156. } else break;
  157. $idx++;
  158. };
  159. if( $idx < 2 ){
  160. for( ;$idx<2;$idx++ ){
  161. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  162. };
  163. };
  164. } else {
  165. for( ;$idx<2;$idx++ ){
  166. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  167. };
  168. };
  169. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  170. $R = $DATABASE->Query( $QS );
  171. $idx = 0;
  172. if( count( $R ) ){
  173. foreach( $R as $DD ){
  174. if( $idx < 1 ){
  175. $TFN = 'report/node_' . $DD['type'] . '.js';
  176. if(!file_exists( $TFN )) continue;
  177. $TPL = file_get_contents( $TFN );
  178. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  179. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  180. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  181. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  182. $Z=$DATABASE->Query( $QS );
  183. $QS="SELECT * FROM `module_eve` LIMIT 1";
  184. $S=$DATABASE->Query( $QS );
  185. $MODULE_DATA = $S[0];
  186. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  187. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  188. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  189. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  190. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  191. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  192. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  193. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  194. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  195. $W = 244;
  196. $H = $W * $FK;
  197. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  198. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  199. $OUT[]= $STA[2+$idx] . $TPL . $END;
  200. } else break;
  201. $idx++;
  202. };
  203. if( $idx < 1 ){
  204. for( ;$idx<1;$idx++ ){
  205. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  206. $OUT[]= $STA[2+$idx] . $T . $END;
  207. };
  208. };
  209. } else {
  210. for( ;$idx<1;$idx++ ){
  211. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  212. $OUT[]= $STA[2+$idx] . $T . $END;
  213. };
  214. };
  215. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  216. break;
  217. };
  218. case 2:{
  219. //Muazot A
  220. $STA[0]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  221. $STA[1]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  222. $STA[2]="{ columnWidth: .40, stylse:'padding:10px 0 10px 10px', items:[";
  223. $STA[3]="{ columnWidth: .60, stylse:'padding:10px 0 10px 10px', items:[";
  224. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 16 AND `enable`=1";
  225. $R = $DATABASE->Query( $QS );
  226. $idx = 0;
  227. if( count( $R ) ){
  228. foreach( $R as $DD ){
  229. if( $idx < 2 ){
  230. $TFN = 'report/node_' . $DD['type'] . '.js';
  231. if(!file_exists( $TFN )) continue;
  232. $TPL = file_get_contents( $TFN );
  233. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  234. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  235. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  236. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  237. $Z=$DATABASE->Query( $QS );
  238. $QS="SELECT * FROM `module_eve` LIMIT 1";
  239. $S=$DATABASE->Query( $QS );
  240. $MODULE_DATA = $S[0];
  241. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  242. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  243. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  244. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  245. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  246. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  247. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  248. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  249. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  250. $W = 244;
  251. $H = $W * $FK;
  252. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  253. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  254. $OUT[]= $STA[$idx] . $TPL . $END;
  255. } else break;
  256. $idx++;
  257. };
  258. if( $idx < 2 ){
  259. for( ;$idx<2;$idx++ ){
  260. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  261. $OUT[]= $STA[$idx] . $T . $END;
  262. };
  263. };
  264. } else {
  265. for( ;$idx<2;$idx++ ){
  266. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  267. $OUT[]= $STA[$idx] . $T . $END;
  268. };
  269. };
  270. $OUT[]= $STA[2] . $DUMMY['map'] . $END;
  271. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  272. break;
  273. };
  274. case 4:{
  275. //Mekorot
  276. $STA[0]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  277. $STA[1]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  278. $STA[2]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  279. $STA[3]="{ columnWidth: .40, stylse:'padding:10px 0 10px 10px', items:[";
  280. $STA[4]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  281. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  282. $R = $DATABASE->Query( $QS );
  283. $idx = 0;
  284. if( count( $R ) ){
  285. foreach( $R as $DD ){
  286. if( $idx < 3 ){
  287. $TFN = 'report/node_' . $DD['type'] . '.js';
  288. if(!file_exists( $TFN )) continue;
  289. $TPL = file_get_contents( $TFN );
  290. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  291. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  292. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  293. $OUT[]= $STA[$idx] . $TPL . $END;
  294. } else break;
  295. $idx++;
  296. };
  297. if( $idx < 3 ){
  298. for( ;$idx<3;$idx++ ){
  299. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  300. };
  301. };
  302. } else {
  303. for( ;$idx<3;$idx++ ){
  304. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  305. };
  306. };
  307. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  308. $R = $DATABASE->Query( $QS );
  309. $idx = 0;
  310. if( count( $R ) ){
  311. foreach( $R as $DD ){
  312. if( $idx < 1 ){
  313. $TFN = 'report/node_' . $DD['type'] . '.js';
  314. if(!file_exists( $TFN )) continue;
  315. $TPL = file_get_contents( $TFN );
  316. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  317. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  318. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  319. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  320. $Z=$DATABASE->Query( $QS );
  321. $QS="SELECT * FROM `module_eve` LIMIT 1";
  322. $S=$DATABASE->Query( $QS );
  323. $MODULE_DATA = $S[0];
  324. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  325. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  326. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  327. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  328. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  329. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  330. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  331. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  332. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  333. $W = 244;
  334. $H = $W * $FK;
  335. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  336. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  337. $OUT[]= $STA[3+$idx] . $TPL . $END;
  338. } else break;
  339. $idx++;
  340. };
  341. if( $idx < 1 ){
  342. for( ;$idx<1;$idx++ ){
  343. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  344. $OUT[]= $STA[3+$idx] . $T . $END;
  345. };
  346. };
  347. } else {
  348. for( ;$idx<1;$idx++ ){
  349. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  350. $OUT[]= $STA[2+$idx] . $T . $END;
  351. };
  352. };
  353. $OUT[]= $STA[4] . $DUMMY['log'] . $END;
  354. break;
  355. };
  356. default:{
  357. $STA[0]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  358. $STA[1]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  359. if( $UP['width'] > 1.6* $UP['height'] ){
  360. $STA[2]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:[";
  361. $STA[3]="{ columnWidth: .67, stylse:'padding:10px 0 10px 10px', items:[";
  362. } else {
  363. $STA[2]="{ columnWidth: .45, stylse:'padding:10px 0 10px 10px', items:[";
  364. $STA[3]="{ columnWidth: .55, stylse:'padding:10px 0 10px 10px', items:[";
  365. };
  366. $OUT[]= $STA[0] . $DUMMY['map'] . $END;
  367. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  368. $R = $DATABASE->Query( $QS );
  369. $idx = 0;
  370. if( count( $R ) ){
  371. foreach( $R as $DD ){
  372. if( $idx < 1 ){
  373. $TFN = 'report/node_' . $DD['type'] . '.js';
  374. if(!file_exists( $TFN )) continue;
  375. $TPL = file_get_contents( $TFN );
  376. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  377. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  378. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  379. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  380. $Z=$DATABASE->Query( $QS );
  381. $QS="SELECT * FROM `module_eve` LIMIT 1";
  382. $S=$DATABASE->Query( $QS );
  383. $MODULE_DATA = $S[0];
  384. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  385. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  386. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  387. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  388. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  389. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  390. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  391. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  392. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  393. $W = 244;
  394. $H = $W * $FK;
  395. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  396. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  397. $OUT[]= $STA[1+$idx] . $TPL . $END;
  398. } else break;
  399. $idx++;
  400. };
  401. if( $idx < 1 ){
  402. for( ;$idx<1;$idx++ ){
  403. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  404. $OUT[]= $STA[1+$idx] . $T . $END;
  405. };
  406. };
  407. } else {
  408. for( ;$idx<1;$idx++ ){
  409. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  410. $OUT[]= $STA[1+$idx] . $T . $END;
  411. };
  412. };
  413. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  414. $R = $DATABASE->Query( $QS );
  415. $idx = 0;
  416. if( count( $R ) ){
  417. foreach( $R as $DD ){
  418. if( $idx < 2 ){
  419. $TFN = 'report/node_' . $DD['type'] . '.js';
  420. if(!file_exists( $TFN )) continue;
  421. $TPL = file_get_contents( $TFN );
  422. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  423. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  424. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  425. $OUT[]= $STA[2+$idx] . $TPL . $END;
  426. } else break;
  427. $idx++;
  428. };
  429. } else {
  430. for( ;$idx<1;$idx++ ){
  431. $OUT[]= $STA[2+$idx] . $DUMMY['sensor'] . $END;
  432. };
  433. };
  434. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  435. break;
  436. };
  437. };
  438. $Data = '[' . implode( ',' , $OUT ) . ']';
  439. } else {
  440. $Data = '[{columnWidth: 1, items:{html:"NO SYSTEM PROPS"}} ]';
  441. };
  442. };
  443. if( $Data != '' ) {
  444. echo $Data;
  445. } else {
  446. echo '[]';
  447. };
  448. ?>