-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrecordSwich.php
64 lines (48 loc) · 1.54 KB
/
recordSwich.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
54
55
56
57
58
59
60
61
62
63
<?php
session_start();
include('rest/EBSCOAPI.php');
$results = $_SESSION['results'];
$queryStringUrl = $results['queryString'];
$api = new EBSCOAPI();
$resultId = $_REQUEST['resultId'];
$query = $_REQUEST['query'];
$fieldCode = $_REQUEST['fieldcode'];
$start = isset($_REQUEST['pagenumber']) ? $_REQUEST['pagenumber'] : 1;
$limit = isset($_REQUEST['resultsperpage'])?$_REQUEST['resultsperpage']:20;
if($resultId>$start*$limit){
$start = $start+1;
$url = $queryStringUrl."&pagenumber=$start";
$results = $api->apiSearch($url);
$_SESSION['results'] = $results;
} else if($resultId<(($start-1)*$limit)+1){
$start = $start-1;
$url = $queryStringUrl."&pagenumber=$start";
$results = $api->apiSearch($url);
$_SESSION['results'] = $results;
} else if(isset($_SESSION['results'])){
$results = $_SESSION['results'];
} else {
$results = $api->apiSearch($queryStringUrl);
$_SESSION['results'] = $results;
}
$recordCount = $results['recordCount'];
foreach($results['records'] as $record){
if($record['ResultId']==$resultId){
$db = $record['DbId'];
$an = $record['An'];
$rId = $record['ResultId'];
$params = array(
'db'=>$db,
'an'=>$an,
'highlight'=>$query,
'resultId'=>$rId,
'recordCount'=>$recordCount,
'query'=>$query,
'fieldcode'=>$fieldCode
);
$params = http_build_query($params);
header("location:record.php?".$params);
break;
}
}
?>