/** * Display the report * @param DOMNode $contentNode The DOM node we wish to display into. If null, we do not do any of the DOM processing stuff, do * not call the report display controls, limits etc. It will however still call processResults with a DOMNode of null * @param boolean $processResults Defaults to true meaning we run through the results. If false, we do not process results. * @param mixed $controls. If null (default), we display all the report controsl. If string or an array of string, we only display the indicated controls * @returns boolean. true on sucess */ public function display($contentNode, $processResults = true, $controls = null) { if (!$this->selectid || !$this->printf || !is_array($this->printf_args) || count($this->printf_args) == 0) { return false; } return parent::display($contentNode, $processResults, $controls); }
/** * Display the report. * @return boolean */ public function display($contentNode, $processResults = true, $controls = null) { if ($this->isExport()) { $csv = $this->generateExport($contentNode); $filename = addslashes(str_replace(array(' ', "\n", "\t"), array('_', ' ', '_'), $this->config->display_name)) . '_' . date("d_m_Y") . ".csv"; if (array_key_exists('HTTP_HOST', $_SERVER)) { header("Content-disposition: attachment; filename=\"{$filename}\""); if (preg_match('/\\s+MSIE\\s+\\d\\.\\d;/', $_SERVER['HTTP_USER_AGENT'])) { header("Content-type: application/vnd.ms-excel"); } else { header("Content-type: text/csv; charset=UTF-8"); } flush(); } $out = fopen("php://output", 'w'); foreach ($csv as $line) { fputcsv($out, $line); } flush(); exit; } else { return parent::display($contentNode, $processResults, $controls); } }