Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
LibraryDocument Class Reference

Public Member Functions

 getId ()
 
 getType ($format= 'name')
 
 getTitle ($format= 'short')
 
 getAuthorNames ()
 
 getIssueDate ($year_only=false)
 
 getIdentifiers ()
 
 filterCslFieldsByType ()
 
 toArray ()
 
 toJson ()
 
 fillEmptyCslFields ()
 
 isEqualTo (LibraryDocument $other)
 
 getInfoTemplate ($format= 'short')
 
 getSearchDescription ()
 
 getIcon ()
 

Static Public Member Functions

static createFromArray (array $data=[])
 
static createFromJson (string $json_string="")
 

Data Fields

 $id = ''
 
 $opac_document_id = ''
 
 $opac_link = ''
 
 $type = ''
 
 $csl_data = []
 
 $catalog = ''
 
 $datafields
 
 $search_params = []
 

Detailed Description

This class represents a document from a library.

Member Function Documentation

static createFromArray ( array  $data = [])
static

Creates a LibraryDocument instance from an associative array.

Parameters
array$dataAn associative array containing data for a LibraryDocument instance.
Returns
LibraryDocument|null A LibraryDocument instance on success or null on failure.
static createFromJson ( string  $json_string = "")
static

Creates a LibraryDocument instance from JSON data.

Parameters
string$json_stringA JSON string containing data for a LibraryDocument instance.
Returns
LibraryDocument|null A LibraryDocument instance on success or null on failure.
fillEmptyCslFields ( )

Fills or creates empty or missing CSL data fields that may be required when rendering the CSL data.

Returns
array The "enriched" CSL data from this document.
filterCslFieldsByType ( )

Filters the CSL data fields by the document type. Only those CSL fields that are specified in library_config.inc.php for the document type are kept.

getAuthorNames ( )
Returns
string A list with all author names.
getIcon ( )
getId ( )

Generates an ID for the document.

getIdentifiers ( )
Returns
string A string with identifiers of the document (ISBN, URL, ...).
getInfoTemplate (   $format = 'short')
Returns
Flexi_Template A template containing information about the the document.
getIssueDate (   $year_only = false)

Returns a string with the issue date.

Parameters
bool$year_onlyWhether to return only the year of the date (true) or the whole date (false). Defaults to false.
Returns
string A string representing the issue date.
getSearchDescription ( )

Creates a descriptive text of the search parameters that lead to the retrieval of this document.

Returns
string[] An array with a textual representation of all used search parameters.
getTitle (   $format = 'short')

Returns the title of the document as string.

Parameters
string$formatThe format of the title. 'short' means that only the title is returned. 'long' means that the author, the year and the title are concatenated into one string. 'long-comma' means that the author, the title and the year are concatenated in that order, only separated by a comma.
Returns
string The title of the document.
getType (   $format = 'name')

Returns the type of the document as string.

Returns
string The type of the document.
isEqualTo ( LibraryDocument  $other)

Determines if this document is equal to another document. Equality is determined by comparing various ID fields and as a last resort, the title, author and year are compared.

Parameters
LibraryDocument$otherAnother library document that shall be compared to this document.
Returns
bool True, if this document is equal to the other document, false otherwise.
toArray ( )

Converts this LibraryDocument to an associative array.

Returns
array An associative array containing the data of this LibraryDocument instance.
toJson ( )

Converts this LibraryDocument to JSON data.

Returns
string A string containing the JSON encoded version of this LibraryDocument instance.

Field Documentation

$catalog = ''

The name of the catalog from which the document has been retrieved.

$csl_data = []

The CSL datafields.

$datafields

Other data that cannot be stored in the $csl_data array.

$id = ''

An unique ID of the document.

$opac_document_id = ''

The OPAC ID of the document.

$opac_link = ''

The link to the document page in the OPAC system.

$search_params = []

The search parameter that have been used to retrieve this item.

$type = ''

The CSL document type.


The documentation for this class was generated from the following file: