function vote_storylink_block in Vote Up/Down 5
Implementation of hook_block().
File
- ./
vote_storylink.module, line 273
Code
function vote_storylink_block($op = 'list', $delta = 0) {
if ($op == 'list') {
$blocks[0]['info'] = t('Top story links');
$blocks[1]['info'] = t('User navigation story links');
return $blocks;
}
else {
if ($op == 'view') {
if (user_access('access content')) {
switch ($delta) {
case 0:
$title = t('Top stories');
$items = array();
$items[] = l(t('This day'), 'storylink/top/day');
$items[] = l(t('This week'), 'storylink/top/week');
$items[] = l(t('This month'), 'storylink/top/month');
$items[] = l(t('This year'), 'storylink/top/year');
$items[] = l(t('All time'), 'storylink/top');
break;
case 1:
global $user;
if ($user->uid) {
//userpoints integration
if (module_exists('userpoints')) {
$title = $user->name . ' (' . userpoints_get_current_points($user->uid) . ')';
}
else {
$title = $user->name;
}
$items = array();
$items[] = l(t('Submit new story'), 'node/add/storylink');
$items[] = l(t('My account'), 'user/' . $user->uid);
$items[] = l(t('My story links'), 'storylink/' . $user->uid);
$items[] = l(t('Log out'), 'logout');
}
break;
}
if ($items) {
$block['subject'] = check_plain($title);
$block['content'] = theme('item_list', $items);
}
return $block;
}
}
}
}