You are here

function uc_file_rules_data_info in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 uc_file/uc_file.rules.inc \uc_file_rules_data_info()

Implements hook_rules_data_info().

An entity is defined in order to get file expiration(s) down to token in the email.

File

uc_file/uc_file.rules.inc, line 14
Rules hooks and functions for uc_file.module.

Code

function uc_file_rules_data_info() {
  $data['uc_file_expiration'] = array(
    'label' => t('Ubercart file expiration(s)'),
    'wrap' => TRUE,
    'property info' => array(
      'fuid' => array(
        'type' => 'integer',
        'label' => t('File-user ID'),
        'description' => t('Primary key for user permission to download a file.'),
      ),
      'fid' => array(
        'type' => 'integer',
        'label' => t('File ID'),
        'description' => t('The file that may be downloaded.'),
      ),
      'file' => array(
        'type' => 'file',
        'label' => t('File'),
        'description' => t('The file that may be downloaded.'),
        'getter callback' => 'uc_file_get_expiration_properties',
        'setter callback' => 'uc_file_set_expiration_properties',
      ),
      'uid' => array(
        'type' => 'integer',
        'label' => t('User ID'),
        'description' => t('The user account ID.'),
      ),
      'user' => array(
        'type' => 'user',
        'label' => t('User'),
        'description' => t('The user account that may download the file.'),
        'getter callback' => 'uc_file_get_expiration_properties',
        'setter callback' => 'uc_file_set_expiration_properties',
      ),
      'pfid' => array(
        'type' => 'integer',
        'label' => t('Product feature ID'),
        'description' => t('The product feature that granted permission to download the file.'),
      ),
      'file-key' => array(
        'type' => 'text',
        'label' => t('File key'),
        'description' => t('A hash of the permission and expiraiton data.'),
      ),
      'granted' => array(
        'type' => 'date',
        'label' => t('Granted time'),
        'description' => t('The time the permission to download the file was granted.'),
      ),
      'expiration' => array(
        'type' => 'date',
        'label' => t('Expiration time'),
        'description' => t('The time when the permission to download the file will expire.'),
      ),
      'accessed' => array(
        'type' => 'integer',
        'label' => t('Accesses'),
        'description' => t('The number of times the file has been accessed.'),
      ),
      'addresses' => array(
        'type' => 'list<text>',
        'label' => t('IP addresses'),
        'description' => t('List of IP addresses to which the file has been downloaded.'),
      ),
      'download-limit' => array(
        'type' => 'integer',
        'label' => t('Download limit'),
        'description' => t('The numer of times the user may download the file.'),
      ),
      'address-limit' => array(
        'type' => 'integer',
        'label' => t('Address limit'),
        'description' => t('The number of different IP addresses that may download the file.'),
      ),
    ),
    'group' => t('File download'),
    'token type' => 'uc_file',
  );
  return $data;
}