Documentation

collections_functions.php

Table of Contents

Functions

get_user_collections()  : array<string|int, mixed>
Return all collections belonging to or shared with $user
get_collection()  : array<string|int, mixed>|bool
Returns all data for collection $ref.
get_collection_resources()  : array<string|int, mixed>|bool
Returns all resources in collection
get_collection_resources_with_data()  : array<string|int, mixed>
Get all resources in a collection without checking permissions or filtering by workflow states.
add_resource_to_collection()  : bool|string
Add resource $resource to collection $collection
remove_resource_from_collection()  : bool|string
Remove resource $resource from collection $collection
collection_add_resources()  : bool|string
Add resource(s) $resources to collection $collection
collection_remove_resources()  : bool|string
collection_remove_resources
collection_writeable()  : bool
Is the collection $collection writable by the current user? Returns true if the current user has write access to the given collection.
collection_readable()  : bool
Returns true if the current user has read access to the given collection.
set_user_collection()  : void
Sets the current collection of $user to be $collection
create_collection()  : int
Creates a new collection for user $userid called $name
delete_collection()  : bool|void
Deletes the collection with reference $ref
refresh_collection_frame()  : void
Adds script to page that refreshes the Collection bar
search_public_collections()  : array<string|int, mixed>
Performs a search for featured collections / public collections.
do_collections_search()  : array<string|int, mixed>
Search within available collections
add_collection()  : bool
Add a collection to a user's 'My Collections'
remove_collection()  : mixed
Remove someone else's collection from a user's My Collections
index_collection()  : int
Update the keywords index for this collection
save_collection()  : false|void
Process the save action when saving a collection
collections_comparator()  : mixed
Case insensitive string comparisons using a "natural order" algorithm for collection names
collections_comparator_desc()  : mixed
Case insensitive string comparisons using a "natural order" algorithm for collection names
get_smart_theme_headers()  : array<string|int, mixed>
Returns a list of smart theme headers, which are basically fields with a 'smart theme name' set.
get_smart_themes_nodes()  : array<string|int, mixed>
get_smart_themes_nodes
email_collection()  : string
E-mail a collection to users
generate_collection_access_key()  : string
Generate an external access key to allow external people to view the resources in this collection.
get_saved_searches()  : array<string|int, mixed>
Returns all saved searches in a collection
add_saved_search()  : void
Add a saved search to a collection
remove_saved_search()  : void
Remove a saved search from a collection
add_smart_collection()  : void
Greate a new smart collection using submitted values
get_search_title()  : string
Get a display friendly name for the given search string Takes a full searchstring of the form 'search=restypes=archive=' and uses search_title_processing to autocreate a more informative title
add_saved_search_items()  : bool
Adds all the resources in the provided search to $collection
allow_multi_edit()  : bool
Returns true or false, can all resources in this collection be edited by the user?
get_featured_collection_resources()  : array<string|int, mixed>
Get featured collection resources (including from child nodes). For normal FCs this is using the collection_resource table.
get_featured_collection_categ_sub_fcs()  : array<string|int, mixed>
Get a list of featured collections based on a higher level featured collection category. This returns all direct/indirect collections under that category.
generate_featured_collection_image_urls()  : array<string|int, mixed>
Get preview URLs for a list of resource IDs
swap_collection_order()  : void
Inserts $resource1 into the position currently occupied by $resource2
update_collection_order()  : void
Reorder the items in a collection using $neworder as the order by metric
get_collection_resource_comment()  : array<string|int, mixed>|bool
Return comments and other columns stored in the collection_resource join.
save_collection_resource_comment()  : bool
Save a comment and/or rating for the instance of a resource in a collection.
relate_to_collection()  : void
Relates every resource in $collection to $ref
get_collection_comments()  : array<string|int, mixed>
Fetch all the comments for a given collection.
send_collection_feedback()  : array<string|int, mixed>|void
Sends the feedback to the owner of the collection
copy_collection()  : void
Copy a collection contents
collection_is_research_request()  : bool
Returns true if a collection is a research request
add_to_collection_link()  : string
Generates a HTML link for adding a resource to a collection
remove_from_collection_link()  : string
Render a "remove from collection" link wherever such a function is shown in the UI
change_collection_link()  : string
Generates a HTML link for adding a changing the current collection
get_collection_external_access()  : array<string|int, mixed>
Return all external access given to a collection.
delete_collection_access_key()  : void
Delete a specific collection access key, withdrawing access via that key to the collection in question
collection_log()  : void
Add a new row to the collection log (e.g. after an action on that collection)
get_collection_log()  : array<string|int, mixed>
Return the log for $collection
collection_max_access()  : int
Returns the maximum access (the most permissive) that the current user has to the resources in $collection.
collection_min_access()  : int
Returns the minimum access (the least permissive) that the current user has to the resources in $collection.
collection_set_public()  : bool
Set an existing collection to be public
remove_all_resources_from_collection()  : void
Remove all resources from a collection
get_home_page_promoted_collections()  : array<string|int, mixed>
Retrieve promoted collections to be displayed on the home page.
is_collection_approved()  : array<string|int, mixed>
Return an array of distinct archive/workflow states for resources in $collection
edit_collection_external_access()  : bool
Update an existing external access share
show_hide_collection()  : bool
Hide or show a collection from the My Collections area.
get_session_collections()  : array<string|int, mixed>
Get an array of collection IDs for the specified ResourceSpace session and user
update_collection_user()  : bool
Update collection to belong to a new user
compile_collection_actions()  : array<string|int, mixed>
Helper function for render_actions(). Compiles actions that are normally valid for collections
makeFilenameUnique()  : string
Make a filename unique by appending a dupe-string.
new_featured_collection_form()  : void
Render the new featured collection form
GetThemesFromRequest()  : array<string|int, mixed>
Get a themes array
collection_download_use_original_filenames_when_downloading()  : void
collection_download_process_text_file()  : string
Provide resource data/collection_resource data to add to text file during a collection download.
collection_download_log_resource_ready()  : void
Update the resource log to show the download during a collection download.
collection_download_process_data_only_types()  : void
Add PDFs for "data only" types to a zip file during creation.
collection_download_process_summary_notes()  : mixed
collection_download_process_csv_metadata_file()  : void
Add a CSV containing resource metadata to a downloaded zip file during creation of the zip.
collection_download_process_collection_download_name()  : void
Modifies the filename for downloading as part of the specified collection
collection_download_process_archive_command()  : bool
Executes the archiver command when downloading a collection.
collection_download_clean_temp_files()  : void
Remove temporary files created during download by exiftool for adding metadata.
collection_cleanup_inaccessible_resources()  : void
Delete any resources from collection moved out of users archive status permissions by other users
relate_all_collection()  : bool
Relate all resources in a collection
unrelate_all_collection()  : bool
Un-relate all resources in a collection
update_collection_type()  : bool
Update collection type for one collection or batch
update_collection_parent()  : bool
Update collection parent for this collection
get_user_selection_collection()  : null|int
Get a users' collection of type SELECTION.
delete_old_collections()  : int
Delete all collections that are not in use e.g. session collections for the anonymous user. Will not affect collections that are public.
get_all_featured_collections()  : array<string|int, mixed>
Get all featured collections
get_featured_collections()  : array<string|int, mixed>
Get all featured collections by parent node
featured_collections_permissions_filter_sql()  : array<string|int, mixed>|string
Build appropriate SQL (for WHERE clause) to filter out featured collections for the user. The function will use either an IN or NOT IN depending which list is smaller to increase performance of the search
featured_collection_check_access_control()  : bool
Access control function used to determine if a featured collection should be accessed by the user
order_featured_collections()  : Return
Helper comparison function for ordering featured collections. It sorts using the order_by property, then based if the collection is a category (using the "has_resource" property), then by name (this takes into account the legacy use of '*' as a prefix to move to the start).
get_featured_collection_categories()  : array<string|int, mixed>
Get featured collection categories
is_featured_collection_category()  : bool
Check if a collection is a featured collection category
is_featured_collection_category_by_children()  : bool
Check if a collection is a featured collection category by checking if the collection has been used as a parent. This function will make a DB query to find this out, it does not use existing structures.
validate_collection_parent()  : null|int
Validate a collection parent value
get_featured_collection_category_branch_by_leaf()  : array<string|int, mixed>
Get to the root of the branch starting from the leaf featured collection
process_posted_featured_collection_categories()  : array<string|int, mixed>
Process POSTed featured collections categories data for a collection
get_featured_collection_ref_by_name()  : null|int
Find existing featured collection ref using its name and parent
move_featured_collection_branch_path_root()  : array<string|int, mixed>
Move a featured collection branch paths' root to the node determined by the global configuration option $featured_collections_root_collection.
allow_collection_share()  : bool
Check if user is allowed to share collection
allow_featured_collection_share()  : bool
Check if user is allowed to share featured collection. If the featured collection provided is a category, then this function will return FALSE if at least one sub featured collection has no share access (this is kept consistent with the check for normal collections when checking resources).
filter_featured_collections_by_root()  : array<string|int, mixed>
Filter out featured collections that have a different root path. The function builds internally the path to the root from the provided featured collection ref and then filters out any featured collections that have a different root path.
get_featured_collections_by_resources()  : array<string|int, mixed>
Get all featured collections branches where the specified resources can be found.
can_delete_featured_collection()  : bool
Verify if a featured collection can be deleted. To be deleted, it MUST not have any resources or children (if category).
strip_prefix_chars()  : string
Remove all instances of the specified character from start of string
allow_upload_to_collection()  : bool
Check access control if user is allowed to upload to a collection.
compute_featured_collections_access_control()  : bool|array<string|int, mixed>
Compute the featured collections allowed based on current access control
can_reorder_featured_collections()  : bool
Check if user is allowed to re-order featured collections
can_edit_featured_collection_category()  : bool
Check if user is authorised to edit a featured collection category
cleanup_anonymous_collections()  : void
Remove all old anonymous collections
can_share_upload_link()  : bool
Check if user is permitted to create an external upload link for the given collection
can_edit_upload_share()  : bool
Check if user can edit an existing upload share
create_upload_link()  : string
Creates an upload link for a collection that can be shared
generate_share_key()  : string
Generates an external share key based on provided string
upload_share_active()  : mixed
Check if an external upload link is being used
upload_share_setup()  : void
Set up external upload share
external_upload_notify()  : void
Notify the creator of an external upload share that resources have been uploaded
purge_expired_shares()  : string|int
Purge all expired shares/**
can_delete_collection()  : bool
Check if user has the appropriate access to delete a collection.
send_collection_to_admin()  : bool
Send collection to administrators - used if $send_collection_to_admin is enabled
get_default_user_collection()  : int
Get the user's default collection, creating one if necessary
update_smart_collection()  : void
Update a smart collection with or without the $smart_collections_async option.
check_upload_terms()  : bool
Check if the terms have been accepted for the given upload Terms only need to be accepted when uploading through an upload share link If uploading through an upload share link then the accepted terms have been stored in $_COOKIE["acceptedterms"]
can_create_collections()  : bool
Determines whether the current user has permission to create collections.
can_view_collection_log()  : bool
Determines whether the current user has permission to view the collection log.
reorder_all_featured_collections_with_parent()  : array<string|int, mixed>
Re-order all featured collections at a particular tree depth.
process_collection_download()  : array<string|int, mixed>
Generate a collection download ZIP file and the download filename

Functions

get_user_collections()

Return all collections belonging to or shared with $user

get_user_collections(int $user[, string $find = "" ][, string $order_by = "name" ][, string $sort = "ASC" ][, int $fetchrows = -1 ][, bool $auto_create = true ]) : array<string|int, mixed>
Parameters
$user : int
$find : string = ""

A search string

$order_by : string = "name"

Column to sort by

$sort : string = "ASC"

ASC or DESC sort order

$fetchrows : int = -1

How many rows to fetch

$auto_create : bool = true

Create a standard "Default Collection" if one doesn't exist

Return values
array<string|int, mixed>

get_collection()

Returns all data for collection $ref.

get_collection(int $ref[, bool $usecache = false ]) : array<string|int, mixed>|bool
Parameters
$ref : int

Collection ID

$usecache : bool = false

Optionally retrieve from cache

Return values
array<string|int, mixed>|bool

get_collection_resources()

Returns all resources in collection

get_collection_resources(int $collection) : array<string|int, mixed>|bool
Parameters
$collection : int

ID of collection being requested

Return values
array<string|int, mixed>|bool

get_collection_resources_with_data()

Get all resources in a collection without checking permissions or filtering by workflow states.

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

This is useful when you want to get all the resources for further subprocessing (@see render_selected_collection_actions() as an example)

Parameters
$ref : int

Collection ID

Return values
array<string|int, mixed>

add_resource_to_collection()

Add resource $resource to collection $collection

add_resource_to_collection(int $resource, int $collection[, bool $smartadd = false ][, string $size = "" ][, string $addtype = "" ][, bool $col_access_control = null ][, array<string|int, mixed> $external_shares = null ][, string $search = '' ][, int $sort_order = null ]) : bool|string
Parameters
$resource : int
$collection : int
$smartadd : bool = false
$size : string = ""
$addtype : string = ""
$col_access_control : bool = null

Collection access control. Is user allowed to add to it? You can leave it null to allow this function to determine it but it may have performance issues.

$external_shares : array<string|int, mixed> = null

List of external share keys. get_external_shares(). You can leave it null to allow this function to determine it but it will affect performance.

$search : string = ''

Optionsl search string. Used to update resource_node hit count

$sort_order : int = null

Sort order of resource in collection

Return values
bool|string

remove_resource_from_collection()

Remove resource $resource from collection $collection

remove_resource_from_collection(int $resource, int $collection[, bool $smartadd = false ]) : bool|string
Parameters
$resource : int
$collection : int
$smartadd : bool = false
Return values
bool|string

collection_add_resources()

Add resource(s) $resources to collection $collection

collection_add_resources(mixed $collection[, mixed $resources = '' ][, mixed $search = '' ][, mixed $selected = false ]) : bool|string
Parameters
$collection : mixed
$resources : mixed = ''
$search : mixed = ''
$selected : mixed = false
Return values
bool|string

collection_remove_resources()

collection_remove_resources

collection_remove_resources(mixed $collection[, mixed $resources = '' ][, mixed $removeall = false ][, mixed $selected = false ]) : bool|string
Parameters
$collection : mixed
$resources : mixed = ''
$removeall : mixed = false
$selected : mixed = false
Return values
bool|string

collection_writeable()

Is the collection $collection writable by the current user? Returns true if the current user has write access to the given collection.

collection_writeable(int $collection) : bool
Parameters
$collection : int
Return values
bool

collection_readable()

Returns true if the current user has read access to the given collection.

collection_readable(int $collection) : bool
Parameters
$collection : int
Return values
bool

set_user_collection()

Sets the current collection of $user to be $collection

set_user_collection(int $user, int $collection) : void
Parameters
$user : int
$collection : int

create_collection()

Creates a new collection for user $userid called $name

create_collection(int $userid, string $name[, bool $allowchanges = 0 ][, bool $cant_delete = 0 ][, int $ref = 0 ][, bool $public = false ][, mixed $extraparams = array() ]) : int
Parameters
$userid : int
$name : string
$allowchanges : bool = 0
$cant_delete : bool = 0
$ref : int = 0
$public : bool = false
$extraparams : mixed = array()
Return values
int

delete_collection()

Deletes the collection with reference $ref

delete_collection(int $collection) : bool|void
Parameters
$collection : int
Return values
bool|void

refresh_collection_frame()

Adds script to page that refreshes the Collection bar

refresh_collection_frame([int $collection = "" ]) : void
Parameters
$collection : int = ""

Collection id

search_public_collections()

Performs a search for featured collections / public collections.

search_public_collections([string $search = "" ][, string $order_by = "name" ][, string $sort = "ASC" ][, bool $exclude_themes = true ][, bool $exclude_public = false ][, bool $include_resources = false ][, bool $override_group_restrict = false ][, int $fetchrows = -1 ]) : array<string|int, mixed>
Parameters
$search : string = ""
$order_by : string = "name"
$sort : string = "ASC"
$exclude_themes : bool = true
$exclude_public : bool = false
$include_resources : bool = false
$override_group_restrict : bool = false
$fetchrows : int = -1
Return values
array<string|int, mixed>

Search within available collections

do_collections_search(string $search, string $restypes[, int $archive = 0 ][, string $order_by = '' ][, string $sort = "DESC" ][, int $fetchrows = -1 ]) : array<string|int, mixed>
Parameters
$search : string
$restypes : string
$archive : int = 0
$order_by : string = ''
$sort : string = "DESC"
$fetchrows : int = -1
Return values
array<string|int, mixed>

add_collection()

Add a collection to a user's 'My Collections'

add_collection(int $user, int $collection) : bool
Parameters
$user : int

ID of user

$collection : int

ID of collection

Return values
bool

remove_collection()

Remove someone else's collection from a user's My Collections

remove_collection(int $user, int $collection) : mixed
Parameters
$user : int
$collection : int

index_collection()

Update the keywords index for this collection

index_collection(int $ref[, string $index_string = '' ]) : int
Parameters
$ref : int
$index_string : string = ''
Return values
int

How many keywords were indexed?

save_collection()

Process the save action when saving a collection

save_collection(int $ref[, array<string|int, mixed> $coldata = array() ]) : false|void
Parameters
$ref : int
$coldata : array<string|int, mixed> = array()
Return values
false|void

collections_comparator()

Case insensitive string comparisons using a "natural order" algorithm for collection names

collections_comparator(string $a, string $b) : mixed
Parameters
$a : string
$b : string
Tags
@return

integer < 0 if $a is less than $b > 0 if $a is greater than $b, and 0 if they are equal.

collections_comparator_desc()

Case insensitive string comparisons using a "natural order" algorithm for collection names

collections_comparator_desc(string $a, string $b) : mixed
Parameters
$a : string
$b : string
Tags
@return

integer < 0 if $a is less than $b > 0 if $a is greater than $b, and 0 if they are equal.

get_smart_theme_headers()

Returns a list of smart theme headers, which are basically fields with a 'smart theme name' set.

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

get_smart_themes_nodes()

get_smart_themes_nodes

get_smart_themes_nodes(int $field, bool $is_category_tree[, int $parent = null ][, array<string|int, mixed> $field_meta = array() ]) : array<string|int, mixed>
Parameters
$field : int
$is_category_tree : bool
$parent : int = null
$field_meta : array<string|int, mixed> = array()
  • resource type field metadata
Return values
array<string|int, mixed>

email_collection()

E-mail a collection to users

email_collection(mixed $colrefs, string $collectionname, string $fromusername, string $userlist, string $message, string $feedback[, int $access = -1 ][, string $expires = "" ][, string $useremail = "" ][, string $from_name = "" ][, string $cc = "" ][, bool $themeshare = false ][, string $themename = "" ][, string $themeurlsuffix = "" ][, bool $list_recipients = false ][, bool $add_internal_access = false ][, string $group = "" ][, string $sharepwd = "" ]) : string
  • Attempt to resolve all users in the string $userlist to user references.
  • Add $collection to these user's 'My Collections' page
  • Send them an e-mail linking to this collection
  • Handle multiple collections (comma separated list)
Parameters
$colrefs : mixed
$collectionname : string
$fromusername : string
$userlist : string
$message : string
$feedback : string
$access : int = -1
$expires : string = ""
$useremail : string = ""
$from_name : string = ""
$cc : string = ""
$themeshare : bool = false
$themename : string = ""
$themeurlsuffix : string = ""
$list_recipients : bool = false
$add_internal_access : bool = false
$group : string = ""
$sharepwd : string = ""
Return values
string

generate_collection_access_key()

Generate an external access key to allow external people to view the resources in this collection.

generate_collection_access_key(int $collection[, int $feedback = 0 ][, string $email = "" ][, int $access = -1 ][, string $expires = "" ][, string $group = "" ][, string $sharepwd = "" ][, array<string|int, mixed> $sub_fcs = array() ]) : string
Parameters
$collection : int

Collection ref -or- collection data structure

$feedback : int = 0
$email : string = ""
$access : int = -1
$expires : string = ""
$group : string = ""
$sharepwd : string = ""
$sub_fcs : array<string|int, mixed> = array()

List of sub-featured collections IDs (collection_email.php page has logic to determine this which is carried forward to email_collection())

Return values
string

The generated key used for external sharing

get_saved_searches()

Returns all saved searches in a collection

get_saved_searches(int $collection) : array<string|int, mixed>
Parameters
$collection : int
Return values
array<string|int, mixed>

Add a saved search to a collection

add_saved_search(int $collection) : void
Parameters
$collection : int

Remove a saved search from a collection

remove_saved_search(int $collection, int $search) : void
Parameters
$collection : int
$search : int

add_smart_collection()

Greate a new smart collection using submitted values

add_smart_collection() : void

get_search_title()

Get a display friendly name for the given search string Takes a full searchstring of the form 'search=restypes=archive=' and uses search_title_processing to autocreate a more informative title

get_search_title(string $searchstring) : string
Parameters
$searchstring : string

Search string

Return values
string

Friendly name for search

add_saved_search_items()

Adds all the resources in the provided search to $collection

add_saved_search_items(int $collection[, string $search = "" ][, string $restypes = "" ][, string $archivesearch = "" ][, string $order_by = "relevance" ][, string $sort = "desc" ][, string $daylimit = "" ][, int $res_access = "" ][, bool $editable_only = false ]) : bool
Parameters
$collection : int
$search : string = ""
$restypes : string = ""
$archivesearch : string = ""
$order_by : string = "relevance"
$sort : string = "desc"
$daylimit : string = ""
$res_access : int = ""

The ID of the resource access level

$editable_only : bool = false

If true then only editable resources will be added

Return values
bool

allow_multi_edit()

Returns true or false, can all resources in this collection be edited by the user?

allow_multi_edit(array<string|int, mixed>|int $collection[, array<string|int, mixed> $collectionid = 0 ]) : bool
Parameters
$collection : array<string|int, mixed>|int

Collection IDs

$collectionid : array<string|int, mixed> = 0
Return values
bool

Get featured collection resources (including from child nodes). For normal FCs this is using the collection_resource table.

get_featured_collection_resources(array<string|int, mixed> $c, array<string|int, mixed> $ctx) : array<string|int, mixed>

For FC categories, this will check within normal FCs contained by that category. Normally used in combination with generate_featured_collection_image_urls() but useful to determine if a FC category is full of empty FCs.

Parameters
$c : array<string|int, mixed>

Collection data structure similar to the one returned by get_featured_collections()

$ctx : array<string|int, mixed>

Extra context used to get FC resources (e.g smart FC?, limit on number of resources returned). Context information should take precedence over internal logic (e.g determining the result limit)

Return values
array<string|int, mixed>

Get a list of featured collections based on a higher level featured collection category. This returns all direct/indirect collections under that category.

get_featured_collection_categ_sub_fcs(array<string|int, mixed> $c[, array<string|int, mixed> $ctx = array() ]) : array<string|int, mixed>
Parameters
$c : array<string|int, mixed>

Collection data structure

$ctx : array<string|int, mixed> = array()

Contextual data (e.g disable access control). This param MUST NOT get exposed over the API

Return values
array<string|int, mixed>

Get preview URLs for a list of resource IDs

generate_featured_collection_image_urls(array<string|int, mixed> $resource_refs) : array<string|int, mixed>
Parameters
$resource_refs : array<string|int, mixed>

List of resources

Return values
array<string|int, mixed>

List of resource refs and corresponding images URLs

swap_collection_order()

Inserts $resource1 into the position currently occupied by $resource2

swap_collection_order(int $resource1, int $resource2, int $collection) : void
Parameters
$resource1 : int
$resource2 : int
$collection : int

update_collection_order()

Reorder the items in a collection using $neworder as the order by metric

update_collection_order(array<string|int, mixed> $neworder, int $collection[, int $offset = 0 ]) : void
Parameters
$neworder : array<string|int, mixed>

Array of columns to order by

$collection : int
$offset : int = 0

get_collection_resource_comment()

Return comments and other columns stored in the collection_resource join.

get_collection_resource_comment(int $resource, int $collection) : array<string|int, mixed>|bool
Parameters
$resource : int
$collection : int
Return values
array<string|int, mixed>|bool

Returns found record data, false otherwise

save_collection_resource_comment()

Save a comment and/or rating for the instance of a resource in a collection.

save_collection_resource_comment(int $resource, int $collection, string $comment, int $rating) : bool
Parameters
$resource : int
$collection : int
$comment : string
$rating : int
Return values
bool

relate_to_collection()

Relates every resource in $collection to $ref

relate_to_collection(int $ref, int $collection) : void
Parameters
$ref : int
$collection : int

get_collection_comments()

Fetch all the comments for a given collection.

get_collection_comments(int $collection) : array<string|int, mixed>
Parameters
$collection : int
Return values
array<string|int, mixed>

send_collection_feedback()

Sends the feedback to the owner of the collection

send_collection_feedback(int $collection, string $comment) : array<string|int, mixed>|void
Parameters
$collection : int

Collection ID

$comment : string

Comment text

Return values
array<string|int, mixed>|void

copy_collection()

Copy a collection contents

copy_collection(int $copied, int $current[, bool $remove_existing = false ]) : void
Parameters
$copied : int

The collection to copy from

$current : int

The collection to copy to

$remove_existing : bool = false

Should existing items be removed?

collection_is_research_request()

Returns true if a collection is a research request

collection_is_research_request(int $collection) : bool
Parameters
$collection : int

Collection ID

Return values
bool

Generates a HTML link for adding a resource to a collection

add_to_collection_link(int $resource[, string $extracode = "" ][, string $size = "" ][, string $class = "" ][, string $view_title = "" ]) : string
Parameters
$resource : int

ID of resource

$extracode : string = ""

Additional code to be run when link is selected IMPORTANT: never use untrusted data here!

$size : string = ""

Resource size if appropriate

$class : string = ""

Class to be applied to link

$view_title : string = ""

The title of the field, taken from $view_title_field

Return values
string

Render a "remove from collection" link wherever such a function is shown in the UI

remove_from_collection_link(int $resource[, string $class = "" ][, string $onclick = '' ][, bool $notused = false ][, string $view_title = "" ]) : string
Parameters
$resource : int
$class : string = ""
$onclick : string = ''

Additional onclick code to call before returning false.

$notused : bool = false

No longer used

$view_title : string = ""

The title of the field, taken from $view_title_field

Return values
string

Generates a HTML link for adding a changing the current collection

change_collection_link(int $collection) : string
Parameters
$collection : int
Return values
string

get_collection_external_access()

Return all external access given to a collection.

get_collection_external_access(int $collection) : array<string|int, mixed>

Users, emails and dates could be multiple for a given access key, an in this case they are returned comma-separated.

Parameters
$collection : int
Return values
array<string|int, mixed>

delete_collection_access_key()

Delete a specific collection access key, withdrawing access via that key to the collection in question

delete_collection_access_key(int $collection, string $access_key) : void
Parameters
$collection : int
$access_key : string

collection_log()

Add a new row to the collection log (e.g. after an action on that collection)

collection_log(int $collection, string $type, int $resource[, string $notes = "" ]) : void
Parameters
$collection : int
$type : string

Action type

$resource : int
$notes : string = ""

get_collection_log()

Return the log for $collection

get_collection_log(int $collection[, int $fetchrows = -1 ]) : array<string|int, mixed>
Parameters
$collection : int
$fetchrows : int = -1

How many rows to fetch

Return values
array<string|int, mixed>

collection_max_access()

Returns the maximum access (the most permissive) that the current user has to the resources in $collection.

collection_max_access(int $collection) : int
Parameters
$collection : int
Return values
int

collection_min_access()

Returns the minimum access (the least permissive) that the current user has to the resources in $collection.

collection_min_access(int|array<string|int, mixed> $collection) : int

Can be passed a collection ID or the results of a collection search, the result will be the most restrictive access that is found.

Parameters
$collection : int|array<string|int, mixed>

Collection ID as an integer or the result of a search as an array

Return values
int

0 - Open, 1 - restricted, 2 - Confidential

collection_set_public()

Set an existing collection to be public

collection_set_public(int $collection) : bool
Parameters
$collection : int

ID of collection

Return values
bool

remove_all_resources_from_collection()

Remove all resources from a collection

remove_all_resources_from_collection(int $ref) : void
Parameters
$ref : int

The collection in question

get_home_page_promoted_collections()

Retrieve promoted collections to be displayed on the home page.

get_home_page_promoted_collections() : array<string|int, mixed>

This function fetches public collections that are marked for publishing to the home page. It returns an array of collection data, including metadata and thumbnail information for the home page image if one is assigned.

Return values
array<string|int, mixed>

An array of associative arrays representing each promoted collection, with keys:

  • 'ref' (int): The unique identifier for the collection.
  • 'type' (int): The type identifier for the collection.
  • 'name' (string): The name of the collection.
  • 'home_page_publish' (int): Indicates if the collection is published on the home page.
  • 'home_page_text' (string): Display text for the collection for the home page.
  • 'home_page_image' (int): Resource ID for the image displayed on the home page.
  • 'thumb_height' (int): Thumbnail height of the associated image.
  • 'thumb_width' (int): Thumbnail width of the associated image.
  • 'resource_type' (int): The type of the associated resource.
  • 'file_extension' (string): File extension of the associated resource.

is_collection_approved()

Return an array of distinct archive/workflow states for resources in $collection

is_collection_approved(int $collection) : array<string|int, mixed>
Parameters
$collection : int
Return values
array<string|int, mixed>

edit_collection_external_access()

Update an existing external access share

edit_collection_external_access(string $key[, int $access = -1 ][, string $expires = "" ][, int $group = "" ][, string $sharepwd = "" ][, array<string|int, mixed> $shareopts = array() ]) : bool
Parameters
$key : string

External access key

$access : int = -1

Share access level

$expires : string = ""

Share expiration date

$group : int = ""

ID of usergroup that share will emulate permissions for

$sharepwd : string = ""

Share password

$shareopts : array<string|int, mixed> = array()

Array of additional share options "collection" - int collection ID "upload" - bool Set to true if share is an upload link (no visibility of existing resources)

Return values
bool

show_hide_collection()

Hide or show a collection from the My Collections area.

show_hide_collection(int $colref[, bool $show = true ][, int $user = "" ]) : bool
Parameters
$colref : int
$show : bool = true

Show or hide?

$user : int = ""
Return values
bool

get_session_collections()

Get an array of collection IDs for the specified ResourceSpace session and user

get_session_collections(string $rs_session[, int $userref = "" ][, bool $create = false ]) : array<string|int, mixed>
Parameters
$rs_session : string

Session id - as obtained by get_rs_session_id()

$userref : int = ""

User ID

$create : bool = false

Create new collection?

Return values
array<string|int, mixed>

Array of collection IDs for the specified sesssion

update_collection_user()

Update collection to belong to a new user

update_collection_user(int $collection, int $newuser) : bool
Parameters
$collection : int

Collection ID

$newuser : int

User ID to assign collection to

Return values
bool

success|failure

compile_collection_actions()

Helper function for render_actions(). Compiles actions that are normally valid for collections

compile_collection_actions(array<string|int, mixed> $collection_data, bool $top_actions[, array<string|int, mixed> $resource_data = array() ]) : array<string|int, mixed>
Parameters
$collection_data : array<string|int, mixed>

Collection data

$top_actions : bool

Set to true if actions are to be rendered in the search filter bar (above results)

$resource_data : array<string|int, mixed> = array()

Resource data

Return values
array<string|int, mixed>

makeFilenameUnique()

Make a filename unique by appending a dupe-string.

makeFilenameUnique(array<string|int, mixed> $base_values, string $filename, string $dupe_string, string $extension[, int $dupe_increment = null ]) : string
Parameters
$base_values : array<string|int, mixed>
$filename : string
$dupe_string : string
$extension : string
$dupe_increment : int = null
Return values
string

Unique filename

Render the new featured collection form

new_featured_collection_form(int $parent) : void
Parameters
$parent : int

Featured collection parent. Use zero for root featured collection category

GetThemesFromRequest()

Get a themes array

GetThemesFromRequest(int $levels) : array<string|int, mixed>
Parameters
$levels : int

Number of levels to parse from request

Return values
array<string|int, mixed>

Array containing names of themes matching the syntax used in the collection table i.e. theme, theme2, theme3

collection_download_use_original_filenames_when_downloading()

collection_download_use_original_filenames_when_downloading(array<string|int, mixed> &$dl_data, string &$filename, int $ref, string $pextension, string &$p, bool $copy) : void
Parameters
$dl_data : array<string|int, mixed>

Array of collection download data from process_collection_download() (passed by reference so can be added to)

$filename : string

Filename (passed by reference)

$ref : int

Resource ID

$pextension : string

File extension

$p : string

Path to download file = passed by reference as may be replaced with a copy file

$copy : bool

Copy the file from filestore rather than renaming?

collection_download_process_text_file()

Provide resource data/collection_resource data to add to text file during a collection download.

collection_download_process_text_file(array<string|int, mixed> $dl_data, int $ref, string $filename, bool $subbed_original) : string
Parameters
$dl_data : array<string|int, mixed>

Array of collection download data passed from process_collection_download()

$ref : int

Resource ID

$filename : string
$subbed_original : bool

Has original file been substituted for unavailable size?

Return values
string

Text to append to file

collection_download_log_resource_ready()

Update the resource log to show the download during a collection download.

collection_download_log_resource_ready(array<string|int, mixed> $dl_data, string $tmpfile, int $ref[, string $email = "" ]) : void
Parameters
$dl_data : array<string|int, mixed>

Array of collection download data passed from process_collection_download()

$tmpfile : string

Temp download file path

$ref : int

The resource ID

$email : string = ""

Email address of downloader

collection_download_process_data_only_types()

Add PDFs for "data only" types to a zip file during creation.

collection_download_process_data_only_types(array<string|int, mixed> $dl_data, object &$zip) : void
Parameters
$dl_data : array<string|int, mixed>

Array of collection download data

$zip : object

Collection zip file

collection_download_process_summary_notes()

collection_download_process_summary_notes(array<string|int, mixed> &$dl_data, string $filename, mixed &$zip) : mixed
Parameters
$dl_data : array<string|int, mixed>

Array of collection download data from process_collection_download() (passed by reference so can be added to)

$filename : string

Resource filename

$zip : mixed

Collection zip file, false if using TAR

collection_download_process_csv_metadata_file()

Add a CSV containing resource metadata to a downloaded zip file during creation of the zip.

collection_download_process_csv_metadata_file(array<string|int, mixed> &$dl_data, object &$zip) : void
Parameters
$dl_data : array<string|int, mixed>

Array of collection download data from process_collection_download() (passed by reference so can be added to)

$zip : object

Collection zip file

collection_download_process_collection_download_name()

Modifies the filename for downloading as part of the specified collection

collection_download_process_collection_download_name(string &$filename, int $collection, string $size, string $suffix, array<string|int, mixed> $collectiondata) : void
Parameters
$filename : string

Filename (passed by reference)

$collection : int

Collection ID

$size : string

Size code e.g scr,pre

$suffix : string

String suffix to add (before file extension)

$collectiondata : array<string|int, mixed>

Collection data obtained by get_collection()

collection_download_process_archive_command()

Executes the archiver command when downloading a collection.

collection_download_process_archive_command(array<string|int, mixed> &$dl_data, object &$zip, string $filename, mixed &$zipfile) : bool
Parameters
$dl_data : array<string|int, mixed>

Array of collection download data from process_collection_download() (passed by reference so can be added to)

$zip : object

Collection zip file

$filename : string

Download filename

$zipfile : mixed
Return values
bool

Will return true if there is no further work to be done as will be the case for a tar file. False when further processing needed e.g. when producing a zip file.

collection_download_clean_temp_files()

Remove temporary files created during download by exiftool for adding metadata.

collection_download_clean_temp_files(array<string|int, mixed> $deletion_array) : void
Parameters
$deletion_array : array<string|int, mixed>

An array of file paths

collection_cleanup_inaccessible_resources()

Delete any resources from collection moved out of users archive status permissions by other users

collection_cleanup_inaccessible_resources(int $collection) : void
Parameters
$collection : int

ID of collection

relate_all_collection()

Relate all resources in a collection

relate_all_collection(int $collection[, mixed $checkperms = true ]) : bool
Parameters
$collection : int

ID of collection

$checkperms : mixed = true
Return values
bool

unrelate_all_collection()

Un-relate all resources in a collection

unrelate_all_collection(int $collection[, mixed $checkperms = true ]) : bool
Parameters
$collection : int

ID of collection

$checkperms : mixed = true
Return values
bool

update_collection_type()

Update collection type for one collection or batch

update_collection_type(int|array<string|int, mixed> $cid, int $type[, mixed $log = true ]) : bool
Parameters
$cid : int|array<string|int, mixed>

Collection ID -or- list of collection IDs

$type : int

Collection type. @see include/definitions.php for available options

$log : mixed = true
Return values
bool

update_collection_parent()

Update collection parent for this collection

update_collection_parent(int $cid, int $parent) : bool
Parameters
$cid : int
$parent : int
Return values
bool

get_user_selection_collection()

Get a users' collection of type SELECTION.

get_user_selection_collection(int $user) : null|int

There can only be one collection of this type per user. If more, the first one found will be used instead.

Parameters
$user : int

User ID

Return values
null|int

Returns NULL if none found or the collection ID

delete_old_collections()

Delete all collections that are not in use e.g. session collections for the anonymous user. Will not affect collections that are public.

delete_old_collections([int $userref = 0 ][, int $days = 30 ]) : int
Parameters
$userref : int = 0
  • ID of user to delete collections for
$days : int = 30
  • minimum age of collections to delete in days
Return values
int
  • number of collections deleted

Get all featured collections

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

Get all featured collections by parent node

get_featured_collections(int $parent, array<string|int, mixed> $ctx) : array<string|int, mixed>
Parameters
$parent : int

The ref of the parent collection. When a featured collection contains another collection, it is then considered a featured collection category and won't have any resources associated with it.

$ctx : array<string|int, mixed>

Contextual data (e.g disable access control). This param MUST NOT get exposed over the API

Return values
array<string|int, mixed>

List of featured collections (with data)

Build appropriate SQL (for WHERE clause) to filter out featured collections for the user. The function will use either an IN or NOT IN depending which list is smaller to increase performance of the search

featured_collections_permissions_filter_sql(string $prefix, string $column[, bool $returnstring = false ]) : array<string|int, mixed>|string
Parameters
$prefix : string

SQL WHERE clause element. Mostly should be either WHERE, AND -or- OR depending on the SQL statement this is part of.

$column : string

SQL column on which to apply the filter for

$returnstring : bool = false

(temporary) Will return the legacy string version until do_search() and others are migrated to use prepared statements. This can be removed once all functions use prepared statements

Return values
array<string|int, mixed>|string

Returns "" if user should see all featured collections or a SQL filter (e.g AND ref IN("32", "34") ) with the placholders as the first element and the collection IDs as params for the second - for use in e.g. ps_query(), ps_value()

Access control function used to determine if a featured collection should be accessed by the user

featured_collection_check_access_control(int $c_ref) : bool
Parameters
$c_ref : int

Collection ref to be tested

Return values
bool

Returns TRUE if user should have access to the featured collection (no parent category prevents this), FALSE otherwise

Helper comparison function for ordering featured collections. It sorts using the order_by property, then based if the collection is a category (using the "has_resource" property), then by name (this takes into account the legacy use of '*' as a prefix to move to the start).

order_featured_collections(array<string|int, mixed> $a, array<string|int, mixed> $b) : Return
Parameters
$a : array<string|int, mixed>

First featured collection data structure to compare

$b : array<string|int, mixed>

Second featured collection data structure to compare

Return values
Return

an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.

Get featured collection categories

get_featured_collection_categories(int $parent, array<string|int, mixed> $ctx) : array<string|int, mixed>
Parameters
$parent : int

The ref of the parent collection.

$ctx : array<string|int, mixed>

Extra context for get_featured_collections(). Mostly used for overriding access control (e.g on the admin_group_permissions.php where we want to see all available featured collection categories).

Return values
array<string|int, mixed>

Check if a collection is a featured collection category

is_featured_collection_category(array<string|int, mixed> $fc) : bool
Parameters
$fc : array<string|int, mixed>

A featured collection data structure as returned by get_featured_collections()

Return values
bool

Check if a collection is a featured collection category by checking if the collection has been used as a parent. This function will make a DB query to find this out, it does not use existing structures.

is_featured_collection_category_by_children(int $c_ref) : bool

Normally a featured collection is a category if it has no resources. In some circumstances, when it's impossible to determine whether it should be or not, relying on children is another approach.

Parameters
$c_ref : int

Collection ID

Return values
bool

validate_collection_parent()

Validate a collection parent value

validate_collection_parent(int|array<string|int, mixed> $c) : null|int
Parameters
$c : int|array<string|int, mixed>

Collection ref -or- collection data as returned by get_collection()

Return values
null|int

Get to the root of the branch starting from the leaf featured collection

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

Collection ref which is considered a leaf of the tree

$fcs : array<string|int, mixed>

List of all featured collections

Return values
array<string|int, mixed>

Branch path structure starting from root to the leaf

Process POSTed featured collections categories data for a collection

process_posted_featured_collection_categories(int $depth, array<string|int, mixed> $branch_path) : array<string|int, mixed>
Parameters
$depth : int

The depth from which to start from. Usually zero.

$branch_path : array<string|int, mixed>

A full branch path of the collection. get_featured_collection_category_branch_by_leaf()

Return values
array<string|int, mixed>

Returns changes done regarding the collection featured collection category structure. This information then can be provided to save_collection() as: $coldata["featured_collections_changes"]

Find existing featured collection ref using its name and parent

get_featured_collection_ref_by_name(string $name, null|int $parent) : null|int
Parameters
$name : string

Featured collection name to search by

$parent : null|int

The featured collection parent

Return values
null|int

Move a featured collection branch paths' root to the node determined by the global configuration option $featured_collections_root_collection.

move_featured_collection_branch_path_root(array<string|int, mixed> $branch_path) : array<string|int, mixed>

This temporarily moves the root of the featured collection branch, removing any nodes on the branch from the real root up to the new root.

Parameters
$branch_path : array<string|int, mixed>

List of branch path nodes as returned by compute_node_branch_path()

see

$featured_collections_root_collection configuration option

Return values
array<string|int, mixed>

allow_collection_share()

Check if user is allowed to share collection

allow_collection_share(array<string|int, mixed> $c) : bool
Parameters
$c : array<string|int, mixed>

Collection data

Return values
bool

Return TRUE if user is allowed to share the collection, FALSE otherwise

Check if user is allowed to share featured collection. If the featured collection provided is a category, then this function will return FALSE if at least one sub featured collection has no share access (this is kept consistent with the check for normal collections when checking resources).

allow_featured_collection_share(array<string|int, mixed> $c) : bool
Parameters
$c : array<string|int, mixed>

Collection data. You can add "has_resources" and "sub_fcs" keys if you already have this information

Return values
bool

Return TRUE if user is allowed to share the featured collection, FALSE otherwise

Filter out featured collections that have a different root path. The function builds internally the path to the root from the provided featured collection ref and then filters out any featured collections that have a different root path.

filter_featured_collections_by_root(array<string|int, mixed> $fcs, int $c_ref[, array<string|int, mixed> $ctx = array() ]) : array<string|int, mixed>
Parameters
$fcs : array<string|int, mixed>

List of featured collections refs to filter out

$c_ref : int

A root featured collection ref

$ctx : array<string|int, mixed> = array()

Contextual data

Return values
array<string|int, mixed>

Get all featured collections branches where the specified resources can be found.

get_featured_collections_by_resources(array<string|int, mixed> $r_refs) : array<string|int, mixed>
Parameters
$r_refs : array<string|int, mixed>

List of resource IDs

Return values
array<string|int, mixed>

Returns list of featured collections (categories included) that contain the specified resource(s).

Verify if a featured collection can be deleted. To be deleted, it MUST not have any resources or children (if category).

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

Collection ID

Return values
bool

Returns TRUE if the featured collection can be deleted, FALSE otherwise

strip_prefix_chars()

Remove all instances of the specified character from start of string

strip_prefix_chars(string $string, string $char) : string
Parameters
$string : string

String to update

$char : string

Character to remove

Return values
string

allow_upload_to_collection()

Check access control if user is allowed to upload to a collection.

allow_upload_to_collection(array<string|int, mixed> $c) : bool
Parameters
$c : array<string|int, mixed>

Collection data structure

Return values
bool

Compute the featured collections allowed based on current access control

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

Returns FALSE if user should not see any featured collections (usually means misconfiguration) -or- TRUE if user has access to all featured collections. If some access control is in place, then the return will be an array with all the allowed featured collections

Check if user is allowed to re-order featured collections

can_reorder_featured_collections() : bool
Return values
bool

Check if user is authorised to edit a featured collection category

can_edit_featured_collection_category() : bool
Return values
bool

cleanup_anonymous_collections()

Remove all old anonymous collections

cleanup_anonymous_collections([int $limit = 100 ]) : void
Parameters
$limit : int = 100

Maximum number of collections to delete - if run from browser this is kept low to avoid delays

Check if user is permitted to create an external upload link for the given collection

can_share_upload_link(array<string|int, mixed> $collection_data) : bool
Parameters
$collection_data : array<string|int, mixed>

Array of collection data

Return values
bool

can_edit_upload_share()

Check if user can edit an existing upload share

can_edit_upload_share(int $collection, string $uploadkey) : bool
Parameters
$collection : int

Collection ID of share

$uploadkey : string

External upload key

Return values
bool

Creates an upload link for a collection that can be shared

create_upload_link(int $collection, array<string|int, mixed> $shareoptions) : string
Parameters
$collection : int

Collection ID

$shareoptions : array<string|int, mixed>
  • values to set 'usergroup' Usergroup id to share as (must be in $upload_link_usergroups array) 'expires' Expiration date in 'YYYY-MM-DD' format 'password' Optional password for share access 'emails' Optional array of email addresses to generate keys for
Return values
string

Share access key

generate_share_key()

Generates an external share key based on provided string

generate_share_key(string $string) : string
Parameters
$string : string
Return values
string

Generated key

upload_share_active()

Check if an external upload link is being used

upload_share_active() : mixed
Return values
mixed

false|int ID of upload collection, or false if not active

upload_share_setup()

Set up external upload share

upload_share_setup(string $key[, array<string|int, mixed> $shareopts = array() ]) : void
Parameters
$key : string

access key

$shareopts : array<string|int, mixed> = array()

Array of share options "collection" - (int) collection ID "user" - (int) user ID of share creator "usergroup" - (int) usergroup ID used for share

external_upload_notify()

Notify the creator of an external upload share that resources have been uploaded

external_upload_notify(int $collection, string $k, int $tempcollection) : void
Parameters
$collection : int

Ref of external shared collection

$k : string

External upload access key

$tempcollection : int

Ref of temporay upload collection

purge_expired_shares()

Purge all expired shares/**

purge_expired_shares(array<string|int, mixed> $filteropts) : string|int
Parameters
$filteropts : array<string|int, mixed>

Array of options to filter shares purged "share_group" - (int) Usergroup ref 'shared as' "share_user" - (int) user ID of share creator "share_type" - (int) 0=view, 1=upload "share_collection" - (int) Collection ID

Return values
string|int

can_delete_collection()

Check if user has the appropriate access to delete a collection.

can_delete_collection(array<string|int, mixed> $collection_data, int $userref[, int $k = "" ]) : bool
Parameters
$collection_data : array<string|int, mixed>

Array of collection details, typically from get_collection()

$userref : int

Id of user

$k : int = ""

External access key value

Return values
bool

Returns true is the collection can be deleted or false if it cannot.

send_collection_to_admin()

Send collection to administrators - used if $send_collection_to_admin is enabled

send_collection_to_admin(int $collection) : bool
Parameters
$collection : int

Collection ID

Return values
bool

get_default_user_collection()

Get the user's default collection, creating one if necessary

get_default_user_collection([bool $setactive = false ]) : int
Parameters
$setactive : bool = false

Set the collection as the user's active collection?

Return values
int

collection ID

update_smart_collection()

Update a smart collection with or without the $smart_collections_async option.

update_smart_collection(int $smartsearch_ref) : void
Parameters
$smartsearch_ref : int

Id of 'savedsearch'.

check_upload_terms()

Check if the terms have been accepted for the given upload Terms only need to be accepted when uploading through an upload share link If uploading through an upload share link then the accepted terms have been stored in $_COOKIE["acceptedterms"]

check_upload_terms(int $collection, string $k) : bool
Parameters
$collection : int

Collection ref

$k : string

Share key

Return values
bool

True if external upload share and terms have also been accepted OR if not an external upload False if external upload share and terms have NOT been accepted

can_create_collections()

Determines whether the current user has permission to create collections.

can_create_collections() : bool

This function checks for specific conditions that would prevent the user from creating collections. It returns false if any of these conditions are met:

  • The user has the "b" permission, which restricts collection creation.
  • The user is anonymous and does not have a session collection.
Return values
bool

Returns true if the user can create collections; otherwise, false.

can_view_collection_log()

Determines whether the current user has permission to view the collection log.

can_view_collection_log(array<string|int, mixed> $collection_data) : bool
Parameters
$collection_data : array<string|int, mixed>

Array of collection data, typically from get_collection()

Return values
bool

Returns true if the collection log can be viewed by the current user.

Re-order all featured collections at a particular tree depth.

reorder_all_featured_collections_with_parent(int|null $parent) : array<string|int, mixed>
Parameters
$parent : int|null
Return values
array<string|int, mixed>

Featured collection IDs list, in the new order

process_collection_download()

Generate a collection download ZIP file and the download filename

process_collection_download(array<string|int, mixed> $dl_data) : array<string|int, mixed>
Parameters
$dl_data : array<string|int, mixed>

Array of collection download options passed from collection_download.php or from the offline job This array will be updated and passed to subsidiary functions to keep track of processed file, generate text etc. Could be moved to an object later [ "filename" => [the name of download file], "collection" => [Collection ID], "collection_resources" => [Resources to include in download], "collectiondata" => [Collection data - from get_collection()], "exiftool_write_option" => [Write exif data?], "useoriginal" => [Use original if requested size not available?], "size" => [Requested Download size ID], "settings_id" => [Index of selected option from $collection_download_settings], "deletion_array" => [Array of paths to delete], "include_csv_file" => [Include metadata CSV file?], "include_alternatives" => [Include alternative files?], "includetext" => Include text file?, "collection_download_tar" => [Generate a TAR file?], "count_data_only_types" => [Count of data only resources], "id" => [Optional unique identifier - [used to create a download.php link that is specific to the user], "k" => External access key from download request if set ];

Return values
array<string|int, mixed>

Array of data about the created file and the download file nam, or the TAR status i.e. [ "filename" => [the name of download file], "path" => [path to the zip file], "completed" => [Set to true if a tar has been sent], ];

On this page

Search results