Tripal
Functions
Bulk Loader

Functions

 tripal_validate_bulk_loader_template ($val_type, &$options, &$errors, &$warnings=[])
 
 tripal_insert_bulk_loader_template ($options, &$errors, &$warnings)
 
 tripal_is_bulk_loader_record_name_unique ($new_record_name, $template_id, $template_array=NULL, $current_priority=NULL)
 
 tripal_delete_bulk_loader_record ($delete_priority, $template_array)
 
 tripal_delete_bulk_loader_field ($priority, $delete_field_index, $template_array)
 

Detailed Description

All functions in this file provide an API to administrative management of bulk loader templates.

Function Documentation

◆ tripal_delete_bulk_loader_field()

tripal_delete_bulk_loader_field (   $priority,
  $delete_field_index,
  $template_array 
)

An API function to delete a field from a template array

Parameters
$priorityThe priority of the record containing the field
$delete_field_indexThe index of the field to be deleted
$template_arrayThe array describing the template
Returns
The modified template array

◆ tripal_delete_bulk_loader_record()

tripal_delete_bulk_loader_record (   $delete_priority,
  $template_array 
)

An API function to delete a record from a template array

Parameters
$delete_priorityThe priority of the record to be deleted
$template_arrayThe array describing the template
Returns
The modified template array

◆ tripal_insert_bulk_loader_template()

tripal_insert_bulk_loader_template (   $options,
$errors,
$warnings 
)

Inserts a bulk loader template record.

This function validates the options passed prior to insertion of the record.

Parameters
$optionsAn array of key/value pairs containing the following keys: 'template_name': The name of the template. 'template_array': The JSON array representing the template. Optional: 'strict': If set then only JSON formatted templates are allowed.
$errorsAn empty array where validation error messages will be set. The keys of the array will be name of the field from the options array and the value is the error message.
$warningsAn empty array where validation warning messagges will be set. The warnings should not stop an insert or an update but should be provided to the user as information by a drupal_set_message() if appropriate. The keys of the array will be name of the field from the options array and the value is the error message.
Returns
TRUE for success and FALSE for failure.

◆ tripal_is_bulk_loader_record_name_unique()

tripal_is_bulk_loader_record_name_unique (   $new_record_name,
  $template_id,
  $template_array = NULL,
  $current_priority = NULL 
)

Meant to be called from a form_validate function to ensure a newly added bulk loader record name is unique and not empty.

Parameters
$new_record_nameThe record name to check for uniqueness
$template_idThe template_id of the template to add the record to
$template_arrayThe array describing the template. Optional -will be loaded using template_id if not provided
$current_priorityThe priority of the already existing record -checks that the name only occurs on this particular record
Returns
TRUE if the record name is not empty and not already in the template_array; FALSE otherwise

◆ tripal_validate_bulk_loader_template()

tripal_validate_bulk_loader_template (   $val_type,
$options,
$errors,
$warnings = [] 
)

Validates an $options array for insert or update of a bulk loader record.

Parameters
$val_typeThe type of validation. Can be either 'insert' or 'update'.
$optionsAn array of key/value pairs containing the following keys: template_name: The name of the template. template_array: The JSON array representing the template. Optional: strict: If set then only JSON formatted templates are allowed.
$errorsAn empty array where validation error messages will be set. The keys of the array will be name of the field from the options array and the value is the error message.
$warningsAn empty array where validation warning messagges will be set. The warnings should not stop an insert or an update but should be provided to the user as information by a drupal_set_message() if appropriate. The keys of the array will be name of the field from the options array and the value is the error message.
Returns
If validation fails then FALSE is returned. Any options that do not pass validation checks will be added in the $errors array with the key being the option and the value being the error message. If validation is successful then TRUE is returned.