Documentation

annotation_functions.php

Table of Contents

Functions

get_annotate_fields()  : array<string|int, mixed>
Get (viewable) "annotate_fields" config. The configs' value is validated (e.g. view access, supported type, active RTF, excluded RT, etc.).
get_all_viable_annotate_metadata_fields()  : array<string|int, mixed>
Get all metadata fields which could be used for the annotate feature. Removes inapplicable fields when excluding specific resource types.
getAnnotation()  : array<string|int, mixed>
Get annotation by ID
getAnnotations()  : array<string|int, mixed>
General annotations search functionality
getResourceAnnotationsCount()  : int
Get number of annotations available for a resource.
getResourceAnnotations()  : array<string|int, mixed>
Get annotations for a specific resource
getAnnotoriousResourceAnnotations()  : array<string|int, mixed>
Create an array of Annotorious annotation objects which can be JSON encoded and passed directly to Annotorious
annotationEditable()  : bool
Check if an annotation can be editable (add/ edit + remove) by the user. Please note that Annotorious JS library is treating edit & remove as the same under the "editable" property.
getAnnotationTags()  : array<string|int, mixed>
Get all tags of an annotation. Checks if a tag is attached to the resource, allowing the user to search by it which is represented by the virtual column "tag_searchable"
deleteAnnotation()  : bool
Delete annotation
createAnnotation()  : bool|int
Create new annotations based on Annotorious annotation
updateAnnotation()  : bool
Update (field bound) annotation and its tags, if applicable.
addAnnotationNodes()  : bool
Add relations between annotation and nodes
prepareTags()  : array<string|int, mixed>
Utility function which allows annotation tags to be prepared (i.e make sure they are all valid nodes) before creating associations between annotations and tags
search_add_annotation_count()  : mixed
Add annotation count to a search result set
get_annotorious_lang()  : array<string|int, mixed>
Get all translations relevant to the Annotorious (RSTagging) plugin.
get_annotorious_resourcespace_config()  : array<string|int, mixed>
Get all ResourceSpace config options relevant for the Annotorious (RSTagging) plugin functionality.
get_valid_annotate_field_types()  : array<string|int, mixed>
Get list of allowed field types to be configured for the "annotate_fields" option
get_annotate_file_path()  : string
Get annotate file path (old annotate plugin logic)
create_annotated_pdf()  : mixed
Create annotations PDF (old annotate plugin logic)
annotation_pdf_class()  : mixed
Utility function to generate a one-off TCPDF variant (with multiRow method)
resource_can_be_annotated()  : bool
Check if a resource can be annotated
resource_type_applicable_for_annotations()  : bool
Check if a given resource type is applicable for annotations

Functions

get_annotate_fields()

Get (viewable) "annotate_fields" config. The configs' value is validated (e.g. view access, supported type, active RTF, excluded RT, etc.).

get_annotate_fields() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_all_viable_annotate_metadata_fields()

Get all metadata fields which could be used for the annotate feature. Removes inapplicable fields when excluding specific resource types.

get_all_viable_annotate_metadata_fields(array<int, int> $exclude_resource_types) : array<string|int, mixed>
Parameters
$exclude_resource_types : array<int, int>

List of Resource types to exclude

Return values
array<string|int, mixed>

getAnnotation()

Get annotation by ID

getAnnotation(int $ref) : array<string|int, mixed>
Parameters
$ref : int

Annotation ID

Return values
array<string|int, mixed>

getAnnotations()

General annotations search functionality

getAnnotations([int $resource = 0 ][, int $resource_type_field = 0 ][, int $user = 0 ][, int $page = 0 ]) : array<string|int, mixed>
Parameters
$resource : int = 0
$resource_type_field : int = 0
$user : int = 0
$page : int = 0
Tags
uses
ps_query()
Return values
array<string|int, mixed>

getResourceAnnotationsCount()

Get number of annotations available for a resource.

getResourceAnnotationsCount(int $resource) : int

Note: multi page resources will show the total number (ie. all pages)

Parameters
$resource : int

Resource ID

Tags
uses
ps_value()
Return values
int

getResourceAnnotations()

Get annotations for a specific resource

getResourceAnnotations(int $resource[, int $page = 0 ]) : array<string|int, mixed>
Parameters
$resource : int

Resource ID

$page : int = 0

Page number of a document. Non documents will have 0

Return values
array<string|int, mixed>

getAnnotoriousResourceAnnotations()

Create an array of Annotorious annotation objects which can be JSON encoded and passed directly to Annotorious

getAnnotoriousResourceAnnotations(int $resource[, int $page = 0 ][, array{k?: string} $ctx = [] ]) : array<string|int, mixed>
Parameters
$resource : int

Resource ID

$page : int = 0

Page number of a document

$ctx : array{k?: string} = []

