You are here

function theme_merci_build_reservation_table_form in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6

Same name and namespace in other branches
  1. 6.2 theme/theme.inc \theme_merci_build_reservation_table_form()

Builds the reserved items table.

File

./merci.module, line 2110
MERCI - Managed Equipment Reservation Checkout and Inventory

Code

function theme_merci_build_reservation_table_form($form) {
  $output = '';
  $header = $form['#header'];
  $node = $form['#node'];
  $rows = array();
  foreach ($form['#table'] as $did => $columns) {
    $item = drupal_render($form['items'][$did]);

    // The content type name.
    if (isset($columns['display_item'])) {
      $item .= $columns['display_item'];
    }
    $rows[] = array(
      $item,
      $form['#table'][$did]['type'],
      $form['#table'][$did]['ops'],
    );
  }
  if (!empty($rows)) {
    $table_caption = in_array((int) $node->merci['status'], array(
      MERCI_STATUS_CHECKED_OUT,
      MERCI_STATUS_CHECKED_IN,
    )) ? t('Checked out items') : t('Currently reserved items');
    $output .= '<div class="existing-items-table-header">' . $table_caption . '</div>';
    $output .= theme('table', $header, $rows);
    if (user_access('administer MERCI')) {
      $output .= '<div><a href="/merci/contract/' . $node->nid . '">Printable Contract</a></div>';
    }
  }
  return $output;
}