poll_view
modules/poll/poll.module, строка 593
- Версии
- 5 – 6
poll_view($node, $teaser = FALSE, $page = FALSE, $block = FALSE)
Реализация hook_view()
.
Параметры
$block
An extra parameter that adapts the hook to display a block-ready
rendering of the poll.
Код
<?php
function poll_view($node, $teaser = FALSE, $page = FALSE, $block = FALSE) {
global $user;
$output = '';
// Special display for side-block
if ($block) {
// No 'read more' link
$node->readmore = FALSE;
$links = module_invoke_all('link', 'node', $node, 1);
$links[] = array('title' => t('Older polls'), 'href' => 'poll', 'attributes' => array('title' => t('View the list of polls on this site.')));
if ($node->allowvotes && $block) {
$links[] = array('title' => t('Results'), 'href' => 'node/'. $node->nid .'/results', 'attributes' => array('title' => t('View the current poll results.')));
}
$node->links = $links;
}
if ($node->allowvotes && ($block || arg(2) != 'results')) {
if ($_POST['op'] == t('Vote')) {
poll_vote($node);
}
$node->content['body'] = array(
'#value' => drupal_get_form('poll_view_voting', $node, $block),
);
}
else {
$node->content['body'] = array(
'#value' => poll_view_results($node, $teaser, $page, $block),
);
}
return $node;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии