Amicus
extends AbstractBase
in package
implements
TranslatorAwareInterface
Uses
TranslatorAwareTrait
Amicus ILS Driver
Tags
Interfaces, Classes, Traits and Enums
- TranslatorAwareInterface
- Lightweight translator aware marker interface (used as an alternative to \Laminas\I18n\Translator\TranslatorAwareInterface, which requires an excessive number of methods to be implemented).
Table of Contents
- $config : array<string|int, mixed>
- Driver configuration
- $db : PDO
- Database connection
- $statusRankings : array<string|int, mixed>|bool
- Stored status rankings from the database; initialized to false but populated by the pickStatus() method.
- $translator : TranslatorInterface
- Translator
- findReserves() : array<string|int, mixed>
- Find Reserves
- getFunds() : array<string|int, mixed>
- Get Funds
- getHolding() : array<string|int, mixed>
- Get Holding
- getHoldLink() : string
- Get Hold Link
- getMyFines() : mixed
- Get Patron Fines
- getMyHolds() : array<string|int, mixed>
- Get Patron Holds
- getMyProfile() : array<string|int, mixed>
- Get Patron Profile
- getMyTransactions() : array<string|int, mixed>
- Get Patron Transactions
- getNewItems() : array<string|int, mixed>
- Get New Items
- getPurchaseHistory() : array<string|int, mixed>
- Get Purchase History
- getStatus() : mixed
- Get Status
- getStatuses() : array<string|int, mixed>
- Get Statuses
- getSuppressedRecords() : array<string|int, mixed>
- Get suppressed records.
- getTranslator() : TranslatorInterface
- Get translator object.
- getTranslatorLocale() : string
- Get the locale from the translator.
- init() : void
- Initialize the driver.
- patronLogin() : mixed
- Patron Login
- setConfig() : void
- Set configuration.
- setTranslator() : TranslatorAwareInterface
- Set a translator
- translate() : string
- Translate a string (or string-castable object)
- translateWithPrefix() : string
- Translate a string (or string-castable object) using a prefix, or without the prefix if a prefixed translation is not found.
- determineAvailability() : array<string|int, mixed>
- Support method to take an array of status strings and determine whether or not this indicates an available item. Returns an array with two keys: 'available', the boolean availability status, and 'otherStatuses', every status code found other than "Not Charged" - for use with _pickStatus().
- extractTextDomain() : array<string|int, mixed>
- Given a translation string with or without a text domain, return an array with the raw string and the text domain separated.
- getDebugTranslation() : string
- Build a debug-mode translation
- pickStatus() : string
- Support method to pick which status message to display when multiple options are present.
- sacaFecha() : string
- Function that returns the due date or a special message.
- sacaReservas() : int
- Function that returns the numbers of holds for a copy id number given.
- sacaStatus() : int
- Function that returns the number or on loan items for a given copy number.
- sanitizeTranslationKey() : string
- Make sure there are not any illegal characters in the translation key that might prevent successful lookup in language files.
- throwAsIlsException() : never
- Rethrow the provided exception as an ILS exception.
- translateString() : string
- Get translation for a string
Properties
$config
Driver configuration
protected
array<string|int, mixed>
$config
= []
$db
Database connection
protected
PDO
$db
$statusRankings
Stored status rankings from the database; initialized to false but populated by the pickStatus() method.
protected
array<string|int, mixed>|bool
$statusRankings
= false
$translator
Translator
protected
TranslatorInterface
$translator
= null
Methods
findReserves()
Find Reserves
public
findReserves(string $course, string $inst, string $dept) : array<string|int, mixed>
Obtain information on course reserves.
Parameters
- $course : string
-
ID from getCourses (empty string to match all)
- $inst : string
-
ID from getInstructors (empty string to match all)
- $dept : string
-
ID from getDepartments (empty string to match all)
Tags
Return values
array<string|int, mixed> —An array of associative arrays representing reserve items.
getFunds()
Get Funds
public
getFunds() : array<string|int, mixed>
Return a list of funds which may be used to limit the getNewItems list.
Tags
Return values
array<string|int, mixed> —An associative array with key = fund ID, value = fund name.
getHolding()
Get Holding
public
getHolding(string $id[, array<string|int, mixed> $patron = null ][, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
This is responsible for retrieving the holding information of a certain record.
Parameters
- $id : string
-
The record id to retrieve the holdings for
- $patron : array<string|int, mixed> = null
-
Patron data
- $options : array<string|int, mixed> = []
-
Extra options (not currently used)
Tags
Return values
array<string|int, mixed> —On success, an associative array with the following keys: id, availability (boolean), status, location, reserve, callnumber, duedate, number, barcode.
getHoldLink()
Get Hold Link
public
getHoldLink(string $recordId, array<string|int, mixed> $details) : string
The goal for this method is to return a URL to a "place hold" web page on the ILS OPAC. This is used for ILSs that do not support an API or method to place Holds.
Parameters
- $recordId : string
-
The id of the bib record
- $details : array<string|int, mixed>
-
Item details from getHoldings return array
Tags
Return values
string —URL to ILS's OPAC's place hold screen.
getMyFines()
Get Patron Fines
public
getMyFines(array<string|int, mixed> $patron) : mixed
This is responsible for retrieving all fines by a specific patron.
Parameters
- $patron : array<string|int, mixed>
-
The patron array from patronLogin
Tags
Return values
mixed —Array of the patron's fines on success.
getMyHolds()
Get Patron Holds
public
getMyHolds(array<string|int, mixed> $patron) : array<string|int, mixed>
This is responsible for retrieving all holds by a specific patron.
Parameters
- $patron : array<string|int, mixed>
-
The patron array from patronLogin
Tags
Return values
array<string|int, mixed> —Array of the patron's holds on success.
getMyProfile()
Get Patron Profile
public
getMyProfile(array<string|int, mixed> $patron) : array<string|int, mixed>
This is responsible for retrieving the profile for a specific patron.
Parameters
- $patron : array<string|int, mixed>
-
The patron array
Tags
Return values
array<string|int, mixed> —Array of the patron's profile data on success.
getMyTransactions()
Get Patron Transactions
public
getMyTransactions(array<string|int, mixed> $patron) : array<string|int, mixed>
This is responsible for retrieving all transactions (i.e. checked out items) by a specific patron.
Parameters
- $patron : array<string|int, mixed>
-
The patron array from patronLogin
Tags
Return values
array<string|int, mixed> —Array of the patron's transactions on success.
getNewItems()
Get New Items
public
getNewItems(int $page, int $limit, int $daysOld[, int $fundId = null ]) : array<string|int, mixed>
Retrieve the IDs of items recently added to the catalog.
Parameters
- $page : int
-
Page number of results to retrieve (counting starts at 1)
- $limit : int
-
The size of each page of results to retrieve
- $daysOld : int
-
The maximum age of records to retrieve in days (max. 30)
- $fundId : int = null
-
optional fund ID to use for limiting results (use a value returned by getFunds, or exclude for no limit); note that "fund" may be a misnomer - if funds are not an appropriate way to limit your new item results, you can return a different set of values from getFunds. The important thing is that this parameter supports an ID returned by getFunds, whatever that may mean.
Tags
Return values
array<string|int, mixed> —Associative array with 'count' and 'results' keys
getPurchaseHistory()
Get Purchase History
public
getPurchaseHistory(string $id) : array<string|int, mixed>
This is responsible for retrieving the acquisitions history data for the specific record (usually recently received issues of a serial).
Parameters
- $id : string
-
The record id to retrieve the info for
Tags
Return values
array<string|int, mixed> —An array with the acquisitions data on success.
getStatus()
Get Status
public
getStatus(string $id) : mixed
This is responsible for retrieving the status information of a certain record.
Parameters
- $id : string
-
The record id to retrieve the holdings for
Tags
Return values
mixed —On success, an associative array with the following keys: id, availability (boolean), status, location, reserve, callnumber.
getStatuses()
Get Statuses
public
getStatuses(array<string|int, mixed> $idList) : array<string|int, mixed>
This is responsible for retrieving the status information for a collection of records.
Parameters
- $idList : array<string|int, mixed>
-
The array of record ids to retrieve the status for
Tags
Return values
array<string|int, mixed> —An array of getStatus() return values on success.
getSuppressedRecords()
Get suppressed records.
public
getSuppressedRecords() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —ID numbers of suppressed records in the system.
getTranslator()
Get translator object.
public
getTranslator() : TranslatorInterface
Return values
TranslatorInterface —getTranslatorLocale()
Get the locale from the translator.
public
getTranslatorLocale([string $default = 'en' ]) : string
Parameters
- $default : string = 'en'
-
Default to use if translator absent.
Return values
string —init()
Initialize the driver.
public
init() : void
Validate configuration and perform all resource-intensive tasks needed to make the driver active.
Tags
Return values
void —patronLogin()
Patron Login
public
patronLogin(string $barcode, string $lname) : mixed
This is responsible for authenticating a patron against the catalog.
Parameters
- $barcode : string
-
The patron username
- $lname : string
-
The patron's password
Tags
Return values
mixed —Associative array of patron info on successful login, null on unsuccessful login.
setConfig()
Set configuration.
public
setConfig(array<string|int, mixed> $config) : void
Set the configuration for the driver.
Parameters
- $config : array<string|int, mixed>
-
Configuration array (usually loaded from a VuFind .ini file whose name corresponds with the driver class name).
Return values
void —setTranslator()
Set a translator
public
setTranslator(TranslatorInterface $translator) : TranslatorAwareInterface
Parameters
- $translator : TranslatorInterface
-
Translator
Return values
TranslatorAwareInterface —translate()
Translate a string (or string-castable object)
public
translate(string|object|array<string|int, mixed> $target[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, bool $useIcuFormatter = false ][, array<string|int, string> $fallbackDomains = [] ]) : string
Parameters
- $target : string|object|array<string|int, mixed>
-
String to translate or an array of text domain and string to translate
- $tokens : array<string|int, mixed> = []
-
Tokens to inject into the translated string
- $default : string = null
-
Default value to use if no translation is found (null for no default).
- $useIcuFormatter : bool = false
-
Should we use an ICU message formatter instead of the default behavior?
- $fallbackDomains : array<string|int, string> = []
-
Text domains to check if no match is found in the domain specified in $target
Return values
string —translateWithPrefix()
Translate a string (or string-castable object) using a prefix, or without the prefix if a prefixed translation is not found.
public
translateWithPrefix(string $prefix, string|object|array<string|int, mixed> $target[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, bool $useIcuFormatter = false ][, array<string|int, string> $fallbackDomains = [] ]) : string
Parameters
- $prefix : string
-
Translation key prefix
- $target : string|object|array<string|int, mixed>
-
String to translate or an array of text domain and string to translate
- $tokens : array<string|int, mixed> = []
-
Tokens to inject into the translated string
- $default : string = null
-
Default value to use if no translation is found (null for no default).
- $useIcuFormatter : bool = false
-
Should we use an ICU message formatter instead of the default behavior?
- $fallbackDomains : array<string|int, string> = []
-
Text domains to check if no match is found in the domain specified in $target
Return values
string —determineAvailability()
Support method to take an array of status strings and determine whether or not this indicates an available item. Returns an array with two keys: 'available', the boolean availability status, and 'otherStatuses', every status code found other than "Not Charged" - for use with _pickStatus().
protected
determineAvailability(array<string|int, mixed> $statusArray) : array<string|int, mixed>
Parameters
- $statusArray : array<string|int, mixed>
-
The status codes to analyze.
Return values
array<string|int, mixed> —Availability and other status information.
extractTextDomain()
Given a translation string with or without a text domain, return an array with the raw string and the text domain separated.
protected
extractTextDomain(string|object|array<string|int, mixed> $target) : array<string|int, mixed>
Parameters
- $target : string|object|array<string|int, mixed>
-
String to translate or an array of text domain and string to translate
Return values
array<string|int, mixed> —getDebugTranslation()
Build a debug-mode translation
protected
getDebugTranslation(string $domain, string $str, array<string|int, mixed> $tokens) : string
Parameters
- $domain : string
-
Text domain
- $str : string
-
String to translate
- $tokens : array<string|int, mixed>
-
Tokens to inject into the translated string
Return values
string —pickStatus()
Support method to pick which status message to display when multiple options are present.
protected
pickStatus(array<string|int, mixed> $statusArray) : string
Parameters
- $statusArray : array<string|int, mixed>
-
Array of status messages to choose from.
Return values
string —The best status message to display.
sacaFecha()
Function that returns the due date or a special message.
protected
sacaFecha(int $copyId) : string
If the difference is greater than 50 days it will return one special message If not it returns the due date
Parameters
- $copyId : int
-
The copy id number to check.
Return values
string —String with special message or due date.
sacaReservas()
Function that returns the numbers of holds for a copy id number given.
protected
sacaReservas(int $holdingId) : int
If there is no holds it returns 0.
Parameters
- $holdingId : int
-
The copy id number to check.
Return values
int —Integer with the number of holds.
sacaStatus()
Function that returns the number or on loan items for a given copy number.
protected
sacaStatus(int $copyId) : int
If there is no on loan items it returns 0. Used in getHolding and getStatus functions
Parameters
- $copyId : int
-
The copy id number to check.
Return values
int —Number of on loan items.
sanitizeTranslationKey()
Make sure there are not any illegal characters in the translation key that might prevent successful lookup in language files.
protected
sanitizeTranslationKey(string $key) : string
Parameters
- $key : string
-
Key to sanitize
Return values
string —Sanitized key
throwAsIlsException()
Rethrow the provided exception as an ILS exception.
protected
throwAsIlsException(Throwable $exception[, string $msg = null ]) : never
Parameters
- $exception : Throwable
-
Exception to rethrow
- $msg : string = null
-
Override exception message (optional)
Tags
Return values
never —translateString()
Get translation for a string
protected
translateString(string $rawStr[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, string $domain = 'default' ][, bool $useIcuFormatter = false ]) : string
Parameters
- $rawStr : string
-
String to translate
- $tokens : array<string|int, mixed> = []
-
Tokens to inject into the translated string
- $default : string = null
-
Default value to use if no translation is found (null for no default).
- $domain : string = 'default'
-
Text domain (omit for default)
- $useIcuFormatter : bool = false
-
Should we use an ICU message formatter instead of the default behavior?