You are here

function library_actions in Library 6

Same name and namespace in other branches
  1. 5.2 library.module \library_actions()
  2. 6.2 library.module \library_actions()
  3. 7 library.module \library_actions()

Parameters

$excluded: (optional) Numeric status change type of actions to exclude

Return value

Array of actions

9 calls to library_actions()
library_action_info in ./library.actions.inc
Implementation of hook_action_info().
library_admin_settings in ./library.admin.inc
Menu callback: Edit Library Settings.
library_admin_settings_overdue in ./library.admin.inc
Menu callback: Edit Library Overdue Settings.
library_admin_settings_overdue_validate in ./library.admin.inc
library_get_action_links in ./library.module

... See full list

File

./library.module, line 1112

Code

function library_actions($actions = NULL, $account = NULL) {
  if (is_array($actions) && !empty($actions)) {
    $result = db_query("SELECT name, aid, status_change from {library_actions} WHERE aid IN('%s') ORDER BY name, aid, status_change", implode(', ', $actions));
  }
  elseif (is_array($actions) && empty($actions)) {
    $result = NULL;
  }
  else {
    $result = db_query("SELECT name, aid, status_change from {library_actions} ORDER BY name, aid, status_change");
  }
  $user_all_library_actions = is_null($account) || user_access('administer transactions');
  $actions = array();
  while ($action = db_fetch_object($result)) {
    if ($user_all_library_actions || user_access('submit library ' . $action->name)) {
      $actions[$action->aid] = array(
        'name' => t($action->name),
        'status_change' => $action->status_change,
      );
    }
  }
  return array_filter($actions);
}