You are here

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

Same name and namespace in other branches
  1. 6.2 merci.module \merci_view()
  2. 7.2 merci.module \merci_view()

Implementation of hook_view().

File

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

Code

function merci_view($node, $teaser = FALSE, $page = FALSE) {

  // TODO: should we fix node previews?
  if ($node->type == 'merci_reservation' && !isset($node->preview)) {
    $node->content['merci_status'] = array(
      '#value' => drupal_get_form('merci_display_reservation_status', merci_record_status($node->merci['status'])),
      '#weight' => 0,
    );
    if ($page) {
      $reservation_table = drupal_get_form('merci_build_reservation_table_form', $node);
      $node = node_prepare($node, $teaser);
      $node->content['reservation_items'] = array(
        '#value' => $reservation_table,
        '#weight' => 1,
      );
    }
  }
  return $node;
}