VuFind API Documentation

NoILS extends AbstractBase
in package
implements TranslatorAwareInterface Uses TranslatorAwareTrait

Driver for offline/missing ILS.

Tags
category

VuFind

author

Luke O'Sullivan l.osullivan@swansea.ac.uk

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

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
$recordLoader  : Loader
Record loader
$translator  : TranslatorInterface
Translator
__construct()  : mixed
Constructor
findReserves()  : array<string|int, mixed>
Find Reserves
getConfig()  : array<string|int, mixed>
Public Function which retrieves renew, hold and cancel settings from the driver ini file.
getCourses()  : array<string|int, mixed>
Get Courses
getDepartments()  : array<string|int, mixed>
Get Departments
getFunds()  : array<string|int, mixed>
Get Funds
getHolding()  : array<string|int, mixed>
Get Holding
getInstructors()  : array<string|int, mixed>
Get Instructors
getNewItems()  : array<string|int, mixed>
Get New Items
getOfflineMode()  : string
Get Offline Mode
getPurchaseHistory()  : array<string|int, mixed>
Get Purchase History
getStatus()  : mixed
Get Status
getStatuses()  : array<string|int, mixed>
Get Statuses
getTranslator()  : TranslatorInterface
Get translator object.
getTranslatorLocale()  : string
Get the locale from the translator.
hasHoldings()  : bool
Has Holdings
init()  : void
Initialize the driver.
loginIsHidden()  : bool
Get Hidden Login Mode
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.
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
getFormattedMarcDetails()  : array<string|int, mixed>
This is responsible for retrieving the status or holdings information of a certain record from a Marc Record.
getIdPrefix()  : string
Get the ID prefix from the configuration, if set.
getSolrRecord()  : AbstractBase
Get a Solr record.
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 = []

$recordLoader

Record loader

protected Loader $recordLoader

Methods

__construct()

Constructor

public __construct(Loader $loader) : mixed
Parameters
$loader : Loader

Record loader

Return values
mixed

findReserves()

Find Reserves

public findReserves(string $course, string $inst, string $dept) : array<string|int, mixed>

Obtain information on course reserves.

This version of findReserves was contributed by Matthew Hooper and includes support for electronic reserves (though eReserve support is still a work in progress).

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
throws
ILS
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
array<string|int, mixed>

An array of associative arrays representing reserve items.

getConfig()

Public Function which retrieves renew, hold and cancel settings from the driver ini file.

public getConfig(string $function[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$function : string

The name of the feature to be checked

$params : array<string|int, mixed> = []

Optional feature-specific parameters (array)

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
array<string|int, mixed>

An array with key-value pairs.

getCourses()

Get Courses

public getCourses() : array<string|int, mixed>

Obtain a list of courses for use in limiting the reserves list.

Tags
throws
ILS
Return values
array<string|int, mixed>

An associative array with key = ID, value = name.

getDepartments()

Get Departments

public getDepartments() : array<string|int, mixed>

Obtain a list of departments for use in limiting the reserves list.

Tags
throws
ILS
Return values
array<string|int, mixed>

An associative array with key = dept. ID, value = dept. name.

getFunds()

Get Funds

public getFunds() : array<string|int, mixed>

Return a list of funds which may be used to limit the getNewItems list.

Tags
throws
ILS
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
throws
ILS
SuppressWarnings

(PHPMD.UnusedFormalParameter)

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.

getInstructors()

Get Instructors

public getInstructors() : array<string|int, mixed>

Obtain a list of instructors for use in limiting the reserves list.

Tags
throws
ILS
Return values
array<string|int, mixed>

An associative array with key = ID, value = name.

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
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
array<string|int, mixed>

Associative array with 'count' and 'results' keys

getOfflineMode()

Get Offline Mode

public getOfflineMode() : string

This is responsible for returning the offline mode

Return values
string

"ils-offline" for systems where the main ILS is offline, "ils-none" for systems which do not use an ILS

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

Return values
array<string|int, mixed>

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
throws
ILS
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
throws
ILS
Return values
array<string|int, mixed>

An array of getStatus() return values on success.

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

hasHoldings()

Has Holdings

public hasHoldings(string $id) : bool

This is responsible for determining if holdings exist for a particular bibliographic id

Parameters
$id : string

The record id to retrieve the holdings for

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
bool

True if holdings exist, False if they do not

init()

Initialize the driver.

public init() : void

Validate configuration and perform all resource-intensive tasks needed to make the driver active.

Tags
throws
ILS
Return values
void

loginIsHidden()

Get Hidden Login Mode

public loginIsHidden() : bool

This is responsible for indicating whether login should be hidden.

Return values
bool

true if the login should be hidden, false if not

patronLogin()

Patron Login

public patronLogin(string $username, string $password) : mixed

This is responsible for authenticating a patron against the catalog.

Parameters
$username : string

Patron username

$password : string

Patron password

Tags
throws
ILS
SuppressWarnings

(PHPMD.UnusedFormalParameter)

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

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

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

getFormattedMarcDetails()

This is responsible for retrieving the status or holdings information of a certain record from a Marc Record.

protected getFormattedMarcDetails(object $recordDriver, string $configSection) : array<string|int, mixed>
Parameters
$recordDriver : object

A RecordDriver Object

$configSection : string

Section of driver config containing data on how to extract details from MARC.

Return values
array<string|int, mixed>

An Array of Holdings Information

getIdPrefix()

Get the ID prefix from the configuration, if set.

protected getIdPrefix() : string
Return values
string

getSolrRecord()

Get a Solr record.

protected getSolrRecord(string $id) : AbstractBase
Parameters
$id : string

ID of record to retrieve

Return values
AbstractBase

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
throws
ILS
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?

Return values
string

Search results