Environment context (e.g. external share)

Return values
array<string|int, mixed>

annotationEditable()

Check if an annotation can be editable (add/ edit + remove) by the user. Please note that Annotorious JS library is treating edit & remove as the same under the "editable" property.

annotationEditable(array<string|int, mixed> $annotation, array{k?: string} $ctx) : bool
Parameters
$annotation : array<string|int, mixed>
$ctx : array{k?: string}

Environment context (e.g. external share)

Tags
uses
checkPermission_anonymoususer()
used-by
deleteAnnotation()
updateAnnotation()
Return values
bool

getAnnotationTags()

Get all tags of an annotation. Checks if a tag is attached to the resource, allowing the user to search by it which is represented by the virtual column "tag_searchable"

getAnnotationTags(array<string|int, mixed> $annotation) : array<string|int, mixed>
Parameters
$annotation : array<string|int, mixed>
Tags
used-by
deleteAnnotation()
updateAnnotation()
Return values
array<string|int, mixed>

createAnnotation()

Create new annotations based on Annotorious annotation

createAnnotation(array<string|int, mixed> $annotation, array{k?: string} $ctx) : bool|int

NOTE: Annotorious annotation shape is an array but at the moment they use only the first shape found

Parameters
$annotation : array<string|int, mixed>
$ctx : array{k?: string}

Environment context (e.g. external share)

Return values
bool|int

Returns false on failure OR the ref of the newly created annotation

updateAnnotation()

Update (field bound) annotation and its tags, if applicable.

updateAnnotation(array<string|int, mixed> $annotation, array{k?: string} $ctx) : bool

Text (comment) annotatins can't be updated (same as the comments logic for those with o perm).

Parameters
$annotation : array<string|int, mixed>
$ctx : array{k?: string}

Environment context (e.g. external share)

Tags
uses
annotationEditable()
getAnnotationTags()
delete_resource_nodes()
addAnnotationNodes()
add_resource_nodes()
db_begin_transaction()
db_end_transaction()
Return values
bool

addAnnotationNodes()

Add relations between annotation and nodes

addAnnotationNodes(int $annotation_ref, array<string|int, mixed> $nodes) : bool
Parameters
$annotation_ref : int

The annotation ID in ResourceSpace

$nodes : array<string|int, mixed>

List of node structures get_nodes(). Only the "ref" property is required.

Tags
used-by
updateAnnotation()
Return values
bool

prepareTags()

Utility function which allows annotation tags to be prepared (i.e make sure they are all valid nodes) before creating associations between annotations and tags

prepareTags(array<string|int, mixed> $dirty_tags) : array<string|int, mixed>
Parameters
$dirty_tags : array<string|int, mixed>

Original array of tags. These can be (in)valid tags/ new tags. IMPORTANT: a tag should have the same structure as a node

Tags
uses
checkperm()
get_resource_type_field()
set_node()
get_node()
Return values
array<string|int, mixed>

search_add_annotation_count()

Add annotation count to a search result set

search_add_annotation_count(mixed &$result) : mixed
Parameters
$result : mixed

get_annotorious_lang()

Get all translations relevant to the Annotorious (RSTagging) plugin.

get_annotorious_lang(array<string, string> $map) : array<string|int, mixed>
Parameters
$map : array<string, string>

Language strings map

Return values
array<string|int, mixed>

get_annotorious_resourcespace_config()

Get all ResourceSpace config options relevant for the Annotorious (RSTagging) plugin functionality.

get_annotorious_resourcespace_config() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_valid_annotate_field_types()

Get list of allowed field types to be configured for the "annotate_fields" option

get_valid_annotate_field_types() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_annotate_file_path()

Get annotate file path (old annotate plugin logic)

get_annotate_file_path(int $ref, bool $getfilepath, string $extension) : string
Parameters
$ref : int
$getfilepath : bool
$extension : string
Return values
string

create_annotated_pdf()

Create annotations PDF (old annotate plugin logic)

create_annotated_pdf(int $ref[, bool $is_collection = false ][, string $size = "letter" ][, bool $cleanup = false ][, bool $preview = false ]) : mixed
Parameters
$ref : int
$is_collection : bool = false
$size : string = "letter"
$cleanup : bool = false
$preview : bool = false

annotation_pdf_class()

Utility function to generate a one-off TCPDF variant (with multiRow method)

annotation_pdf_class() : mixed

resource_can_be_annotated()

Check if a resource can be annotated

resource_can_be_annotated(int $ref) : bool
Parameters
$ref : int

Resource ID

Return values
bool

resource_type_applicable_for_annotations()

Check if a given resource type is applicable for annotations

resource_type_applicable_for_annotations(int $ref) : bool
Parameters
$ref : int

Resource type ID

Return values
bool
On this page

Search results