function createReport() { if ($this->class) { $methods = get_class_methods($this->class); if (in_array($this->report_row, $methods)) { $func_type = 'method'; } } if (!isset($func_type)) { if (function_exists($this->report_row)) { $func_type = 'function'; } else { $func_type = 'none'; } } $index_set = false; $tmp_file = \PHPWS_Text::randomString(10) . time(); $directory = CACHE_DIRECTORY; $file_path = sprintf('%s/%s', $directory, $tmp_file); $fp = fopen($file_path, 'w'); foreach ($this->display_rows as $foo) { if ($func_type == 'method') { $result = call_user_func(array($foo, $this->report_row)); } elseif ($func_type == 'function') { $result = call_user_func($this->report_row, $foo); } else { if (is_object($foo)) { $result = PHPWS_Core::stripObjValues($foo); } else { $result =& $foo; } } if (!$index_set) { $index_keys = array_keys($result); $row = fputcsv($fp, $index_keys); $index_set = true; } fputcsv($fp, $result); //$row = self::formatCSVRow($result); //fwrite($fp, $row); } fclose($fp); $new_file = time() . '_pager.csv'; require_once 'HTTP/Download.php'; $dl = new HTTP_Download(); $dl->setFile($file_path); $dl->setContentDisposition(HTTP_DOWNLOAD_ATTACHMENT, $new_file); $dl->setContentType('text/csv'); $dl->send(); exit; }
$default['scrollbars'] = 'yes'; $default['resizable'] = 'yes'; $default['width'] = '400'; $default['height'] = '300'; $default['titlebar'] = 'no'; $default['link_title'] = ''; $default['window_name'] = 'default' . rand(); $default['class'] = 'js-open-window'; $default['center'] = 1; if (isset($data['type'])) { if ($data['type'] == 'button') { $bodyfile = PHPWS_SOURCE_DIR . 'javascript/open_window/body2.js'; } } if (isset($data['center'])) { $data['center'] = (bool) $data['center'] ? 1 : 0; } $site_address = PHPWS_Core::getHomeHttp(); if (!stristr($data['address'], $site_address)) { $data['address'] = $site_address . $data['address']; } if (!empty($data['secure'])) { if (!isset($_GLOBALS['open_window_reset'])) { unset($_SESSION['secure_open_window']); $_GLOBALS['open_window_reset'] = true; } $rand = PHPWS_Text::randomString(); $data['address'] .= '&owpop=' . $rand; $_SESSION['secure_open_window'][] = $rand; $data['id'] = $rand; }