You are here

function activity_batch_load in Activity 6.2

Menu loader function to load batch-able action_id.

Parameters

$aid: The action id for the template.

Return value

array / FALSE An array of events to batch if the action is batch-able or FALSE

2 calls to activity_batch_load()
activity_batch_regenerate_step in ./activity.admin.inc
Batch regeneration step.
theme_activity_settings_actions_list in ./activity.module
Theme function to display a list of available activity actions.

File

./activity.module, line 256
Primarily Drupal hooks and global API functions to manipulate activity.

Code

function activity_batch_load($aid, $from, $count) {
  $trigger_assignment = db_fetch_object(db_query("SELECT hook, op FROM {trigger_assignments} WHERE aid = '%s'", $aid));

  // Load the action to make sure aid is saved to the parameters, otherwise this
  // activity template is up to date with the batch api. This is for backwards
  // compatibility.
  $action = actions_load($aid);
  $parameters = unserialize($action->parameters);
  if (!empty($trigger_assignment) && !empty($parameters['aid'])) {
    $module = activity_module_name($trigger_assignment->hook);
    $info = activity_get_module_info($module);
    if (!empty($info->list_callback) && !empty($info->context_load_callback)) {
      $callback = $info->list_callback;
      $listing = $callback($trigger_assignment->hook, $trigger_assignment->op, variable_get('activity_expire', 0), $from, $count);
      if (!empty($listing)) {
        return $listing;
      }
    }
  }
  return FALSE;
}