1 : <?php
2 : require_once "JetPlugin.class.php";
3 :
4 :
5 :
6 :
7 :
8 :
9 :
10 :
11 :
12 :
13 :
14 : class JetCsvDownload extends JetPlugin{
15 : public function __construct(){
16 4 : $this->key = "csv";
17 4 : }
18 :
19 : public function action($header, $records){
20 0 : $headerString = implode("\",\"", $header);
21 0 : $headerString = "\"" . $headerString . "\"";
22 0 : $contents = $headerString;
23 0 : $contents .= "\r\n";
24 :
25 0 : foreach($records as $record){
26 0 : $recordArray = array();
27 0 : foreach($header as $headerKey=>$headerValue){
28 0 : $recordArray[] = $record[$headerKey];
29 0 : }
30 0 : $recordString = implode("\",\"", $recordArray);
31 0 : $recordString = "\"" . $recordString . "\"";
32 0 : $contents .= $recordString;
33 0 : $contents .= "\r\n";
34 0 : }
35 :
36 0 : Header("Content-disposition: attachment; filename=list.csv");
37 0 : Header("Content-type: application/octet-stream; name=list.csv");
38 0 : print $contents;
39 :
40 0 : die();
41 : }
42 : }
43 : ?>
|