function advpoll_get_poll_info_blocks in Advanced Poll 7.2
Same name and namespace in other branches
- 7.3 advpoll.module \advpoll_get_poll_info_blocks()
- 7 advpoll.module \advpoll_get_poll_info_blocks()
1 call to advpoll_get_poll_info_blocks()
- advpoll_block_info in ./
advpoll.module - Implements hook_block_info().
File
- ./
advpoll.module, line 880
Code
function advpoll_get_poll_info_blocks($blocks) {
$result = db_query("SELECT n.title, n.nid FROM {node} n\n LEFT JOIN {field_data_advpoll_dates} d \n ON d.entity_id = n.nid \n LEFT JOIN {field_data_advpoll_closed} c\n ON c.entity_id = n.nid\n LEFT JOIN {field_data_advpoll_options} o\n ON o.entity_id = n.nid\n WHERE \n n.type LIKE '%advpoll%' AND\n o.advpoll_options_value <> 'electoral' AND\n o.advpoll_options_value = 'block' AND\n n.status = 1 AND\n c.advpoll_closed_value = 'open' AND\n d.advpoll_dates_value < NOW() AND d.advpoll_dates_value2 > NOW() \n GROUP BY n.nid \n ORDER BY n.created DESC");
if ($result) {
foreach ($result as $record) {
$blocks['advpoll_block_' . $record->nid] = array(
'info' => t('Advanced Poll: @title', array(
'@title' => $record->title,
)),
);
}
}
return $blocks;
}