-
Notifications
You must be signed in to change notification settings - Fork 0
Core Components
- Purpose: Smarty template engine wrapper
- Extends: Smarty
-
Key Methods:
-
__construct()- Sets up template directories, registers functions -
assign()- Assign variables to templates -
display()- Render template
-
- Purpose: Session management for VuFind
- Extends: DSession
-
Singleton Pattern:
VFSession::instance() -
Key Methods:
-
instance()- Get/create session instance - (Inherits from DSession: set, get, delete, is_set)
-
- Purpose: Database-backed session storage
-
Storage: MySQL
sessionstable -
Key Features:
- UUID-based session IDs
- HttpOnly secure cookies
- Automatic session expiration
- Data serialization
-
Key Methods:
-
singleton()- Get/create session -
set($var, $val)- Store data -
is_set($var, $val)- Check existence -
get($var)- Retrieve data -
delete($var)- Remove data -
write()- Persist to database -
kill()- Destroy session
-
- Purpose: Solr search interface
-
Key Methods:
-
__construct($host, $index)- Connect to Solr -
simplesearch($query)- Execute search -
standardSearchComponents()- Construct Solr query -
getRecord($id)- Fetch single record
-
- Purpose: HTTP client for Solr
- Uses: HTTP_Request2 (PEAR)
-
Key Methods:
-
send($url)- Execute HTTP request - Response parsing and error handling
-
- Purpose: HathiTrust user access status
-
Data Source:
HTstatuscookie (set by Shibboleth SSO) -
Key Properties:
-
$logged_in- Boolean -
$institution_code- Institution identifier -
$auth_type- Authentication method -
$emergency_access- Emergency access flag -
$mapped_institution_code- Mapped institution for consortia
-
- Purpose: IP geolocation
- Database: MaxMind GeoIP2
-
Key Methods:
-
ip_to_iso($ip)- Get country code from IP
-
- Purpose: Record-specific business logic
-
Key Methods:
- Access determination
- Rights interpretation
- Format detection
- URL generation
All controllers (service/Record/Record.php and service/Search/Home.php) extend the base Action class. The base Action class is a PEAR-derived stub whose only method is an empty launch(); every service action is expected to override launch (or run its workflow on construction).
services/Record/Record.php keeps the action inside the constructor instead of overriding launch, instantiating a record immediately normalizes the incoming id/mergesearch parameters (including redirects/404s or merged-item shortcuts), records the default tab, and wires $interface with session metadata and the configured search engine before pulling the MARC data.
Once the raw record is retrieved, it is assigned to Smarty, decorated with summary/link data, similar records, subjects, legacy URLs, and the MDL flag so the templated view can render the “record” page without any further controller logic; helpers like getEditions() and getLinkNums() keep per-record enrichment localized.
services/Search/Home.php follows the more conventional action pattern: launch() calls setup() to build the SearchStructure, session, and the Solr connection, then decides whether module/action parameters are present.
- If so, it sets the page title and invokes search(); otherwise, it renders the static home page.
-
search()acts as the main workflow: it primesSmartywith sort/search/session/facet metadata, enforces pagination limits, callsnewprocessSearch()to run the backend query, handles no-results/error cases, enriches each hit with MARC/title/link data, caches the query in a cookie, and finally displays the list template after populating facet counts. - The supporting methods
newprocessSearch()andgetFacetCounts()encapsulate the Solr call and facet aggregation sosearch()can remain a clean orchestration point.
- Home.php - Search results page
- Advanced.php - Advanced search form
- Reserves.php - Course reserves
- Suggest.php - Autocomplete suggestions
- SearchExport.php - RSS feed generation
- Error.php - Error action
- Home.php - Record display
- Export.php - Citation export formats
- RecordUtils.php - Record utility functions . . .