You are here

function theme_casetracker_project_summary in Case Tracker 7

Same name and namespace in other branches
  1. 5 casetracker.module \theme_casetracker_project_summary()
  2. 6 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_node_view in ./casetracker.module
Implements hook_node_view().

File

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

Code

function theme_casetracker_project_summary($variables) {
  $project = $variables['project'];
  $rows = array();
  $rows[] = array(
    t('Project number:'),
    $project->nid,
  );
  $rows[] = array(
    t('Opened by:'),
    theme('username', array(
      'account' => $project,
    )),
  );
  $rows[] = array(
    t('Opened on:'),
    format_date($project->created, 'long'),
  );
  $rows[] = array(
    t('Last modified:'),
    format_date($project->changed, 'long'),
  );
  $querystring = _casetracker_get_og_query_string($project);
  $operations = array();
  $node_types = node_type_get_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' => array(
        'destination' => $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' => array(
        'destination' => '',
        'keys' => '',
        'pid' => $project->nid,
      ),
    )),
  );
  $output = '<div class="project">';
  $output .= theme('table', array(
    'header' => NULL,
    'rows' => $rows,
    'attributes' => array(
      'class' => 'summary',
    ),
  ));
  $output .= '</div>';
  return $output;
}