You are here

function shorten_cs_services_table in Shorten URLs 7

Same name and namespace in other branches
  1. 6 shorten_cs.admin.inc \shorten_cs_services_table()
  2. 7.2 shorten_cs.admin.inc \shorten_cs_services_table()

Displays the table of existing custom services.

1 call to shorten_cs_services_table()
theme_shorten_cs_admin in ./shorten_cs.admin.inc
Themes the configuration page.

File

./shorten_cs.admin.inc, line 19
Provides the configuration page for Shorten URLs Custom Services.

Code

function shorten_cs_services_table() {
  $header = array(
    t('Name'),
    t('URL'),
    t('Type'),
    t('XML/JSON tag'),
    t('Actions'),
  );
  $rows = array();
  $result = db_query("SELECT * FROM {shorten_cs} ORDER BY name ASC")
    ->fetchAll();
  foreach ($result as $service) {
    $service = (array) $service;
    $service = array(
      'sid' => $service['sid'],
      'name' => check_plain($service['name']),
      'url' => check_plain($service['url']),
      'type' => $service['type'],
      'tag' => check_plain($service['tag']),
    );
    $service['actions'] = l(t('edit'), 'admin/config/services/shorten/custom/edit/' . $service['sid']) . ' ' . l(t('delete'), 'admin/config/services/shorten/custom/delete/' . $service['sid']);
    unset($service['sid']);
    $rows[] = $service;
  }
  if (!empty($rows)) {
    return theme('table', array(
      'header' => $header,
      'rows' => $rows,
    ));
  }
  return '';
}