This repository was archived by the owner on Apr 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcsv.php
More file actions
70 lines (58 loc) · 1.45 KB
/
csv.php
File metadata and controls
70 lines (58 loc) · 1.45 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* Exports data to a CSV file
*
* @author Jared Howland <book.usage@jaredhowland.com>
* @version 2013-07-09
* @since 2013-05-30
*
*/
require_once 'config.php';
$term = $_GET['term'];
$type = $_GET['type'];
$heading = to_slug($_GET['heading']);
function to_slug($string, $space='-') {
if (function_exists('iconv')) {
$string = @iconv('UTF-8', 'ASCII//TRANSLIT', $string);
}
$string = preg_replace('/[^a-zA-Z0-9 -]/', '', $string);
$string = strtolower($string);
$string = str_replace(' ', $space, $string);
return $string;
}
switch ($type) {
case 'vendor':
$browse = new browse;
$array = $browse->vendor($term, NULL, 0);
break;
case 'platform':
$browse = new browse;
$array = $browse->platform($term, NULL, 0);
break;
case 'lib':
$browse = new browse;
$array = $browse->lib($term, NULL, 0);
break;
case 'call_num':
$browse = new browse;
$array = $browse->call_num($term, NULL, 0);
break;
case 'fund':
$browse = new browse;
$array = $browse->fund($term, NULL, 0);
break;
case 'title':
$search = new search($term, NULL, 0);
$array = $search->title();
break;
case 'isbn':
$search = new search($term, NULL, 0);
$array = $search->isbn();
break;
default:
error::trigger('An error in downloading has occurred. Please go back and try again.');
break;
}
$csv = new csv;
$csv->download($array, $heading);
?>