You are here

function agenda_admin in Agenda 6.2

Same name and namespace in other branches
  1. 6 agenda.admin.php \agenda_admin()
  2. 7.2 agenda.admin.php \agenda_admin()
  3. 7 agenda.admin.php \agenda_admin()

Admin configuration page

1 string reference to 'agenda_admin'
agenda_menu in ./agenda.module
Implementation of hook_menu().

File

./agenda.admin.php, line 13
Administration interface for the agenda module

Code

function agenda_admin() {

  // Headers
  $headers = array(
    'id' => t('Block ID'),
    'name' => t('Name'),
    'ops' => t('Operations'),
  );

  // Rows
  $res = db_query("SELECT id, bid, value FROM {agenda} WHERE name = 'title'");
  $rows = array();
  while ($row = db_fetch_object($res)) {
    $actions = array(
      'configure' => l(t('Configure'), sprintf('admin/settings/agenda/%d/configure', $row->bid)),
      'delete' => l(t('Delete'), sprintf('admin/settings/agenda/%d/delete', $row->bid)),
      'debug' => l(t('Debug'), sprintf('admin/settings/agenda/%d/debug', $row->bid)),
      'clear' => l(t('Clear'), sprintf('admin/settings/agenda/%d/clear', $row->bid)),
    );
    $rows[] = array(
      'id' => $row->bid,
      'name' => $row->value,
      'ops' => implode(' | ', $actions),
    );
  }
  $table = '';
  if (!empty($rows)) {
    $table = theme('table', $headers, $rows);
  }
  return theme('agenda_admin', $table);
}