VuFind API Documentation

Virtua extends AbstractBase
in package
implements HttpServiceAwareInterface Uses HttpServiceAwareTrait

VTLS Virtua Driver

Tags
category

VuFind

author

Greg Pendlebury vufind-tech@lists.sourceforge.net

license

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

link

Wiki

Interfaces, Classes, Traits and Enums

HttpServiceAwareInterface

Table of Contents

$config  : array<string|int, mixed>
Driver configuration
$db  : Oracle
Oracle connection
cancelHolds()  : array<string|int, mixed>
Cancel Holds
findReserves()  : array<string|int, mixed>
Find Reserves
getAll853()  : array<string|int, mixed>
Used for TESTING only. Grabs all prediction patterns in the system for analysis
getCancelHoldDetails()  : string
Get Cancel Hold Details
getCourses()  : array<string|int, mixed>
Get Courses
getHolding()  : array<string|int, mixed>
Get Holding
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
getOpeningHours()  : array<string|int, mixed>
Retrieve the opening hours for all campuses.
getPurchaseHistory()  : array<string|int, mixed>
Get Purchase History
getRenewDetails()  : string
Get Renew Details
getStatus()  : mixed
Get Status
getStatuses()  : array<string|int, mixed>
Get Statuses
getSuppressedAuthorityRecords()  : array<string|int, mixed>
Get suppressed authority records
init()  : void
Initialize the driver.
patronLogin()  : mixed
Patron Login
placeHold()  : mixed
Place Hold
renewMyItems()  : array<string|int, mixed>
Renew My Items
setConfig()  : void
Set configuration.
cancelHold()  : bool
Cancel a request in virtua.
checkHoldAllowed()  : array<string|int, mixed>
Check if this patron is allowed to place a request.
fakeLogin()  : string
Fake a virtua login on the patron's behalf.
getApiBaseUrl()  : string
Support method -- get base URL for API requests.
getConfiguredLanguage()  : string
Support method -- determine the language from the configuration.
getField()  : mixed
Simple utility -- retrieve data matching a code
httpRequest()  : string
Support method -- perform an HTTP request. This will be a GET request unless either $postParams or $rawPost is set to a non-null value.
renderOtherPattern()  : array<string|int, mixed>
Currently used to handled note SUBfields eg. 863/z, not 866 generally but anything non enum and chrono related ends up here.
renderPartSubPattern()  : string
Patterns coming in here are either all chrono patterns, or no chrono patterns.
renderPattern()  : array<string|int, mixed>
Renders individual holdings against a pattern Note fields and prediction patterns are handled separately
renderSerialHoldings()  : array<string|int, mixed>
A function turning holdings marc into an array of display ready strings.
renderSubPattern()  : string
Breaks up the full pattern into chrono and other chrono = (year) etc... ie. gets replaced inline other = most enum holdings or 'Pt.'... ie. get concatenated
throwAsIlsException()  : never
Rethrow the provided exception as an ILS exception.

Properties

$config

Driver configuration

protected array<string|int, mixed> $config = []

Methods

cancelHolds()

Cancel Holds

public cancelHolds(array<string|int, mixed> $cancelDetails) : array<string|int, mixed>

Attempts to Cancel a hold or recall on a particular item. The data in $cancelDetails['details'] is determined by getCancelHoldDetails().

Parameters
$cancelDetails : array<string|int, mixed>

An array of item and patron data

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
array<string|int, mixed>

An array of data on each request including whether or not it was successful and a system message (if available)

findReserves()

Find Reserves

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

Obtain information on course reserves.

Parameters
$course : string

ID from getCourses (empty string to match all)

$inst : string = false

ID from getInstructors (empty string to match all)

$dept : string = false

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.

getAll853()

Used for TESTING only. Grabs all prediction patterns in the system for analysis

public getAll853() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCancelHoldDetails()

Get Cancel Hold Details

public getCancelHoldDetails(array<string|int, mixed> $holdDetails[, array<string|int, mixed> $patron = [] ]) : string

In order to cancel a hold, Voyager requires the patron details an item ID and a recall ID. This function returns the item id and recall id as a string separated by a pipe, which is then submitted as form data in Hold.php. This value is then extracted by the CancelHolds function.

Parameters
$holdDetails : array<string|int, mixed>

A single hold array from getMyHolds

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

Patron information from patronLogin

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
string

Data for use in a form field

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.

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
DateException
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.

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

Array of the patron's transactions on success.

getOpeningHours()

Retrieve the opening hours for all campuses.

public getOpeningHours([string $fake_time = null ]) : array<string|int, mixed>
  • Used on the home page to show time information.
Parameters
$fake_time : string = null

Optional time string (for debugging purposes)

Return values
array<string|int, mixed>

Opening hours information.

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

An array with the acquisitions data on success.

getRenewDetails()

Get Renew Details

public getRenewDetails(array<string|int, mixed> $checkOutDetails) : string

In order to renew an item, Voyager requires the patron details and an item id. This function returns the item id as a string which is then used as submitted form data in checkedOut.php. This value is then extracted by the RenewMyItems function.

