function theme_availability_calendars_node in Availability Calendars 5
Same name and namespace in other branches
- 6.2 availability_calendars.page.inc \theme_availability_calendars_node()
- 6 availability_calendars.module \theme_availability_calendars_node()
- 7.2 availability_calendars.page.inc \theme_availability_calendars_node()
Themed output to display a lits of node dates.
Parameters
$node:
Return value
HTML output.
3 theme calls to theme_availability_calendars_node()
- availability_calendars_menu_callback in ./
availability_calendars.module - Create tab to show node availability
- availability_calendars_nodeapi in ./
availability_calendars.module - Implementation hook node_nodeapi();
- availability_calendars_page in ./
availability_calendars.module - Availability calendars page
File
- ./
availability_calendars.module, line 250 - Availability Calendars Module
Code
function theme_availability_calendars_node($node, $year = 2008, $month = 01, $monthstodisplay = 12) {
drupal_add_css(drupal_get_path('module', 'availability_calendars') . '/availability_calendars.css');
$rows = array();
// Fill availability array
/* foreach ($node->availability_dates as $k => $v) {
foreach ($v as $i) {
$booked[date("Y", $i['date'])][date("m", $i['date'])][date("d", $i['date'])] = 1;
}
} */
// Calendar code based on example at http://evolt.org/node/60673 :
$day = 1;
$startofweek = variable_get('availability_calendars_' . $node->nid . '_startofweek', 1);
$monthsremaining = $monthstodisplay;
while ($monthsremaining > 0) {
$output .= theme('availability_calendars_month', $node, $year, $month, $startofweek, $booked);
$monthsremaining--;
$month++;
if ($month > 12) {
$month = 1;
$year++;
}
}
// add an extra three months for editors only
if (user_access('edit availability calendars')) {
$monthsremaining = 3;
while ($monthsremaining > 0) {
$output .= theme('availability_calendars_month', $node, $year, $month, $startofweek, $booked);
$monthsremaining--;
$month++;
if ($month > 12) {
$month = 1;
$year++;
}
}
}
return $output;
}