You are here

function makemeeting_logpage in Make Meeting Scheduler 7

Same name and namespace in other branches
  1. 6 makemeeting.pages.inc \makemeeting_logpage()

Showing voters logpage.

Parameters

string $admin_url:

1 string reference to 'makemeeting_logpage'
makemeeting_menu in ./makemeeting.module
hook_menu implementation

File

./makemeeting.pages.inc, line 51

Code

function makemeeting_logpage($admin_url) {

  // Retrieve the node
  $node = node_load(db_query("SELECT nid FROM {makemeeting_poll_heads} WHERE admin_url = :admin_url", array(
    ':admin_url' => $admin_url,
  ))
    ->fetchfield());
  if (!$node) {
    return drupal_not_found();
  }
  $breadcrumb = array(
    l(t('Home'), NULL),
    l(t('Make Meetings'), 'makemeeting'),
    l(t("Admin page: @question", array(
      '@question' => $node->title,
    )), 'makemeeting/' . $node->poll_admin_url),
    l(t("View logs"), 'makemeeting/' . $node->poll_admin_url . "/log"),
  );
  drupal_set_breadcrumb($breadcrumb);

  // Retrieve the votes
  $result = db_query("SELECT username, dt FROM {makemeeting_poll_logs} WHERE nid = :nid", array(
    ':nid' => $node->nid,
  ));
  if (!$result
    ->rowCount()) {
    return t('No vote has been recorded yet.');
  }
  $rows = array();
  foreach ($result as $r) {
    $rows[] = array(
      $r->username,
      format_date($r->dt),
    );
  }
  return theme('table', array(
    'header' => array(
      t('Name'),
      t('Date'),
    ),
    'rows' => $rows,
  ));
}