Documentation

EMuAPI
in package

EMuAPI is a wrapper for IMu API

EMuAPI wrapps aroung IMu APi by providing an easy way of searching and retrieving objects from an KE EMu database. Current functionality allows getting objects mainly based on IRN

Example usage: $emu_api = new EMuAPI($emu_api_server, $emu_api_server_port, 'epublic'); $emu_api->setColumns(array('ClaInstitution', 'ObjTitle', 'ObjectNumber', 'AffOriCountry_tab', 'OriginSummaryData_tab')); echo '

';print_r($emu_api->getObjectByIrn(362024));echo '
';

Tags
author

Alin Cota

version
1.1
access

public

Table of Contents

Constants

MIME_TYPES  : mixed = ['application', 'audio', 'image', 'text', 'video']

Properties

$columns  : mixed
$module  : mixed
$session  : mixed
$terms  : mixed

Methods

__construct()  : void
Initialises a connection to an EMu server
getColumns()  : void
Get all columns names or just one of them
getMediaFile()  : bool
Download media file from EMu
getObjectByIrn()  : array<string|int, mixed>
Get EMu object based on IRN
getObjectMultimediaByIrn()  : array<string|int, mixed>
Get EMu Multimedia resource object based on a multimedia IRN
getObjectsByIrns()  : array<string|int, mixed>
Get EMu objects based on an array of IRNs
getResults()  : array<string|int, mixed>
Get results based on search done before calling this function
getSearchResults()  : array<string|int, mixed>
Get search results
runSearch()  : int
Search an EMu database using existing session in the current module using current search terms
setColumns()  : void
Set columns property
setIrnColumn()  : void
Set IRN column
setModule()  : bool
Set module
setTerms()  : void
Set terms
validMime()  : bool
Utility function used to check whether a particular MIME type is EMu valid

Constants

MIME_TYPES

private mixed MIME_TYPES = ['application', 'audio', 'image', 'text', 'video']

Properties

$columns

protected mixed $columns = array()

Methods

__construct()

Initialises a connection to an EMu server

public __construct(string $server_address, int $server_port) : void

Creates a sessions for a given server address and port

Parameters
$server_address : string

KE EMu server address

$server_port : int

KE EMu server port to connect to

getColumns()

Get all columns names or just one of them

public getColumns([array<string|int, mixed> $name = '' ]) : void
Parameters
$name : array<string|int, mixed> = ''

Column name to individually select/ list

getMediaFile()

Download media file from EMu

public static getMediaFile(array<string|int, mixed> $multimedia, string $to[, int $length = 4096 ]) : bool
Parameters
$multimedia : array<string|int, mixed>
$to : string

Path where TO save this file

$length : int = 4096

Up to length number of bytes read

Return values
bool

getObjectByIrn()

Get EMu object based on IRN

public getObjectByIrn(int $irn) : array<string|int, mixed>
Parameters
$irn : int

Unique KE EMu object identifier

Return values
array<string|int, mixed>

getObjectMultimediaByIrn()

Get EMu Multimedia resource object based on a multimedia IRN

public getObjectMultimediaByIrn(int $irn[, array<string|int, mixed> $columns = array('resource') ]) : array<string|int, mixed>
Parameters
$irn : int

Multimedia resource IRN

$columns : array<string|int, mixed> = array('resource')

Optional, columns to fetch from EMu

Return values
array<string|int, mixed>

getObjectsByIrns()

Get EMu objects based on an array of IRNs

public getObjectsByIrns(array<string|int, mixed> $irns) : array<string|int, mixed>
Parameters
$irns : array<string|int, mixed>

Array of Unique KE EMu object identifiers

Return values
array<string|int, mixed>

getResults()

Get results based on search done before calling this function

public getResults(string|array<string|int, mixed> $columns[, int $offset = 0 ][, int $count = 1 ]) : array<string|int, mixed>
Parameters
$columns : string|array<string|int, mixed>

The columns to retrieve for a record. You can use either an array of columns or an alias (which is defined by calling $this->module->addFetchSet('[alias]', array(columns assigned to alias));) Note: using aliases is faster when requesting the same columns

$offset : int = 0
$count : int = 1
Tags
used-by
EMuAPI::getSearchResults()
Return values
array<string|int, mixed>

getSearchResults()

Get search results

public getSearchResults([int $offset = 0 ][, int $limit = -1 ]) : array<string|int, mixed>
Parameters
$offset : int = 0
$limit : int = -1

Use default value (-1) to get all results back

Tags
uses
EMuAPI::getResults()
Return values
array<string|int, mixed>

runSearch()

Search an EMu database using existing session in the current module using current search terms

public runSearch() : int
Return values
int

An estimate of number of records found

setColumns()

Set columns property

public setColumns(array<string|int, mixed> $names) : void
Parameters
$names : array<string|int, mixed>

Column name(s) to set

setIrnColumn()

Set IRN column

public setIrnColumn() : void

setModule()

Set module

public setModule(string $name) : bool
Parameters
$name : string
Return values
bool

setTerms()

Set terms

public setTerms(IMuTerms $terms) : void
Parameters
$terms : IMuTerms

validMime()

Utility function used to check whether a particular MIME type is EMu valid

public static validMime(string $mime) : bool
Parameters
$mime : string
Return values
bool
On this page

Search results