You are here

function theme_library_items in Library 6.2

Same name and namespace in other branches
  1. 5.2 library.theme.inc \theme_library_items()
  2. 6 library.theme.inc \theme_library_items()
  3. 7 library.theme.inc \theme_library_items()
1 theme call to theme_library_items()
library_nodeapi in ./library.module
Implementation of hook_nodeapi()

File

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

Code

function theme_library_items($node) {
  $barcodes = variable_get('library_item_barcodes', LIBRARY_NO_BARCODES) == LIBRARY_BARCODES;
  $display_status = variable_get(library_status_display, 0) == 1;
  $items = $node->items;
  $header = array(
    t('Copy'),
  );
  if ($barcodes) {
    $header[] = t('Barcode');
  }
  if ($display_status) {
    $header[] = t('Status');
  }
  $header[] = t('Notes');
  $header[] = t('Actions');
  $rows = array();
  if ($items) {
    foreach ($items 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[] = $temp_array;
    }
  }
  return theme('table', $header, $rows);
}