Tripal
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TripalEntityCollection Class Reference

Public Member Functions

 __construct ()
 
 delete ()
 
 load ($collection_id)
 
 create ($details)
 
 addBundle ($details)
 
 getBundles ()
 
 getBundleSiteId ($bundle_name)
 
 getFormatters ()
 
 getEntityIDs ($bundle_name)
 
 getFieldIDs ($bundle_name)
 
 getCreateDate ($formatted=TRUE)
 
 getName ()
 
 getCollectionID ()
 
 getDescription ()
 
 getUser ()
 
 getUserID ()
 
 getOutfile ($formatter)
 
 getOutfileURL ($formatter)
 
 getOutfilePath ($formatter)
 
 write ($formatter=NULL, TripalJob $job=NULL)
 

Protected Member Functions

 isFormatterCompatible ($formatter)
 

Protected Attributes

 $bundles = []
 
 $collection_id = NULL
 
 $collection_name = ''
 
 $ids = []
 
 $fields = []
 
 $user = []
 
 $create_date = ''
 
 $formatters = []
 
 $description = ''
 

Constructor & Destructor Documentation

◆ __construct()

TripalEntityCollection::__construct ( )

Constructs a new instance of the TripalEntityCollection class.

Member Function Documentation

◆ addBundle()

TripalEntityCollection::addBundle (   $details)

Creates a new tripal_collection_bundle entry.

Parameters
$detailsAn association array containing the details for a collection. The details must include the following key/value pairs:
  • 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.
Exceptions
Exception

◆ create()

TripalEntityCollection::create (   $details)

Creates a new data collection.

To add bundles with entities and fields to a collection, use the addBundle() function after the collection is created.

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
  • description: A user supplied description for the collection.
Exceptions
Exception

◆ delete()

TripalEntityCollection::delete ( )

Deletes the current collection

◆ getBundles()

TripalEntityCollection::getBundles ( )

Retrieves the list of bundles associated with the collection.

Returns
An array of bundles.

◆ getBundleSiteId()

TripalEntityCollection::getBundleSiteId (   $bundle_name)

Retrieves the site id for this specific bundle fo the collection.

Returns
A remote site ID, or an empty string if the bundle is local.

◆ getCollectionID()

TripalEntityCollection::getCollectionID ( )

Retrieves the collection ID.

Returns
A numeric ID for this collection.

◆ getCreateDate()

TripalEntityCollection::getCreateDate (   $formatted = TRUE)

Retrieves the date that the basket was created.

Parameters
$formattedIf TRUE then the date time will be formatted for human readability.
Returns
A UNIX time stamp string containing the date or a human-readable string if $formatted = TRUE.

◆ getDescription()

TripalEntityCollection::getDescription ( )

Retrieves the collection description

Returns
A string containing the description of the collection.

◆ getEntityIDs()

TripalEntityCollection::getEntityIDs (   $bundle_name)

Retrieves the list of entity IDs.

Returns
An array of numeric entity IDs.

◆ getFieldIDs()

TripalEntityCollection::getFieldIDs (   $bundle_name)

Retrieves the list of fields in the basket.

Returns
An array of numeric field IDs.

◆ getFormatters()

TripalEntityCollection::getFormatters ( )

Retrieves the list of appropriate download formatters for the basket.

Returns
An associative array where the key is the TripalFieldDownloader class name and the value is the human-readable label for the formatter.

◆ getName()

TripalEntityCollection::getName ( )

Retrieves the name of the collection.

Returns
A string containing the name of the collection.

◆ getOutfile()

TripalEntityCollection::getOutfile (   $formatter)

Retrieves the output filename for the desired formatter.

Parameters
$formatterThe class name of the formatter to use. The formatter must be compatible with the data collection.
Exceptions
Exception

◆ getOutfilePath()

TripalEntityCollection::getOutfilePath (   $formatter)

Retrieves the path for the downloadable file.

The path is in the Drupal URI format.

Parameters
$formatterThe name of the class

◆ getOutfileURL()

TripalEntityCollection::getOutfileURL (   $formatter)

Retrieves the URL for the downloadable file.

Parameters
$formatterThe name of the class

◆ getUser()

TripalEntityCollection::getUser ( )

Retrieves the user object of the user that owns the collection

Returns
A Drupal user object.

◆ getUserID()

TripalEntityCollection::getUserID ( )

Retrieves the ID of the user that owns the collection

Returns
The numeric User ID.

◆ isFormatterCompatible()

TripalEntityCollection::isFormatterCompatible (   $formatter)
protected

Indicates if the given formatter is compatible with the data collection.

Parameters
$formatterThe class name of the formatter to check.
Returns
boolean TRUE if the formatter is compatible, FALSE otherwise.

◆ load()

TripalEntityCollection::load (   $collection_id)

Loads an existing collection using a collection ID.

Parameters
$collection_idThe ID of the collection to load.
Exceptions
Exception

◆ write()

TripalEntityCollection::write (   $formatter = NULL,
TripalJob  $job = NULL 
)

Writes the collection to a file using a given formatter.

Parameters
formatterThe name of the formatter class to use (e.g. TripalTabDownloader). The formatter must be compatible with the data collection. If no formatter is supplied then all file formats supported by this data collection will be created.
$jobIf this function is run as a Tripal Job then this argument can be set to the Tripaljob object for keeping track of progress.
Exceptions
Exception

Member Data Documentation

◆ $bundles

TripalEntityCollection::$bundles = []
protected

The name of the bundles (i.e. content type) to which the entities belong.

◆ $collection_id

TripalEntityCollection::$collection_id = NULL
protected

The collection ID

◆ $collection_name

TripalEntityCollection::$collection_name = ''
protected

The name of this collection.

◆ $create_date

TripalEntityCollection::$create_date = ''
protected

The date that the collection was created.

◆ $description

TripalEntityCollection::$description = ''
protected

The description for this collection.

◆ $fields

TripalEntityCollection::$fields = []
protected

An array of field IDs.

◆ $formatters

TripalEntityCollection::$formatters = []
protected

The list of downloaders available for this bundle.

◆ $ids

TripalEntityCollection::$ids = []
protected

An array of numeric entities IDs.

◆ $user

TripalEntityCollection::$user = []
protected

The user object of the user that owns the collection.


The documentation for this class was generated from the following file: