test with real data
This commit is contained in:
@@ -509,55 +509,12 @@ function booking_variety_sessions_view_summary() {
|
||||
*/
|
||||
function booking_varietysessions_csv_report($timeslot_id) {
|
||||
global $event;
|
||||
$data = array();
|
||||
$data = array();
|
||||
$rows = array();
|
||||
|
||||
//include_once("./libraries/xlsxwriter.class.php");
|
||||
module_load_include('php', 'booking', 'libraries/xlsxwriter.class');
|
||||
//ini_set('display_errors', 0);
|
||||
//ini_set('log_errors', 1);
|
||||
//error_reporting(E_ALL & ~E_NOTICE);
|
||||
$filename = "example.xlsx";
|
||||
header('Content-disposition: attachment; filename="'.XLSXWriter::sanitize_filename($filename).'"');
|
||||
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Cache-Control: must-revalidate');
|
||||
header('Pragma: public');
|
||||
/*
|
||||
$data1 = array(
|
||||
array('5','3'),
|
||||
array('1','6'),
|
||||
);
|
||||
$data2 = array(
|
||||
array('2','7','9'),
|
||||
array('4','8','0'),
|
||||
);
|
||||
|
||||
$writer = new XLSXWriter();
|
||||
$writer->setAuthor('Doc Author');
|
||||
$writer->writeSheet($data1);
|
||||
$writer->writeSheet($data2);
|
||||
echo $writer->writeToString();
|
||||
|
||||
//foreach($rows as $row)
|
||||
// $writer->writeSheetRow('Sheet1', $row);
|
||||
//$writer->writeToStdOut();
|
||||
//$writer->writeToFile('example.xlsx');
|
||||
//echo $writer->writeToString();
|
||||
exit(0);
|
||||
*/
|
||||
|
||||
|
||||
$rows = array(
|
||||
array('2003','1','-50.5','2010-01-01 23:00:00','2012-12-31 23:00:00'),
|
||||
array('2003','=B1', '23.5','2010-01-01 00:00:00','2012-12-31 00:00:00'),
|
||||
);
|
||||
$writer = new XLSXWriter();
|
||||
$writer->setAuthor('Some Author');
|
||||
foreach($rows as $row)
|
||||
$writer->writeSheetRow('Sheet1', $row);
|
||||
$writer->writeToStdOut();
|
||||
exit(0);
|
||||
|
||||
//verify that $timeslot_id is a number
|
||||
if (! preg_match('/^[0-9]+$/', $timeslot_id)) {
|
||||
drupal_set_message("Error: Invalid variety session timeslot ID '" . $group_id . "' supplied.", 'error', FALSE);
|
||||
@@ -664,10 +621,38 @@ function booking_varietysessions_csv_report($timeslot_id) {
|
||||
$output[] = $field;
|
||||
}
|
||||
} //loop through columns
|
||||
$rows[] = $output;
|
||||
$row = implode($delimiter, $output) . "\n";
|
||||
$csv .= $row;
|
||||
|
||||
}
|
||||
|
||||
//ini_set('display_errors', 0);
|
||||
//ini_set('log_errors', 1);
|
||||
//error_reporting(E_ALL & ~E_NOTICE);
|
||||
$filename = $name . ".xlsx";
|
||||
header('Content-disposition: attachment; filename="'.XLSXWriter::sanitize_filename($filename).'"');
|
||||
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Cache-Control: must-revalidate');
|
||||
header('Pragma: public');
|
||||
|
||||
//$rows = array(
|
||||
// array('2003','1','-50.5','2010-01-01 23:00:00','2012-12-31 23:00:00'),
|
||||
// array('2003','=B1', '23.5','2010-01-01 00:00:00','2012-12-31 00:00:00'),
|
||||
//);
|
||||
$writer = new XLSXWriter();
|
||||
$writer->setAuthor('Some Author');
|
||||
//Add the header row
|
||||
$writer->writeSheetRow('Sheet1', $column_headings);
|
||||
|
||||
//Add the data
|
||||
foreach($rows as $row) {
|
||||
$writer->writeSheetRow('Sheet1', $row);
|
||||
}
|
||||
|
||||
$writer->writeToStdOut();
|
||||
exit(0);
|
||||
|
||||
//output the CSV to the browser
|
||||
drupal_add_http_header("Content-type", "text/csv; charset=utf-8");
|
||||
|
Reference in New Issue
Block a user