Documentation

research_functions.php

Table of Contents

Functions

send_research_request()  : void
Sends a research request by inserting it into the requests table and notifying the relevant users.
get_research_requests()  : array<string|int, mixed>
Retrieves research requests from the database, optionally filtering by a search term and sorting the results by a specified field.
get_research_request()  : array<string|int, mixed>|false
Retrieves a research request by its reference number, returning its details including name, description, deadline, contact information, user assignment, status, and custom fields.
save_research_request()  : bool
Saves a research request by updating its status and assigned user, sending notifications to the originator if the status changes, and optionally deleting the request or copying existing collection resources.
get_research_request_collection()  : int|false
Retrieves the collection reference associated with a given research request.
set_research_collection()  : void
Updates the collection reference associated with a specified research request.

Functions

send_research_request()

Sends a research request by inserting it into the requests table and notifying the relevant users.

send_research_request(array<string|int, mixed> $rr_cfields) : void

This function takes an array of custom fields related to the research request, processes the input data, and sends an email notification to the designated research admins. It gathers resource types, deadlines, contact information, and custom fields, and stores them in the database. It also constructs and sends a notification message with the request details.

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

An array of custom fields associated with the research request.

Tags
throws
Exception

If there is an error during JSON encoding of custom fields.

Return values
void

This function does not return any value but performs database operations and sends notifications.

get_research_requests()

Retrieves research requests from the database, optionally filtering by a search term and sorting the results by a specified field.

get_research_requests([string $find = "" ][, string $order_by = "name" ][, string $sort = "ASC" ]) : array<string|int, mixed>
Parameters
$find : string = ""

Optional search term to filter research requests by name, description, contact, or reference number.

$order_by : string = "name"

The field to sort the results by. Valid options are 'ref', 'name', 'created', 'status', or 'assigned_to'.

$sort : string = "ASC"

The sort direction, either 'ASC' or 'DESC'. Defaults to 'ASC'.

Return values
array<string|int, mixed>

An array of research requests that match the search criteria.

get_research_request()

Retrieves a research request by its reference number, returning its details including name, description, deadline, contact information, user assignment, status, and custom fields.

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

The reference number of the research request to retrieve.

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

An associative array with the research request details if found, or false if no request exists.

save_research_request()

Saves a research request by updating its status and assigned user, sending notifications to the originator if the status changes, and optionally deleting the request or copying existing collection resources.

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

The reference number of the research request to be saved.

Return values
bool

True if the operation was successful, false otherwise.

get_research_request_collection()

Retrieves the collection reference associated with a given research request.

get_research_request_collection(int $ref) : int|false
Parameters
$ref : int

The reference number of the research request.

Return values
int|false

The collection reference if found, or false if not.

set_research_collection()

Updates the collection reference associated with a specified research request.

set_research_collection(int $research, int $collection) : void
Parameters
$research : int

The reference number of the research request.

$collection : int

The reference number of the collection to associate.

On this page

Search results