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.

620 lines
25 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
​
​
5 months ago
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
4 years ago
4 years ago
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months 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. title: false,
  115. /* frame: true,*/
  116. frame: false,
  117. border: false,
  118. draggable: false,
  119. collapsible: false,
  120. html: '&nbsp;',
  121. listeners:{
  122. afterrender : function( t ){
  123. var papa = Ext.getCmp('segment_portal');
  124. var jj = 9 * papa.getWidth() / 32;//getComponent( 0 ).getHeight();
  125. //alert( jj );
  126. t.setHeight( jj + 30 );
  127. geoMapIsPresent = true;
  128. initMapReporting();
  129. }
  130. }
  131. }
  132. _DATA_BOUNDARY;
  133. //$DUMMY['map']="{xtype:'panel', title: 'Map Placeholder', frame: true, height: 200, border: true, draggable: false, html:'NO MAP'}";
  134. $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);}} }";
  135. $DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Report Log', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
  136. $STA = array();
  137. $END="]}";
  138. $OUT = array();
  139. //$OUT[] = "{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[{html:'App Type:{$SP['type']}'}]}";
  140. switch( $SP['type'] ){
  141. case 0:{
  142. $STA[0]="{ columnWidth: 1.0, stydle:'padding:10px 0 10px 10px', items:[";
  143. //$STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  144. //$STA[2]="{ columnWidth: .75, stylse:'padding:10px 0 10px 10px', items:[";
  145. $STA[1]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  146. $MH = 4;
  147. $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( 'event_map' ); }}], items:[{$MAPIO}],listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*{$MH}); initMapMonitoring();}} }";
  148. $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)*4);}} }";
  149. $DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: '{$Labels->GetLabel('_EVENT_LOG_')}', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
  150. $OUT[]= $STA[0] . $DUMMY['map'] . $END;
  151. //$OUT[]= $STA[1] . $DUMMY['sensor'] . $END;
  152. $OUT[]= $STA[1] . $DUMMY['log'] . $END;
  153. break;
  154. };
  155. case 1:{
  156. //Metro
  157. $STA[0]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  158. $STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  159. $STA[2]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  160. $STA[3]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  161. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10";// AND `enable`=1";
  162. $R = $DATABASE->Query( $QS );
  163. $idx = 0;
  164. if( count( $R ) ){
  165. foreach( $R as $DD ){
  166. if( $idx < 2 ){
  167. $TFN = 'report/node_' . $DD['type'] . '.js';
  168. if(!file_exists( $TFN )) continue;
  169. $TPL = file_get_contents( $TFN );
  170. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  171. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  172. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  173. $OUT[]= $STA[$idx] . $TPL . $END;
  174. } else break;
  175. $idx++;
  176. };
  177. if( $idx < 2 ){
  178. for( ;$idx<2;$idx++ ){
  179. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  180. };
  181. };
  182. } else {
  183. for( ;$idx<2;$idx++ ){
  184. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  185. };
  186. };
  187. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 ";// AND `enable`=1";
  188. $R = $DATABASE->Query( $QS );
  189. $idx = 0;
  190. if( count( $R ) ){
  191. foreach( $R as $DD ){
  192. if( $idx < 1 ){
  193. $TFN = 'report/node_' . $DD['type'] . '.js';
  194. if(!file_exists( $TFN )) continue;
  195. $TPL = file_get_contents( $TFN );
  196. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  197. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  198. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  199. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  200. $Z=$DATABASE->Query( $QS );
  201. $QS="SELECT * FROM `module_eve` LIMIT 1";
  202. $S=$DATABASE->Query( $QS );
  203. $MODULE_DATA = $S[0];
  204. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  205. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  206. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  207. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  208. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  209. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  210. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  211. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  212. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  213. $W = 244;
  214. $H = $W * $FK;
  215. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  216. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  217. $OUT[]= $STA[2+$idx] . $TPL . $END;
  218. } else break;
  219. $idx++;
  220. };
  221. if( $idx < 1 ){
  222. for( ;$idx<1;$idx++ ){
  223. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  224. $OUT[]= $STA[2+$idx] . $T . $END;
  225. };
  226. };
  227. } else {
  228. for( ;$idx<1;$idx++ ){
  229. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  230. $OUT[]= $STA[2+$idx] . $T . $END;
  231. };
  232. };
  233. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  234. break;
  235. };
  236. case 2:{
  237. //Muazot A
  238. $STA[0]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  239. $STA[1]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
  240. $STA[2]="{ columnWidth: .40, stylse:'padding:10px 0 10px 10px', items:[";
  241. $STA[3]="{ columnWidth: .60, stylse:'padding:10px 0 10px 10px', items:[";
  242. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 16 AND `enable`=1";
  243. $R = $DATABASE->Query( $QS );
  244. $idx = 0;
  245. if( count( $R ) ){
  246. foreach( $R as $DD ){
  247. if( $idx < 2 ){
  248. $TFN = 'report/node_' . $DD['type'] . '.js';
  249. if(!file_exists( $TFN )) continue;
  250. $TPL = file_get_contents( $TFN );
  251. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  252. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  253. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  254. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  255. $Z=$DATABASE->Query( $QS );
  256. $QS="SELECT * FROM `module_eve` LIMIT 1";
  257. $S=$DATABASE->Query( $QS );
  258. $MODULE_DATA = $S[0];
  259. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  260. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  261. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  262. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  263. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  264. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  265. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  266. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  267. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  268. $W = 244;
  269. $H = $W * $FK;
  270. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  271. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  272. $OUT[]= $STA[$idx] . $TPL . $END;
  273. } else break;
  274. $idx++;
  275. };
  276. if( $idx < 2 ){
  277. for( ;$idx<2;$idx++ ){
  278. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  279. $OUT[]= $STA[$idx] . $T . $END;
  280. };
  281. };
  282. } else {
  283. for( ;$idx<2;$idx++ ){
  284. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  285. $OUT[]= $STA[$idx] . $T . $END;
  286. };
  287. };
  288. $OUT[]= $STA[2] . $DUMMY['map'] . $END;
  289. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  290. break;
  291. };
  292. case 3:{
  293. $LOGIO=<<<_DATA_BOUNDARY
  294. {
  295. xtype: 'grid',
  296. id: 'rep_grid',
  297. border: false,
  298. frame: false,
  299. autoScroll: true,
  300. //width: '100%',
  301. lazyRender: true,
  302. height: 210,
  303. ds: rep_store,
  304. tbar:[{
  305. text: 'Analyze Bubbles',
  306. handler: doBubbleAnalyze
  307. }],
  308. cm: new Ext.grid.ColumnModel( rep_ColModel_ops ),
  309. sm: new Ext.grid.RowSelectionModel( rep_SelModel_ops ),
  310. viewConfig: {
  311. forceFit: true,
  312. getRowClass: function( record, rowIndex, rowParams, store){
  313. switch( record.get('node_id')%5 ){
  314. case 0: return 'row-level01';
  315. case 1: return 'row-level02';
  316. case 2: return 'row-level03';
  317. case 3: return 'row-level04';
  318. case 4: return 'row-level05';
  319. };
  320. return '';
  321. }
  322. },
  323. listeners:{
  324. afterrender : function( t ){
  325. var papa = Ext.getCmp('segment_portal');
  326. var mama = Ext.getCmp('lg_panel');
  327. var R = papa.getHeight() - papa.getComponent( 1 ).getHeight() - 73;
  328. mama.setHeight( R+40 );
  329. t.setHeight( R );
  330. }
  331. }
  332. }
  333. _DATA_BOUNDARY;
  334. $DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Report Log', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
  335. $STA[0]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  336. $STA[1]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  337. if( $UP['width'] > 1.6* $UP['height'] ){
  338. $STA[2]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:[";
  339. $STA[3]="{ columnWidth: .67, stylse:'padding:10px 0 10px 10px', items:[";
  340. } else {
  341. $STA[2]="{ columnWidth: .45, stylse:'padding:10px 0 10px 10px', items:[";
  342. $STA[3]="{ columnWidth: .55, stylse:'padding:10px 0 10px 10px', items:[";
  343. };
  344. $OUT[]= $STA[0] . $DUMMY['map'] . $END;
  345. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  346. $R = $DATABASE->Query( $QS );
  347. $idx = 0;
  348. if( count( $R ) ){
  349. foreach( $R as $DD ){
  350. if( $idx < 1 ){
  351. $TFN = 'report/node_' . $DD['type'] . '.js';
  352. if(!file_exists( $TFN )) continue;
  353. $TPL = file_get_contents( $TFN );
  354. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  355. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  356. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  357. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  358. $Z=$DATABASE->Query( $QS );
  359. $QS="SELECT * FROM `module_eve` LIMIT 1";
  360. $S=$DATABASE->Query( $QS );
  361. $MODULE_DATA = $S[0];
  362. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  363. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  364. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  365. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  366. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  367. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  368. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  369. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  370. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  371. $W = 244;
  372. $H = $W * $FK;
  373. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  374. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  375. $OUT[]= $STA[1+$idx] . $TPL . $END;
  376. } else break;
  377. $idx++;
  378. };
  379. if( $idx < 1 ){
  380. for( ;$idx<1;$idx++ ){
  381. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  382. $OUT[]= $STA[1+$idx] . $T . $END;
  383. };
  384. };
  385. } else {
  386. for( ;$idx<1;$idx++ ){
  387. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  388. $OUT[]= $STA[1+$idx] . $T . $END;
  389. };
  390. };
  391. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  392. $R = $DATABASE->Query( $QS );
  393. $idx = 0;
  394. if( count( $R ) ){
  395. foreach( $R as $DD ){
  396. if( $idx < 2 ){
  397. $TFN = 'report/node_' . $DD['type'] . '.js';
  398. if(!file_exists( $TFN )) continue;
  399. $TPL = file_get_contents( $TFN );
  400. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  401. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  402. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  403. $OUT[]= $STA[2+$idx] . $TPL . $END;
  404. } else break;
  405. $idx++;
  406. };
  407. } else {
  408. for( ;$idx<1;$idx++ ){
  409. $OUT[]= $STA[2+$idx] . $DUMMY['sensor'] . $END;
  410. };
  411. };
  412. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  413. break;
  414. };
  415. case 4:{
  416. //Mekorot
  417. $STA[0]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  418. $STA[1]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  419. $STA[2]="{ columnWidth: .20, stylse:'padding:10px 0 10px 10px', items:[";
  420. $STA[3]="{ columnWidth: .40, stylse:'padding:10px 0 10px 10px', items:[";
  421. $STA[4]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  422. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  423. $R = $DATABASE->Query( $QS );
  424. $idx = 0;
  425. if( count( $R ) ){
  426. foreach( $R as $DD ){
  427. if( $idx < 3 ){
  428. $TFN = 'report/node_' . $DD['type'] . '.js';
  429. if(!file_exists( $TFN )) continue;
  430. $TPL = file_get_contents( $TFN );
  431. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  432. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  433. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  434. $OUT[]= $STA[$idx] . $TPL . $END;
  435. } else break;
  436. $idx++;
  437. };
  438. if( $idx < 3 ){
  439. for( ;$idx<3;$idx++ ){
  440. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  441. };
  442. };
  443. } else {
  444. for( ;$idx<3;$idx++ ){
  445. $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
  446. };
  447. };
  448. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  449. $R = $DATABASE->Query( $QS );
  450. $idx = 0;
  451. if( count( $R ) ){
  452. foreach( $R as $DD ){
  453. if( $idx < 1 ){
  454. $TFN = 'report/node_' . $DD['type'] . '.js';
  455. if(!file_exists( $TFN )) continue;
  456. $TPL = file_get_contents( $TFN );
  457. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  458. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  459. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  460. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  461. $Z=$DATABASE->Query( $QS );
  462. $QS="SELECT * FROM `module_eve` LIMIT 1";
  463. $S=$DATABASE->Query( $QS );
  464. $MODULE_DATA = $S[0];
  465. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  466. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  467. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  468. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  469. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  470. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  471. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  472. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  473. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  474. $W = 244;
  475. $H = $W * $FK;
  476. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  477. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  478. $OUT[]= $STA[3+$idx] . $TPL . $END;
  479. } else break;
  480. $idx++;
  481. };
  482. if( $idx < 1 ){
  483. for( ;$idx<1;$idx++ ){
  484. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  485. $OUT[]= $STA[3+$idx] . $T . $END;
  486. };
  487. };
  488. } else {
  489. for( ;$idx<1;$idx++ ){
  490. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  491. $OUT[]= $STA[2+$idx] . $T . $END;
  492. };
  493. };
  494. $OUT[]= $STA[4] . $DUMMY['log'] . $END;
  495. break;
  496. };
  497. case 6:{
  498. $STA[0]="{ columnWidth: 1.0, stydle:'padding:10px 0 10px 10px', items:[";
  499. //$STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
  500. //$STA[2]="{ columnWidth: .75, stylse:'padding:10px 0 10px 10px', items:[";
  501. $STA[1]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
  502. $MH = 4;
  503. $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( 'event_map' ); }}], items:[{$MAPIO}],listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*{$MH}); initMapMonitoring();}} }";
  504. $DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: '{$Labels->GetLabel('_EVENT_LOG_')}', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
  505. $OUT[]= $STA[0] . $DUMMY['map'] . $END;
  506. //$OUT[]= $STA[1] . $DUMMY['sensor'] . $END;
  507. $OUT[]= $STA[1] . $DUMMY['log'] . $END;
  508. break;
  509. };
  510. default:{
  511. $STA[0]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  512. $STA[1]="{ columnWidth: .5, stylse:'padding:10px 0 10px 10px', items:[";
  513. if( $UP['width'] > 1.6* $UP['height'] ){
  514. $STA[2]="{ columnWidth: .33, stylse:'padding:10px 0 10px 10px', items:[";
  515. $STA[3]="{ columnWidth: .67, stylse:'padding:10px 0 10px 10px', items:[";
  516. } else {
  517. $STA[2]="{ columnWidth: .45, stylse:'padding:10px 0 10px 10px', items:[";
  518. $STA[3]="{ columnWidth: .55, stylse:'padding:10px 0 10px 10px', items:[";
  519. };
  520. $OUT[]= $STA[0] . $DUMMY['map'] . $END;
  521. $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
  522. $R = $DATABASE->Query( $QS );
  523. $idx = 0;
  524. if( count( $R ) ){
  525. foreach( $R as $DD ){
  526. if( $idx < 1 ){
  527. $TFN = 'report/node_' . $DD['type'] . '.js';
  528. if(!file_exists( $TFN )) continue;
  529. $TPL = file_get_contents( $TFN );
  530. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  531. $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
  532. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  533. $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
  534. $Z=$DATABASE->Query( $QS );
  535. $QS="SELECT * FROM `module_eve` LIMIT 1";
  536. $S=$DATABASE->Query( $QS );
  537. $MODULE_DATA = $S[0];
  538. $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
  539. //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
  540. $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
  541. $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
  542. $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
  543. $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
  544. $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
  545. $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
  546. $FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
  547. $W = 244;
  548. $H = $W * $FK;
  549. $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
  550. $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
  551. $OUT[]= $STA[1+$idx] . $TPL . $END;
  552. } else break;
  553. $idx++;
  554. };
  555. if( $idx < 1 ){
  556. for( ;$idx<1;$idx++ ){
  557. $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
  558. $OUT[]= $STA[1+$idx] . $T . $END;
  559. };
  560. };
  561. } else {
  562. for( ;$idx<1;$idx++ ){
  563. $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
  564. $OUT[]= $STA[1+$idx] . $T . $END;
  565. };
  566. };
  567. $QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
  568. $R = $DATABASE->Query( $QS );
  569. $idx = 0;
  570. if( count( $R ) ){
  571. foreach( $R as $DD ){
  572. if( $idx < 2 ){
  573. $TFN = 'report/node_' . $DD['type'] . '.js';
  574. if(!file_exists( $TFN )) continue;
  575. $TPL = file_get_contents( $TFN );
  576. $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
  577. $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
  578. $TPL = str_replace('%%%APPTYPE%%%', $SP['type'], $TPL );
  579. $OUT[]= $STA[2+$idx] . $TPL . $END;
  580. } else break;
  581. $idx++;
  582. };
  583. } else {
  584. for( ;$idx<1;$idx++ ){
  585. $OUT[]= $STA[2+$idx] . $DUMMY['sensor'] . $END;
  586. };
  587. };
  588. $OUT[]= $STA[3] . $DUMMY['log'] . $END;
  589. break;
  590. };
  591. };
  592. $Data = '[' . implode( ',' , $OUT ) . ']';
  593. } else {
  594. $Data = '[{columnWidth: 1, items:{html:"NO SYSTEM PROPS"}} ]';
  595. };
  596. };
  597. if( $Data != '' ) {
  598. echo $Data;
  599. } else {
  600. echo '[]';
  601. };
  602. ?>