You are here

function theme_library_items in Library 7

Same name and namespace in other branches
  1. 5.2 library.theme.inc \theme_library_items()
  2. 6.2 library.theme.inc \theme_library_items()
  3. 6 library.theme.inc \theme_library_items()

Theme library items.

Parameters

array $items: The items to theme.

Return value

string Returns themed table.

1 theme call to theme_library_items()
library_node_view in ./library.module
Implements hook_node_view().

File

./library.theme.inc, line 61
Theming for the library module

Code

function theme_library_items($items) {
  $barcodes = variable_get('library_item_barcodes', LIBRARY_NO_BARCODES) == LIBRARY_BARCODES;
  $display_status = variable_get('library_status_display', 0) == 1;
  $header = array(
    t('Copy'),
  );
  if ($barcodes) {
    $header[] = t('Barcode');
  }
  if ($display_status) {
    $header[] = t('Status');
  }
  $header[] = t('Notes');
  $header[] = t('Actions');
  $rows = array();
  $itemlist = $items['items'];
  if ($itemlist) {
    foreach ($itemlist as $key => $item) {
      $temp_array = array(
        $key + 1,
      );
      if ($barcodes) {
        $temp_array[] = $item['barcode'];
      }
      if ($display_status) {
        $temp_array[] = library_get_status_text($item);
      }
      $temp_array[] = $item['notes'];
      $temp_array[] = implode(" | ", library_get_action_links($item)) . ' ';
      $rows[$key] = $temp_array;
    }
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
}