/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk

« back to all changes in this revision

Viewing changes to classes/reader.php

  • Committer: Suren A. Chilingaryan
  • Date: 2018-04-13 03:42:49 UTC
  • Revision ID: csa@suren.me-20180413034249-f7zx8mrrp7ycidhs
Support real-time export mode for status displays

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
 const ALARM_MODE_FULL_LIST = 1;
66
66
 const ALARM_MODE_ACTIVE_LIST = 2;
67
67
 
 
68
 const EXPORT_SKIP_HEADERS = 1;
 
69
 
68
70
 function __construct(&$props) {
69
71
    if ($props instanceof REQUEST) {
70
72
        $this->req = &$props;
1001
1003
    throw new ADEIException(translate("Control interface is not supported by the READER"));
1002
1004
 }
1003
1005
 
1004
 
 protected function ExportData(DATAHandler $h = NULL, LOGGROUP $grp, MASK $mask, INTERVAL $ivl = NULL, $resample = 0, array &$names, $opts = 0, $dmcb = NULL) {
 
1006
 protected function ExportData(DATAHandler $h = NULL, LOGGROUP $grp, MASK $mask, INTERVAL $ivl = NULL, $resample = 0, array &$names, $flags = 0, $dmcb = NULL) {
1005
1007
    global $DEFAULT_MISSING_VALUE;  
1006
1008
    $dm = new DOWNLOADMANAGER();
1007
1009
    if (!$h) $h = new CSVHandler();    
1013
1015
   
1014
1016
    $data = $this->GetFilteredData($grp, $ivl->GetWindowStart(), $ivl->GetWindowEnd(), $filter);
1015
1017
 
1016
 
    $columns = sizeof($names);
 
1018
    if ($names) {
 
1019
        $columns = sizeof($names);
1017
1020
    
1018
 
    $h->Start($columns);
1019
 
    $h->DataHeaders($names);    
 
1021
        $h->Start($columns);
 
1022
        $h->DataHeaders($names);
 
1023
    } else {
 
1024
        $h->Start(false);
 
1025
    }
1020
1026
    
1021
1027
    if($dmcb != NULL) {
1022
1028
      $action = "start";
1051
1057
    }    
1052
1058
  
1053
1059
    $h->End();
1054
 
    
 
1060
    return 0;
1055
1061
 }
1056
1062
 
1057
 
 
1058
 
 
1059
 
 function Export(DATAHandler $h = NULL, LOGGROUP $grp = NULL, MASK $mask = NULL, INTERVAL $ivl = NULL, $resample = 0, $opts = 0, $dmcb = NULL) {
 
1063
 function Export(DATAHandler $h = NULL, LOGGROUP $grp = NULL, MASK $mask = NULL, INTERVAL $ivl = NULL, $resample = 0, $flags = 0, $dmcb = NULL) {
1060
1064
    $grp = $this->CheckGroup($grp);
1061
1065
    if (!$mask) $mask = $this->CreateMask($grp, $minfo = array());
1062
1066
   
1063
 
    $names = $this->GetItemList($grp, $mask);
1064
 
    return $this->ExportData($h, $grp, $mask, $ivl, $resample, $names, $opts, $dmcb);
 
1067
    if ($flags&READER::EXPORT_SKIP_HEADERS)
 
1068
        $names = array();
 
1069
    else
 
1070
        $names = $this->GetItemList($grp, $mask);
1065
1071
 
 
1072
    return $this->ExportData($h, $grp, $mask, $ivl, $resample, $names, $flags, $dmcb);
1066
1073
 }
1067
1074
 
1068
 
 function ExportCSV(STRINGHandler $h = NULL, LOGGROUP $grp = NULL, MASK $mask = NULL, INTERVAL $ivl = NULL, $resample = 0, $opts = 0) {
1069
 
    return $this->Export(new CSVHandler($h), $grp, $msk, $ivl, $resample, $opts);
 
1075
 function ExportCSV(STRINGHandler $h = NULL, LOGGROUP $grp = NULL, MASK $mask = NULL, INTERVAL $ivl = NULL, $resample = 0, $flags = 0) {
 
1076
    return $this->Export(new CSVHandler($h), $grp, $msk, $ivl, $resample, $flags);
1070
1077
 }
1071
1078
 
1072
1079
}