GetItemStatuses
extends AbstractBase
in package
implements
TranslatorAwareInterface, HasSorterInterface
Uses
TranslatorAwareTrait, HasSorterTrait
"Get Item Status" AJAX handler
This is responsible for printing the holdings information for a collection of records in JSON format.
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).
- HasSorterInterface
- Interface SortingInterface
Table of Contents
- $availabilityStatusManager : AvailabilityStatusManager
- $config : Config
- $holdLogic : Holds
- $ils : Connection
- $renderer : RendererInterface
- $sessionSettings : Settings
- Session settings
- $sorter : SorterInterface|null
- Sorter
- $translator : TranslatorInterface
- Translator
- __construct() : mixed
- Constructor
- getSorter() : SorterInterface
- Get the sorter
- getTranslator() : TranslatorInterface
- Get translator object.
- getTranslatorLocale() : string
- Get the locale from the translator.
- handleRequest() : array<string|int, mixed>
- Handle a request.
- setSorter() : void
- Set the sorter
- 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.
- disableSessionWrites() : void
- Prevent session writes -- this is designed to be called prior to time- consuming AJAX operations to help reduce the odds of a timing-related bug that causes the wrong version of session data to be written to disk (see VUFIND-716 for more details).
- 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.
- filterSuppressedLocations() : array<string|int, mixed>
- Support method for getItemStatuses() -- filter suppressed locations from the array of item information for a particular bib record.
- formatCallNo() : string
- Create a delimited version of the call number to allow the Javascript code to handle the prefix appropriately.
- formatResponse() : array<string|int, mixed>
- Format a response array.
- getAvailabilityMessage() : string
- Get a message for availability status
- getCallnumberHandler() : string
- Based on settings and the number of callnumbers, return callnumber handler Use callnumbers before pickValue is run.
- getDebugTranslation() : string
- Build a debug-mode translation
- getItemStatus() : array<string|int, mixed>
- Support method for getItemStatuses() -- process a single bibliographic record for location settings other than "group".
- getItemStatusError() : array<string|int, mixed>
- Support method for getItemStatuses() -- process a failed record.
- getItemStatusGroup() : array<string|int, mixed>
- Support method for getItemStatuses() -- process a single bibliographic record for "group" location setting.
- pickValue() : string
- Support method for getItemStatuses() -- when presented with multiple values, pick which one(s) to send back via AJAX.
- reduceServices() : string
- Reduce an array of service names to a human-readable string.
- renderFullStatus() : string
- Render full item status.
- sanitizeTranslationKey() : string
- Make sure there are not any illegal characters in the translation key that might prevent successful lookup in language files.
- translateList() : array<string|int, mixed>
- Translate an array of strings using a prefix.
- translateString() : string
- Get translation for a string
Properties
$availabilityStatusManager
protected
AvailabilityStatusManager
$availabilityStatusManager
$config
protected
Config
$config
$holdLogic
protected
Holds
$holdLogic
$ils
protected
Connection
$ils
$renderer
protected
RendererInterface
$renderer
$sessionSettings
Session settings
protected
Settings
$sessionSettings
= null
$sorter
Sorter
protected
SorterInterface|null
$sorter
= null
$translator
Translator
protected
TranslatorInterface
$translator
= null
Methods
__construct()
Constructor
public
__construct(Settings $ss, Config $config, Connection $ils, RendererInterface $renderer, Holds $holdLogic, AvailabilityStatusManager $availabilityStatusManager) : mixed
Parameters
- $ss : Settings
-
Session settings
- $config : Config
-
Top-level configuration
- $ils : Connection
-
ILS connection
- $renderer : RendererInterface
-
View renderer
- $holdLogic : Holds
-
Holds logic
- $availabilityStatusManager : AvailabilityStatusManager
-
Availability status manager
Return values
mixed —getSorter()
Get the sorter
public
getSorter() : SorterInterface
Return values
SorterInterface —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 —handleRequest()
Handle a request.
public
handleRequest(Params $params) : array<string|int, mixed>
Parameters
- $params : Params
-
Parameter helper from controller
Return values
array<string|int, mixed> —[response data, HTTP status code]
setSorter()
Set the sorter
public
setSorter(SorterInterface $sorter) : void
Parameters
- $sorter : SorterInterface
-
Sorter service
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 —disableSessionWrites()
Prevent session writes -- this is designed to be called prior to time- consuming AJAX operations to help reduce the odds of a timing-related bug that causes the wrong version of session data to be written to disk (see VUFIND-716 for more details).
protected
disableSessionWrites() : void
Return values
void —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> —filterSuppressedLocations()
Support method for getItemStatuses() -- filter suppressed locations from the array of item information for a particular bib record.
protected
filterSuppressedLocations(array<string|int, mixed> $record) : array<string|int, mixed>
Parameters
- $record : array<string|int, mixed>
-
Information on items linked to a single bib record
Return values
array<string|int, mixed> —Filtered version of $record
formatCallNo()
Create a delimited version of the call number to allow the Javascript code to handle the prefix appropriately.
protected
formatCallNo(string $prefix, string $callnumber) : string
Parameters
- $prefix : string
-
Callnumber prefix or empty string.
- $callnumber : string
-
Main call number.
Return values
string —formatResponse()
Format a response array.
protected
formatResponse(mixed $response[, int $httpCode = null ]) : array<string|int, mixed>
Parameters
- $response : mixed
-
Response data
- $httpCode : int = null
-
HTTP status code (omit for default)
Return values
array<string|int, mixed> —getAvailabilityMessage()
Get a message for availability status
protected
getAvailabilityMessage(AvailabilityStatusInterface $availability) : string
Parameters
- $availability : AvailabilityStatusInterface
-
Availability Status
Return values
string —getCallnumberHandler()
Based on settings and the number of callnumbers, return callnumber handler Use callnumbers before pickValue is run.
protected
getCallnumberHandler([array<string|int, mixed> $list = null ][, string $displaySetting = null ]) : string
Parameters
- $list : array<string|int, mixed> = null
-
Array of callnumbers.
- $displaySetting : string = null
-
config.ini setting -- first, all or msg
Return values
string —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 —getItemStatus()
Support method for getItemStatuses() -- process a single bibliographic record for location settings other than "group".
protected
getItemStatus(array<string|int, mixed> $record, string $locationSetting, string $callnumberSetting) : array<string|int, mixed>
Parameters
- $record : array<string|int, mixed>
-
Information on items linked to a single bib record
- $locationSetting : string
-
The location mode setting used for pickValue()
- $callnumberSetting : string
-
The callnumber mode setting used for pickValue()
Return values
array<string|int, mixed> —Summarized availability information
getItemStatusError()
Support method for getItemStatuses() -- process a failed record.
protected
getItemStatusError(array<string|int, mixed> $record[, string $msg = '' ]) : array<string|int, mixed>
Parameters
- $record : array<string|int, mixed>
-
Information on items linked to a single bib record
- $msg : string = ''
-
Availability message
Return values
array<string|int, mixed> —Summarized availability information
getItemStatusGroup()
Support method for getItemStatuses() -- process a single bibliographic record for "group" location setting.
protected
getItemStatusGroup(array<string|int, mixed> $record, string $callnumberSetting) : array<string|int, mixed>
Parameters
- $record : array<string|int, mixed>
-
Information on items linked to a single bib record
- $callnumberSetting : string
-
The callnumber mode setting used for pickValue()
Return values
array<string|int, mixed> —Summarized availability information
pickValue()
Support method for getItemStatuses() -- when presented with multiple values, pick which one(s) to send back via AJAX.
protected
pickValue(array<string|int, mixed> $rawList, string $mode, string $msg[, string $transPrefix = false ]) : string
Parameters
- $rawList : array<string|int, mixed>
-
Array of values to choose from.
- $mode : string
-
config.ini setting -- first, all or msg
- $msg : string
-
Message to display if $mode == "msg"
- $transPrefix : string = false
-
Translator prefix to apply to values (false to omit translation of values)
Return values
string —reduceServices()
Reduce an array of service names to a human-readable string.
protected
reduceServices(array<string|int, mixed> $rawServices) : string
Parameters
- $rawServices : array<string|int, mixed>
-
Names of available services.
Return values
string —renderFullStatus()
Render full item status.
protected
renderFullStatus(array<string|int, mixed> $record, array<string|int, mixed> $simpleStatus[, array<string|int, mixed> $values = [] ]) : string
Parameters
- $record : array<string|int, mixed>
-
Record
- $simpleStatus : array<string|int, mixed>
-
Simple status result
- $values : array<string|int, mixed> = []
-
Additional values for the template
Return values
string —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
translateList()
Translate an array of strings using a prefix.
protected
translateList(string $transPrefix, array<string|int, mixed> $list) : array<string|int, mixed>
Parameters
- $transPrefix : string
-
Translation prefix
- $list : array<string|int, mixed>
-
List of values to translate
Return values
array<string|int, mixed> —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?