Révision feca1e4a
Ajouté par Assos Assos il y a presque 7 ans
drupal7/sites/all/modules/webform/includes/exporters/webform_exporter_excel_delimited.inc | ||
---|---|---|
5 | 5 |
* The Excel exporter currently is just a tab-delimited export. |
6 | 6 |
*/ |
7 | 7 |
|
8 |
/** |
|
9 |
* |
|
10 |
*/ |
|
8 | 11 |
class webform_exporter_excel_delimited extends webform_exporter_delimited { |
9 |
function __construct($options) { |
|
12 |
|
|
13 |
/** |
|
14 |
* |
|
15 |
*/ |
|
16 |
public function __construct($options) { |
|
10 | 17 |
$options['delimiter'] = '\t'; |
11 | 18 |
parent::__construct($options); |
12 | 19 |
} |
13 | 20 |
|
14 |
function bof(&$file_handle) { |
|
21 |
/** |
|
22 |
* |
|
23 |
*/ |
|
24 |
public function bof(&$file_handle) { |
|
15 | 25 |
$output = ''; |
16 | 26 |
|
17 | 27 |
// Include at BOM at the beginning of the file for Little Endian. |
... | ... | |
22 | 32 |
@fwrite($file_handle, $output); |
23 | 33 |
} |
24 | 34 |
|
25 |
function add_row(&$file_handle, $data, $row_count) { |
|
35 |
/** |
|
36 |
* |
|
37 |
*/ |
|
38 |
public function add_row(&$file_handle, $data, $row_count) { |
|
26 | 39 |
foreach ($data as $key => $value) { |
27 | 40 |
// Escape inner quotes and wrap all contents in new quotes. |
28 | 41 |
$data[$key] = '"' . str_replace('"', '""', $data[$key]) . '"'; |
... | ... | |
39 | 52 |
@fwrite($file_handle, $row); |
40 | 53 |
} |
41 | 54 |
|
42 |
function set_headers($filename) { |
|
55 |
/** |
|
56 |
* |
|
57 |
*/ |
|
58 |
public function set_headers($filename) { |
|
43 | 59 |
drupal_add_http_header('Content-Type', 'application/x-msexcel'); |
44 | 60 |
drupal_add_http_header('Content-Disposition', "attachment; filename=$filename.xls"); |
45 | 61 |
drupal_add_http_header('Pragma', 'public'); |
46 | 62 |
drupal_add_http_header('Cache-Control', 'max-age=0'); |
47 | 63 |
} |
64 |
|
|
48 | 65 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules