function advpoll_block in Advanced Poll 6.3
Same name and namespace in other branches
- 5 advpoll.module \advpoll_block()
- 6 advpoll.module \advpoll_block()
- 6.2 advpoll.module \advpoll_block()
Implementation of hook_block().
File
- ./
advpoll.module, line 253 - Advanced Poll - a sophisticated polling module for voting, elections, and group decision-making.
Code
function advpoll_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks['latest_poll']['info'] = t('Advanced Poll: Latest poll');
$items = _advpoll_available_blocks();
if ($items) {
foreach ($items as $poll) {
$blocks['adv_poll_' . $poll->nid]['info'] = t('Advanced Poll: @title', array(
'@title' => $poll->title,
));
}
}
return $blocks;
case 'view':
if ($delta == 'latest_poll') {
$block['subject'] = t('Latest poll');
$block['content'] = theme('advpoll_block_latest_poll');
}
else {
$nid = intval(str_replace('adv_poll_', '', $delta));
$block['subject'] = t('Poll');
$block['content'] = theme('advpoll_view_block_poll', $nid);
}
return $block;
}
}