You are here

function support_pm_admin_project_overview in Support Ticketing System 6

Same name and namespace in other branches
  1. 7 support_pm/support_pm.admin.inc \support_pm_admin_project_overview()

Overview of client projects.

1 string reference to 'support_pm_admin_project_overview'
support_pm_menu in support_pm/support_pm.module
Implementation of hook_menu(). TODO: Include date in 'view' and 'edit' tabs

File

support_pm/support_pm.admin.inc, line 465

Code

function support_pm_admin_project_overview() {
  $rows = array();
  $header = array(
    array(
      'data' => t('Project'),
      'field' => 'sp.project',
    ),
    array(
      'data' => t('Client(s)'),
    ),
    array(
      'data' => t('Weight'),
      'field' => 'sp.weight',
    ),
    array(
      'data' => t('Disabled'),
      'field' => 'sp.disabled',
    ),
    array(
      'data' => t('Options'),
    ),
  );
  $sql = 'SELECT sp.projid, sp.project, sp.weight, sp.disabled FROM {support_project} sp';
  $sql .= tablesort_sql($header);
  $result = pager_query($sql, 50, 0);
  while ($project = db_fetch_object($result)) {
    $options = l(t('edit'), "admin/support/project/{$project->projid}/edit");
    $clients = array();
    $result2 = db_query('SELECT spc.clid, sc.name FROM {support_project_client} spc LEFT JOIN {support_client} sc ON spc.clid = sc.clid WHERE spc.projid = %d', $project->projid);
    while ($client = db_fetch_object($result2)) {
      $clients[] = check_plain($client->name);
    }
    if (empty($clients)) {
      $clients[] = '<em>' . t('All clients') . '</em>';
    }
    $rows[] = array(
      truncate_utf8(check_plain($project->project), 52, TRUE, TRUE),
      implode(', ', $clients),
      number_format($project->weight),
      $project->disabled ? t('Disabled') : t('Active'),
      $options,
    );
  }
  if (empty($rows)) {
    drupal_set_message(t('There are currently no projects defined.'));
  }
  return theme('table', $header, $rows);
}