You are here

function makemeeting_show_pollpage in Make Meeting Scheduler 6

Same name and namespace in other branches
  1. 7 makemeeting.pages.inc \makemeeting_show_pollpage()

Show the poll pages - scheduler and regular poll

1 string reference to 'makemeeting_show_pollpage'
makemeeting_menu in ./makemeeting.module
Implements hook_menu().

File

./makemeeting.pages.inc, line 6

Code

function makemeeting_show_pollpage($url) {
  $node_id = db_result(db_query("SELECT nid FROM {makemeeting_poll_heads} WHERE url = '%s'", $url));

  // poll url - showing the poll panel
  if (is_numeric($node_id) && $node_id > 0) {
    $node = node_load($node_id);
    $author = $node->uid == 0 ? $node->anonym_name == "" ? t('Anonymous') : $node->anonym_name : $node->name;
    if ($author != $node->name) {
      $node->name = $author;
    }
    drupal_set_title(t("@name's question: @question", array(
      "@name" => $author,
      "@question" => $node->title,
    )));

    // Breadcrumb navigation
    drupal_set_breadcrumb(array(
      l(t('Home'), NULL),
      l(t('Make Meetings'), 'makemeeting'),
      l(t("Question: @question", array(
        '@question' => $node->title,
      )), 'makemeeting/' . $node->poll_url),
    ));
    return node_view($node);
  }

  // admin url - showing the admin panel
  $node_id = db_result(db_query("SELECT nid FROM {makemeeting_poll_heads} WHERE admin_url = '%s'", $url));
  if (is_numeric($node_id) && $node_id > 0) {
    $node = node_load($node_id);
    drupal_set_title(t("Admin page for: @question", array(
      "@question" => $node->title,
    )));
    drupal_set_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),
    ));
    if ($node->poll_type == 1) {
      return theme("makemeeting_poll_admin", $node, drupal_get_form("makemeeting_update_poll", $node));
    }
    elseif ($node->poll_type == 2) {
      return theme("makemeeting_poll_admin", $node, drupal_get_form("makemeeting_simplepoll_update_poll", $node));
    }
  }
}