Parameters
$checkOutDetails : array<string|int, mixed>

An array of item data

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
string

Data for use in a form field

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.

getSuppressedAuthorityRecords()

Get suppressed authority records

public getSuppressedAuthorityRecords() : array<string|int, mixed>
Return values
array<string|int, mixed>

ID numbers of suppressed authority records in the system.

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

patronLogin()

Patron Login

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

This is responsible for authenticating a patron against the catalog.

Parameters
$barcode : string

The patron barcode

$password : string

The patron password

Tags
throws
ILS
Return values
mixed

Associative array of patron info on successful login, null on unsuccessful login.

placeHold()

Place Hold

public placeHold(array<string|int, mixed> $holdDetails) : mixed

Attempts to place a hold or recall on a particular item and returns an array with result details or throws an exception on failure of support classes

Parameters
$holdDetails : array<string|int, mixed>

An array of item and patron data

Tags
throws
ILS
Return values
mixed

An array of data on the request including whether or not it was successful and a system message (if available)

renewMyItems()

Renew My Items

public renewMyItems(array<string|int, mixed> $renewDetails) : array<string|int, mixed>

Function for attempting to renew a patron's items. The data in $renewDetails['details'] is determined by getRenewDetails().

Parameters
$renewDetails : array<string|int, mixed>

An array of data required for renewing items including the Patron ID and an array of renewal IDS

Return values
array<string|int, mixed>

An array of renewal information keyed by item ID

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

cancelHold()

Cancel a request in virtua.

protected cancelHold(string $request_number) : bool
  • Return true/false for success/failure.
Parameters
$request_number : string

ID of hold to cancel

Return values
bool

checkHoldAllowed()

Check if this patron is allowed to place a request.

protected checkHoldAllowed(string $patron_id, array<string|int, mixed> $holdings) : array<string|int, mixed>
  • Return the holdings array with true/false and a reason.

Because of the location comparisons with the patron's location that occur here we also take the oppurtunity to push their "Home" location to the top.

Parameters
$patron_id : string

ID of patron

$holdings : array<string|int, mixed>

Holdings information from getHolding

Return values
array<string|int, mixed>

Holdings info augmented with req_allowed field

fakeLogin()

Fake a virtua login on the patron's behalf.

protected fakeLogin(array<string|int, mixed> $patron) : string
  • Return a session id.
Parameters
$patron : array<string|int, mixed>

Array with cat_username/cat_password keys

Return values
string

Session ID

getApiBaseUrl()

Support method -- get base URL for API requests.

protected getApiBaseUrl() : string
Return values
string

getConfiguredLanguage()

Support method -- determine the language from the configuration.

protected getConfiguredLanguage() : string
Return values
string

getField()

Simple utility -- retrieve data matching a code

protected getField(array<string|int, mixed> $data, string $code) : mixed
Parameters
$data : array<string|int, mixed>

Data to search

$code : string

Code to search for

Return values
mixed

httpRequest()

Support method -- perform an HTTP request. This will be a GET request unless either $postParams or $rawPost is set to a non-null value.

protected httpRequest(string $url[, array<string|int, mixed> $postParams = null ][, string $rawPost = null ]) : string
Parameters
$url : string

Target URL for request

$postParams : array<string|int, mixed> = null

Associative array of POST parameters (null for none).

$rawPost : string = null

String representing raw POST parameters (null for none).

Tags
throws
ILS
Return values
string

Response body

renderOtherPattern()

Currently used to handled note SUBfields eg. 863/z, not 866 generally but anything non enum and chrono related ends up here.

protected renderOtherPattern(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>

Data to render

Return values
array<string|int, mixed>

renderPartSubPattern()

Patterns coming in here are either all chrono patterns, or no chrono patterns.

protected renderPartSubPattern(array<string|int, mixed> $data) : string

This function takes care of the final string render for each pattern subpart.

Parameters
$data : array<string|int, mixed>

Data to render

Return values
string

renderPattern()

Renders individual holdings against a pattern Note fields and prediction patterns are handled separately

protected renderPattern(array<string|int, mixed> $patterns, array<string|int, mixed> $field) : array<string|int, mixed>
Parameters
$patterns : array<string|int, mixed>

Pattern data

$field : array<string|int, mixed>

Field data

Return values
array<string|int, mixed>

renderSerialHoldings()

A function turning holdings marc into an array of display ready strings.

protected renderSerialHoldings(array<string|int, mixed> $holdings_marc) : array<string|int, mixed>
Parameters
$holdings_marc : array<string|int, mixed>

Holdings data from MARC.

Return values
array<string|int, mixed>

renderSubPattern()

Breaks up the full pattern into chrono and other chrono = (year) etc... ie. gets replaced inline other = most enum holdings or 'Pt.'... ie. get concatenated

protected renderSubPattern(array<string|int, mixed> $data) : string

The same sub function handles both, but they must be sent in like groups.

Parameters
$data : array<string|int, mixed>

Data to render

Return values
string

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

Search results