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.

28 lines
1.1 KiB

​
​
3 years ago
​
​
​
4 years ago
​
​
​
3 years ago
​
​
​
4 years ago
3 years ago
4 years ago
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. if( $CUser->Data['id'] > 1 ){
  4. $ZIZI = new SQLite_DB( $SYSPath . '/lib/controller/data/reports/stat.db');
  5. $TZ = new DateTimeZone( date_default_timezone_get() );
  6. $DT = new DateTime("now", $TZ );
  7. $DIDI = $TZ->getOffset( $DT );
  8. $QS = "SELECT * FROM `days`";
  9. $RR = $ZIZI->Query( $QS );
  10. if( count( $RR ) ){
  11. $DD = array();
  12. foreach( $RR as $R ){
  13. $CC = intval( $R['evt_count'] );
  14. // Day key = local noon of the day in the host time zone: maps back to the same date on the
  15. // server in any time zone, and shows the right day in a browser within 12 h of the host
  16. $DS = sprintf( "%04d-%02d-%02d 12:00:00", intval( $R['year'] ), intval( $R['month'] ), intval( $R['day'] ) );
  17. $TS = strtotime( $DS );
  18. if( $CC > 100 ) $CC = 100;
  19. $DD[] = '{"t": '.( $TS * 1000 ).',"v":'.$CC.'}';
  20. //echo '[{"t": 1285891200000,"v": 20},{"t": 1285804800000,"v": 100},{"t": 1672249854000,"v": 50},{"t": 1672279854000,"v": 80}]';
  21. };
  22. echo "[" . implode(",", $DD ) . "]";
  23. } else {
  24. echo "[]";
  25. };
  26. } else {
  27. header('location: /');
  28. };
  29. ?>