emu_functions.php
Table of Contents
Functions
- emu_format_date() : string
- Format date for EMu use (similar to the ISO8601 date format except the time zone designator is not included)
- get_emu_resources() : array<string|int, mixed>
- Function to retrieve all resources that have their IRN field set to a value and that are within the allowed resource types for an EMu update
- get_emu_data() : array<string|int, mixed>
- Get EMu data by using an array of IRNs.
- emu_script_log() : void
- Log EMu script history both on screen and in a file
- check_config_changed() : bool
- Utility function to figure out emu plugin configuration changed.
- add_search_criteria() : IMuTerms
- Add search criteria to any existing IMuTerms object before doing a search on a module Note: uses $emu_search_criteria which value is basic TexQL (currently only AND and OR are supported, without support for nesting)
- emu_update_resource() : bool
- Update resource with the newly imported orginal file from EMu
- emu_get_rs_mapped_field_id() : int
- Utility function to get the mapped ResourceSpace field from the mapping we set for emu plugin
- emu_update_resource_metadata_from_record() : bool
- Update a resource with all the information from an EMu record which has mapped fields to ResourceSpace
- emu_update_rs_field() : bool
- Update ResourceSpace field based on an EMu record field value (atomic/ non-atomic) Note: non-atomic values will be converted to a CSV value
- emu_convert_to_atomic() : string
- Utility function which allows ResourceSpace to convert any EMu record field to an atomic field with its value formatted as CSV
Functions
emu_format_date()
Format date for EMu use (similar to the ISO8601 date format except the time zone designator is not included)
emu_format_date(int $timestamp[, string $format = 'c' ]) : string
Parameters
- $timestamp : int
- $format : string = 'c'
-
PHP's date() valid format
Return values
stringget_emu_resources()
Function to retrieve all resources that have their IRN field set to a value and that are within the allowed resource types for an EMu update
get_emu_resources() : array<string|int, mixed>
Return values
array<string|int, mixed>get_emu_data()
Get EMu data by using an array of IRNs.
get_emu_data(mixed $emu_api_server, mixed $emu_api_server_port, array<string|int, mixed> $irns, array<string|int, mixed> $emu_rs_mappings) : array<string|int, mixed>
Parameters
- $emu_api_server : mixed
- $emu_api_server_port : mixed
- $irns : array<string|int, mixed>
-
Array of one/ more IRNs to get data by
- $emu_rs_mappings : array<string|int, mixed>
-
EMu table-column -> RS field mappings
Return values
array<string|int, mixed> —$return[IRN][Column] = Column value
Example: [74766] => Array ( [ObjTitle] => [ObjName] => mask [ChaAspectRatio] => )
[886159] => Array ( [ObjTitle] => [ObjName] => mask )
emu_script_log()
Log EMu script history both on screen and in a file
emu_script_log(string $message[, resource $log_file_pointer = null ]) : void
Parameters
- $message : string
- $log_file_pointer : resource = null
check_config_changed()
Utility function to figure out emu plugin configuration changed.
check_config_changed() : bool
For example, can be used in cases when we need to check all records again because of new mappings have been added.
Return values
booladd_search_criteria()
Add search criteria to any existing IMuTerms object before doing a search on a module Note: uses $emu_search_criteria which value is basic TexQL (currently only AND and OR are supported, without support for nesting)
add_search_criteria(IMuTerms $imu_terms) : IMuTerms
Parameters
- $imu_terms : IMuTerms
-
Any IMuTerms object on which we want to add new search terms
Return values
IMuTermsemu_update_resource()
Update resource with the newly imported orginal file from EMu
emu_update_resource(int $ref, int $type, string $file_path) : bool
Parameters
- $ref : int
-
Resource ID
- $type : int
-
Resource type ID
- $file_path : string
-
Resource original file path
Return values
boolemu_get_rs_mapped_field_id()
Utility function to get the mapped ResourceSpace field from the mapping we set for emu plugin
emu_get_rs_mapped_field_id(string $column, array<string|int, mixed> $rs_module_column_field_mappings) : int
Parameters
- $column : string
-
EMu column that should have a map to a ResourceSpace field
- $rs_module_column_field_mappings : array<string|int, mixed>
Return values
int —Returns 0 if could not find value
emu_update_resource_metadata_from_record()
Update a resource with all the information from an EMu record which has mapped fields to ResourceSpace
emu_update_resource_metadata_from_record(int $resource, array<string|int, mixed> $record, array<string|int, mixed> $rs_module_column_field_mappings) : bool
Parameters
- $resource : int
-
Resource ID
- $record : array<string|int, mixed>
-
EMu record processed by emu plugin
- $rs_module_column_field_mappings : array<string|int, mixed>
Return values
boolemu_update_rs_field()
Update ResourceSpace field based on an EMu record field value (atomic/ non-atomic) Note: non-atomic values will be converted to a CSV value
emu_update_rs_field(int $ref, int $field, string|array<string|int, mixed> $record_value) : bool
Parameters
- $ref : int
-
Resource ID
- $field : int
-
Field ID
- $record_value : string|array<string|int, mixed>
-
The value of the record field
Return values
boolemu_convert_to_atomic()
Utility function which allows ResourceSpace to convert any EMu record field to an atomic field with its value formatted as CSV
emu_convert_to_atomic(string|array<string|int, mixed> $values) : string
Parameters
- $values : string|array<string|int, mixed>
-
The value client code wants to convert to
Return values
string —CSV formatted string