You are here

function support_admin_client_overview in Support Ticketing System 6

Administrative listing of all clients.

1 string reference to 'support_admin_client_overview'
support_menu in ./support.module
Implementation of hook_menu().

File

./support.admin.inc, line 10
support.admin.inc

Code

function support_admin_client_overview() {
  $rows = array();
  $header = array(
    array(
      'data' => t('Client name'),
      'field' => 'jc.name',
    ),
    array(
      'data' => t('Status'),
      'field' => 'jc.status',
    ),
    array(
      'data' => t('Inbound email'),
      'field' => 'jc.integrate_email',
    ),
    array(
      'data' => t('From address'),
      'field' => 'jc.mailfrom',
    ),
    array(
      'data' => t('Options'),
    ),
  );
  $sql = 'SELECT clid, name, status, integrate_email, mailfrom FROM {support_client} jc';
  $sql .= tablesort_sql($header);
  $result = pager_query($sql, 50, 0);
  while ($client = db_fetch_object($result)) {
    $options = l(t('edit'), "admin/support/clients/{$client->clid}/edit");
    if ($client->integrate_email) {
      $options .= ' | ' . l(t('fetch'), "admin/support/clients/{$client->clid}/fetch");
    }
    $rows[] = array(
      check_plain($client->name),
      $client->status == 1 ? t('enabled') : t('disabled'),
      $client->integrate_email ? t('integrated') : t('not integrated'),
      $client->integrate_email ? check_plain($client->mailfrom) : '<em>' . t('using default') . '</em>: ' . l(_support_admin_default_mail(), 'admin/support/settings'),
      $options,
    );
  }
  if (empty($rows)) {
    drupal_set_message(t('There are currently no clients defined.'));
  }
  $output = theme('table', $header, $rows);
  $output .= theme('pager', array(), 50, 0);
  return $output;
}