/** * Process incoming parameters and display the page. * * @return void * @access public */ public function launch() { global $configArray, $interface; // Execute Default Tab $defaultTab = isset($configArray['Site']['defaultRecordTab']) ? $configArray['Site']['defaultRecordTab'] : 'Holdings'; // Don't let bots crawl holdings if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider/i', $_SERVER['HTTP_USER_AGENT'])) { $defaultTab = 'Description'; } else { // We need to do a whole bunch of extra work to determine the default // tab if we have the hideHoldingsTabWhenEmpty setting turned on; only // do this work if we absolutely have to! if (isset($configArray['Site']['hideHoldingsTabWhenEmpty']) && $configArray['Site']['hideHoldingsTabWhenEmpty'] && $defaultTab == "Holdings") { $db = ConnectionManager::connectToIndex(); if (!($record = $db->getRecord($_REQUEST['id']))) { PEAR::raiseError(new PEAR_Error('Record Does Not Exist')); } $recordDriver = RecordDriverFactory::initRecordDriver($record); $showHoldingsTab = $recordDriver->hasHoldings(); $defaultTab = $showHoldingsTab ? 'Holdings' : 'Description'; } } include_once $defaultTab . '.php'; $service = new $defaultTab(); $service->recordHit(); $service->launch(); }
/** * Constructor. * * @access public */ public function __construct() { parent::__construct(); // Setup Search Engine Connection $this->db = ConnectionManager::connectToIndex(); $_SESSION['no_store'] = true; }
/** * Constructor * * @access public */ public function __construct() { global $interface; $interface->assign('id', $_GET['id']); // Setup Search Engine Connection $this->db = ConnectionManager::connectToIndex('SolrAuth'); parent::__construct(); }
/** * Process incoming parameters and generate an appropriate JSON response. * * @return void * @access public */ public function launch() { //header('Content-type: application/x-suggestions+json'); header('Content-type: application/json'); // Setup Search Engine Connection $db = ConnectionManager::connectToIndex(); $results = $db->getSuggestion(strtolower($_GET['lookfor']), 'title_sort', 10); echo json_encode($results); }
/** * Private constructor to ensure singleton pattern. * * @access private */ private function __construct() { global $configArray; if (isset($configArray['Site']['bookBagMaxSize'])) { $this->_maxSize = $configArray['Site']['bookBagMaxSize']; } $this->_items = array(); // Setup Search Engine Connection $this->db = ConnectionManager::connectToIndex(); }
/** * Display the page. * * @return void * @access public */ public function launch() { global $interface; global $configArray; // Connect to Solr: $db = ConnectionManager::connectToIndex(); // Process incoming parameters: $source = isset($_GET['source']) ? $_GET['source'] : false; $from = isset($_GET['from']) ? $_GET['from'] : false; $rowid = isset($_GET['rowid']) ? $_GET['rowid'] : false; $page = isset($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 0; $limit = isset($configArray['AlphaBrowse']['page_size']) ? $configArray['AlphaBrowse']['page_size'] : 20; $extras = isset($configArray['AlphaBrowse_Extras'][$source]) ? $configArray['AlphaBrowse_Extras'][$source] : null; // Normalize input for call numbers if ($source == 'lcc' && $from) { $from = $this->_normalizeCallNumber($from); } // If required parameters are present, load results: if ($source && ($from !== false || $rowid !== false)) { // Load Solr data or die trying: $result = $db->alphabeticBrowse($source, $from, $rowid, $page, $limit, $extras, true); $this->_checkError($result); // No results? Try the previous page just in case we've gone past the // end of the list.... if ($result['Browse']['totalCount'] == 0) { $page--; $result = $db->alphabeticBrowse($source, $from, $rowid, $page, $limit, $extras, true); $this->_checkError($result); } // Only display next/previous page links when applicable: $interface->assign('nextpage', $page + 1); $interface->assign('nextRowid', $result['Browse']['endRow']); if ($result['Browse']['startRow'] > 1) { $interface->assign('prevpage', -1); $interface->assign('prevRowid', $result['Browse']['startRow']); } // Send other relevant values to the template: $interface->assign('source', $source); $interface->assign('from', $from); // Before assigning results, lets dedupe the extras foreach ($result['Browse']['items'] as &$item) { if (isset($item['extras'])) { foreach ($item['extras'] as &$extra) { $extra = array_unique($extra); } } } $interface->assign('result', $result); } // We also need to load all the same details as the basic Home action: parent::launch(); }
/** * Constructor * * @param bool $skipLogin Set to true to bypass the default login requirement. * * @access public */ public function __construct($skipLogin = false) { global $interface; global $configArray; global $user; if (!$skipLogin && !UserAccount::isLoggedIn()) { include_once 'Login.php'; Login::launch(); exit; } // Setup Search Engine Connection $this->db = ConnectionManager::connectToIndex(); // Connect to Database $this->catalog = ConnectionManager::connectToCatalog(); // Is Placing Holds allowed? $this->checkHolds = $this->catalog->checkFunction("Holds", null); // Is Cancelling Holds allowed? $this->cancelHolds = $this->catalog->checkFunction("cancelHolds", null); // Is Renewing Items allowed? $this->checkRenew = $this->catalog->checkFunction("Renewals", null); // Register Library Catalog Account if (isset($_POST['submit']) && !empty($_POST['submit']) && $this->catalog && isset($_POST['cat_username']) && isset($_POST['cat_password'])) { $username = $_POST['cat_username']; $password = $_POST['cat_password']; $loginTarget = isset($_POST['login_target']) ? $_POST['login_target'] : false; if ($loginTarget) { $username = "******"; } if (UserAccount::processCatalogLogin($username, $password)) { $interface->assign('user', $user); } else { $interface->assign('loginError', 'Invalid Patron Login'); } } // Assign Exporter Options $exportOptions = array(); if ($configArray['BulkExport']['enabled']) { $options = explode(':', $configArray['BulkExport']['options']); foreach ($options as $option) { if ($configArray['Export'][$option] == true) { $exportOptions[] = $option; } } $interface->assign('exportOptions', $exportOptions); } // Get Messages $this->infoMsg = isset($_GET['infoMsg']) ? $_GET['infoMsg'] : false; $this->errorMsg = isset($_GET['errorMsg']) ? $_GET['errorMsg'] : false; $this->showExport = isset($_GET['showExport']) ? $_GET['showExport'] : false; $this->followupUrl = false; }
/** * Get similar items and return html snippet * * @return void */ public function launch() { global $interface; if (!isset($_REQUEST['id'])) { return; } $this->db = ConnectionManager::connectToIndex(); // Retrieve the record from the index if (!($record = $this->db->getRecord($_REQUEST['id']))) { PEAR::raiseError(new PEAR_Error('Record Does Not Exist')); } $this->recordDriver = RecordDriverFactory::initRecordDriver($record); $interface->display($this->recordDriver->getSimilarItems()); }
/** * Constructor. */ public function __construct() { // Load Configuration for this Module $this->ilsConfigArray = parse_ini_file('conf/Unicorn.ini', true); global $configArray; // allow user to specify the full url to the Sirsi side perl script $this->url = $this->ilsConfigArray['Catalog']['url']; // host/port/search_prog kept for backward compatibility if (isset($this->ilsConfigArray['Catalog']['host']) && isset($this->ilsConfigArray['Catalog']['port']) && isset($this->ilsConfigArray['Catalog']['search_prog'])) { $this->host = $this->ilsConfigArray['Catalog']['host']; $this->port = $this->ilsConfigArray['Catalog']['port']; $this->search_prog = $this->ilsConfigArray['Catalog']['search_prog']; } $this->db = ConnectionManager::connectToIndex(); }
/** * Initialize the driver. * * Validate configuration and perform all resource-intensive tasks needed to * make the driver active. * * @throws ILSException * @return void */ public function init() { if (empty($this->config)) { throw new ILSException('Configuration needs to be set.'); } // allow user to specify the full url to the Sirsi side perl script $this->url = $this->config['Catalog']['url']; // host/port/search_prog kept for backward compatibility if (isset($this->config['Catalog']['host']) && isset($this->config['Catalog']['port']) && isset($this->config['Catalog']['search_prog'])) { $this->host = $this->config['Catalog']['host']; $this->port = $this->config['Catalog']['port']; $this->search_prog = $this->config['Catalog']['search_prog']; } $this->db = ConnectionManager::connectToIndex(); }
/** * Process parameters and display the page. * * @return void * @access public */ public function launch() { global $interface; // Run the specified method if it exists... but don't run the launch // method or we'll end up in an infinite loop!! if (isset($_GET['util']) && $_GET['util'] != 'launch' && method_exists($this, $_GET['util'])) { // Setup Search Engine Connection $this->_db = ConnectionManager::connectToIndex(); $this->{$_GET}['util'](); } else { $interface->setTemplate('records.tpl'); $interface->setPageTitle('Record Management'); $interface->display('layout-admin.tpl'); } }
/** * Process parameters and display the page. * * @return void * @access public */ public function launch() { global $configArray; global $interface; // Load SOLR Statistics $solr = ConnectionManager::connectToIndex('SolrStats'); // All Statistics $result = $solr->search('*:*', null, null, 0, null, array('field' => array('ipaddress', 'browser')), '', null, null, null, HTTP_REQUEST_METHOD_GET); if (!PEAR::isError($result)) { if (isset($result['facet_counts']['facet_fields']['ipaddress'])) { $interface->assign('ipList', $result['facet_counts']['facet_fields']['ipaddress']); } if (isset($result['facet_counts']['facet_fields']['browser'])) { $interface->assign('browserList', $result['facet_counts']['facet_fields']['browser']); } } // Search Statistics $result = $solr->search('phrase:[* TO *]', null, null, 0, null, array('field' => array('noresults', 'phrase')), '', null, null, null, HTTP_REQUEST_METHOD_GET); if (!PEAR::isError($result)) { $interface->assign('searchCount', $result['response']['numFound']); // Extract the count of no hit results by finding the "no hit" facet // entry set to boolean true. $nohitCount = 0; $nhFacet =& $result['facet_counts']['facet_fields']['noresults']; if (isset($nhFacet) && is_array($nhFacet)) { foreach ($nhFacet as $nhRow) { if ($nhRow[0] == 'true') { $nohitCount = $nhRow[1]; } } } $interface->assign('nohitCount', $nohitCount); $interface->assign('termList', $result['facet_counts']['facet_fields']['phrase']); } // Record View Statistics $result = $solr->search('recordId:[* TO *]', null, null, 0, null, array('field' => array('recordId')), '', null, null, null, HTTP_REQUEST_METHOD_GET); if (!PEAR::isError($result)) { $interface->assign('recordViews', $result['response']['numFound']); $interface->assign('recordList', $result['facet_counts']['facet_fields']['recordId']); } $interface->setTemplate('statistics.tpl'); $interface->setPageTitle('Statistics'); $interface->display('layout-admin.tpl'); }
/** * Process parameters and return the cart content as HTML. * * @return string the cart content formatted as HTML * @access public */ public function getCartAsHTML() { global $interface; // Setup Search Engine Connection $db = ConnectionManager::connectToIndex(); // fetch records from search engine // FIXME: currently only work with VuFind records // we should make this work with Summon/WorldCat too $records = array(); $items = $this->cart->getItems(); foreach ($items as $item) { if ($record = $db->getRecord($item)) { // TODO: perhaps we could use RecordDriver here $records[] = $record; } } $interface->assign('records', $records); return $interface->fetch('Cart/cart.tpl'); }
/** * Process incoming parameters and display the page. * * @return void * @access public */ public function launch() { global $configArray; header('Content-Type: text/html; charset=ISO-8859-1'); echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\">\n"; // Load information on the requested record: // Setup Search Engine Connection $db = ConnectionManager::connectToIndex(); // Retrieve the record from the index if (!($record = $db->getRecord($_REQUEST['id']))) { PEAR::raiseError(new PEAR_Error('Record Does Not Exist')); } if (strlen($record['fullrecord'])) { $xml = $record['fullrecord']; $result = simplexml_load_string($xml); } $url = isset($result->url) ? trim($result->url) : false; if (empty($url)) { PEAR::raiseError(new PEAR_Error('Not a VuDL Record')); } // Set up the XSLT processor: $xslt = new XSLTProcessor(); // Register all non-private methods other than "launch" for access via XSLT: $class = get_class($this); $methods = get_class_methods($class); foreach ($methods as $method) { if ($method != 'launch' && substr($method, 0, 1) != '_') { $xslt->registerPHPFunctions($class . '::' . $method); } } $xsl = new DOMDocument(); $xsl->load(dirname(__FILE__) . '/xsl/transform.xsl'); $xslt->importStylesheet($xsl); $xslt->setParameter('', 'path', $configArray['Site']['path']); $sXml = file_get_contents($url); $XML = new DOMDocument(); $XML->loadXML($sXml); $html = $xslt->transformToXML($XML); $html = str_replace('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">', '', $html); $html = preg_replace('/<html[^>]*>/', '<html>', $html); echo $html; }
/** * Constructor. Initialise some details about the server * * @access public */ public function __construct() { // Standard logic from parent class: parent::__construct(); global $configArray; // Connect to the index $this->_indexEngine = ConnectionManager::connectToIndex('SolrReserves'); // Set up appropriate results action: $this->resultsModule = 'Search'; $this->resultsAction = 'Reserves'; // Set up basic and advanced search types; default to basic. $this->searchType = $this->basicSearchType = 'Reserves'; // Get default facet settings $this->facetConfig = array(); $this->recommendIni = 'reserves'; // Load search preferences: $searchSettings = getExtraConfigArray('reserves'); if (isset($searchSettings['General']['facet_limit'])) { $this->_facetLimit = $searchSettings['General']['facet_limit']; } if (isset($searchSettings['General']['default_handler'])) { $this->defaultIndex = $searchSettings['General']['default_handler']; } if (isset($searchSettings['General']['default_sort'])) { $this->defaultSort = $searchSettings['General']['default_sort']; } if (isset($searchSettings['Basic_Searches'])) { $this->basicTypes = $searchSettings['Basic_Searches']; } if (isset($searchSettings['Advanced_Searches'])) { $this->advancedTypes = $searchSettings['Advanced_Searches']; } if (isset($searchSettings['Autocomplete']['enabled'])) { $this->autocompleteStatus = $searchSettings['Autocomplete']['enabled']; } // Load sort preferences (or defaults if none in .ini file): if (isset($searchSettings['Sorting'])) { $this->sortOptions = $searchSettings['Sorting']; } else { $this->sortOptions = array('instructor_str' => 'sort_instructor', 'course_str' => 'sort_course', 'department_str' => 'sort_department'); } }
/** * Get description and return html snippet * * @return void */ public function launch() { global $configArray; if (!isset($_GET['id']) || !$_GET['id']) { return; } $id = $_GET['id']; $localFile = 'interface/cache/description_' . urlencode($id) . '.txt'; $maxAge = isset($configArray['Content']['summarycachetime']) ? $configArray['Content']['summarycachetime'] : 1440; if (is_readable($localFile) && time() - filemtime($localFile) < $maxAge * 60) { // Load local cache if available header('Content-type: text/plain'); echo file_get_contents($localFile); return; } else { // Get URL $db = ConnectionManager::connectToIndex(); if (!($record = $db->getRecord($id))) { return; } $recordDriver = RecordDriverFactory::initRecordDriver($record); $url = $recordDriver->getDescriptionURL(); // Get, manipulate, save and display content if available if ($url) { if ($content = @file_get_contents($url)) { $content = preg_replace('/.*<.B>(.*)/', '\\1', $content); $content = strip_tags($content); // Replace line breaks with <br> $content = preg_replace('/(\\r\\n|\\n|\\r){3,}/', "<br><br>", $content); $content = utf8_encode($content); file_put_contents($localFile, $content); echo $content; return; } } if ($summary = $recordDriver->getSummary()) { echo implode('<br><br>', $summary); } } }
/** * Get data and output in JSON * * @return void * @access public */ public function getVisData() { global $interface; $facetField = isset($_REQUEST['facetField']) ? $_REQUEST['facetField'] : ''; $filterField = isset($_REQUEST['filterField']) ? $_REQUEST['filterField'] : ''; if (is_a($this->searchObject, 'SearchObject_Solr')) { if (isset($_REQUEST['collection'])) { //ID of the collection $collection = $_REQUEST['collection']; // Retrieve the record for this collection from the index $this->db = ConnectionManager::connectToIndex(); if (!($record = $this->db->getRecord($collection))) { PEAR::raiseError(new PEAR_Error('Record Does Not Exist')); } $this->recordDriver = RecordDriverFactory::initRecordDriver($record); //get the collection identefier for this record $this->collectionIdentifier = $this->recordDriver->getCollectionRecordIdentifier(); $this->searchObject->setCollectionField($this->collectionIdentifier); // Set the searchobjects collection id to the collection id $this->searchObject->collectionID($collection); } $this->searchObject->init(); $filters = $this->searchObject->getFilters(); $filterFields = $this->processDateFacets($filters); $facets = $this->processFacetValues(); foreach ($filterFields as $field => $val) { $facets[$field]['min'] = $val[0]; $facets[$field]['max'] = $val[1]; $facets[$field]['removalURL'] = $this->searchObject->renderLinkWithoutFilter(isset($filters[$filterField][0]) ? $field . ':' . $filters[$filterField][0] : null); if (isset($_REQUEST['collection'])) { $collection = $_REQUEST['collection']; $facets[$field]['removalURL'] = str_replace('Search/Results', 'Collection/' . $collection . '/' . $_REQUEST['collectionAction'], $facets[$field]['removalURL']); } } $this->output($facets, JSON::STATUS_OK); } else { $this->output("", JSON::STATUS_ERROR); } }
/** * Constructor. Initialise some details about the server * * @access public */ public function __construct() { // Call base class constructor parent::__construct(); global $configArray; // Initialise the index $this->_indexEngine = ConnectionManager::connectToIndex('SolrAuth'); // Set up appropriate results action: $this->resultsModule = 'Authority'; $this->resultsAction = 'Search'; // Set up basic and advanced search types; default to basic. $this->searchType = $this->basicSearchType = 'Authority'; $this->advancedSearchType = 'AuthorityAdvanced'; // Get default facet settings $this->facetConfig = array(); $this->recommendIni = 'authority'; // Load search preferences: $searchSettings = getExtraConfigArray('authority'); if (isset($searchSettings['General']['default_handler'])) { $this->defaultIndex = $searchSettings['General']['default_handler']; } if (isset($searchSettings['General']['default_sort'])) { $this->defaultSort = $searchSettings['General']['default_sort']; } if (isset($searchSettings['Basic_Searches'])) { $this->basicTypes = $searchSettings['Basic_Searches']; } if (isset($searchSettings['Advanced_Searches'])) { $this->advancedTypes = $searchSettings['Advanced_Searches']; } // Load sort preferences (or defaults if none in .ini file): if (isset($searchSettings['Sorting'])) { $this->sortOptions = $searchSettings['Sorting']; } else { $this->sortOptions = array('relevance' => 'sort_relevance', 'heading' => 'Heading'); } // Load Spelling preferences $this->spellcheck = false; }
/** * Constructor. * * @access public */ public function __construct() { global $interface; global $configArray; global $user; parent::__construct(); $this->user = UserAccount::isLoggedIn(); // Setup Search Engine Connection $this->db = ConnectionManager::connectToIndex(); // Connect to Database $this->catalog = ConnectionManager::connectToCatalog(); // Assign Exporter Options $exportOptions = array(); if ($configArray['BulkExport']['enabled']) { $options = explode(':', $configArray['BulkExport']['options']); foreach ($options as $option) { if ($configArray['Export'][$option] == true) { $exportOptions[] = $option; } } $this->exportOptions = $exportOptions; } // Get Messages $this->infoMsg = isset($_GET['infoMsg']) ? $_GET['infoMsg'] : false; $this->errorMsg = isset($_GET['errorMsg']) ? $_GET['errorMsg'] : false; $this->showExport = isset($_GET['showExport']) ? $_GET['showExport'] : false; $this->origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : false; // Set FollowUp URL if (isset($_REQUEST['followup'])) { $this->followupUrl = $configArray['Site']['url'] . "/" . $_REQUEST['followupModule']; $this->followupUrl .= "/" . $_REQUEST['followupAction']; } else { if (isset($_REQUEST['listID']) && !empty($_REQUEST['listID'])) { $this->followupUrl = $configArray['Site']['url'] . "/MyResearch/MyList/" . urlencode($_REQUEST['listID']); } else { $this->followupUrl = $configArray['Site']['url'] . "/Cart/Home"; } } }
/** * Assign comments for the current resource to the interface. * * @return void * @access public */ public static function assignComments() { global $interface, $user; $comments = new Comments(); $commentList = $comments->getComments($_GET['id']); $interface->assign('commentList', $commentList); $reported = isset($_SESSION['reportedComments']) ? $_SESSION['reportedComments'] : array(); $usersComments = array(); if (is_object($user)) { $commentInapp = new Comments_inappropriate(); $commentInapp->user_id = $user->id; $commentInapp->find(); while ($commentInapp->fetch()) { $usersComments[] = $commentInapp->comment_id; } $commentedByUser = false; foreach ($commentList as $comment) { if ($user->id == $comment->user_id) { $commentedByUser = true; break; } } } include_once 'RecordDrivers/Factory.php'; $db = ConnectionManager::connectToIndex(); $id = $_REQUEST['id']; if (!($record = $db->getRecord($id))) { PEAR::raiseError(new PEAR_Error('Record Does Not Exist')); } $recordDriver = RecordDriverFactory::initRecordDriver($record); if ($recordDriver->getSector() == 'lib') { $interface->assign('ratings', true); } $interface->assign(compact('commentedByUser')); $interface->assign('reported', array_merge($reported, $usersComments)); }
/** * Record a record hit to the statistics index when stat tracking is enabled; * this is called by the Home action. * * @return void * @access public */ public function recordHit() { global $configArray; if ($configArray['Statistics']['enabled']) { // Setup Statistics Index Connection $solrStats = ConnectionManager::connectToIndex('SolrStats'); // Save Record View $solrStats->saveRecordView($this->recordDriver->getUniqueID()); unset($solrStats); } }
/** * Initialize the index engine for searches. (This is called by the constructor * and is only a separate method to allow easy override by child classes). * * @return void * @access protected */ protected function initializeIndex() { $this->index = ConnectionManager::connectToIndex(); }
/** * Get the index engine to do a follow-up query. * * @return object * @access protected */ protected function getIndexEngine() { // Build the index engine if we don't already have one: if (!$this->index) { $this->index = ConnectionManager::connectToIndex(); } return $this->index; }
* @package Utilities * @author Tuan Nguyen <*****@*****.**> * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link http://vufind.org/wiki Wiki */ ini_set('memory_limit', '50M'); ini_set('max_execution_time', '3600'); /** * Set up util environment */ require_once 'util.inc.php'; require_once 'sys/ConnectionManager.php'; // Read Config file $configArray = readConfig(); // Setup Solr Connection $solr = ConnectionManager::connectToIndex('SolrReserves'); // Connect to ILS $catalog = ConnectionManager::connectToCatalog(); // Records to index $index = array(); // Get instructors $instructors = $catalog->getInstructors(); // Get Courses $courses = $catalog->getCourses(); // Get Departments $departments = $catalog->getDepartments(); // Get all reserve records $reserves = $catalog->findReserves('', '', ''); if (!empty($instructors) && !empty($courses) && !empty($departments) && !empty($reserves)) { // Delete existing records $solr->deleteAll();
/** * Process parameters and display the page. * * @return void * @access public */ public function launch() { global $interface; global $configArray; if (!($user = UserAccount::isLoggedIn())) { include_once 'Login.php'; Login::launch(); exit; } // Save Data if (isset($_POST['submit'])) { $this->_saveChanges($user); // After changes are saved, send the user back to an appropriate page; // either the list they were viewing when they started editing, or the // overall favorites list. if (isset($_GET['list_id'])) { $nextAction = 'MyList/' . $_GET['list_id']; } else { $nextAction = 'Favorites'; } header('Location: ' . $configArray['Site']['url'] . '/MyResearch/' . $nextAction); exit; } // Setup Search Engine Connection $db = ConnectionManager::connectToIndex(); // Get Record Information $details = $db->getRecord($_GET['id']); $interface->assign('record', $details); // Record ID $interface->assign('recordId', $_GET['id']); // Retrieve saved information about record $saved = $user->getSavedData($_GET['id']); // Add tag information $savedData = array(); foreach ($saved as $current) { // If we're filtering to a specific list, skip any other lists: if (isset($_GET['list_id']) && $current->list_id != $_GET['list_id']) { continue; } $savedData[] = array('listId' => $current->list_id, 'listTitle' => $current->list_title, 'notes' => $current->notes, 'tags' => $this->_getTags($user, $current->list_id)); } $interface->assign('savedData', $savedData); $interface->assign('listFilter', isset($_GET['list_id']) ? $_GET['list_id'] : null); $interface->setTemplate('edit.tpl'); $interface->display('layout.tpl'); }
/** * Support method for getItemStatuses() -- Get Axiell Full Item Status * * @param array $holdings Holdings for the record * @param object $catalog Catalog connection * @param array $patron Patron * * @return void * @access public * @author Erik Henriksson <*****@*****.**> * @author Ere Maijala <*****@*****.**> */ protected function getAxiellItemStatusFull($holdings, $catalog, $patron) { global $interface; global $configArray; $itemCount = 0; $requestCount = 0; $locationCount = 0; $branchCount = 0; $availableLocationCount = 0; $availableCount = 0; $itemStatusText = ''; $closestDueDate = ''; $closestDueDateStamp = 0; $journal = false; $itemStatusText = ''; $isHoldable = false; foreach ($holdings as &$location) { if (is_array($location)) { $journal = isset($location['journal']) && $location['journal']; if (is_array($location['holdings'])) { foreach ($location['holdings'] as $holding) { if (isset($holding['total'])) { $itemCount += $holding['total']; } if (isset($holding['status']) && trim($holding['status']) === JSON::REFERENCE_DESK_STATUS) { $location['status']['availableCount']++; } $branchCount++; } } if (isset($location['status'])) { if (isset($location['status']['reservations']) && $location['status']['reservations'] > $requestCount) { $requestCount = $location['status']['reservations']; } if (isset($location['status']['available']) && $location['status']['available']) { $availableLocationCount++; } if (isset($location['status']['availableCount']) && $location['status']['availableCount'] > 0) { $availableCount += $location['status']['availableCount']; } if (isset($location['status']['text']) && $location['status']['text'] != '' && $closestDueDate == '') { $itemStatusText = $location['status']['text']; } if (isset($location['status']['dueDateStamp']) && $location['status']['dueDateStamp'] != '' && isset($location['status']['closestDueDate']) && $location['status']['closestDueDate'] != '') { $dueDate = $location['status']['dueDateStamp']; if ($closestDueDateStamp < $dueDate) { $closestDueDate = $location['status']['closestDueDate']; if (isset($location['status']['text']) && $location['status']['text'] != '') { $itemStatusText = $location['status']['text']; } } } $locationCount++; } if (isset($location['is_holdable']) && $location['is_holdable']) { $isHoldable = true; } } } $id = $holdings[0]['id']; $interface->assign('id', $id); $interface->assign('holdings', $holdings); $locationThreshold = isset($configArray['Site']['locationThreshold']) ? $configArray['Site']['locationThreshold'] : 5; $branchThreshold = isset($configArray['Site']['branchThreshold']) ? $configArray['Site']['branchThreshold'] : 15; $interface->assign('itemCount', $itemCount); $interface->assign('requestCount', $requestCount); $interface->assign('branchCount', $branchCount); $interface->assign('locationCount', $locationCount); $interface->assign('availableLocationCount', $availableLocationCount); $interface->assign('availableCount', $availableCount); $interface->assign('closestDueDate', $closestDueDate); $interface->assign('itemStatusText', $itemStatusText); $interface->assign('isHoldable', $isHoldable); $interface->assign('locationThreshold', $locationThreshold); $interface->assign('branchThreshold', $branchThreshold); $interface->assign('journal', $journal); $interface->assign('referenceDeskStatus', JSON::REFERENCE_DESK_STATUS); $db = ConnectionManager::connectToIndex(); if (!($record = $db->getRecord($id))) { PEAR::raiseError(new PEAR_Error('Record Does Not Exist')); } $recordDriver = RecordDriverFactory::initRecordDriver($record); $interface->assign('patronFunctions', $recordDriver->hasPatronFunctions()); if ("driver" == CatalogConnection::getHoldsMode()) { $interface->assign('driverMode', true); } if ("driver" == CatalogConnection::getTitleHoldsMode()) { $interface->assign('titleDriverMode', true); } if (!PEAR::isError($patron)) { $holdLogic = new HoldLogicTitle($catalog); $holdingTitleHold = $holdLogic->getHold($id, $patron); $interface->assign('holdingTitleHold', $holdingTitleHold); } return $interface->fetch('AJAX/holdings-axiell.tpl'); }
/** * Initialize the index engine for searches. (This is called by the constructor * and is only a separate method to allow easy override by child classes). * * @return void * @access protected */ protected function initializeIndex() { global $configArray; $this->index = ConnectionManager::connectToIndex('SolrAuth'); }
} // Display help message if parameters missing: if (!isset($argv[2]) || $switchError) { echo "Usage: {$progName} [--test-only] [--index <type>] XML_file " . "properties_file\n" . "\tXML_file - source file to index\n" . "\tproperties_file - import configuration file\n" . "If the optional --test-only flag is set, transformed XML will be " . "displayed\non screen for debugging purposes, but it will not be " . "indexed into VuFind.\n\n" . "If the optional --index parameter is set, it must be followed by " . "the name of\na class for accessing Solr; it defaults to the standard " . "Solr class, but could\nbe overridden with, for example, SolrAuth to " . "load authority records.\n\n" . "Note: See vudl.properties and ojs.properties for configuration " . "examples.\n"; exit(1); } // Setup Local Database Connection ConnectionManager::connectToDatabase(); // Process the file (or die trying): $xml = processXSLT($argv[1], $argv[2]); if (!$xml) { exit(1); } // Save the results (or just display them, if in test mode): if (!$testMode) { $solr = ConnectionManager::connectToIndex($index); $result = $solr->saveRecord($xml); if (!PEAR::isError($result)) { echo "Successfully imported {$argv[1]}...\n"; exit(0); } else { echo "Fatal error: " . $result->getMessage() . "\n"; exit(1); } } else { echo $xml . "\n"; } /** * Main function -- transform $xmlFile using the provided $properties configuration. * * @param string $xmlFile XML file to transform.
* @author Lutz Biedinger <*****@*****.**> * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link http://vufind.org/wiki Wiki */ require_once 'util.inc.php'; require_once 'sys/ConfigArray.php'; require_once 'sys/solr.php'; require_once 'sys/SearchObject/solr.php'; require_once 'sys/SearchObject/Factory.php'; require_once 'RecordDrivers/Factory.php'; require_once 'sys/hierarchy/HierarchyTreeGenerator_JSTree.php'; print "getting config\r\n"; $configArray = readConfig(); print "creating Search Object\r\n"; $solrSearchObject = new SearchObject_Solr(); if (!$solrSearchObject) { die("Error: No connection to solr index\n"); } print "Getting Full Field Facets\r\n"; $hierarchyTopFacets = $solrSearchObject->getFullFieldFacets(array("hierarchy_top_id")); $db = ConnectionManager::connectToIndex(); print "Iterate through Values\r\n"; foreach ($hierarchyTopFacets["hierarchy_top_id"]["data"] as $hierarchyTopFacet) { $topRecord = $db->getRecord($hierarchyTopFacet[0]); $RecDriver = RecordDriverFactory::initRecordDriver($topRecord); if ($RecDriver->getHierarchyType()) { //only do this if the record is actually a hierarchy type record $generator = new HierarchyTreeGenerator_JSTree($RecDriver); $generator->generateXMLfromSolr($hierarchyTopFacet[0]); } }
/** * Save the record specified by GET parameters. * * @param object $user User who is saving the record. * * @return bool True on success, false on failure. * @access public */ public static function saveRecord($user) { // Fail if the user is not logged in: if (!$user) { return false; } $list = new User_list(); if (isset($_GET['list']) && $_GET['list'] != '') { $list->id = $_GET['list']; } else { if (isset($_POST['list']) && $_POST['list'] != '') { $list->id = $_POST['list']; } else { $list->user_id = $user->id; $list->title = "My Favorites"; if (!$list->find(true)) { $list->insert(); } } } // Remember that the list was used so it can be the default in future // dialog boxes: $list->rememberLastUsed(); // Setup Search Engine Connection $db = ConnectionManager::connectToIndex('MetaLib'); // Get Record Information $record = $db->getRecord($_GET['id']); if (!$record) { return false; } $resource = new Resource(); $resource->record_id = $_GET['id']; $resource->source = 'MetaLib'; if (!$resource->find(true)) { $resource->data = serialize($record); $resource->insert(); } else { $resource->data = serialize($record); $resource->update(); } preg_match_all('/"[^"]*"|[^ ]+/', isset($_GET['mytags']) ? $_GET['mytags'] : '', $tagArray); return $user->addResource($resource, $list, $tagArray[0], isset($_GET['notes']) ? $_GET['notes'] : ''); }