You are here

function agenda_admin in Agenda 7

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

Admin configuration page

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

File

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

Code

function agenda_admin() {

  // Headers
  $header = 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 = $res
    ->fetchObject()) {
    $actions = array(
      'configure' => l(t('Configure'), sprintf('admin/config/services/agenda/%d/configure', $row->bid)),
      'delete' => l(t('Delete'), sprintf('admin/config/services/agenda/%d/delete', $row->bid)),
      'debug' => l(t('Debug'), sprintf('admin/config/services/agenda/%d/debug', $row->bid)),
      'clear' => l(t('Clear'), sprintf('admin/config/services/agenda/%d/clear', $row->bid)),
    );
    $rows[] = array(
      'id' => $row->bid,
      'name' => $row->value,
      'ops' => implode(' | ', $actions),
    );
  }
  $table = '';
  if (!empty($rows)) {
    $table = theme('table', array(
      'header' => $header,
      'rows' => $rows,
    ));
  }
  return theme('agenda_admin', array(
    'table' => $table,
  ));
}