/** * Perform any actions for the page * * @returns boolean. true on sucess */ public function action() { $view = false; if (count($this->request_remainder) > 0) { $view = current($this->request_remainder); } $run_reports_in_bg = !array_key_exists('run_reports_in_background', $this->args) || $this->args['run_reports_in_background']; if ($run_reports_in_bg) { $use_reports = array(); if ($view) { $use_reports = array($view); } else { $report_config = I2CE::getConfig()->traverse("/modules/CustomReports", true); $bkg_time = 0; $report_config->setIfIsSet($bkg_time, "times/background"); foreach ($report_config->search_reports as $report => $report_info) { // if background generation of reports is turned off, then don't run this unless // overridden by the search report setting // When the background process runs each report will check it's own staleness // before running. $force = $report_info->traverse("force"); if ((!is_numeric($bkg_time) || $bkg_time <= 0) && !$force) { continue; } $use_reports[] = $report; } } $stale_reports = array(); foreach ($use_reports as $report) { if (!I2CE_CustomReport::isStale($report)) { continue; } $stale_reports[] = $report; } if (count($stale_reports) > 0) { $this->launchBackgroundPage("/CustomReports/generate/" . implode("/", $stale_reports)); } } $this->template->setDisplayData("limit_description", false); if ($view) { return $this->actionSearch($view); } else { return $this->actionMenu(); } //parent handles the show action return parent::action(); }