function biblio_block_view in Bibliography Module 7
Same name and namespace in other branches
- 7.2 biblio.module \biblio_block_view()
File
- ./
biblio.module, line 2004 - Bibliography Module for Drupal.
Code
function biblio_block_view($delta = '') {
switch ($delta) {
case 'recent':
$num_in_block = variable_get('biblio_rowsperblock', 4);
$block_order = variable_get('biblio_block_order', 'n.created');
$query = db_select('node', 'n')
->fields('n', array(
'nid',
'title',
))
->condition(db_and()
->condition('n.type', 'biblio')
->condition('n.status', 1))
->orderBy($block_order, 'DESC')
->range(0, $num_in_block);
if ($block_order == 'b.biblio_year') {
$query
->leftJoin('biblio', 'b', 'n.vid=b.vid');
}
$result = $query
->execute();
$base = variable_get('biblio_base', 'biblio');
$block['subject'] = t('Recent Publications');
$block['content'] = '<div class="item-list"><ul>';
$options['html'] = TRUE;
foreach ($result as $pub) {
$block['content'] .= '<li >' . l(filter_xss($pub->title, biblio_get_allowed_tags()), "node/{$pub->nid}", $options) . '</li>';
}
$block['content'] .= '</ul>';
if (variable_get('biblio_rss', 0)) {
$block['content'] .= theme('feed_icon', array(
'url' => url("{$base}/recent/rss.xml", array(
'absolute' => TRUE,
)),
'title' => t('Recent Publications'),
));
}
$block['content'] .= l(t('More...'), $base);
$block['content'] .= '</div>';
return $block;
}
}