GetRecordCover
extends AbstractBase
in package
implements
AjaxHandlerInterface
Uses
CacheTrait
GetRecordCover AJAX handler.
Tags
Interfaces, Classes, Traits and Enums
- AjaxHandlerInterface
- AJAX handler interface
Table of Contents
- $cache : StorageInterface
- Cache for storing data temporarily (e.g. patron blocks with the ILS driver)
- $cacheLifetime : int
- Lifetime of cache (in seconds).
- $coverRouter : Router
- Cover router
- $recordLoader : Loader
- Record loader
- $renderer : PhpRenderer
- PHP renderer
- $sessionSettings : Settings
- Session settings
- $useCoverFallbacksOnFail : bool
- If true we will render a fallback html template in case no image could be loaded
- __construct() : mixed
- GetRecordCover constructor.
- handleRequest() : array<string|int, mixed>
- Handle request
- setCacheStorage() : void
- Set a cache storage object.
- 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).
- formatResponse() : array<string|int, mixed>
- Format a response array.
- getCachedData() : mixed|null
- Helper function for fetching cached data.
- putCachedData() : void
- Helper function for storing cached data.
- removeCachedData() : void
- Helper function for removing cached data.
Properties
$cache
Cache for storing data temporarily (e.g. patron blocks with the ILS driver)
protected
StorageInterface
$cache
= null
$cacheLifetime
Lifetime of cache (in seconds).
protected
int
$cacheLifetime
= 30
$coverRouter
Cover router
protected
Router
$coverRouter
$recordLoader
Record loader
protected
Loader
$recordLoader
$renderer
PHP renderer
protected
PhpRenderer
$renderer
$sessionSettings
Session settings
protected
Settings
$sessionSettings
= null
$useCoverFallbacksOnFail
If true we will render a fallback html template in case no image could be loaded
protected
bool
$useCoverFallbacksOnFail
= false
Methods
__construct()
GetRecordCover constructor.
public
__construct(Settings $ss, Loader $recordLoader, Router $coverRouter[, PhpRenderer $renderer = null ][, bool $useCoverFallbacksOnFail = false ]) : mixed
Parameters
- $ss : Settings
-
Session settings
- $recordLoader : Loader
-
Record loader
- $coverRouter : Router
-
Cover router
- $renderer : PhpRenderer = null
-
PHP renderer (only required if $userCoverFallbacksOnFail is set to true)
- $useCoverFallbacksOnFail : bool = false
-
If true we will render a fallback html template in case no image could be loaded
Return values
mixed —handleRequest()
Handle request
public
handleRequest(Params $params) : array<string|int, mixed>
Parameters
- $params : Params
-
Request parameters
Tags
Return values
array<string|int, mixed> —setCacheStorage()
Set a cache storage object.
public
setCacheStorage([StorageInterface $cache = null ]) : void
Parameters
- $cache : StorageInterface = null
-
Cache storage interface
Return values
void —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 —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> —getCachedData()
Helper function for fetching cached data.
protected
getCachedData(string $key) : mixed|null
Data is cached for up to $this->cacheLifetime.
Parameters
- $key : string
-
Cache entry key
Return values
mixed|null —Cached entry or null if not cached or expired
putCachedData()
Helper function for storing cached data.
protected
putCachedData(string $key, mixed $entry[, int $lifetime = null ]) : void
Data is cached for up to $this->cacheLifetime seconds.
Parameters
- $key : string
-
Cache entry key
- $entry : mixed
-
Entry to be cached
- $lifetime : int = null
-
Optional lifetime for the entry in seconds
Return values
void —removeCachedData()
Helper function for removing cached data.
protected
removeCachedData(string $key) : void
Parameters
- $key : string
-
Cache entry key