-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlimiter.php
More file actions
52 lines (47 loc) · 1.54 KB
/
limiter.php
File metadata and controls
52 lines (47 loc) · 1.54 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
<?php
session_start();
include "rest/EBSCOAPI.php";
$api = new EBSCOAPI();
$Info = $api->getInfo();
$results = $_SESSION['results'];
$queryStringUrl = $results['queryString'];
$addLimiterActions=array();
$removeLimiterActions=array();
/*
* Check which expander check boxes are checked, which are not checked
* if is checked add the action to addExpanderActions
* if is not checked, add remove action to removeExpanderActions when the expander is found in applied expanders
* or do nothing when not found in applied expanders.
*/
$i = 1;
foreach($Info['limiters'] as $limiter){
if($limiter['Id'] != 'DT1'){
if(isset($_REQUEST[$limiter['Id']])){
$addLimiterActions['action['.$i.']'] = str_replace('value', 'y',$limiter['Action']);
$i++;
}else{
foreach($results['appliedLimiters'] as $filter){
if($filter['Id']==$limiter['Id']){
$removeLimiterActions['action['.$i.']'] = str_replace('value', 'y',$filter['removeAction']);
$i++;
}
}
}
}
else{
$addLimiterActions['action['.$i.']'] = $_REQUEST['DT1'];
$i++;
}
}
$searchTerm = $_REQUEST['query'];
$fieldCode = $_REQUEST['fieldcode'];
$params = array(
'refine'=>'y',
'query' => $searchTerm,
'fieldcode'=>$fieldCode,
);
$params = array_merge($params,$addLimiterActions);
$params = array_merge($params,$removeLimiterActions);
$url = 'results.php?'.http_build_query($params).'&'.$queryStringUrl;
header("location: {$url}");
?>