You are here

function theme_casetracker_project_summary in Case Tracker 6

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

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

Parameters

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

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

File

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

Code

function theme_casetracker_project_summary($project) {
  $rows = array();
  $rows[] = array(
    t('Project number:'),
    $project->nid,
  );
  $rows[] = array(
    t('Opened by:'),
    theme('username', $project),
  );
  $rows[] = array(
    t('Opened on:'),
    format_date($project->created, 'large'),
  );
  $rows[] = array(
    t('Last modified:'),
    format_date($project->changed, 'large'),
  );
  $querystring = _casetracker_get_og_query_string($project);
  $operations = array();
  $node_types = node_get_types('names');
  foreach (array_filter(variable_get('casetracker_case_node_types', array(
    'casetracker_basic_case',
  ))) as $type) {
    $operations[] = l(t('add !name', array(
      '!name' => $node_types[$type],
    )), 'node/add/' . str_replace('_', '-', $type) . '/' . $project->nid, array(
      'query' => $querystring,
    ));
  }
  $operations = implode(' | ', $operations);

  // ready for printing in our Operations table cell - delimited by a pipe. nonstandard.
  $rows[] = array(
    t('Operations:'),
    $operations . ' | ' . l(t('view all project cases'), 'casetracker', array(
      'query' => 'keys=&pid=' . $project->nid,
    )),
  );
  $output = '<div class="project">';
  $output .= theme('table', NULL, $rows, array(
    'class' => 'summary',
  ));
  $output .= '</div>';
  return $output;
}