You are here

function library_get_status_text in Library 7

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

Get the text that corresponds to a given status.

Parameters

array $item: Array of values for a given library item.

Return value

null|string The text to display the user for a given item's status.

3 calls to library_get_status_text()
library_get_table_row in ./library.module
Returns one table for an item table.
library_handler_field_library_status::render in includes/views/handlers/library_handler_field_library_status.inc
Implements render().
theme_library_items in ./library.theme.inc
Theme library items.

File

./library.module, line 1534

Code

function library_get_status_text($item) {
  if ($item['in_circulation'] == LIBRARY_REFERENCE_ONLY) {
    $text = variable_get('library_reference_only_text', 'REFERENCE ONLY');
  }
  elseif ($item['library_status'] == LIBRARY_ITEM_AVAILABLE) {
    $text = variable_get('library_available_text', 'AVAILABLE');
  }
  elseif ($item['library_status'] == LIBRARY_ITEM_UNAVAILABLE && !empty($item['last_due_date'])) {
    $duedate = format_date($item['last_due_date'], 'short');
    $text = 'DUE ' . $duedate;
  }
  else {
    $text = variable_get('library_unavailable_noduedates_text', 'UNAVAILABLE');
  }
  return $text;
}