Beispiel #1
0
 protected function _runReport()
 {
     if (!$this->is_ready) {
         throw new Exception("Report is not ready.  Missing variables");
     }
     PhpReports::setVar('Report', $this);
     //release the write lock on the session file
     //so the session isn't locked while the report is running
     session_write_close();
     $classname = $this->options['Type'] . 'ReportType';
     if (!class_exists($classname)) {
         throw new exception("Unknown report type '" . $this->options['Type'] . "'");
     }
     foreach ($this->headers as $header) {
         $headerclass = $header . 'Header';
         $headerclass::beforeRun($this);
     }
     $classname::openConnection($this);
     $datasets = $classname::run($this);
     $classname::closeConnection($this);
     // Convert old single dataset format to multi-dataset format
     if (!isset($datasets[0]['rows']) || !is_array($datasets[0]['rows'])) {
         $datasets = array(array('rows' => $datasets));
     }
     // Only include a subset of datasets
     $include = array_keys($datasets);
     if (isset($_GET['dataset'])) {
         $include = array($_GET['dataset']);
     } elseif (isset($_GET['datasets'])) {
         // If just a single dataset was specified, make it an array
         if (!is_array($_GET['datasets'])) {
             $include = explode(',', $_GET['datasets']);
         } else {
             $include = $_GET['datasets'];
         }
     }
     $this->options['DataSets'] = array();
     foreach ($include as $i) {
         if (!isset($datasets[$i])) {
             continue;
         }
         $this->options['DataSets'][$i] = $datasets[$i];
     }
     $this->parseDynamicHeaders();
 }
Beispiel #2
0
 protected function _runReport()
 {
     if (!$this->is_ready) {
         throw new Exception("Report is not ready.  Missing variables");
     }
     PhpReports::setVar('Report', $this);
     //release the write lock on the session file
     //so the session isn't locked while the report is running
     session_write_close();
     $classname = $this->options['Type'] . 'ReportType';
     if (!class_exists($classname)) {
         throw new exception("Unknown report type '" . $this->options['Type'] . "'");
     }
     foreach ($this->headers as $header) {
         $headerclass = $header . 'Header';
         $headerclass::beforeRun($this);
     }
     $classname::openConnection($this);
     $datasets = $classname::run($this);
     $classname::closeConnection($this);
     // Convert old single dataset format to multi-dataset format
     if (!isset($datasets[0]['rows']) || !is_array($datasets[0]['rows'])) {
         $datasets = array(array('rows' => $datasets));
     }
     $this->options['DataSets'] = $datasets;
     $this->parseDynamicHeaders();
 }