You are here

function theme_casetracker_case_summary in Case Tracker 5

Same name and namespace in other branches
  1. 6 casetracker.module \theme_casetracker_case_summary()
  2. 7 casetracker.module \theme_casetracker_case_summary()

Theme the case summary shown at the beginning of a case's node.

Parameters

$case: The node object of the case being viewed.

$project: The node object of the project this case belongs to.

1 theme call to theme_casetracker_case_summary()
casetracker_nodeapi in ./casetracker.module
Implementation of hook_nodeapi().

File

./casetracker.module, line 1051
Enables the handling of projects and their cases.

Code

function theme_casetracker_case_summary($case, $project) {
  $rows = array();
  $rows[] = array(
    t('Case number:'),
    $project->project_number . '-' . $case->case_number,
  );
  $rows[] = array(
    t('Project:'),
    l($project->title, 'node/' . $case->pid),
  );
  $rows[] = array(
    t('Opened by:'),
    theme_username($case),
  );
  $rows[] = array(
    t('Status:'),
    check_plain(casetracker_case_state_load('status', $case->case_status_id)),
  );
  $rows[] = array(
    t('Assigned:'),
    casetracker_get_name($case->assign_to),
  );
  $rows[] = array(
    t('Priority:'),
    check_plain(casetracker_case_state_load('priority', $case->case_priority_id)),
  );
  $rows[] = array(
    t('Type:'),
    check_plain(casetracker_case_state_load('type', $case->case_type_id)),
  );
  $rows[] = array(
    t('Opened on:'),
    format_date($case->created, 'large'),
  );
  $last_comment = db_result(db_query('SELECT last_comment_timestamp FROM {node_comment_statistics} WHERE nid = %d', $case->nid));
  $rows[] = array(
    t('Last modified:'),
    format_date($last_comment, 'large'),
  );

  // @bug fails if comments are disabled.
  $output = '<div class="case">';
  $output .= theme('table', NULL, $rows, array(
    'class' => 'summary',
  ));
  $output .= '</div>';
  return $output;
}