You are here

function _casetracker_dashboard_states in Case Tracker 5

Function to get an overview of all projects and their states count

Parameters

void:

Return value

string

1 call to _casetracker_dashboard_states()
casetracker_dashboard_overview in ./casetracker_dashboard.module
Menu callback Displays a list of all projects and a count of all their states.

File

./casetracker_dashboard.module, line 161

Code

function _casetracker_dashboard_states() {
  $output = array();

  // first we get all the possible projects
  $projects = _casetracker_dashboard_getProjects();

  // we get the possible states
  $states = casetracker_case_state_load('status');

  // we get the project - cases count
  $caseCount = _casetracker_dashboard_projectCasesCount();

  // create the table array
  $projectCaseCount = _casetracker_dashboard_createProjectCountArray($projects, $states, $caseCount);

  // create the overview table
  $headers = array(
    array(
      'data' => t('Project'),
      'class' => 'project',
    ),
  );
  foreach ($states as $state) {
    $headers[] = check_plain(t($state));
  }
  $headers[] = array(
    'data' => t('Todo'),
    'class' => 'devider',
  );
  $headers[] = t('Done');
  $headers[] = array(
    'data' => t('Total'),
    'class' => 'devider',
  );
  $headers[] = array(
    'data' => t('Completed<br />%'),
    'class' => 'percent',
  );

  // theme the array
  $output[] = theme('table', $headers, $projectCaseCount, array(
    'id' => 'casetracker-dashboard',
  ));
  return implode("\n", $output);
}