Tripal
Functions
Data Collections

Functions

 tripal_create_collection ($details)
 
 tripal_get_user_collections ($uid)
 
 tripal_expire_collections ()
 
 tripal_get_collection ($values)
 
 tripal_create_collection_files ($collection_id, TripalJob $job=NULL)
 

Detailed Description

New with Tripal v3 are data collections. A data collection can be compared to a "shopping cart" system where site users can collect data of interest to them, and use that data later for other purposes. By default, Tripal offers data collections with the default search interface provided by views. This interface allows end-users to create data collections after searching for items using the default search. Once in a collection users can then generate files for downloading or use by other tools that support data collections.

Function Documentation

◆ tripal_create_collection()

tripal_create_collection (   $details)

Creates a collection of entities for a given user.

Use this function if you want to create a new collection with an bundle. Otherwise, a new collection can also be created by creating an new instance of a TripalEntityCollection object.

Parameters
$detailsAn association array containing the details for a collection. The details must include the following key/value pairs:
  • uid: The ID of the user that owns the collection
  • collection_name: The name of the collection
  • bundle_name: The name of the TripalEntity content type.
  • ids: An array of the entity IDs that form the collection.
  • fields: An array of the field IDs that the collection is limited to.
  • description: A user supplied description for the collection.
Returns
TripalEntityCollection An instance of a TripalEntityCollection class or FALSE on failure.

◆ tripal_create_collection_files()

tripal_create_collection_files (   $collection_id,
TripalJob  $job = NULL 
)

Generates the downloadable files for a Collection

Parameters
TripalEntityCollection$collection

◆ tripal_expire_collections()

tripal_expire_collections ( )

Deletes all collections that have surpassed their lifespan

◆ tripal_get_collection()

tripal_get_collection (   $values)

Retrieve a collection using the collection ID

Parameters
$valuesAn array of key/value pairs to uniquely identify a collection. The following keys can be used:
  • collection_id: The numeric value for the collection.
  • uid: The ID of the user that owns the collection. This key must always be used with the 'name' key.
  • name: The name of the collection. This key must always be used with the 'uid' key.
Returns
An instance of a TripalEntityCollection class or FALSE on failure.

◆ tripal_get_user_collections()

tripal_get_user_collections (   $uid)

Retrieves an array of collections for a user.

Parameters
$uidThe User ID
Returns
An array of TripalEntityCollection objects.