VuFind API Documentation

AbstractBase implements HasSorterInterface Uses HasSorterTrait

Hierarchy Tree Data Formatter (abstract base)

Tags
category

VuFind

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

HasSorterInterface
Interface SortingInterface

Table of Contents

$childMap  : array<string|int, mixed>
Child data map from index
$collectionType  : string
Collection mode
$count  : int
How many nodes have we formatted?
$sort  : bool
Is sorting enabled?
$sorter  : SorterInterface|null
Sorter
$topNode  : object
Top-level record from index
$validateHierarchySequences  : bool
Throw an exception if hierarchy parent and sequence data is out of sync?
__construct()  : mixed
Constructor
getCount()  : int
Get number of nodes formatted.
getData()  : string
Get the formatted metadata.
getSorter()  : SorterInterface
Get the sorter
setRawData()  : void
Set raw data.
setSorter()  : void
Set the sorter
getHierarchyPositionsInParents()  : array<string|int, mixed>
Get the positions of this item within parent collections. Returns an array of parent ID => sequence number.
getTitlesInHierarchy()  : array<string|int, mixed>
Get the titles of this item within parent collections. Returns an array of parent ID => sequence number.
isCollection()  : bool
Identify whether the provided record is a collection.
pickTitle()  : string
Choose a title for the record.
sortNodes()  : array<string|int, mixed>
Sort Nodes Convert an unsorted array of [ key, value ] pairs into a sorted array of values.

Properties

$childMap

Child data map from index

protected array<string|int, mixed> $childMap

$collectionType

Collection mode

protected string $collectionType

$count

How many nodes have we formatted?

protected int $count = 0

$topNode

Top-level record from index

protected object $topNode

$validateHierarchySequences

Throw an exception if hierarchy parent and sequence data is out of sync?

protected bool $validateHierarchySequences

Methods

__construct()

Constructor

public __construct([bool $validateHierarchySequences = true ]) : mixed
Parameters
$validateHierarchySequences : bool = true

Throw an exception if hierarchy parent and sequence data is out of sync?

Return values
mixed

getCount()

Get number of nodes formatted.

public getCount() : int
Return values
int

getData()

Get the formatted metadata.

public abstract getData() : string
Return values
string

setRawData()

Set raw data.

public setRawData(object $topNode, array<string|int, mixed> $childMap[, bool $sort = false ][, string $cType = 'All' ]) : void
Parameters
$topNode : object

Full record for top node

$childMap : array<string|int, mixed>

Data map from index

$sort : bool = false

Is sorting enabled?

$cType : string = 'All'

Collection type

Return values
void

getHierarchyPositionsInParents()

Get the positions of this item within parent collections. Returns an array of parent ID => sequence number.

protected getHierarchyPositionsInParents(object $fields) : array<string|int, mixed>
Parameters
$fields : object

Solr fields

Return values
array<string|int, mixed>

getTitlesInHierarchy()

Get the titles of this item within parent collections. Returns an array of parent ID => sequence number.

protected getTitlesInHierarchy(object $fields) : array<string|int, mixed>
Parameters
$fields : object

Solr fields

Return values
array<string|int, mixed>

isCollection()

Identify whether the provided record is a collection.

protected isCollection(object $fields) : bool

NOTE: \VuFind\RecordDriver\SolrDefault::isCollection() duplicates some of
this logic.

Parameters
$fields : object

Solr fields

Return values
bool

pickTitle()

Choose a title for the record.

protected pickTitle(object $record, string $parentID) : string
Parameters
$record : object

Solr record to format

$parentID : string

The starting point for the current recursion (equivalent to Solr field hierarchy_parent_id)

Return values
string

sortNodes()

Sort Nodes Convert an unsorted array of [ key, value ] pairs into a sorted array of values.

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

The array of arrays to sort

Return values
array<string|int, mixed>

Search results