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.

456 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
​
​
​
​
​
​
​
​
​
​
​
  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. cm: new Ext.grid.ColumnModel( rep_ColModel_ops ),
  79. sm: new Ext.grid.RowSelectionModel( rep_SelModel_ops ),
  80. viewConfig: {
  81. forceFit: true,
  82. getRowClass: function( record, rowIndex, rowParams, store){
  83. switch( record.get('node_id')%5 ){
  84. case 0: return 'row-level01';
  85. case 1: return 'row-level02';
  86. case 2: return 'row-level03';
  87. case 3: return 'row-level04';
  88. case 4: return 'row-level05';
  89. };
  90. return '';
  91. }
  92. },
  93. listeners:{
  94. afterrender : function( t ){
  95. var papa = Ext.getCmp('segment_portal');
  96. var jj = papa.getComponent( 1 ).getHeight();
  97. var mama = Ext.getCmp('lg_panel');
  98. var R = PanelH - jj - 30;
  99. mama.setHeight( R+40 );
  100. t.setHeight( R );
  101. }
  102. }
  103. }
  104. _DATA_BOUNDARY;
  105. $MAPIO=<<<_DATA_BOUNDARY
  106. {
  107. id: 'report_map',
  108. height: 200,
  109. title: 'Map',
  110. frame: true,
  111. draggable: false,
  112. collapsible: false,
  113. html: '&nbsp;',
  114. listeners:{
  115. afterrender : function( t ){
  116. var papa = Ext.getCmp('segment_portal');
  117. var jj = 9 * papa.getWidth() / 32;//getComponent( 0 ).getHeight();
  118. //alert( jj );
  119. t.setHeight( jj + 30 );
  120. geoMapIsPresent = true;
  121. initMapReporting();
  122. }
  123. }
  124. }
  125. _DATA_BOUNDARY;
  126. //$DUMMY['map']="{xtype:'panel', title: 'Map Placeholder', frame: true, height: 200, border: true, draggable: false, html:'NO MAP'}";
  127. $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);}} }";
  128. $DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Report Log', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
  129. $STA = array();
  130. $END="]}";
  131. $OUT = array();
  132. switch( $SP['type'] ){
  133. case 1:{
  134. //Metro
  135. $STA[0]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  136. $STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  137. $STA[2]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  138. $STA[3]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  139. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  140. $R = $DATABASE->Query( $QS );
  141. $idx = 0;
  142. if( count( $R ) ){
  143. foreach( $R as $DD ){
  144. if( $idx < 2 ){
  145. $TFN = 'report/node_' . $DD['type'] . '.js';
  146. if(!file_exists( $TFN )) continue;
  147. $TPL = file_get_contents( $TFN );
  148. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  149. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  150. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  151. $OUT[]= $STA[$idx] . $TPL . $END;
  152. } else break;
  153. $idx++;
  154. };
  155. if( $idx < 2 ){
  156. for( ;$idx<2;$idx++ ){
  157. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  158. };
  159. };
  160. } else {
  161. for( ;$idx<2;$idx++ ){
  162. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  163. };
  164. };
  165. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  166. $R = $DATABASE->Query( $QS );
  167. $idx = 0;
  168. if( count( $R ) ){
  169. foreach( $R as $DD ){
  170. if( $idx < 1 ){
  171. $TFN = 'report/node_' . $DD['type'] . '.js';
  172. if(!file_exists( $TFN )) continue;
  173. $TPL = file_get_contents( $TFN );
  174. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  175. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  176. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  177. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  178. $Z=$DATABASE->Query( $QS );
  179. $QS="SELECT * FROM `module_eve` LIMIT 1";
  180. $S=$DATABASE->Query( $QS );
  181. $MODULE_DATA = $S[0];
  182. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  183. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  184. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  185. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  186. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  187. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  188. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  189. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  190. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  191. $W = 244;
  192. $H = $W * $FK;
  193. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  194. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  195. $OUT[]= $STA[2+$idx] . $TPL . $END;
  196. } else break;
  197. $idx++;
  198. };
  199. if( $idx < 1 ){
  200. for( ;$idx<1;$idx++ ){
  201. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  202. $OUT[]= $STA[2+$idx] . $T . $END;
  203. };
  204. };
  205. } else {
  206. for( ;$idx<1;$idx++ ){
  207. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  208. $OUT[]= $STA[2+$idx] . $T . $END;
  209. };
  210. };
  211. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  212. break;
  213. };
  214. case 2:{
  215. //Muazot A
  216. $STA[0]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  217. $STA[1]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  218. $STA[2]="{ columnWidth: .40, stylse:'padding:10px 0 10px 10px', items:[";
  219. $STA[3]="{ columnWidth: .60, stylse:'padding:10px 0 10px 10px', items:[";
  220. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 16 AND `enable`=1";
  221. $R = $DATABASE->Query( $QS );
  222. $idx = 0;
  223. if( count( $R ) ){
  224. foreach( $R as $DD ){
  225. if( $idx < 2 ){
  226. $TFN = 'report/node_' . $DD['type'] . '.js';
  227. if(!file_exists( $TFN )) continue;
  228. $TPL = file_get_contents( $TFN );
  229. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  230. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  231. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  232. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  233. $Z=$DATABASE->Query( $QS );
  234. $QS="SELECT * FROM `module_eve` LIMIT 1";
  235. $S=$DATABASE->Query( $QS );
  236. $MODULE_DATA = $S[0];
  237. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  238. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  239. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  240. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  241. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  242. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  243. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  244. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  245. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  246. $W = 244;
  247. $H = $W * $FK;
  248. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  249. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  250. $OUT[]= $STA[$idx] . $TPL . $END;
  251. } else break;
  252. $idx++;
  253. };
  254. if( $idx < 2 ){
  255. for( ;$idx<2;$idx++ ){
  256. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  257. $OUT[]= $STA[$idx] . $T . $END;
  258. };
  259. };
  260. } else {
  261. for( ;$idx<2;$idx++ ){
  262. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  263. $OUT[]= $STA[$idx] . $T . $END;
  264. };
  265. };
  266. $OUT[]= $STA[2] . $DUMMY['map'] . $END;
  267. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  268. break;
  269. };
  270. case 4:{
  271. //Mekorot
  272. $STA[0]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  273. $STA[1]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  274. $STA[2]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  275. $STA[3]="{ columnWidth: .40, stylse:'padding:10px 0 10px 10px', items:[";
  276. $STA[4]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  277. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  278. $R = $DATABASE->Query( $QS );
  279. $idx = 0;
  280. if( count( $R ) ){
  281. foreach( $R as $DD ){
  282. if( $idx < 3 ){
  283. $TFN = 'report/node_' . $DD['type'] . '.js';
  284. if(!file_exists( $TFN )) continue;
  285. $TPL = file_get_contents( $TFN );
  286. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  287. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  288. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  289. $OUT[]= $STA[$idx] . $TPL . $END;
  290. } else break;
  291. $idx++;
  292. };
  293. if( $idx < 3 ){
  294. for( ;$idx<3;$idx++ ){
  295. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  296. };
  297. };
  298. } else {
  299. for( ;$idx<3;$idx++ ){
  300. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  301. };
  302. };
  303. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  304. $R = $DATABASE->Query( $QS );
  305. $idx = 0;
  306. if( count( $R ) ){
  307. foreach( $R as $DD ){
  308. if( $idx < 1 ){
  309. $TFN = 'report/node_' . $DD['type'] . '.js';
  310. if(!file_exists( $TFN )) continue;
  311. $TPL = file_get_contents( $TFN );
  312. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  313. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  314. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  315. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  316. $Z=$DATABASE->Query( $QS );
  317. $QS="SELECT * FROM `module_eve` LIMIT 1";
  318. $S=$DATABASE->Query( $QS );
  319. $MODULE_DATA = $S[0];
  320. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  321. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  322. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  323. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  324. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  325. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  326. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  327. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  328. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  329. $W = 244;
  330. $H = $W * $FK;
  331. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  332. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  333. $OUT[]= $STA[3+$idx] . $TPL . $END;
  334. } else break;
  335. $idx++;
  336. };
  337. if( $idx < 1 ){
  338. for( ;$idx<1;$idx++ ){
  339. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  340. $OUT[]= $STA[3+$idx] . $T . $END;
  341. };
  342. };
  343. } else {
  344. for( ;$idx<1;$idx++ ){
  345. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  346. $OUT[]= $STA[2+$idx] . $T . $END;
  347. };
  348. };
  349. $OUT[]= $STA[4] . $DUMMY['log'] . $END;
  350. break;
  351. };
  352. default:{
  353. $STA[0]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  354. $STA[1]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  355. if( $UP['width'] > 1.6* $UP['height'] ){
  356. $STA[2]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:[";
  357. $STA[3]="{ columnWidth: .67, stylse:'padding:10px 0 10px 10px', items:[";
  358. } else {
  359. $STA[2]="{ columnWidth: .45, stylse:'padding:10px 0 10px 10px', items:[";
  360. $STA[3]="{ columnWidth: .55, stylse:'padding:10px 0 10px 10px', items:[";
  361. };
  362. $OUT[]= $STA[0] . $DUMMY['map'] . $END;
  363. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  364. $R = $DATABASE->Query( $QS );
  365. $idx = 0;
  366. if( count( $R ) ){
  367. foreach( $R as $DD ){
  368. if( $idx < 1 ){
  369. $TFN = 'report/node_' . $DD['type'] . '.js';
  370. if(!file_exists( $TFN )) continue;
  371. $TPL = file_get_contents( $TFN );
  372. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  373. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  374. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  375. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  376. $Z=$DATABASE->Query( $QS );
  377. $QS="SELECT * FROM `module_eve` LIMIT 1";
  378. $S=$DATABASE->Query( $QS );
  379. $MODULE_DATA = $S[0];
  380. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  381. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  382. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  383. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  384. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  385. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  386. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  387. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  388. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  389. $W = 244;
  390. $H = $W * $FK;
  391. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  392. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  393. $OUT[]= $STA[1+$idx] . $TPL . $END;
  394. } else break;
  395. $idx++;
  396. };
  397. if( $idx < 1 ){
  398. for( ;$idx<1;$idx++ ){
  399. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  400. $OUT[]= $STA[1+$idx] . $T . $END;
  401. };
  402. };
  403. } else {
  404. for( ;$idx<1;$idx++ ){
  405. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  406. $OUT[]= $STA[1+$idx] . $T . $END;
  407. };
  408. };
  409. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  410. $R = $DATABASE->Query( $QS );
  411. $idx = 0;
  412. if( count( $R ) ){
  413. foreach( $R as $DD ){
  414. if( $idx < 2 ){
  415. $TFN = 'report/node_' . $DD['type'] . '.js';
  416. if(!file_exists( $TFN )) continue;
  417. $TPL = file_get_contents( $TFN );
  418. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  419. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  420. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  421. $OUT[]= $STA[2+$idx] . $TPL . $END;
  422. } else break;
  423. $idx++;
  424. };
  425. } else {
  426. for( ;$idx<1;$idx++ ){
  427. $OUT[]= $STA[2+$idx] . $DUMMY['sensor'] . $END;
  428. };
  429. };
  430. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  431. break;
  432. };
  433. };
  434. $Data = '[' . implode( ',' , $OUT ) . ']';
  435. } else {
  436. $Data = '[{columnWidth: 1, items:{html:"NO SYSTEM PROPS"}} ]';
  437. };
  438. };
  439. if( $Data != '' ) {
  440. echo $Data;
  441. } else {
  442. echo '[]';
  443. };
  444. ?>