// session_save_path("session"); session_start(); include "app/app.php"; $customparams = loadCustomParams($c, decryptCookie($_COOKIE['oauth_consumer_key'])); include "rest/EBSCOAPI.php"; $clean = strip_tags_deep($_REQUEST); $api = new EBSCOAPI($c, $customparams); $Info = $api->getInfo(); if (isset($_SESSION['results'])) { $results = $_SESSION['results']; if (isset($results['queryString'])) { $queryStringUrl = $results['queryString']; } } else { $queryStringUrl = urldecode(urldecode($clean['backpath'])); $results = $api->apiSearch($queryStringUrl); $_SESSION['results'] = $results; if (isset($results['queryString'])) { $backpath = $results['queryString']; } } $addExpanderActions = array(); $removeExpanderAction = 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['expanders'] as $expander) {
$mode = 'all'; $expander = isset($clean['expander']) ? $clean['expander'] : ''; $limiter = isset($clean['limiter']) ? $clean['limiter'] : ''; $debug = isset($clean['debug']) ? $clean['debug'] : ''; $Info = $api->getInfo(); // If user come back from the detailed record // The same search will not call API again if (isset($clean['back']) && isset($_SESSION['results'])) { $results = $_SESSION['results']; if (isset($results['queryString'])) { $backpath = $results['queryString']; } } else { if (isset($clean['back']) && isset($clean['backpath'])) { $_SESSION['debug'] = "<p>PARAMS AFTER RESULTS.PHP: " . urldecode($clean['backpath']) . "</p>"; $results = $api->apiSearch(urldecode($clean['backpath'])); $_SESSION['results'] = $results; if (isset($results['queryString'])) { $backpath = $results['queryString']; } } else { if (isset($clean['option'])) { // All page options will be handled here // New Search or refined search will call the API if (isset($_SESSION['results'])) { $results = $_SESSION['results']; if (isset($results['queryString'])) { $queryStringUrl = $results['queryString']; } } else { $queryStringUrl = urldecode(urldecode($clean['backpath']));
} if (sizeof($listOfANs) > 0) { $query['query'] = implode(" OR ", $listOfANs); $searchTerm = $query; $fieldCode = ''; $start = 1; $limit = 100; $sortBy = 'relevance'; $amount = 'detailed'; $mode = 'all'; $expander = ''; $limiter = ''; $debug = ''; $params = array('sort' => $sortBy, 'searchmode' => $mode, 'view' => $amount, 'includefacets' => 'n', 'resultsperpage' => $limit, 'pagenumber' => $start, 'highlight' => 'n', 'expander' => $expander); if (!is_array($limiter)) { $params['limiter'] = $limiter; } $params = array_merge($params, $query); $params = http_build_query($params); if (is_array($limiter)) { foreach ($limiter as $selectedLimiter) { $params .= "&limiter=" . urlencode($selectedLimiter); } } $results = $api->apiSearch($params); } else { $results = array(); } } $variables = array('results' => $results, 'readingList' => $readingList, 'c' => $c, 'customparams' => $customparams, 'useCache' => $useCache); ebsco_render('reading_list.html', 'layout.html', $variables);