You are here

function support_node_view in Support Ticketing System 7

Implementation of hook_node_view().

File

./support.module, line 875
support.module

Code

function support_node_view($node, $view_mode, $langcode) {
  global $user;
  if ($node->type == 'support_ticket') {

    // viewing a ticket
    drupal_add_css(drupal_get_path('module', 'support') . '/support-tickets.css');
    $breadcrumb = array();
    $breadcrumb[] = l(t('Home'), NULL);
    $breadcrumb[] = l(t('Support tickets'), 'support');
    if (isset($node->client) && is_numeric($node->client)) {
      $_SESSION['support_client'] = $node->client;
      if ($client = support_client_load($node->client)) {
        if (!empty($client->parent)) {
          $parent = support_client_load($client->parent);
          $breadcrumb[] = l(check_plain($parent->name), "support/{$parent->path}");
          $breadcrumb[] = l(check_plain($client->name), "support/{$parent->path}/{$client->path}");
        }
        else {
          $breadcrumb[] = l(check_plain($client->name), "support/{$client->path}");
        }
      }
    }
    drupal_set_breadcrumb($breadcrumb);
  }
}