You are here

function library_get_status_text in Library 6

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. 7 library.module \library_get_status_text()

Get the text that corresponds to a given status

Parameters

$item: Array of values for a given library item

Return value

A string

3 calls to library_get_status_text()
library_get_table_row in ./library.module
library_handler_field_library_status::render in includes/views/handlers/library_handler_field_library_status.inc
theme_library_items in ./library.theme.inc

File

./library.module, line 1511

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'], 'small');
    $text = 'DUE ' . $duedate;
  }
  else {
    $text = variable_get('library_unavailable_noduedates_text', 'UNAVAILABLE');
  }
  return $text;
}