function makemeeting_show_pollpage in Make Meeting Scheduler 7
Same name and namespace in other branches
- 6 makemeeting.pages.inc \makemeeting_show_pollpage()
Show the poll pages - scheduler and regular poll
Parameters
string $url:
1 string reference to 'makemeeting_show_pollpage'
- makemeeting_menu in ./
makemeeting.module - hook_menu implementation
File
- ./
makemeeting.pages.inc, line 8
Code
function makemeeting_show_pollpage($url) {
// Try to retrieve poll URL
$node_id = db_query("SELECT nid FROM {makemeeting_poll_heads} WHERE url = :url", array(
':url' => $url,
))
->fetchfield();
if (is_numeric($node_id) && $node_id > 0) {
// Show poll form
$node = node_load($node_id);
if ($node->uid == 0) {
$node->name = $node->anonym_name == "" ? t('Anonymous') : $node->anonym_name;
}
drupal_set_title(t("@name's question: @question", array(
"@name" => $node->name,
"@question" => $node->title,
)));
$breadcrumb = array(
l(t('Home'), NULL),
l(t('Meetings'), 'makemeeting'),
l(t("Question: @question", array(
'@question' => $node->title,
)), 'makemeeting/' . $node->poll_url),
);
drupal_set_breadcrumb($breadcrumb);
return node_view($node);
}
// Try to retrieve admin URL
$node_id = db_query("SELECT nid FROM {makemeeting_poll_heads} WHERE admin_url = :admin_url", array(
':admin_url' => $url,
))
->fetchfield();
if (is_numeric($node_id) && $node_id > 0) {
// Show the admin panel
$node = node_load($node_id);
drupal_set_title(t("Admin page for: @question", array(
"@question" => $node->title,
)));
$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),
);
drupal_set_breadcrumb($breadcrumb);
return theme("makemeeting_poll_admin", array(
'node' => $node,
'admin_form' => drupal_render(drupal_get_form("makemeeting_update_poll", $node)),
));
}
// No URL found, display 404
return drupal_not_found();
}