コード例 #1
0
 /**
  * Displays the browse page for all reports.
  */
 public function browseAction()
 {
     $db = $this->_helper->db;
     if (!$this->_getParam('sort_field')) {
         $this->_setParam('sort_field', 'added');
         $this->_setParam('sort_dir', 'd');
     }
     parent::browseAction();
     $reportItemCounts = array();
     $reportUserNames = array();
     foreach ($this->view->reports_reports as $report) {
         $user = $db->getTable('User')->find($report->creator);
         $query = unserialize($report->query);
         $params = reports_convert_search_filters($query);
         $itemCount = $db->getTable('Item')->count($params);
         $reportItemCounts[(string) $report->id] = $itemCount;
     }
     $this->view->reportItemCounts = $reportItemCounts;
     $this->view->formats = reports_get_output_formats();
 }
コード例 #2
0
ファイル: Generator.php プロジェクト: ungc0/comp356-mac15
 public function generate()
 {
     set_error_handler(array($this, 'errorHandler'), E_WARNING);
     try {
         $this->_reportFile->status = Reports_File::STATUS_IN_PROGRESS;
         $this->_reportFile->save();
         $this->_report = $this->_reportFile->getReport();
         $this->_params = reports_convert_search_filters(unserialize($this->_report->query));
         // Creates a random filename based on the type of report.
         $filter = new Omeka_Filter_Filename();
         $filename = $filter->renameFile('report.' . $this->getExtension());
         // Generates the report (passes to subclass)
         $tempFilePath = tempnam($this->_storage->getTempDir(), 'reports');
         $tempFilePath = $this->generateReport($tempFilePath);
         // Store the report
         $destPath = $this->_storagePrefixDir . '/' . $filename;
         $this->_storage->store($tempFilePath, $destPath);
         $this->_reportFile->status = Reports_File::STATUS_COMPLETED;
         $this->_reportFile->filename = $filename;
     } catch (Exception $e) {
         $this->_reportFile->status = Reports_File::STATUS_ERROR;
         $this->_addStatusMessage('storagePrefixDir: ' . $this->_storagePrefixDir . ' filename: ' . $filename . ' error:' . $e->getMessage(), 'Error');
         _log($e, Zend_Log::ERR);
     }
     $this->_reportFile->save();
 }