function churchcal_block_info() {
$blocks = array();
$blocks['monthly_calendar'] = array(
'info' => t('Display the monthly calendar.'),
'cache' => DRUPAL_NO_CACHE,
);
//get calendars
include('db.php');
$result = mysql_query("SELECT * FROM churchcal_calendars WHERE set_default != '1'");
while($row = mysql_fetch_array($result)) {
$cal_name = $row['name'];
$sys_cal_name = strtolower(str_replace(' ', '_', $cal_name));
$blocks['churchcal_' . $sys_cal_name] = array(
'info' => t('Display calendar for ' . $cal_name . '.'),
'cache' => DRUPAL_NO_CACHE,
);
}
return $blocks;
}
function churchcal_block_view($block_name = '') {
if ($block_name == 'monthly_calendar') {
$content = monthlyCalendar();
$block = array (
'subject' => t(''),
'content' => $content,
);
}
//get calendars
include('db.php');
$result = mysql_query("SELECT * FROM churchcal_calendars WHERE set_default != '1'");
while($row = mysql_fetch_array($result)) {
$cal_name = $row['name'];
$sys_cal_name = strtolower(str_replace(' ', '_', $cal_name));
$cal_id = $row['id'];
if($block_name == 'churchcal_' . $sys_cal_name) {
$content .= churchCal($cal_id);
$block = array(
'subject' => t('Upcoming Events'),
'content' => $content,
);
}
return $block;
}
}
How can I display a calendar for each calendar in the db? How can I display a calendar for each calendar in the db?