function pretty_calendar_block_view in Pretty Calendar 7
Implements hook_block_view().
File
- ./
pretty_calendar.module, line 233 - Simple nice calendar module that displays the materials by date.
Code
function pretty_calendar_block_view($delta = '') {
$theme = variable_get('pretty_calendar_theme', 'round');
$m = date('m');
$y = date('Y');
if (arg(0) == 'calendar') {
if (arg(1) > 0) {
$y = (int) arg(1);
}
if (arg(2) > 0) {
$m = (int) arg(2);
}
}
if (arg(0) == 'node' && arg(1) > 0) {
$types = explode(',', variable_get('pretty_calendar_node_type', ''));
$use_all = in_array('', $types);
$node = node_load(arg(1));
if ($use_all || in_array($node->type, $types) && !$use_all) {
$m = date('m', $node->created);
$y = date('Y', $node->created);
}
}
$path = drupal_get_path('module', 'pretty_calendar');
$block['subject'] = t('Calendar');
$block['content'] = array(
'#markup' => '<div id="calendar-body">' . pretty_calendar_block_content(mktime(0, 0, 0, $m, 1, $y)) . '</div>',
'#attached' => array(
'js' => array(
$path . '/pretty_calendar.js',
),
'css' => array(
$path . '/themes/' . $theme . '/calendar.css',
),
),
);
return $block;
}