tidy up spreadsheet info
This commit is contained in:
@@ -517,7 +517,7 @@ function booking_varietysessions_csv_report($timeslot_id) {
|
|||||||
|
|
||||||
//verify that $timeslot_id is a number
|
//verify that $timeslot_id is a number
|
||||||
if (! preg_match('/^[0-9]+$/', $timeslot_id)) {
|
if (! preg_match('/^[0-9]+$/', $timeslot_id)) {
|
||||||
drupal_set_message("Error: Invalid variety session timeslot ID '" . $group_id . "' supplied.", 'error', FALSE);
|
drupal_set_message("Error: Invalid variety session timeslot ID '" . $timeslot_id . "' supplied.", 'error', FALSE);
|
||||||
drupal_goto('admin/booking/variety');
|
drupal_goto('admin/booking/variety');
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -630,6 +630,8 @@ function booking_varietysessions_csv_report($timeslot_id) {
|
|||||||
//ini_set('display_errors', 0);
|
//ini_set('display_errors', 0);
|
||||||
//ini_set('log_errors', 1);
|
//ini_set('log_errors', 1);
|
||||||
//error_reporting(E_ALL & ~E_NOTICE);
|
//error_reporting(E_ALL & ~E_NOTICE);
|
||||||
|
|
||||||
|
// Create headers for Excel spreadsheet
|
||||||
$filename = $name . ".xlsx";
|
$filename = $name . ".xlsx";
|
||||||
header('Content-disposition: attachment; filename="'.XLSXWriter::sanitize_filename($filename).'"');
|
header('Content-disposition: attachment; filename="'.XLSXWriter::sanitize_filename($filename).'"');
|
||||||
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
@@ -637,18 +639,15 @@ function booking_varietysessions_csv_report($timeslot_id) {
|
|||||||
header('Cache-Control: must-revalidate');
|
header('Cache-Control: must-revalidate');
|
||||||
header('Pragma: public');
|
header('Pragma: public');
|
||||||
|
|
||||||
//$rows = array(
|
$sheetname = "Variety Session " . $timeslot_id;
|
||||||
// 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 = new XLSXWriter();
|
||||||
$writer->setAuthor('Some Author');
|
$writer->setAuthor($event->booking_eventname);
|
||||||
//Add the header row
|
//Add the header row
|
||||||
$writer->writeSheetRow('Sheet1', $column_headings);
|
$writer->writeSheetRow($sheetname, $column_headings);
|
||||||
|
|
||||||
//Add the data
|
//Add the data
|
||||||
foreach($rows as $row) {
|
foreach($rows as $row) {
|
||||||
$writer->writeSheetRow('Sheet1', $row);
|
$writer->writeSheetRow($sheetname, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
$writer->writeToStdOut();
|
$writer->writeToStdOut();
|
||||||
|
Reference in New Issue
Block a user