<ul class="subsubsub"> <?php $reports = ShoppAdminReport::reports(); foreach ((array) $reports as $id => $rt) { $this_report = isset($_GET['report']) && array_key_exists($_GET['report'], $reports) ? $_GET['report'] : 'sales'; $args = array('report' => $id); $url = add_query_arg(array_merge($_GET, $args), admin_url('admin.php')); $classes = $this_report === $id ? ' class="current"' : ''; $separator = !isset($separator) ? '' : '| '; ?> <li><?php echo $separator; ?> <a href="<?php echo esc_url($url); ?> "<?php echo $classes; ?> ><?php esc_html_e($reports[$id]['label']); ?> </a></li> <?php } ?> </ul>
/** * Generates the output for the exported report * * @author Jonathan Davis * @since 1.3 * * @return void **/ public function output() { if (empty($this->data)) { Shopp::redirect(add_query_arg(array_merge($_GET, array('src' => null)), admin_url('admin.php'))); } $sitename = get_bloginfo('name'); $report = $this->options['report']; $reports = ShoppAdminReport::reports(); $name = $reports[$report]['name']; header("Content-type: {$this->content_type}"); header("Content-Disposition: attachment; filename=\"{$sitename} {$name}.{$this->extension}\""); header("Content-Description: Delivered by " . ShoppVersion::agent()); header("Cache-Control: maxage=1"); header("Pragma: public"); $this->begin(); if ($this->headings) { $this->heading(); } $this->records(); $this->end(); }
/** * Delivers order export files to the browser * * @author Jonathan Davis * @since 1.1 * * @return void **/ public function export_reports() { if (!current_user_can('shopp_financials') || !current_user_can('shopp_export_orders')) { exit; } add_filter('shopp_reports', array('ShoppAdminReport', 'xreports')); $reports = ShoppAdminReport::reports(); $Report = ShoppAdminReport::load(); if (!isset($_POST['settings']["{$report}_report_export"])) { $_POST['settings']["{$report}_report_export"]['columns'] = array_keys($Report->columns); $_POST['settings']["{$report}_report_export"]['headers'] = 'on'; } shopp_set_formsettings(); // Save workflow setting $format = shopp_setting('report_export_format'); switch ($format) { case 'csv': new ShoppReportCSVExport($Report); break; default: new ShoppReportTabExport($Report); } exit; }