function library_actions in Library 7
Same name and namespace in other branches
- 5.2 library.module \library_actions()
- 6.2 library.module \library_actions()
- 6 library.module \library_actions()
Return all library actions.
@todo display_all is possible redundant to !$aids or needs documentation.
Parameters
array $aids: List of actions to match.
bool $display_all: Set to ignore permissions.
Return value
array List of actions.
9 calls to library_actions()
- library_action_info in ./
library.actions.inc - Implements 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 - Validates settings set in library administration.
- library_get_action_links in ./
library.module - Returns the actions available for an item.
1 string reference to 'library_actions'
- library_get_transactions_query in ./
library.module - Retrieves all transactions, not called directly.
File
- ./
library.module, line 1012
Code
function library_actions($aids = array(), $display_all = TRUE) {
$result = NULL;
if (!empty($aids)) {
$result = db_query("SELECT name, aid, status_change from {library_actions} WHERE aid IN (:aids) ORDER BY name", array(
':aids' => $aids,
));
}
elseif ($display_all) {
$result = db_query("SELECT name, aid, status_change from {library_actions} ORDER BY name");
}
$view_all_library_actions = $display_all || user_access('administer transactions');
$actions = array();
if ($result) {
foreach ($result as $action) {
if ($view_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);
}