-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcsv_export.php
executable file
·53 lines (51 loc) · 1.81 KB
/
csv_export.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
//error_reporting(E_ERROR );
//ini_set('display_errors' , 1 );
ob_start();
require_once('app_code/global.config.php');
require_once('class/config.inc.php');
require_once('class/class.email_client.php');
require_once('class/class.flags.php');
require_once('class/class.GlobalTask.php');
require_once('class/class.smtp.php');
require_once('class/class.display.php');
require_once('class/class.casecreation.php');
require_once('class/class.dynamicpage.php');
require_once('class/class.FctSearchScreen.php');
require_once('class/class.eapi_order.php');
require_once('class/class.eapi_account.php');
require_once('class/class.cases.php');
require_once('class/class.note.php');
require_once('class/class.knowledgebase.php');
require_once('class/class.FctSearchScreen.php');
ob_end_clean();
header("Content-type: text/csv");
header("Cache-Control: no-store, no-cache");
header('Content-Disposition: attachment; filename="filename.csv"');
$page = $_REQUEST['page'];
$arr = array();
$options = array();
$op = $_REQUEST['options'];
foreach( $_REQUEST as $n => $v){
if( strtolower(substr($n, 0 , 7) ) == 'search_' ){
$options[ substr($n , 7 )] = $v;
}
}
switch( $page ){
case "bucket_search":
$fct = new FctSearchScreen();
$arr = $fct->display_flowchart_task2( $options , array( 'return_csv' => true , 'user_id' => $_SESSION['user_id'] ) );
break;
case "case_search":
$case = new cases;
$arr = $case->display_search( $options , array('return_csv' => true ,'user_id' => $_SESSION["user_id"]) );
break;
}
foreach( $arr['body'] as $row ){
$clean_row = array();
foreach( $row as $name => $col ){
$clean_row[$name] = $col;
}
echo '"' . trim( str_replace( "\n" , '' , implode('","', $clean_row) . '"' ) ) . "\n";
}
?>